Boost logo

Boost :

Subject: Re: [boost] Is there BOOST_ENABLE_IF macro now?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2013-08-20 06:09:12


On 20/08/13 04:00, Matt Calabrese wrote:
> On Mon, Aug 19, 2013 at 9:11 PM, paul Fultz <pfultz2_at_[hidden]> wrote:
>
>>>> I was referring to the ConceptsLite proposal.
>>>
>>>
>>> I'm not going to open up this can of worms in this thread, but I am not a
>>> fan of that proposal in the least.
>>>
>>
>> The proposal seems to be just native support of enable_if. Which lets the
>> compiler do better overload matching, and error reporting. It really has
>> nothing to do with concepts.
>
>
> Exactly. The C++0x concept proposal, on the other hand, had a lot more than
> just concept maps going for it -- it had automatically deduced associated
> types, an actual working way to check template definitions, and
> pseudo-signatures provide a much more clear and direct correspondence to
> archetypes, which is how definition checking was performed in the 0x
> proposal and is likely how it will be done in any working concept
> implementation with definition checking. IMO concept maps are the way to go
> for all of the reasons that have been talked about for the past 8 years or
> however long it's been, but at this point I don't care if we start out with
> everything implicit. Concept maps are almost a non-issue at this point.
> Pseudo-signatures and proper associated type support are what really need
> to be brought back if we are to have something more than just a glorified,
> native enable_if. The big problem is that a proper concepts language
> feature would require fundamental changes to what ConceptsLite proposes, so
> it's not simply a matter of getting ConceptsLite in and then improving it
> in the future. If ConceptsLite gets in, I find it hard to believe that C++
> will ever get proper concept support.

If you're going to explicitly make some types conforming to a concept,
then you might as well use SFINAE like so:

template<class T, class Enable = void>
struct my_class;

template<class T>
struct my_class<T, typename T::my_concept_tag>
{
   // T fulfills my concept
};


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