|
Boost : |
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2008-01-10 08:33:13
Maybe add these:
template<typename range_type>
inline bounded_iterator<typename boost::range_iterator<range_type>::type>
make_bounded_iterator (range_type & r) {
return bounded_iterator<typename boost::range_iterator<range_type>::type> (r);
}
template<typename range_type>
inline bounded_iterator<typename boost::range_iterator<range_type>::type>
make_bounded_iterator (range_type const& r) {
return bounded_iterator<typename boost::range_iterator<range_type>::type> (r);
}
Now you can do:
template<typename out_t, typename in_t>
inline out_t Map (in_t const& in) const {
out_t out (boost::size (in));
typename boost::range_iterator<out_t>::type o = boost::begin (out);
typename bounded_iterator_type<in_t>::type i = make_bounded_iterator<in_t> (in);
for (; i; ++i, ++o)
*o = Map1 (*i);
return out;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk