|
Boost : |
Subject: Re: [boost] Call for interest - BOOST_AUTO_FUNCTION
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2010-10-18 00:47:44
On Sun, Oct 17, 2010 at 10:25 PM, David Abrahams <dave_at_[hidden]> wrote:
> But then, how would you return something that happens to have a nested
> ::type? Wrap it in identity?
>
Yes. Not that this would necessarily be a good idea, just throwing it out
there. Ultimately I think it'd be best to leave it as result_type and
lazy_result_type (or possibly explicit and lazy_explicit) to avoid such
subtleties.
> Can't you just detect whether "return" was used, and if not, sythesize
> the "end" internally?
>
No. The problem is that end is what closes off the return type (it closes
off a decltype). With each ( requires stuff_here ) or similar, it adds more
to the return type and then the last thing it does is specify the name of a
macro. The next ( arguments_here ) applies that macro and does the same
thing. At a return, everything is closed off and a definition is provided,
which is why you don't need an end there, but you can't do that otherwise
since it's possible that more arguments will be passed. The macro can't know
in advance the next thing the user will pass -- it could be a semicolon, or
it could be a return, or it could be a requires, or something else.
-- -Matt Calabrese
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk