|
Boost : |
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2006-05-25 15:33:16
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'?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk