TDPL: Operator Overloading
Steven Schveighoffer
schveiguy at yahoo.com
Wed Aug 25 07:05:05 PDT 2010
On Wed, 25 Aug 2010 09:55:47 -0400, bearophile <bearophileHUGS at lycos.com>
wrote:
> Steven Schveighoffer:
>> Inside a template instantiation, the template name without template
>> parameters is equivalent to the current instantiation.
>>
>> It saves a lot of typing.
>
> And causes some troubles :-) It's a barter, and I am not sure it's a
> good one.
What trouble? I've already stated in the bug report how there's not
anything better you can expect from the compiler. If it was required to
specify the template parameters instead of using the shortcut, then you
would be no better off. Here is something I had found to be a problem
with dcollections:
final class TreeMap(K, V, alias ImplTemp=RBTree, alias
compareFunc=DefaultCompare)
{
...
TreeMap!(K, V) set(K k, V v) {...}
...
}
Notice the problem?
-Steve
More information about the Digitalmars-d-learn
mailing list