Subject: Re: [boost] Provisional Boost.Generic and Boost.Auto_Function (concepts without concepts)
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2010-12-16 10:28:32
On Thu, Dec 16, 2010 at 9:18 AM, Dave Abrahams <dave_at_[hidden]> wrote:
> That sort of sounds like concept map templates with SFINAE "tacked on"
> (just the same way we tacked on SFINAE to partial template
> specializationthough most people don't know that usage of enable_if).
That's exactly how it works. Everything is done with specializations and
there is also an implicit "Enabler" for convenience, which is why the macro
can optionally use those "if" and "try" conditions (try just checks
> Would you support the analogue of concept map templates that can be
> partially-ordered (sounds from what you write below like you would),
> or would we be writing SFINAE conditions like "if (InputIterator<X> &&
> !BidirectionalIterator<X>)" to avoid ambiguities?
You can do everything that you'd expect from C++03 template specializations
that also happen to implicitly include a "SFINAE enabler". So, for instance,
you can have a concept map for std::vector< bool, Alloc > that will be
picked as a better match over one for std::vector< T, Alloc >, but you
cannot do the equivalent of concept overloading, which I think you may be
trying to get at with your example. If it came down to it, that could be
simulated in a manner similar to how "switch" works with Auto_Function, but
that'd be really pushing things to their limits and I'm not sure it's worth
trying to support, especially not at this stage.
-- -Matt Calabrese
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk