Boost logo

Boost :

Subject: Re: [boost] New, powerful way to use enable_if in C++0x
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2011-04-11 17:16:26


Matt Calabrese wrote:
> Gevorg Voskanyan wrote:
> > Is there a particular reason
> > you
> > did it like:
> > typename boost::enable_if< boost::is_arithmetic< T > >::type*& =
> > boost::enabler
> > instead of:
> > typename Enable = typename boost::enable_if< boost::is_arithmetic< T >
> > >::type
> > ?
> > The latter seems clearer to me and removes the need to introduce a
> > boost::enabler identifier.
>
>
> It's necessary because otherwise with two overloads you'd end up with two
> declarations that differ only in default arguments, which would be a compile
> error.

Yes, of course that's very true, I wonder how could I miss that!
This could be included in the rationale section of the doc to prevent other
users from being tempted to "simplify" it as I was. :)

[snip]

Thanks,
Gevorg


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