|
Boost : |
From: Larry Evans (cppljevans_at_[hidden])
Date: 2008-03-12 10:29:47
On 03/12/08 08:22, Max Motovilov wrote:
[snip]
>> A solution is posted here:
>>
>> http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?CPPTM_Answers_-_Exercise_7-8
>>
>> 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.
[snip]
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...
row.col=0.100
row.col=0.101
row.col=0.102
...
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