Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct wrapper
- {
- struct iterator : std::iterator<std::forward_iterator_tag, ObservationReport>
- {
- iterator(ObservationReportList* p, int i) : pnt_(p), i_(i) {}
- ObservationReport& operator*() {
- return (*pnt_)[i_];
- }
- iterator& operator++() {
- ++i_;
- return *this;
- }
- bool operator==(const iterator& r) const {
- return i_ == r.i_;
- }
- bool operator!=(const iterator& r) const {
- return i_ != r.i_;
- }
- ObservationReportList* pnt_;
- int i_;
- };
- wrapper(ObservationReportList & n)
- : begin_( boost::addressof(n), 0 )
- , end_( boost::addressof(n), n.length() )
- {}
- iterator begin() { return begin_; }
- iterator end() { return end_; }
- iterator begin_, end_;
- };
- // usage
- ObservationReportList reportList;
- // filling reportList
- BOOST_FOREACH(ObservationReport o, wrapper(reportList))
- {
- }
- //gcc error
- In file included from /usr/include/boost159/boost/foreach.hpp:71:0,
- from test/src/MessageFillerTest.cpp:18:
- /usr/include/boost159/boost/mpl/eval_if.hpp: In instantiation of ‘struct boost::mpl::eval_if<mpl_::bool_<true>, boost::range_const_iterator<wrapper, void>, boost::range_mutable_iterator<wrapper, void> >’:
- /usr/include/boost159/boost/foreach.hpp:359:13: required from ‘struct boost::foreach_detail_::foreach_iterator<wrapper, mpl_::bool_<true> >’
- /usr/include/boost159/boost/foreach.hpp:679:1: required by substitution of ‘template<class T> boost::foreach_detail_::auto_any<typename boost::foreach_detail_::foreach_iterator<T, mpl_::bool_<true> >::type> boost::foreach_detail_::begin(
- boost::foreach_detail_::auto_any_t, boost::foreach_detail_::type2type<T, mpl_::bool_<true> >*, bool*) [with T = wrapper]’
- test/src/MessageFillerTest.cpp:206:3: required from here
- /usr/include/boost159/boost/mpl/eval_if.hpp:38:31: error: no type named ‘type’ in ‘boost::mpl::eval_if<mpl_::bool_<true>, boost::range_const_iterator<wrapper, void>, boost::range_mutable_iterator<wrapper, void> >::f_ {aka struct boost::ran
- ge_const_iterator<wrapper, void>}’
- typedef typename f_::type type;
- ^
- In file included from test/src/MessageFillerTest.cpp:18:0:
- test/src/MessageFillerTest.cpp: In member function ‘virtual void MessageFiller_XXX_Test::TestBody()’:
- /usr/include/boost159/boost/foreach.hpp:1020:39: error: no matching function for call to ‘begin(const boost::foreach_detail_::auto_any_base&, boost::foreach_detail_::type2type<wrapper, mpl_::bool_<true> >*, bool*)’
- , BOOST_FOREACH_SHOULD_COPY(COL))
- ^
- /usr/include/boost159/boost/foreach.hpp:1101:77: note: in expansion of macro ‘BOOST_FOREACH_BEGIN’
- if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else \
- ^
- test/src/MessageFillerTest.cpp:206:3: note: in expansion of macro ‘BOOST_FOREACH’
- BOOST_FOREACH(ObservationReport o, wrapper(reportList))
- ^
- /usr/include/boost159/boost/foreach.hpp:660:1: note: candidate: template<class T, class C> boost::foreach_detail_::auto_any<typename boost::foreach_detail_::foreach_iterator<T, C>::type> boost::foreach_detail_::begin(boost::foreach_detail_
- ::auto_any_t, boost::foreach_detail_::type2type<T, C>*, mpl_::true_*)
- begin(auto_any_t col, type2type<T, C> *, boost::mpl::true_ *) // rvalue
- ^
- /usr/include/boost159/boost/foreach.hpp:660:1: note: template argument deduction/substitution failed:
- /usr/include/boost159/boost/foreach.hpp:964:46: note: cannot convert ‘boost::foreach_detail_::should_copy_impl(((mpl_::bool_<false>*)0u), ((mpl_::bool_<false>*)0u), (& _foreach_is_rvalue206))’ (type ‘bool*’) to type ‘mpl_::true_* {aka mp
- l_::bool_<true>*}’
- (boost::foreach_detail_::should_copy_impl( \
- ^
- /usr/include/boost159/boost/foreach.hpp:1020:9: note: in expansion of macro ‘BOOST_FOREACH_SHOULD_COPY’
- , BOOST_FOREACH_SHOULD_COPY(COL))
- ^
- /usr/include/boost159/boost/foreach.hpp:1101:77: note: in expansion of macro ‘BOOST_FOREACH_BEGIN’
- if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else \
- ^
- test/src/MessageFillerTest.cpp:206:3: note: in expansion of macro ‘BOOST_FOREACH’
- BOOST_FOREACH(ObservationReport o, wrapper(reportList))
- ^
- /usr/include/boost159/boost/foreach.hpp:668:1: note: candidate: template<class T, class C> boost::foreach_detail_::auto_any<typename boost::foreach_detail_::foreach_iterator<T, C>::type> boost::foreach_detail_::begin(boost::foreach_detail_
- ::auto_any_t, boost::foreach_detail_::type2type<T, C>*, mpl_::false_*)
- begin(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue
- ^
- /usr/include/boost159/boost/foreach.hpp:668:1: note: template argument deduction/substitution failed:
- /usr/include/boost159/boost/foreach.hpp:964:46: note: cannot convert ‘boost::foreach_detail_::should_copy_impl(((mpl_::bool_<false>*)0u), ((mpl_::bool_<false>*)0u), (& _foreach_is_rvalue206))’ (type ‘bool*’) to type ‘mpl_::false_* {aka m
- pl_::bool_<false>*}’
- (boost::foreach_detail_::should_copy_impl( \
- ^
- /usr/include/boost159/boost/foreach.hpp:1020:9: note: in expansion of macro ‘BOOST_FOREACH_SHOULD_COPY’
- , BOOST_FOREACH_SHOULD_COPY(COL))
- ^
- /usr/include/boost159/boost/foreach.hpp:1101:77: note: in expansion of macro ‘BOOST_FOREACH_BEGIN’
- if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else \
- ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement