Boost logo

Boost :

From: Hamish Mackenzie (hamish_at_[hidden])
Date: 2002-04-15 18:00:53


On Mon, 2002-04-15 at 14:46, David Abrahams wrote:
> > As I understand it, both result in nesting, ether of N * count_if or N
> *
> > (for_loop + for_loop_iteration). (I don't seem to have source for
> > mpl::fold so I am basing this on the next_if implementation).
>
> No, read the paper. The library uses loop unrolling to decrease nesting
> depth.

Ok I've read most of it now including "Loop unrolling" 2.3.8. Firstly
might I say it is a superb document and I will remember to refer to it
before I try to understand the code in future.

Am I correct in thinking that the number of template instantiations is
not reduced only the depth? How much does this affect speed and on
which compilers (see last line of 2.3.8)?

Also is CVS up to date? I still can't find fold in my copy?

> > * Improved self documentation
>
> I don't think duplicating functionality improves self documentation.

Fair enough.

> > * Testability (ie. you can check one implementation against the other)
>
> Not worth it, IMO. Especially since getting both implementations to run
> in the same program breaks the ODR (or requires renaming hacks).

I was thinking of a rule in a make file to build each test program once
with the appropriate define (see #ifdef in previous post) and once
without then compare the output of the two binaries.

> > * Possibly shorter error messages
>
> You'd have to prove that, too. Decreased nesting due to loop unrolling
> will also shorten error messages.

Wont it still end up with N * fold_step in the message, which has four
template arguments (as opposed to two)?

Hamish


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