returning range adaptor generator
What should be the return type for a function that returns an adapted
range? E.g.
template<class Range>
xxx getIndirected( const Range& r ) {
return r | boost::adaptors::indirected;
}
The use case being, providing a API with these little useful helpers
without forcing the user to know about Boost.Range at all. Like so:
#include
On Tue, Oct 1, 2013 at 4:21 PM, Nick Stokes
What should be the return type for a function that returns an adapted range? E.g.
template<class Range> xxx getIndirected( const Range& r ) { return r | boost::adaptors::indirected; }
boost::indirected_range<Range> -kyle
On Tue, Oct 1, 2013 at 4:55 PM, Kyle Lutz
On Tue, Oct 1, 2013 at 4:21 PM, Nick Stokes [..] boost::indirected_range<Range>
Thanks. But the question is not really about one single adaptor that indirected is. That was just an example (although your answer was useful, thank you) How about in general? Say, template<class Range> xxx getPuffedRange( Range& r ) { return r | indirected | filtered(puff) | etc; }
Thanks. But the question is not really about one single adaptor that indirected is. That was just an example (although your answer was useful, thank you)
How about in general? Say,
template<class Range> xxx getPuffedRange( Range& r ) { return r | indirected | filtered(puff) | etc; }
Your options are:
1) Use the exact type of the adapted range:
template <class Range>
filtered_range
participants (3)
-
Kyle Lutz
-
Nathan Ridge
-
Nick Stokes