diff --git a/iterator_adaptors.htm b/iterator_adaptors.htm index 531bef9..aa3c42a 100644 --- a/iterator_adaptors.htm +++ b/iterator_adaptors.htm @@ -131,11 +131,11 @@
iterator_adaptor is declared like this:
template <class Base, class Policies, - class ValueOrNamedParams = typename std::iterator_traits<Base>::value_type, - class ReferenceOrNamedParams = ...(see below), - class PointerOrNamedParams = ...(see below), - class CategoryOrNamedParams = typename std::iterator_traits<Base>::iterator_category, - class DistanceOrNamedParams = typename std::iterator_traits<Base>::difference_type> + class ValueOrNamedParam = typename std::iterator_traits<Base>::value_type, + class ReferenceOrNamedParam = ...(see below), + class PointerOrNamedParam = ...(see below), + class CategoryOrNamedParam = typename std::iterator_traits<Base>::iterator_category, + class DistanceOrNamedParam = typename std::iterator_traits<Base>::difference_type> struct iterator_adaptor;@@ -208,11 +208,9 @@ struct iterator_adaptor; std::iterator_traits<BaseType>::difference_type
- The iterator_traits_generator is used to create a list of - of template arguments. For example, suppose you want to set the - Reference and Category parameters, and use the - defaults for the rest. Then you can use the traits generator as - follows: + For example, the following adapts foo_iterator to create + an InputIterator + with reference type foo, and whose other traits + are determined according to the defaults described above.-class iterator_traits_generator -{ -public: - template <class Value> - struct value_type : public recursive magic { }; - - template <class Reference> - struct reference : public recursive magic { }; - - template <class Pointer> - struct pointer : public recursive magic { }; - - template <class Distance> - struct difference_type : public recursive magic { }; - - template <class Category> - struct iterator_category : public recursive magic { }; -}; +template <class Value> struct value_type_is; +template <class Reference> struct reference_is; +template <class Pointer> struct pointer_is; +template <class Distance> struct difference_type_is; +template <class Category> struct iterator_category_is;
- - This generated type can then be passed into the iterator_adaptor - class to replace any of the last five parameters. If you use the traits - generator in the ith parameter position, then the parameters i - through 7 will use the types specified in the generator. For example, the - following adapts foo_iterator to create an InputIterator with - reference type foo, and whose other traits are determined - according to the defaults described above. - --iterator_traits_generator::reference<foo>::category<std::input_iterator_tag> --
--iterator_adaptor<foo_iterator, foo_policies, - iterator_traits_generator - ::reference<foo> - ::iterator_category<std::input_iterator_tag> -> +typedef iterator_adaptor<foo_iterator, foo_policies, + reference_is<foo>, iterator_category_is<std::input_iterator_tag> + > MyIterator;