Subject: Re: [boost] [range][rangex] Joining two unrelated ranges?
From: Joel de Guzman (joel_at_[hidden])
Date: 2009-06-23 10:23:45
Mathias Gaunard wrote:
> Dean Michael Berris wrote:
>> I was wondering if a utility that allows the encapsulation (and
>> merging) of two ranges is already part of RangeEx? I was thinking
>> along the lines of:
>> vector<int> a, b;
>> // populate a, populate b
>> auto r = concat(a, b); // concatenates the ranges into a single range
>> set<int> c(begin(r), end(r)); // r looks like a single forward range
>> I'm not sure if this is already supported in Boost.Range and it'd be
>> nice to know if this is already in RangeEx.
> I don't think it's provided by RangeEx, but that indeed seems like a
> good idea.
In Fusion (and also in MPL), it's called joint_view:
and there's the fusion::join algo:
If anyone writes such a thing (I'm surprised RangeEx does not have it),
please follow MPL/Fusion's lead.
-- Joel de Guzman http://www.boostpro.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk