00001
00002 #ifndef _INSTIGATE_STL_INTERNAL_HEADER_IN_ALGORITHM
00003 #error This is an internal header file used to implement Instigate STL.\
00004 It should never be included directly by a program.
00005 #endif
00006
00007 #ifndef INSTIGATE_STL_REMOVE_IF_HPP
00008 #define INSTIGATE_STL_REMOVE_IF_HPP
00009
00059
00060 #include "concept.hpp"
00061 #include "_find_if.hpp"
00062 #include "_remove_copy_if.hpp"
00063 #include "_basis.hpp"
00064
00065
00066
00067
00068
00069
00070 namespace instigate {
00071 namespace stl {
00072 template <typename F, typename P>
00073 F remove_if(F b, F e, P p);
00074 }
00075 }
00076
00110 template <typename F, typename P>
00111 F instigate::stl::remove_if(F b, F e, P p)
00112 {
00113 namespace FI = instigate::stl::forward_iterator;
00114 namespace WR = instigate::stl::writable_iterator;
00115 namespace EQ = instigate::generic::equality_comparable;
00116 namespace UP = instigate::stl::unary_predicate;
00117 typedef typename WR::interface<F>::value_type value_type;
00118 typedef typename UP::interface<P>::argument_type argument_type;
00119 CHECK(FI::requirements<F>);
00120 CHECK(WR::requirements<F>);
00121 CHECK(UP::requirements<P>);
00122 CHECK_CONVERTIBILITY(value_type, argument_type);
00123 assign(b, instigate::stl::find_if(b, e, p));
00124 char c[sizeof(F)];
00125 F* i = 0;
00126 assign(i, copy_constructor(c, b));
00127 assert(0 != i);
00128 increment(*i);
00129 return equal(b, e) ? b : instigate::stl::remove_copy_if(*i, e, b, p);
00130 }
00131
00132
00133
00134 #endif // INSTIGATE_STL_REMOVE_IF_HPP