|
Boost Users : |
Subject: Re: [Boost-users] [Range] Adapt 2-iterator container constructors for Range?
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-09-24 07:59:46
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<class TYPE, typename RANGE>
> 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_range
-Thorsten
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net