www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Constructor template

reply niovol <niovol gmail.com> writes:
I tried to make a constructor template like this(T)() {...}, but the compilier
doesn't allow to do it. Will there be such possibiliy? Or is it impossible?
May 02 2007
parent reply BCS <BCS pathlink.com> writes:
niovol wrote:
 I tried to make a constructor template like this(T)() {...}, but the compilier
doesn't allow to do it. Will there be such possibiliy? Or is it impossible?

Constructors are never virtual (the reason non-static class member templates are not allowed) so I don't see why they /aren't/ allowed.
May 02 2007
parent bc <mi_emayl_adrez hotmail.com> writes:
On Wed, 02 May 2007 22:25:14 +0100, BCS <BCS pathlink.com> wrote:

 niovol wrote:
 I tried to make a constructor template like this(T)() {...}, but the  
 compilier doesn't allow to do it. Will there be such possibiliy? Or is  
 it impossible?

Constructors are never virtual (the reason non-static class member templates are not allowed) so I don't see why they /aren't/ allowed.

non-static member template functions work though, albeit non-virtually.
May 09 2007