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_GENERATE_N_HPP
00008 #define INSTIGATE_STL_GENERATE_N_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 O, typename S, typename G>
00071 O generate_n(O b, S n, G g);
00072 }
00073 }
00074
00107 template <typename O, typename S, typename G>
00108 O instigate::stl::generate_n(O b, S n, G g)
00109 {
00110 typedef typename instigate::stl::writable_iterator::interface<O>::
00111 value_type value_type;
00112 CHECK(instigate::stl::incrementable_iterator::requirements<O>);
00113 CHECK(instigate::stl::generator::requirements<G>);
00114 CHECK(instigate::generic::less_than_comparable::requirements<S>);
00115 CHECK_CONVERTIBILITY(value_type, typename instigate::stl::generator::
00116 interface<G>::result_type );
00117 for (; 0 < n; --n, increment(b)) {
00118 dereference_assign(b, invoke(g));
00119 }
00120 return b;
00121 }
00122
00123
00124
00125 #endif // INSTIGATE_STL_GENERATE_N_HPP
00126