Boost logo

Boost :

Subject: Re: [boost] [static_if] Is there interest in a `static if` emulation library?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2014-09-02 13:13:33


Le 02/09/14 17:34, Roland Bock a écrit :
> On 2014-09-02 14:08, Sebastian Redl wrote:
>> On 02 Sep 2014, at 8:58, Roland Bock <rbock_at_[hidden]> wrote:
>>
>>> On 2014-09-02 03:27, Lorenzo Caminiti wrote:
>>>
>>> You could use inheritance. If the condition is true, you inherit from a
>>> struct that provides the data member, otherwise you inherit from a
>>> struct that does not. Ugly, I know, but it works if inheritance is an
>>> option for you.
>> That’s what I’m doing, but as you say, it is ugly:
>>
>> template <typename Policy>
>> using proxy_base_t = std::conditional_t<
>> has(Policy::requirements, features::raw_access),
>> proxy_raw_access<proxy_nodot<Policy>>,
>> proxy_nodot<Policy>>;
>>
>> template <typename Policy>
>> class proxy : public proxy_detail::proxy_base_t<Policy> {
>> …
>> };
>>
>> Sebastian
>>
> Yep, same here :-)
An here
https://github.com/boostorg/thread/blob/develop/include/boost/thread/concurrent_queues/queue_base.hpp.

Vicente


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