Actions
Bug #2425
closedName doesn't conform to SinglePassRangeConcept
Start date:
01/27/2015
Due date:
% Done:
100%
Estimated time:
1.50 h
Description
This is necessary, for example, to use boost::adaptors::reversed
Code snippet (test.cpp)
#include <ndn-cxx/name.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <iostream>
int main()
{
ndn::Name test("/hello/world");
for (const auto& i : test | boost::adaptors::reversed) {
std::cout << i << std::endl;
}
return 0;
}
Compile
g++ test.cpp -std=c++11 `pkg-config --cflags --ldflags libndn-cxx`
Expected: compiles
Actual:
In file included from test.cpp:2:
In file included from /usr/local/include/boost/range/adaptor/reversed.hpp:14:
In file included from /usr/local/include/boost/range/iterator_range.hpp:13:
In file included from /usr/local/include/boost/range/iterator_range_core.hpp:38:
In file included from /usr/local/include/boost/range/functions.hpp:18:
/usr/local/include/boost/range/begin.hpp:47:16: error: cannot initialize return object of type 'typename range_iterator<Name>::type'
(aka 'ndn::name::Component *') with an rvalue of type 'const_iterator' (aka 'const ndn::name::Component *')
return c.begin();
^~~~~~~~~
/usr/local/include/boost/range/begin.hpp:102:12: note: in instantiation of function template specialization
'boost::range_detail::range_begin<ndn::Name>' requested here
return range_begin( r );
^
/usr/local/include/boost/range/concepts.hpp:287:34: note: in instantiation of function template specialization
'boost::range_adl_barrier::begin<ndn::Name>' requested here
iterator i1 = boost::begin(*m_range);
^
/usr/local/include/boost/concept/usage.hpp:16:43: note: in instantiation of member function
'boost::SinglePassRangeConcept<ndn::Name>::~SinglePassRangeConcept' requested here
~usage_requirements() { ((Model*)0)->~Model(); }
^
/usr/local/include/boost/concept/detail/general.hpp:38:42: note: in instantiation of member function
'boost::concepts::usage_requirements<boost::SinglePassRangeConcept<ndn::Name> >::~usage_requirements' requested here
static void failed() { ((Model*)0)->~Model(); }
^
/usr/local/include/boost/range/concepts.hpp:282:9: note: in instantiation of member function 'boost::concepts::requirement<boost::concepts::failed
************boost::concepts::usage_requirements<boost::SinglePassRangeConcept<ndn::Name> >::************>::failed' requested here
BOOST_CONCEPT_USAGE(SinglePassRangeConcept)
^
/usr/local/include/boost/concept/usage.hpp:29:7: note: expanded from macro 'BOOST_CONCEPT_USAGE'
BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
^
/usr/local/include/boost/concept/assert.hpp:43:5: note: expanded from macro 'BOOST_CONCEPT_ASSERT'
BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
^
/usr/local/include/boost/concept/detail/general.hpp:78:51: note: expanded from macro 'BOOST_CONCEPT_ASSERT_FN'
&::boost::concepts::requirement_<ModelFnPtr>::failed> \
^
test.cpp:8:31: note: in instantiation of function template specialization 'boost::range_detail::operator|<ndn::Name>' requested here
for (const auto& i : test | boost::adaptors::reversed) {
^
In file included from test.cpp:2:
In file included from /usr/local/include/boost/range/adaptor/reversed.hpp:14:
In file included from /usr/local/include/boost/range/iterator_range.hpp:13:
In file included from /usr/local/include/boost/range/iterator_range_core.hpp:38:
In file included from /usr/local/include/boost/range/functions.hpp:19:
/usr/local/include/boost/range/end.hpp:48:20: error: cannot initialize return object of type 'typename range_iterator<Name>::type'
(aka 'ndn::name::Component *') with an rvalue of type 'const_iterator' (aka 'const ndn::name::Component *')
return c.end();
^~~~~~~
/usr/local/include/boost/range/end.hpp:96:12: note: in instantiation of function template specialization 'boost::range_detail::range_end<ndn::Name>'
requested here
return range_end( r );
^
/usr/local/include/boost/range/concepts.hpp:288:34: note: in instantiation of function template specialization
'boost::range_adl_barrier::end<ndn::Name>' requested here
iterator i2 = boost::end(*m_range);
^
/usr/local/include/boost/concept/usage.hpp:16:43: note: in instantiation of member function
'boost::SinglePassRangeConcept<ndn::Name>::~SinglePassRangeConcept' requested here
~usage_requirements() { ((Model*)0)->~Model(); }
^
/usr/local/include/boost/concept/detail/general.hpp:38:42: note: in instantiation of member function
'boost::concepts::usage_requirements<boost::SinglePassRangeConcept<ndn::Name> >::~usage_requirements' requested here
static void failed() { ((Model*)0)->~Model(); }
^
/usr/local/include/boost/range/concepts.hpp:282:9: note: in instantiation of member function 'boost::concepts::requirement<boost::concepts::failed
************boost::concepts::usage_requirements<boost::SinglePassRangeConcept<ndn::Name> >::************>::failed' requested here
BOOST_CONCEPT_USAGE(SinglePassRangeConcept)
^
/usr/local/include/boost/concept/usage.hpp:29:7: note: expanded from macro 'BOOST_CONCEPT_USAGE'
BOOST_CONCEPT_ASSERT((boost::concepts::usage_requirements<model>)); \
^
/usr/local/include/boost/concept/assert.hpp:43:5: note: expanded from macro 'BOOST_CONCEPT_ASSERT'
BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
^
/usr/local/include/boost/concept/detail/general.hpp:78:51: note: expanded from macro 'BOOST_CONCEPT_ASSERT_FN'
&::boost::concepts::requirement_<ModelFnPtr>::failed> \
^
test.cpp:8:31: note: in instantiation of function template specialization 'boost::range_detail::operator|<ndn::Name>' requested here
for (const auto& i : test | boost::adaptors::reversed) {
^
2 errors generated.
Actions