Boost logo

Boost :

Subject: Re: [boost] enable_if and non-template member functions?
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2011-08-06 18:25:19


On Sat, Aug 6, 2011 at 5:54 PM, Mathias Gaunard <
mathias.gaunard_at_[hidden]> wrote:

> On 08/06/2011 10:29 PM, Matt Calabrese wrote:
>
>> On Sat, Aug 6, 2011 at 3:40 PM, Matt Calabrese<rivorus_at_[hidden]> wrote:
>>
>> I'll put something together and make sure it all gets to Release.
>>>
>>>
>> Opinions on the following macro implementation?
>> http://codepaste.net/svq4hu
>>
>
> You managed to cram so many non-C++03 things in that macro it's impressive.
>
> __COUNTER__, variadic macros, decltype and function template default args.
>
> I think that for those reasons, it's pretty much unusable in real code.

I'm not sure why that rules it out for "real code". It's true that you need
a couple of 0x features, but that's because it's the only way for such a
macro to exist. So either it uses 0x or there is no macro at all.

That said, on the two compilers I've tested that support default template
arguments to function templates, GCC and Clang, it works fine, so I don't
really see the issue. The decltype trick is the only thing not strictly
necessary and it does imply a couple of extra template instantiations, so I
could always remove it. That part is just there to make it so that the
single macro can be used with either bool constants or types (so there's no
need for a separate _C version of the macro). Everything else is either
essential for the macro to exist in any form or shouldn't impact compile
times.

-- 
-Matt Calabrese

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