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_FILL_HPP
00008 #define INSTIGATE_STL_FILL_HPP
00009
00058
00059 #include "concept.hpp"
00060 #include "_basis.hpp"
00061
00062
00063
00064
00065 #include <cstring>
00066
00067
00068 namespace instigate {
00069 namespace stl {
00070 template <typename F, typename T>
00071 void fill(F b, F e, const T& v);
00072 inline void fill(char* b, char* e, const char& c);
00073 }
00074 }
00075
00104 template <typename F, typename T>
00105 void instigate::stl::fill(F b, F e, const T& v)
00106 {
00107 typedef typename instigate::stl::writable_iterator::interface<F>::
00108 value_type value_type;
00109 CHECK(instigate::generic::assignable::requirements<T>);
00110 CHECK(instigate::stl::forward_iterator::requirements<F>);
00111 CHECK(instigate::stl::writable_iterator::requirements<F>);
00112 CHECK_CONVERTIBILITY(value_type, T);
00113 for (; !equal(b, e); increment(b)) {
00114 dereference_assign(b, v);
00115 }
00116 }
00117
00134 inline void instigate::stl::fill(char* b, char* e, const char& c)
00135 {
00136 assert(0 != b);
00137 assert(0 != e);
00138 char tmp = c;
00139 memset(b, static_cast<unsigned char>(tmp), e - b);
00140 }
00141
00142
00143
00144 #endif // INSTIGATE_STL_FILL_HPP
00145