diff --git a/include/boost/counting_iterator.hpp b/include/boost/counting_iterator.hpp index 2279c93..bbbe994 100644 --- a/include/boost/counting_iterator.hpp +++ b/include/boost/counting_iterator.hpp @@ -4,7 +4,7 @@ // without express or implied warranty, and with no claim as to its suitability // for any purpose. // -// See http://www.boost.org for most recent version including documentation. +// See http://www.boost.org for most recent version including documentation. // // Supplies: // @@ -15,16 +15,21 @@ // value progresses through consecutive values of Incrementable when the // iterator is derferenced. // +// template struct counting_iterator_generator; +// +// A "type generator" whose nested type "type" is a counting iterator as +// described above. +// // template -// iterator_adaptor, -// counting_iterator_traits > -// counting_iterator(Incrementable); +// typename counting_iterator_generator::type +// counting_iterator(Incrementable); // // A function which produces an adapted counting iterator over values of // Incrementable. // // Revision History +// 04 Feb 2001 Added counting_iterator_generator; updated comments +// (David Abrahams) // 24 Jan 2001 initial revision, based on Jeremy Siek's // boost/pending/integer_range.hpp (David Abrahams) @@ -33,7 +38,7 @@ # include # include -# include +# include # include # include # ifndef BOOST_NO_LIMITS @@ -161,11 +166,18 @@ struct counting_iterator_policies : public default_iterator_policies } }; +// A type generator for counting iterators +template +struct counting_iterator_generator +{ + typedef iterator_adaptor, + counting_iterator_traits > type; +}; + // Manufacture a counting iterator for an arbitrary incrementable type template -inline iterator_adaptor, - counting_iterator_traits > +inline typename counting_iterator_generator::type counting_iterator(Incrementable x) { return iterator_adaptor >(x); } + } // namespace boost #endif // BOOST_COUNTING_ITERATOR_HPP_DWA20000119