24 Sep
2008
24 Sep
'08
11:59 a.m.
Nat Goodspeed skrev:
As I work with Boost.Range, I frequently want to call a method returning an iterator_range and, from that range, instantiate a standard container. I have a couple of helpers I'd like to propose for inclusion in the Boost.Range library.
/** * From any range compatible with Boost.Range, return an instance of any * class with a constructor accepting a compatible iterator pair. */ template
TYPE make_from_range(const RANGE& range) { return TYPE(boost::begin(range), boost::end(range)); } It would probably be appropriate to provide a non-const RANGE& overload as well.
http://www.boost.org/doc/libs/1_36_0/libs/range/doc/utility_class.html#copy_... -Thorsten