template this parameters for constructors

Jacob Carlborg doob at me.com
Wed Feb 20 12:47:01 PST 2013


On 2013-02-20 16:56, Gor Gyolchanyan wrote:
> This adds boilerplate, that I can't afford. I need to transparently add
> dynamic dispatch to classes and I can't modify all of them. Besides, I
> have had experience with this previously and it causes a ton of
> problems, because there's no way of making sure the static type is
> passed and its' the right one.

The compiler will make sure the a type is passed. You could add some 
constraints on the template type but it wouldn't be 100% bulletproof.

class Base (T : Base) { }
class Sub : Base!(Sub) { }

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list