Range_Ex and Multi-Index: conflicting mpl::begin and boost::begin

Hi, I am under-impression that for_each construct of range_ex for all container concepts. However when I tried with multi-index it gave conflicting errors. Attached below is the code and corresponding errors. code: typedef multi_index_container< std::pair<value_type,int>, indexed_by< ordered_unique<member<pair<value_type,int>, value_type, &pair<value_type, int>::first> >, ordered_unique<member<pair<value_type,int>, int, &pair<value_type, int>::second> > > > mic; mic serialStore; for_each(serialStore, std::cout<<boost::lambda::_1<<' '); error: /home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp:22: error: ‘template<class Sequence> struct boost::mpl::begin’ is not a function, /home/sandeep/Computing/boost_1_38_0/boost/range/begin.hpp:96: error: conflict with ‘template<class T> typename boost::range_iterator::type boost::begin(T&)’ /home/sandeep/Computing/boost_1_38_0/boost/range_ex/./detail/adl_begin_end.hpp:27: error: in call to ‘begin’ /home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp:23: error: ‘template<class Sequence> struct boost::mpl::end’ is not a function, /home/sandeep/Computing/boost_1_38_0/boost/range/end.hpp:92: error: conflict with ‘template<class T> typename boost::range_iterator::type boost::end(T&)’ /home/sandeep/Computing/boost_1_38_0/boost/range_ex/./detail/adl_begin_end.hpp:35: error: in call to ‘end’ I apologies in advance if this is due to trivial omission. Thanks -sandeep

Hi Sandeep, I think your problem comes from the fact that you should have some using namespace declarations. using namespace boost; using namespace boost::mpl; If this is the case, try removing them and been explicit about which begin do you want; i.e. moost::begin or boost::mpl::begin. If this is not the case, I have no idead without a complete example and the result of the compilation. Best, Vicente ----- Original Message ----- From: "Sandeep Gupta" <gupta.sandeep@gmail.com> To: <boost-users@lists.boost.org>; <boost@lists.boost.org> Sent: Wednesday, March 18, 2009 6:38 PM Subject: [boost] Range_Ex and Multi-Index: conflicting mpl::begin andboost::begin Hi, I am under-impression that for_each construct of range_ex for all container concepts. However when I tried with multi-index it gave conflicting errors. Attached below is the code and corresponding errors. code: typedef multi_index_container< std::pair<value_type,int>, indexed_by< ordered_unique<member<pair<value_type,int>, value_type, &pair<value_type, int>::first> >, ordered_unique<member<pair<value_type,int>, int, &pair<value_type, int>::second> > > > mic; mic serialStore; for_each(serialStore, std::cout<<boost::lambda::_1<<' '); error: /home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp:22: error: ‘template<class Sequence> struct boost::mpl::begin’ is not a function, /home/sandeep/Computing/boost_1_38_0/boost/range/begin.hpp:96: error: conflict with ‘template<class T> typename boost::range_iterator::type boost::begin(T&)’ /home/sandeep/Computing/boost_1_38_0/boost/range_ex/./detail/adl_begin_end.hpp:27: error: in call to ‘begin’ /home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp:23: error: ‘template<class Sequence> struct boost::mpl::end’ is not a function, /home/sandeep/Computing/boost_1_38_0/boost/range/end.hpp:92: error: conflict with ‘template<class T> typename boost::range_iterator::type boost::end(T&)’ /home/sandeep/Computing/boost_1_38_0/boost/range_ex/./detail/adl_begin_end.hpp:35: error: in call to ‘end’ I apologies in advance if this is due to trivial omission. Thanks -sandeep _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On Wed, Mar 18, 2009 at 11:02 AM, vicente.botet <vicente.botet@wanadoo.fr> wrote:
Hi Sandeep,
I think your problem comes from the fact that you should have some using namespace declarations. using namespace boost; using namespace boost::mpl;
If this is the case, try removing them and been explicit about which begin do you want; i.e. moost::begin or boost::mpl::begin.
If this is not the case, I have no idead without a complete example and the result of the compilation.
Best, Vicente
Thanks for looking into this Vicente. I am not directly adding boost::mpl to the namespace. Please find attached the code. Below is the full error. home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp: In function ‘typename boost::range_result_iterator<C>::type boost::range_ex_detail::adl_begin(Rng&) [with Rng = boost::multi_index::multi_index_container<std::pair<int, int>, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::member<std::pair<int, int>, int, &std::pair<int, int>::first>, mpl_::na, mpl_::na>, boost::multi_index::ordered_unique<boost::multi_index::member<std::pair<int, int>, int, &std::pair<int, int>::second>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, std::allocator<std::pair<int, int> > >]’: /home/sandeep/Computing/boost_1_38_0/boost/range_ex/algorithm.hpp:79: instantiated from ‘Fun boost::for_each(Rng&, Fun) [with Rng = mic, Fun = void (*)(const std::pair<int, int>&)]’ MultiIndexAndRangeEx.cpp:49: instantiated from here /home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp:22: error: ‘template<class Sequence> struct boost::mpl::begin’ is not a function, /home/sandeep/Computing/boost_1_38_0/boost/range/begin.hpp:96: error: conflict with ‘template<class T> typename boost::range_iterator::type boost::begin(T&)’ /home/sandeep/Computing/boost_1_38_0/boost/range_ex/./detail/adl_begin_end.hpp:27: error: in call to ‘begin’ /home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp: In function ‘typename boost::range_result_iterator<C>::type boost::range_ex_detail::adl_end(Rng&) [with Rng = boost::multi_index::multi_index_container<std::pair<int, int>, boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::member<std::pair<int, int>, int, &std::pair<int, int>::first>, mpl_::na, mpl_::na>, boost::multi_index::ordered_unique<boost::multi_index::member<std::pair<int, int>, int, &std::pair<int, int>::second>, mpl_::na, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, std::allocator<std::pair<int, int> > >]’: /home/sandeep/Computing/boost_1_38_0/boost/range_ex/algorithm.hpp:79: instantiated from ‘Fun boost::for_each(Rng&, Fun) [with Rng = mic, Fun = void (*)(const std::pair<int, int>&)]’ MultiIndexAndRangeEx.cpp:49: instantiated from here /home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp:23: error: ‘template<class Sequence> struct boost::mpl::end’ is not a function, /home/sandeep/Computing/boost_1_38_0/boost/range/end.hpp:92: error: conflict with ‘template<class T> typename boost::range_iterator::type boost::end(T&)’ /home/sandeep/Computing/boost_1_38_0/boost/range_ex/./detail/adl_begin_end.hpp:35: error: in call to ‘end’
----- Original Message ----- From: "Sandeep Gupta" <gupta.sandeep@gmail.com> To: <boost-users@lists.boost.org>; <boost@lists.boost.org> Sent: Wednesday, March 18, 2009 6:38 PM Subject: [boost] Range_Ex and Multi-Index: conflicting mpl::begin andboost::begin
Hi, I am under-impression that for_each construct of range_ex for all container concepts. However when I tried with multi-index it gave conflicting errors. Attached below is the code and corresponding errors.
code:
typedef multi_index_container< std::pair<value_type,int>, indexed_by< ordered_unique<member<pair<value_type,int>, value_type, &pair<value_type, int>::first> >, ordered_unique<member<pair<value_type,int>, int, &pair<value_type, int>::second> > > > mic;
mic serialStore; for_each(serialStore, std::cout<<boost::lambda::_1<<' ');
error: /home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp:22: error: ‘template<class Sequence> struct boost::mpl::begin’ is not a function, /home/sandeep/Computing/boost_1_38_0/boost/range/begin.hpp:96: error: conflict with ‘template<class T> typename boost::range_iterator::type boost::begin(T&)’ /home/sandeep/Computing/boost_1_38_0/boost/range_ex/./detail/adl_begin_end.hpp:27: error: in call to ‘begin’
/home/sandeep/Computing/boost_1_38_0/boost/mpl/begin_end_fwd.hpp:23: error: ‘template<class Sequence> struct boost::mpl::end’ is not a function, /home/sandeep/Computing/boost_1_38_0/boost/range/end.hpp:92: error: conflict with ‘template<class T> typename boost::range_iterator::type boost::end(T&)’ /home/sandeep/Computing/boost_1_38_0/boost/range_ex/./detail/adl_begin_end.hpp:35: error: in call to ‘end’
I apologies in advance if this is due to trivial omission.
Thanks -sandeep _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Do you us egcc ? If so, gcc is greedy when doing ADL. If a class use a mpl type as tempalte argument, it'll look into mpl namespace when doing ADL.

Sandeep Gupta <gupta.sandeep <at> gmail.com> writes:
Thanks for looking into this Vicente. I am not directly adding boost::mpl to the namespace. Please find attached the code. Below is the full error.
[...]
/home/sandeep/Computing/boost_1_38_0/boost/range_ex/./detail/ adl_begin_end.hpp:27: error: in call to ‘begin’ [...]
Hi Sandeep, What version of range_ex are you using? The one that was reviewed last February http://www.cs.aau.dk/~nesotto/boost/range_ex.zip is merged into the same folder as Boost.Range, as indicated in http://lists.boost.org/boost-announce/2009/02/0225.php so there aren't any "range_ex" folders, unlike what's shown in your error trace. Maybe you can use the review version of range_ex and see if the problem persists? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (4)
-
Joaquin M Lopez Munoz
-
Joel Falcou
-
Sandeep Gupta
-
vicente.botet