Boost logo

Boost :

From: Jaap Suter (J.Suter_at_[hidden])
Date: 2002-12-31 04:27:51

> Nifty! You're using one of my favorite metaprogramming tricks, the
> default template parameter which allows you to avoid creating a
> separate implementation template. I almost forgot about that one,
> it's been so long since I've been able to use it.

Funny you mention that. I've been meaning to ask for its appropriateness on
this list. After all, we are exposing implementation details in the
interface which is not something I would recommend on a daily basis. Glad
you like it :).

> > I need to change my algorithms in some other places too I
> > think. However, the functional style of programming and the
> > associated amount of recursion does not leave much flexibility.
> It's usually easier if you re-use the algorithms supplied by the MPL
> itself.

Yeah, but the MPL algorithms are just lower-level core algorithms. I doubt
you get all your algorithm needs from the what the STL has to offer.
However, if you mean that my algorithm should use the MPL algorithms to
divide-and-conquer, than you're right.

> The loop unrolling technique you mention below can help reduce
> recursion, but it won't change "big O" for your algorithm. Its main
> purpose is to avoid deeply nested templates, which may anger the
> little man in your compiler ;-)

True, but with the small recursion depths that are allowed anyway, any
optimization can help.

> > Also, I'll need to start thinking about
> >
> > and
> Please let me know if you have questions. I think I wrote both of
> those.

Thanks, I'll probably have some questions on the loop unrolling in the

> > now. I suppose I really need to tweak my algorithms.
> No, probably you just need to follow the instructions and specify /Zm
> ;-) We use a fairly high number by default in the msvc toolset.

That's good to hear. I would rather stay away from specific project
settings, but I guess I have no choice here.

> > By the way, would it be worthwhile to create an 'Effective MPL' wiki
> > page with some common gotchas on the different compilers? We could
> > refer to the document on Integral Constant Expressions, we could
> > mention the 'early template instantiation' and the work-around, and
> > we could mention the lambda complications. And I'm sure that you and
> > Dave have more gold nuggets from your experience using the MPL in
> > real-world code.
> Yes, it would probably be very worthwhile.

I quickly hacked something together at:

It still has some questions for you and Alexsey, and also some TODO's. I'll
try to fill those in asap, probably next year :). Also, any comments or
pointing out blatant errors (hej, I'm just an MPL newbie) would be greatly
appreciated (or just fix them in the wiki directly).


Jaap Suter

Boost list run by bdawes at, gregod at, cpdaniel at, john at