Boost logo

Boost :

Subject: Re: [boost] Interesting variadic template trick
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-11-18 01:18:14


AMDG

On 11/17/2013 09:55 PM, Andrey Semashev wrote:
>
>> template <typename ...T>
>> struct or_ {
>> static constexpr bool value = !all_pointers(
>> ((typename std::conditional<T::value, int, void*>::type)0)...
>> );
>> };
>>
>> template <>
>> struct or_<> {
>> static constexpr bool value = false;
>> };
>
>
> It requires N instantiations of std::conditional, doesn't it? In that
> case is it actually faster than the naive recursive instantiation of
> or_?
>

No it doesn't. It requires exactly two
instantiations of std::conditional for
all uses of or_.

In Christ,
Steven Watanabe


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