Re: Is there an indenter/formatter/prettyprinter for D?

2011-10-25 Thread Jacob Carlborg
On 2011-10-26 02:07, Davidson Corry wrote: Either one dedicated to D (D2 specifically), or a configuration for 'indent' or some other cross-language prettyprinter? Thanks. The Eclipse plugin Descent has a formatter. Don't know if it works for D2. -- /Jacob Carlborg

Workaround to 3051? (Passing alias to member function don't work)

2011-10-25 Thread Nick Sabalausky
Anyone know a workaround to #3051 - "Passing alias to member function does not work"? (Hopefully besides just making "fun" either static or global) http://d.puremagic.com/issues/show_bug.cgi?id=3051

An issue with setting delegates via templates

2011-10-25 Thread Andrej Mitrovic
class Foo { void func(double) { } void func(int) { } void set(T)(T handler) { dg = handler; } void delegate(int) dg; } void main() { auto foo = new Foo; foo.set(&foo.func); // NG, func(double) is picked up first } Error: cannot implicitly convert expression (handler) of

Re: Is there an indenter/formatter/prettyprinter for D?

2011-10-25 Thread Andrej Mitrovic
Uncrustify works with D. You might want UniversalIndentGUI as a frontend if you don't prefer commandline.

Re: Is there an indenter/formatter/prettyprinter for D?

2011-10-25 Thread Jesse Phillips
On Tue, 25 Oct 2011 17:07:31 -0700, Davidson Corry wrote: > Either one dedicated to D (D2 specifically), or a configuration for > 'indent' or some other cross-language prettyprinter? > > Thanks. Not really. indent already mostly works, similarly vim mostly gets it right. Visual D has something

Is there an indenter/formatter/prettyprinter for D?

2011-10-25 Thread Davidson Corry
Either one dedicated to D (D2 specifically), or a configuration for 'indent' or some other cross-language prettyprinter? Thanks.

Re: removing an item from a dynamic array

2011-10-25 Thread bearophile
Jonathan M Davis: > It operates on a range. It can't do anything else. It has no access to the > underlying container and can't remove anything from it. Thank you for explaining me this stuff again. I have updated the enhancement request 6849 with a note. Bye, bearophile

Re: removing an item from a dynamic array

2011-10-25 Thread Graham Fawcett
On Tue, 25 Oct 2011 20:52:57 +0200, Timon Gehr wrote: > On 10/25/2011 08:38 PM, Graham Fawcett wrote: >> On Tue, 25 Oct 2011 13:11:20 -0400, bearophile wrote: >> >>> Dmitry Olshansky: >>> No, it's not a bug. It's the same as c++ STL remove - it operates on range but not on container. To

Re: removing an item from a dynamic array

2011-10-25 Thread Timon Gehr
On 10/25/2011 08:38 PM, Graham Fawcett wrote: On Tue, 25 Oct 2011 13:11:20 -0400, bearophile wrote: Dmitry Olshansky: No, it's not a bug. It's the same as c++ STL remove - it operates on range but not on container. To shrink container, update it's length. Thank you for your answer, I didn't

Re: ZeroMQ wrapper for D2

2011-10-25 Thread Johannes Pfau
simendsjo wrote: >On 23.10.2011 14:47, Johannes Pfau wrote: >> simendsjo wrote: >>> I saw someone mention ZeroMQ in a subthread the other day. I >>> watched a few videos, and it looks to me like a good fit for D. The >>> philosophies matches pretty well: small, clean api, no bloat (only >>> transpo

Re: removing an item from a dynamic array

2011-10-25 Thread Graham Fawcett
On Tue, 25 Oct 2011 13:11:20 -0400, bearophile wrote: > Dmitry Olshansky: > >> No, it's not a bug. It's the same as c++ STL remove - it operates on >> range but not on container. To shrink container, update it's length. > > Thank you for your answer, I didn't know this, and I didn't think about

Re: removing an item from a dynamic array

2011-10-25 Thread Jonathan M Davis
On Tuesday, October 25, 2011 10:11 bearophile wrote: > Dmitry Olshansky: > > No, it's not a bug. It's the same as c++ STL remove - it operates on > > range but not on container. To shrink container, update it's length. > > Thank you for your answer, I didn't know this, and I didn't think about > t

Re: removing an item from a dynamic array

2011-10-25 Thread simendsjo
On 25.10.2011 18:23, Dmitry Olshansky wrote: On 25.10.2011 13:51, bearophile wrote: maarten van damme: import std.algorithm; struct Loc { uint row; uint col; } void main(){ Loc[] testArray; Loc a={3,2}; Loc b={5,3}; testArray~=a; testArray~=b; remove(testArray,a); } gives the same error The

Re: removing an item from a dynamic array

2011-10-25 Thread bearophile
Dmitry Olshansky: > No, it's not a bug. It's the same as c++ STL remove - it operates on > range but not on container. To shrink container, update it's length. Thank you for your answer, I didn't know this, and I didn't think about this possibility because it's weird, it's an in-place operation

Re: removing an item from a dynamic array

2011-10-25 Thread Dmitry Olshansky
On 25.10.2011 13:51, bearophile wrote: maarten van damme: import std.algorithm; struct Loc { uint row; uint col; } void main(){ Loc[] testArray; Loc a={3,2}; Loc b={5,3}; testArray~=a; testArray~=b; remove(testArray,a); } gives the same error The second argument of remove() needs to be an ind

Re: removing an item from a dynamic array

2011-10-25 Thread maarten van damme
thank you, meanwhile I'll just use find + remove the index.

Re: removing an item from a dynamic array

2011-10-25 Thread bearophile
I have written this: http://d.puremagic.com/issues/show_bug.cgi?id=6849 Bye, bearophile

Re: removing an item from a dynamic array

2011-10-25 Thread simendsjo
On 25.10.2011 11:51, bearophile wrote: maarten van damme: import std.algorithm; struct Loc { uint row; uint col; } void main(){ Loc[] testArray; Loc a={3,2}; Loc b={5,3}; testArray~=a; testArray~=b; remove(testArray,a); } gives the same error The second argument of remove() needs to be an ind

Re: removing an item from a dynamic array

2011-10-25 Thread bearophile
maarten van damme: > import std.algorithm; > struct Loc { > uint row; > uint col; > } > void main(){ > Loc[] testArray; > Loc a={3,2}; > Loc b={5,3}; > testArray~=a; > testArray~=b; > remove(testArray,a); > } > gives the same error The second argument of remove() needs to be an index, a size_t.

Re: Random, not so random?

2011-10-25 Thread Kagamin
Jesse Phillips Wrote: > RandomCover is a very useful for selecting all options of a range. But you > must create a new generator every-time to get random behavior from sequential > calls. Also it's probably a big structure. Check its size.