C++0x Concepts - Dead?
aarti_pl
aarti at interia.pl
Thu Jul 16 14:40:15 PDT 2009
Walter Bright pisze:
> aarti_pl wrote:
>> My proposal would make meta programing in D much more intuitive
>> (because of using rules - not bunch of corner cases as it is today).
>> Unfortunately almost no one from NG commented on that...
>
> Thank you, but I don't see in your proposal a method that can:
>
> 1. instantiate templates only if a value argument is prime or odd.
>
> 2. instantiate templates only on a type which supports addition and has
> the method foo.
>
> Note that C++ Concepts could do (2) but could not do (1).
ad.1
template normalizedType((T U N : U[N=size_t]) && (N & 1))
As it is stated in proposal commas are only syntax sugar for more
general form with '&&'.
ad.2.
This case is in fact the same as 1. Because of the fact that A, B, C <=>
A && B && C, you can create expressions as you want just using second
form with logical operators. In this case you should just use proper
compile time reflection mechanism in D to get information about type
properties.
BR
Marcin Kuszczak
(aarti_pl)
More information about the Digitalmars-d-announce
mailing list