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_COPY_IF_HPP
00008 #define INSTIGATE_STL_REMOVE_COPY_IF_HPP
00009
00059
00060 #include "concept.hpp"
00061 #include "_basis.hpp"
00062
00063
00064
00065
00066
00067
00068 namespace instigate {
00069 namespace stl {
00070 template <typename I, typename O, typename P>
00071 O remove_copy_if(I b, I e, O r, P p);
00072 }
00073 }
00074
00117 template <typename I, typename O, typename P>
00118 O instigate::stl::remove_copy_if(I b, I e, O r, P p)
00119 {
00120 namespace SP = instigate::stl::single_pass_iterator;
00121 namespace RI = instigate::stl::readable_iterator;
00122 namespace INC = instigate::stl::incrementable_iterator;
00123 namespace WR = instigate::stl::writable_iterator;
00124 namespace EQ = instigate::generic::equality_comparable;
00125 namespace UP = instigate::stl::unary_predicate;
00126 typedef typename RI::interface<I>::value_type value_type1;
00127 typedef typename WR::interface<O>::value_type value_type2;
00128 typedef typename UP::interface<P>::argument_type argument_type;
00129 CHECK(SP::requirements<I>);
00130 CHECK(RI::requirements<I>);
00131 CHECK(INC::requirements<O>);
00132 CHECK(WR::requirements<O>);
00133 CHECK(UP::requirements<P>);
00134 CHECK_CONVERTIBILITY(value_type1, value_type2);
00135 CHECK_CONVERTIBILITY(value_type1, argument_type);
00136 while (!equal(b, e)) {
00137 if (!invoke_predicate(p, const_dereference(b))) {
00138 dereference_assign(r, const_dereference(b));
00139 increment(r);
00140 }
00141 increment(b);
00142 }
00143 return r;
00144 }
00145
00146
00147
00148 #endif // INSTIGATE_STL_REMOVE_COPY_IF_HPP