Constraints & Concepts [Was: Re: C++0x news]

bearophile bearophileHUGS at lycos.com
Mon Mar 22 12:09:37 PDT 2010


Andrei Alexandrescu:

> you'd have to understand the reasons that made concepts unsuitable
> for C++0x and then work out ways to make concepts work for D.

I don't know exactly why they have refused Concepts, but to refuse them after so many years of developments and discussions (and ConceptG++, many nice papers written about their usage, etc) then they have good reasons. You are right, better to not go there, even if it's seducing stuff.


> Detecting mistaken use of concepts is practically very easy - just write 
> a type that implements the concept vacuously and then instantiate the 
> tested template against it in a unittest. I sometimes do that to test my 
> range-based code.

Thank you for this interesting suggestion, I'll try it.
In the meantime I have found a Boost docs page about the same topic, I think their 'archetype class' is the same thing you are saying me:
http://www.boost.org/doc/libs/1_42_0/libs/concept_check/concept_covering.htm

Bye,
bearophile



More information about the Digitalmars-d mailing list