
----- Mensaje original ----- De: David Abrahams <dave@boost-consulting.com> Fecha: Domingo, Mayo 13, 2007 0:16 am Asunto: Re: [boost] [iterator] Proposal to add is_const_iterator trait Para: boost@lists.boost.org
on Sat May 12 2007, Andrey Semashev <andysem-AT-mail.ru> wrote:
[...]
I apologize for returning to this, but as I'm reading the docs and looking at my use cases I have before me I don't see how would I elide is_const_iterator when using iterator_adaptor. Suppose this:
template< typename ValueT > class MyList { public: typedef ValueT value_type;
// etc. all other common typedefs except iterators
private: struct MyNode { ValueT value; int m_SomeOtherData; }; typedef std::list< MyNode > underlying_container;
template< typename > class MyIterator;
public: typedef MyIterator< typename underlying_container::iterator > iterator;
typedef MyIterator< typename underlying_container::const_iterator > const_iterator;
private: template< typename ItT > class MyIterator : public iterator_adaptor< MyIterator< ItT >, ItT, value_type, // I have to substitute value type
No, just leave it out. The default works.
I think this is the crux of the matter. value_type is *not* the same type as underlying_container::value_type. I think Andrey has a valid point here. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo