Re: abstract function templates

2010-12-28 Thread Simen kjaeraas
bearophile wrote: (I don't know why templated methods can't be virtual) First of all, they can. But it's a shitload of extra work, and requires that compilation be mixed up with linking. Whenever a templated method is used from any subclass, it has to be generated for the base class, and an

Re: abstract function templates

2010-12-28 Thread Ali Çehreli
bearophile wrote: > (I don't know why templated methods can't be virtual), so I leave the bug report to someone else that's able to write something meaningful in the bug report :-) I created a bug report just about the compiler error message: http://d.puremagic.com/issues/show_bug.cgi?id=53

gaming pointers

2010-12-28 Thread g g
I know this is just playing dangerous, still tempting to use for things like plugins ,"member interfaces" or even struct interfaces. It is easy to do without unions because delegates have ptr and funcptr pointers with just a swap of pointers. Are .ptr and .funcptr really needed to be writeable? "

Re: slist insertion

2010-12-28 Thread Simen kjaeraas
Ellery Newcomer wrote: why does SList.insertFront have a complexity of O(log(n)) ? Good question! It certainly is not the code's fault, as that's O(1) for single elements and O(m) for ranges. File it to Bugzilly, I guess. -- Simen

slist insertion

2010-12-28 Thread Ellery Newcomer
why does SList.insertFront have a complexity of O(log(n)) ?

Re: abstract function templates

2010-12-28 Thread bearophile
Andrej Mitrovic: > Agreed. Can you file a bug report? Sorry, but I don't understand the topic enough yet (I don't know why templated methods can't be virtual), so I leave the bug report to someone else that's able to write something meaningful in the bug report :-) Bye, bearophile

Re: abstract function templates

2010-12-28 Thread Andrej Mitrovic
On 12/28/10, bearophile wrote: > But the error messages given by DMD 2.051 aren't easy to understand for me: > > test.d(10): Error: variable test.Bar.draw!(int).draw.this override cannot be > applied to variable > test.d(10): Error: variable test.Bar.draw!(int).draw.t override cannot be > applied

Re: abstract function templates

2010-12-28 Thread bearophile
Ali Çehreli: > > But uncomment the override and it fails. > > That's because "Templates cannot be used to add [...] virtual functions > to classes" But the error messages given by DMD 2.051 aren't easy to understand for me: test.d(10): Error: variable test.Bar.draw!(int).draw.this override c

Re: abstract function templates

2010-12-28 Thread Andrej Mitrovic
Thanks, Ali! :)

Re: abstract function templates

2010-12-28 Thread Ali Çehreli
Andrej Mitrovic wrote: > I think this is relevant: > http://www.digitalmars.com/d/2.0/template.html : "Limitations": > > Templates cannot be used to add non-static members or virtual > functions to classes. > Templates cannot add functions to interfaces. > > But I'm a little confused as to how it

Re: declaration with typedef

2010-12-28 Thread Stanislav Blinov
28.12.2010 20:42, David Nadlinger пишет: On 12/28/10 2:09 AM, Stanislav Blinov wrote: I don't think I got what David meant with it either. Assigning instances of the same type is perfectly valid as long as you do not define some very peculiar opAssign. The point here is that person1 and person

Re: declaration with typedef

2010-12-28 Thread David Nadlinger
On 12/28/10 2:09 AM, Stanislav Blinov wrote: I don't think I got what David meant with it either. Assigning instances of the same type is perfectly valid as long as you do not define some very peculiar opAssign. The point here is that person1 and person2 are not instances of the same type, try

Re: declaration with typedef

2010-12-28 Thread Hamad Mohammad
== Quote from Stanislav Blinov (stanislav.bli...@gmail.com)'s article > On 12/27/2010 06:41 PM, Hamad Mohammad wrote: > >> If you tried to assign person2 to person1 or vice versa > > > > how? > > > I don't think I got what David meant with it either. Assigning instances > of the same type is perfec