class template conflict

Steven Schveighoffer schveiguy at gmail.com
Mon Dec 24 01:51:49 UTC 2018


On 12/23/18 7:09 AM, Michelle Long wrote:
> class X
> {
> 
> }
> 
> class X(int N) : X
> {
> 
> }
> 
> Is there any real reason we can't do this?

I think it has less to do with class names and more to do with symbol 
overloading.

The only place I think templates are allowed to overload names with 
non-templates is functions, which actually was not always the case (you 
used to have to only have templates or non templates as function overloads).

> 
> It is very nice to be able to treat X like the base and X!n as a derived 
> class.

The problem I see is:

template foo(alias A) { ... }

foo!X

Did you mean class X or template X?

For functions, this is OK, because it's one overload set.

-Steve


More information about the Digitalmars-d-learn mailing list