|
Boost : |
Subject: Re: [boost] [mpl] is there a or_seq like logical metafunction?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-02-12 18:16:25
On 02/12/09 16:19, Larry Evans wrote:
[snip]
> I guess the compiler can do some sort of analysis to figure
> which templates really need to be instantiated and which don't.
> Maybe when instantiating some template, the compiler looks
> at which other templates are needed by the methods in that
> template (wait, there were not methods in while_, but maybe in
> the IfOps arg to while_) and then instantiates only those,
> but other compilers don't bother with that and instantiate
> templates even though they're not used.
One example of an unneeded instantiations are those for
some of the and_ifops::else_. The profile shows
that was instantiated 4 times:
and_seq_while.cpp:106 4 134
when only the last one is really needed. Which
leads to the obvious (at least now) optimization
of just making State as the last element in the
eval_if super of while_.
So, maybe the gcc you're using does this sort of optimization
for the find_if but not for the while_ implementation.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk