Boost logo

Boost Users :

Subject: Re: [Boost-users] Iterators for the cartesian product
From: Larry Evans (cppljevans_at_[hidden])
Date: 2011-06-17 22:52:39


On 06/13/11 17:54, Larry Evans wrote:
> On 06/13/11 15:25, Larry Evans wrote:
>> On 06/13/11 15:06, kelvSYC wrote:
>>>
>>> On Jun 13, 2011, at 8:19 AM, Larry Evans wrote:
> [snip]
>>> So I'd want z to be equal to
>>>
>>> std::vector<std::vector<int>>({{1,4}, {1,5}, {2,4}, {2,5}, {3,4}, {3,5}});
>>>
>>> Is there something in boost that will give me this sequence (or at least iterators therein?)
>>
>> I pretty sure there is none since the thread I mentioned previously did
>> not mention one and people replying to that thread indicated it would
>> be desirable.
>
> The attached code, using boost multi_array, produces output shown in
> 2nd attachment.
[snip]
The attached code produces same output but is clearer and probably
faster because, instead of using div, it just uses ++, although it
does have 2 loops instead of just one.




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