|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2007-12-04 19:42:58
on Tue Dec 04 2007, Tobias Schwinger <tschwinger-AT-isonews2.com> wrote:
> I believe Paul's code can theoretically run a lot faster with a
> preprocessor that is well-optimized for metaprogramming (not sure there
> is one around) and it has the "wizardry bonus". Mine OTOH emits at least
> a few newline characters - which I happen to like :-).
>
> Anyway, I will benchmark with some more compilers and eventually change
> things to use Paul's approach if a significant advantage becomes apparent.
I think you might find yourself wanting to use both approaches,
depending on the compiler :(
>>
>> It should use compressed_pair to store the wrapped function object to
>> take advantage of EBO.
>>
>
> The class only has a single member, so how would it be applicable?
Just make the other element of the pair an empty class.
> We could just inherit the target function privately to exploit EBCO in
> cases when inheriting from 'forward<F>'...
That won't work when the target function is a function pointer.
compressed_pair handles these issues automatically.
>>> * What is your evaluation of the documentation?
>>
>> Nice, but terse. It would probably be helpful to many to add some
>> more material explaining the forwarding problem.
>
> Are you missing something in particular?
Yeah, a little segment that goes, "suppose you're trying to do this:
... . So you implement it this way ... and then this problem ... happens. So
you try doing this ... and that problem .... happens. What you should
do instead is use the forwarding library like this: ...."
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk