Boost logo

Boost :

Subject: Re: [boost] C++11 Metaprogramming
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-04-03 14:50:36


on Tue Apr 03 2012, Howard Hinnant <howard.hinnant-AT-gmail.com> wrote:

> On Apr 3, 2012, at 1:44 PM, Dave Abrahams wrote:
>
>>
>> on Tue Apr 03 2012, Howard Hinnant <howard.hinnant-AT-gmail.com> wrote:
>>
>> But isn't this a better way to relieve the tedium?
>>
>> #define RETURNS(...) \
>> noexcept(noexcept(decltype(__VA_ARGS__)(std::move(__VA_ARGS__)))) \
>> -> decltype(__VA_ARGS__) \
>> { return (__VA_ARGS__); } \
>> typedef int RETURNS_CAT(RETURNS_, __LINE__)
>>
>> #define RETURNS_CAT_0(x, y) x ## y
>> #define RETURNS_CAT(x, y) RETURNS_CAT_0(x,y)
>>
>> ...
>>
>> auto swap(B& x, B& y) RETURNS(swap(x.a,y.a), swap(x.b,y.b), ...);
>
> I hadn't seen that one before. I guess Bjarne isn't getting rid of
> the preprocessor yet...

Nope. I guess he's just made it all the more relevant ;-)

-- 
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