
25 May
2006
25 May
'06
7:33 p.m.
STL iterators are designed so that ordinary pointers can be iterators. Can we do the same with boost::range? With STL we can do: int x; std::copy (&x, &x+1, output); Does this work for range? #include <boost/range.hpp> template<typename in_t> void F (in_t const& in) { typename boost::range_const_iterator<in_t>::type i = boost::begin (in); for (; i != boost::end (in); ++i) ; } int main() { int x; F (boost::sub_range<int*> (&x, &x+1)); } usr/local/src/boost.cvs/boost/range/sub_range.hpp:26: instantiated from ‘boost::sub_range<int*>’ test.cc:11: instantiated from here /usr/local/src/boost.cvs/boost/range/mutable_iterator.hpp:37: error: ‘int*’ is not a class, struct, or union type How do I turn the 'int x' into a 'range'?