Boost logo

Boost :

Subject: Re: [boost] Call for interest - BOOST_AUTO_FUNCTION
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2010-10-05 16:08:14


On Tue, Oct 5, 2010 at 3:57 PM, David Abrahams <dave_at_[hidden]> wrote:

> I always imagined I'd want something like that when I started using
> C++0x in anger.
>

So I take it that's at least one definite interest, ha. I've also updated
the code at the link to use a "better" implementation of AUTO_FUN:
 http://codepaste.net/iqzbiz

It's now implemented as:

#define AUTO_FUN_IMPL( ... ) decltype( __VA_ARGS__ ) { return __VA_ARGS__; }

#define AUTO_FUN( name_and_param_list ) auto name_and_param_list->
AUTO_FUN_IMPL

This is so that usage looks more like a function template definition, as
seen in the example code. The use of __VA_ARGS__ is there so that people
don't have to wrap their expression in an additional set of parentheses if a
top-level comma is present in the expression (such as if you refer to a
template with multiple arguments). 0x has variadic macros, might as well use
them, albeit in an unconventional manner!

-- 
-Matt Calabrese

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