
1 Oct
2013
1 Oct
'13
8:21 p.m.
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 <myapi.hpp> #include <boost/foreach.hpp> LegacyPointerContainers f; // contains Foo pointers BOOST_FOREACH( Foo& f, TraverseFoo( f ) ) { } /// where in myapi.hpp xxx TraverseFoo( LegacyPointerContainers& f ) { return getIndirected( makeRange(f) ) ; } PS: This is all C++03. No autos. Thanks Nick