Boost logo

Boost :

Subject: [boost] [type_erasure] Using any with iterator Concept.
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-04-26 12:22:44


I'm trying to use type-erased iterator in STL algorithms, e.g. copy but
get errors like this one:

error C2039: 'iterator_category' : is not a member of
'boost::type_erasure::any<Concept>' c:\program files (x86)\microsoft
visual studio 10.0\vc\include\xutility 373

of course any doesn't define iterator_category. I'm using MSVC2010 and
doing something like this:

typedef boost::type_erasure::any<
> iterator;

// ...

iterator first = return_some_iterator(...);
iterator last = return_some_iterator(...);

// BAM!
std::copy(first, last, std::back_inserter(result));

// BAM!
typedef iterator::iterator_category C;

I simply tried to add it to the iterator<> Concept defined in
iterator.hpp but this didn't help:

struct iterator< ::boost::single_pass_traversal_tag, ...> :
     iterator< ::boost::incrementable_traversal_tag, ...>
     typedef ValueType value_type;
     typedef typename iterator_reference<
         Reference, ValueType
>::type reference;
     typedef DifferenceType difference_type;
     typedef std::input_iterator_tag iterator_category;

Am I doing something wrong or is it an error in Boost.TypeErasure?

Adam Wulkiewicz

Boost list run by bdawes at, gregod at, cpdaniel at, john at