Re: Recursive templated structs disallowed?

2010-08-05 Thread Don
Simen kjaeraas wrote: struct bar( T ) { auto baz( U )( U arg ) { bar!( typeof( this ) ) tmp; return tmp; } } void main( ) { bar!int n; n.baz( 3 ); } This code fails with Error: recursive template expansion for template argument bar!(int) Now, I agree it is recurs

Re: std.algorithm.sort fails?

2010-08-05 Thread Johannes Pfau
On 04.08.2010 11:34, Jonathan M Davis wrote: > > There appears to be a bug with regards to SwapStrategy.stable. If you don't > pass > it a swap strategy it works just fine, but if you do, it fails. > > I'm using svn snapshot 1751 of phobos, which is a few weeks old, and it fails > an > assert

Re: std.algorithm.sort fails?

2010-08-05 Thread Jonathan M Davis
On Thursday 05 August 2010 01:26:32 Johannes Pfau wrote: > On 04.08.2010 11:34, Jonathan M Davis wrote: > > There appears to be a bug with regards to SwapStrategy.stable. If you > > don't pass it a swap strategy it works just fine, but if you do, it > > fails. > > > > I'm using svn snapshot 1751 o

Re: std.algorithm.sort fails?

2010-08-05 Thread Johannes Pfau
On 05.08.2010 11:28, Jonathan M Davis wrote: > On Thursday 05 August 2010 01:26:32 Johannes Pfau wrote: >> On 04.08.2010 11:34, Jonathan M Davis wrote: >>> There appears to be a bug with regards to SwapStrategy.stable. If you >>> don't pass it a swap strategy it works just fine, but if you do, it >

Re: One question about templates

2010-08-05 Thread bearophile
Philippe Sigaud: > I used to be confronted to this pb too. Here is what I did: > ... You are gentle and helpful, and your post has given me useful ideas, but your post it too much unreadable for me. If you take a look here you can see 16 attaches, and it seems part of your message are missing,

Re: std.algorithm.sort fails?

2010-08-05 Thread Jonathan M Davis
On Thursday 05 August 2010 03:23:54 Johannes Pfau wrote: > OK I reported it, thanks for your help. > http://d.puremagic.com/issues/show_bug.cgi?id=4584 > > Btw: it also asserts in phobos for me. I just never saw the assert > because my distributions package now has -release in the default > dmd.co

Re: One question about templates

2010-08-05 Thread Philippe Sigaud
bearophile Wrote: > Philippe Sigaud: > > > I used to be confronted to this pb too. Here is what I did: > > ... > > You are gentle and helpful, and your post has given me useful ideas, but your > post it too much unreadable for me. > > If you take a look here you can see 16 attaches, and it see

Is it bad practice to alter dynamic arrays that have references to them?

2010-08-05 Thread simendsjo
Just tell me if this is frowned upon... The reason I posted on SO is because I think it can help making people aware of D. http://stackoverflow.com/questions/3416657/is-it-bad-practice-to-alter-dynamic-arrays-that-have-references-to-them Let me know if it's not accepted to crosspost like this.

Re: Is it bad practice to alter dynamic arrays that have references to them?

2010-08-05 Thread Steven Schveighoffer
On Thu, 05 Aug 2010 13:10:44 -0400, simendsjo wrote: Just tell me if this is frowned upon... The reason I posted on SO is because I think it can help making people aware of D. http://stackoverflow.com/questions/3416657/is-it-bad-practice-to-alter-dynamic-arrays-that-have-references-to-them

inheriting ctors?

2010-08-05 Thread dcoder
Suppose I have a base class with many ctors(). I want to inherit from the base class and make one slight alteration to it, but I don't want to write X times the following: this(args) { super(args); } Does D have an easy way for the derived class to 'inherit' all or some of the base class ctors

Re: One question about templates

2010-08-05 Thread Philippe Sigaud
OK, let's try again. I used to be confronted to this pb too. Here is what I did: /** Alias itself to true if T is an instance of templ. To obtain the template parameters, see TemplateParametersTypeTuple. Example: auto cy = cycle([0,1,2,3]); // cy is a Cycle!(int[]) alias typeof(cy) Cy; asse

Re: inheriting ctors?

2010-08-05 Thread Steven Schveighoffer
On Thu, 05 Aug 2010 13:53:20 -0400, dcoder wrote: Suppose I have a base class with many ctors(). I want to inherit from the base class and make one slight alteration to it, but I don't want to write X times the following: this(args) { super(args); } Does D have an easy way for the deriv

Re: Is it bad practice to alter dynamic arrays that have references to them?

2010-08-05 Thread simendsjo
On 05.08.2010 19:35, Steven Schveighoffer wrote: On Thu, 05 Aug 2010 13:10:44 -0400, simendsjo wrote: (...) One helpful function to note is the capacity function: http://digitalmars.com/d/2.0/phobos/object.html#capacity This gives you the capacity of the array, or the largest length it can

Re: Is it bad practice to alter dynamic arrays that have references to them?

2010-08-05 Thread Steven Schveighoffer
On Thu, 05 Aug 2010 14:41:12 -0400, simendsjo wrote: On 05.08.2010 19:35, Steven Schveighoffer wrote: On Thu, 05 Aug 2010 13:10:44 -0400, simendsjo wrote: (...) One helpful function to note is the capacity function: http://digitalmars.com/d/2.0/phobos/object.html#capacity This gives yo

Re: Is it bad practice to alter dynamic arrays that have references to them?

2010-08-05 Thread simendsjo
On 05.08.2010 20:50, Steven Schveighoffer wrote: On Thu, 05 Aug 2010 14:41:12 -0400, simendsjo wrote: On 05.08.2010 19:35, Steven Schveighoffer wrote: On Thu, 05 Aug 2010 13:10:44 -0400, simendsjo wrote: (...) (...) Ah, that's really good to know! So I can see if it will reallocate usin

Re: Is it bad practice to alter dynamic arrays that have references to them?

2010-08-05 Thread Steven Schveighoffer
On Thu, 05 Aug 2010 15:23:13 -0400, simendsjo wrote: On 05.08.2010 20:50, Steven Schveighoffer wrote: On Thu, 05 Aug 2010 14:41:12 -0400, simendsjo wrote: On 05.08.2010 19:35, Steven Schveighoffer wrote: On Thu, 05 Aug 2010 13:10:44 -0400, simendsjo wrote: (...) (...) Ah, that's rea

Re: One question about templates

2010-08-05 Thread bearophile
Philippe Sigaud: > I used to be confronted to this pb too. Here is what I did: Thank you for all your code :) Bye, bearophile

Re: inheriting ctors?

2010-08-05 Thread Simen kjaeraas
dcoder wrote: Suppose I have a base class with many ctors(). I want to inherit from the base class and make one slight alteration to it, but I don't want to write X times the following: this(args) { super(args); } Does D have an easy way for the derived class to 'inherit' all or some

Re: inheriting ctors?

2010-08-05 Thread Sean Kelly
Steven Schveighoffer Wrote: > On Thu, 05 Aug 2010 13:53:20 -0400, dcoder wrote: > > > Suppose I have a base class with many ctors(). > > > > I want to inherit from the base class and make one slight alteration to > > it, > > but I don't want to write X times the following: > > > > this(args) {