Joining two forward ranges
Hello, I'm looking to create an iterator which iterates over two joined ranges: [b0,e0)[b1,e1) I'm sure there's a way to do it with an iterator adapter. I was wondering, however, if someone knew of an already available implementation. Thank you.
AMDG er wrote:
I'm looking to create an iterator which iterates over two joined ranges:
[b0,e0)[b1,e1)
I'm sure there's a way to do it with an iterator adapter. I was wondering, however, if someone knew of an already available implementation.
Are both pairs of iterators always the same type? In Christ, Steven Watanabe
Steven Watanabe wrote:
AMDG
er wrote:
I'm looking to create an iterator which iterates over two joined ranges:
[b0,e0)[b1,e1)
I'm sure there's a way to do it with an iterator adapter. I was wondering, however, if someone knew of an already available implementation.
Are both pairs of iterators always the same type?
In Christ, Steven Watanabe
Good point, thanks. Here's the exact situation I have: // mf of a class which derives from super_type // which prepends 1 to one of the arguments before calling // the super's (protected) mf template<typename R0,typename R1> void mf( const R0& source, const R1& rest_weight ){ typedef std::vector<value_type> weight_type; typedef boost::range_iterator<weight_type> ri_type; typedef typename ri_type::type iter_type; typedef typename iterator_difference<iter_type>::type diff_type; //TODO joined iterator preferable static weight_type weight(this->weight_size,(value_type)(1)); iter_type i = boost::begin(weight); std::advance(i,(diff_type)(1)); copy( boost::begin(rest_weight), boost::end(rest_weight), i ); super_type::mf( source, weight); //args passed by const ref as well }
participants (2)
-
er
-
Steven Watanabe