Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-07-24 18:28:00


On 07/24/2005 05:45 PM, Alex Mendes da Costa wrote:
> Hi folks:
>
> I quite often have to write code to do the following:
>
> Given N sequences, generate all the N-tuples s.t. the i'th element in
> each tuple is drawn from the i'th sequence.
>
> For example, if sequence S1 is { 1, 2, 3 } and sequence S2 is { 10, 20
> }, I need to generate these tuples: (1, 10), (2, 10), (1, 20), (2,
> 20).
>
In:

   http://www.boost-consulting.com/metaprogramming-book.html

exercise 7-8 requires that given "two original sequences" that the
result be "all possible pairs of their elements in right cross product
order". I *think* this is similar enough to your example to
qualify. I don't know if the order matters, but it seems your example
does produce "all possible pairs". Anyway, there is one solution
to exercise 7-8 here:

http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?CPPTM_Answers_-_Exercise_7-8

you might post your code there.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk