[Boost-bugs] [Boost C++ Libraries] #1020: Boost.Iterator proposal to add is_constant_iterator

Subject: [Boost-bugs] [Boost C++ Libraries] #1020: Boost.Iterator proposal to add is_constant_iterator
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2007-05-31 18:49:36

#1020: Boost.Iterator proposal to add is_constant_iterator
 Reporter: andysem_at_[hidden] | Type: Patches
   Status: new | Milestone: Boost 1.35.0
Component: iterator | Version:
 Severity: Not Applicable | Keywords: is_constant_iterator
 I propose to add a new trait to the Boost.Iterator library:
 `is_constant_iterator`. The trait is applied to an iterator and returns
 true if the iterator's reference type is a constant reference and false if
 the type is a non-constant reference. The trait will fail to compile when
 applied to iterators having non-reference reference types.

 This addition would make it easier to use library components like
 `iterator_facade` and `iterator_adaptor` for implementing container
 iterator wrappers like this:
   template< NodeItT >
   struct MyIterator :
       public iterator_facade<
           MyIterator< NodeItT >,
           typename mpl::if_<
               is_constant_iterator< NodeItT >,
               const value_type,
           typename iterator_category< NodeItT >::type
 Here `NodeItT` is a wrapped iterator and may be a `const_iterator` or
 `iterator` of a container.

 Another use case is when a user wants to detect whether an iterator is
 `const_iterator` or `iterator`. An example of this: implementing
 functionality of iterator translation similar to Boost.MultiIndex
 `project` method.

 I've attached an archive with the implementation, tests and patches to
 documentation. The implementation, in addition to the abovementioned
 functionality, supports `std::vector< bool >` iterators, though their
 reference types are not references.

Ticket URL: <http://svn.boost.org/trac/boost/ticket/1020>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:55 UTC