Boost logo

Boost :

Subject: Re: [boost] [Variant] C++11 variadic template implementation
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-04-15 19:12:18


on Sun Apr 15 2012, Mathias Gaunard <mathias.gaunard-AT-ens-lyon.org> wrote:

> On 15/04/12 15:02, paul Fultz wrote:
>
>> Well you can expand the parameter pack to create a static array of
>> function pointers.
>
> I see, interesting.
>
> How does it fare in terms of bloat and performance? Are compilers
> still able to inline with this?

You can probably get somewhere by using constexpr to ensure that
function pointers remain compile-time constants. However, note that
such a dispatch may still be less efficient than a switch statement or
chained if/then/else.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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