Boost logo

Boost Users :

Subject: [Boost-users] Strange error while using BOOST_FOREACH
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2012-03-11 05:56:16

I used BOOST_FOREACH with a collection whose iterator is derived from
boost::iterator_adaptor. I got this:

7>E:\boost_1_47\boost/range/iterator.hpp(63): error C2039: 'type' : is not a member of
7> with
7> [
7> C=true,
7> F1=boost::range_const_iterator<VSeeClient_list>,
7> F2=boost::range_mutable_iterator<const type>
7> ]
7> E:\boost_1_47\boost/foreach.hpp(670) : see reference to class template
instantiation 'boost::range_iterator<C>' being compiled
7> with
7> [
7> C=const type
7> ]
7> AutoPerformance\APSystem.cpp(224) : see reference to function template
instantiation 'boost::foreach_detail_::auto_any<T>
*,boost::mpl::false_ *)' being compiled
7> with
7> [
7> T=VSeeClient_list::iterator,
7> C=boost::mpl::false_
7> ]

The error points here:
     template< typename C >
     struct range_iterator
             mpl::eval_if_c< is_const<C>::value,
                             range_const_iterator< typename remove_const<C>::type >,
                             range_mutable_iterator<C> >::type type;

Now a little looking through the manual tells me that mpl::eval_if_c::type will be one of
the two metafunctions, so it should not disappear completely.

I don't believe I missed anything from the iterator code: the Value type is given as the
3rd template argument to the iterator_adaptor, so that should set up any metafunctions
needed to find the iterator's type, right?

I'm compiling using MS Visual Studio 10.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at