From: Larry Evans (cppljevans_at_[hidden])
Date: 2008-03-12 10:29:47
On 03/12/08 08:22, Max Motovilov wrote:
>> A solution is posted here:
>> It would be interesting to compare the two solutions. The exercise just
>> specified 2 input sequences whereas your's allows (I guess)
>> any n>0 number of input sequences.
> No, they don't look similar. As far as I can tell from a one-minute
> look, the solution is simply a nested for_each loop and does not provide
> an actual sequence adapter, despite the name cross_product_view.
From one of your previous post's, the output is a crossproduct which
requires a nested for_each loop to printout first the rows
and for each row the elements in that row. That's the only reason
for the static print_each and struct element_printer.
I realize now that should have been commented to indicate it was
not part of the solution but only used to demonstrate the
correctness, which I hoped the printout:
Running 2 test cases...
would have demonstrated.
Also, I am not sure that cross_product_view:
does not provide an actual sequence adapter
because the superclass of cross_product_view is a transform_view and the
first page of chapter 7 states:
A sequence view ... is a lazy adapter
So, in view of that, could you explain why it's not a sequence adapter?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk