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 perfectly valid

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,

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

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 all works

Re: abstract function templates

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

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 cannot

Re: abstract function templates

2010-12-28 Thread Andrej Mitrovic
On 12/28/10, bearophile bearophileh...@lycos.com 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

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

slist insertion

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

Re: slist insertion

2010-12-28 Thread Simen kjaeraas
Ellery Newcomer ellery-newco...@utulsa.edu 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

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: abstract function templates

2010-12-28 Thread Simen kjaeraas
bearophile bearophileh...@lycos.com 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