C++ concepts
retard
re at tard.com.invalid
Tue Feb 16 10:04:04 PST 2010
Tue, 16 Feb 2010 06:28:19 -0500, bearophile wrote:
> One of the main purposes of Concepts is shared by Template Constraints,
> if you instantiate the following Add templated function on a type that
> doesn't support the plus operator, you get a compilation error at the
> calling point instead inside the template.
>
> T Add(T)(T x, T y) if (IsAddable!T) {
> return x + y;
> }
BTW, how does D handle functional dependencies between types?
> "Groups" of Concepts are a bit less handy to manage in D compared to
> that C++x0 proposal, but I think I will not miss this too much.
Type class is a higher level abstraction. Some consider it to be one of
the best features in languages like Haskell. The similar feature in C++0x
was concept maps or something like that.
>
> In the proposal for Concepts there are Axioms too, and they are not
> present in D2. One of the nice thing about Axioms is that they in theory
> will allow the user to give more semantics to the compiler
But even in the abandoned c++0x proposal, checking axioms was optional
IIRC.
More information about the Digitalmars-d
mailing list