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_REPLACE_COPY_HPP
00008 #define INSTIGATE_STL_REPLACE_COPY_HPP
00009
00059
00060 #include "concept.hpp"
00061 #include "_basis.hpp"
00062
00063
00064 #include <generic/base.hpp>
00065
00066
00067
00068
00069 namespace instigate {
00070 namespace stl {
00071 template <typename I, typename O, typename T>
00072 inline O replace_copy(I, I, O, const T&, const T&);
00073 }
00074 }
00075
00117 template <typename I, typename O, typename T>
00118 inline O instigate::stl::replace_copy(I f, I l, O r, const T& o, const T& n)
00119 {
00120 CHECK(instigate::stl::single_pass_iterator::requirements<I>);
00121 CHECK(instigate::stl::readable_iterator::requirements<I>);
00122 CHECK(instigate::stl::incrementable_iterator::requirements<O>);
00123 CHECK(instigate::stl::writable_iterator::requirements<O>);
00124 CHECK(instigate::generic::assignable::requirements<T>);
00125 CHECK(instigate::generic::equality_comparable::requirements<T>);
00126 CHECK_CONVERTIBILITY(T, typename instigate::stl::writable_iterator::
00127 interface<O>::value_type);
00128 for ( ; !equal(f, l); increment(f), increment(r)) {
00129 dereference_assign(r, (const_dereference(f) == o) ? n :
00130 const_dereference(f));
00131 }
00132 return r;
00133 }
00134
00135
00136
00137 #endif // INSTIGATE_STL_REPLACE_COPY_HPP