Re: nogc Array

2016-01-25 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 03:06:40 UTC, maik klein wrote: On Tuesday, 26 January 2016 at 03:03:40 UTC, Igor wrote: Is there a GC-less array that we can use out of the box or do I have to create my own? https://dlang.org/phobos/std_container_array.html How do we use std.algorithm with

Re: how to allocate class without gc?

2016-01-25 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? Allocate a block of memory big enough to hold an instance of your class using whichever

Re: how to allocate class without gc?

2016-01-25 Thread Ali Çehreli via Digitalmars-d-learn
On 01/25/2016 09:47 PM, Igor wrote: > it fails because the string representing the name inside App is null... > Which doesn't happen when I use new. There must be something else going on. Do you see it with a simpler type? > Should it work as expected(which it isn't) new allocates and

Re: How can i track the GC when it's runing?

2016-01-25 Thread cym13 via Digitalmars-d-learn
On Monday, 25 January 2016 at 09:33:15 UTC, Dsby wrote: I want to know How can i track the GC when it's runing? And Which algorithm is D's GC used,only Scan-Mark? Something that isn't on Garry's link: if using dmd you can pass the "-profile=gc" flag which will do the GC configuration so that

Re: nogc Array

2016-01-25 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 04:38:13 UTC, Adam D. Ruppe wrote: On Tuesday, 26 January 2016 at 04:31:07 UTC, Igor wrote: then std.algorithm.find!("a.myInt == b")(classes, 3) Try std.algorithm.find!("a.myInt == b")(classes[], 3) notice the [] after classes I guess std.container.array

Re: Improving CSV parsing performance, Episode 2 (Was: Re: Speed of csvReader)

2016-01-25 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Jan 24, 2016 at 06:07:41AM +, Jesse Phillips via Digitalmars-d-learn wrote: [...] > My suggestion is to take the unittests used in std.csv and try to get > your code working with them. As fastcsv limitations would prevent > replacing the std.csv implementation the API may not need to

Re: nogc Array

2016-01-25 Thread Kapps via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 04:31:07 UTC, Igor wrote: On Tuesday, 26 January 2016 at 03:06:40 UTC, maik klein wrote: On Tuesday, 26 January 2016 at 03:03:40 UTC, Igor wrote: Is there a GC-less array that we can use out of the box or do I have to create my own?

Re: nogc Array

2016-01-25 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, January 26, 2016 03:03:40 Igor via Digitalmars-d-learn wrote: > Is there a GC-less array that we can use out of the box or do I > have to create my own? If what you want is a dynamic array (as opposed std.container.Array), then you can simply malloc the memory and then slice it to get

Re: nogc Array

2016-01-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 04:31:07 UTC, Igor wrote: then std.algorithm.find!("a.myInt == b")(classes, 3) Try std.algorithm.find!("a.myInt == b")(classes[], 3) notice the [] after classes I guess std.container.array isn't a range? Or am I using it wrong? Containers aren't really

Re: how to allocate class without gc?

2016-01-25 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote: On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? Allocate a block of memory

Re: New Win32 Core api broke?

2016-01-25 Thread Mike Parker via Digitalmars-d-learn
On Monday, 25 January 2016 at 22:57:22 UTC, Igor wrote: error LNK2019: unresolved external symbol GetStockObject referenced in function _D2Application10createWindowMFPFZvZi (int Application.createWindow(void function()*)) and the line of code is wc.hbrBackground =

Re: New Win32 Core api broke?

2016-01-25 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 05:05:43 UTC, Mike Parker wrote: the linker looked for its copied form *compiled* form

Re: is there a set container?

2016-01-25 Thread Adam D. Ruppe via Digitalmars-d-learn
The std.container.RedBlackTree is close: http://dlang.org/phobos/std_container_rbtree.html Or you may prefer my work-in-progress unofficial docs: http://dpldocs.info/experimental-docs/std.container.rbtree.RedBlackTree.html You can see methods there like insert, removeKey, and opBinaryRight,

is there a set container?

2016-01-25 Thread Namal via Digitalmars-d-learn
Hello, I am looking for data structure equivalent to std::set from C++. Couldn't find it in the documentation.

Error using templates: "cannot use template to add field to aggregate ''"

2016-01-25 Thread pineapple via Digitalmars-d-learn
I'm getting several of these since I'm trying to do the same thing in a few places. Here's a complete error: path\to\file.d(55): Error: variable units.unitvalue.opmethod!("sum(in unitvalue value)", "add(value)").methodtemplate cannot use template to add field to aggregate 'unitvalue'

Re: Collapsing n-dimensional array to linear (1 dimensional)

2016-01-25 Thread ixid via Digitalmars-d-learn
On Monday, 25 January 2016 at 08:31:14 UTC, abad wrote: On Monday, 25 January 2016 at 02:27:57 UTC, Solomon E wrote: On Saturday, 23 January 2016 at 07:57:55 UTC, Ali Çehreli Ruby's Array class includes this sort method for flattening and for me it was surprisingly useful, for instance when it

D Dll's usefulness

2016-01-25 Thread Igor via Digitalmars-d-learn
Can D Dll's be linked and used as if they were compiled directly with the program? I was thinking of writing some library routines and put them in a Dll but now I'm not thinking that would be very useful because the Dll's won't export class like behavior. in my DLL: class MyClass { void

Re: Error using templates: "cannot use template to add field to aggregate ''"

2016-01-25 Thread pineapple via Digitalmars-d-learn
Thanks so much for the help! I'm still getting used to D's compile-time code.

Re: Error using templates: "cannot use template to add field to aggregate ''"

2016-01-25 Thread anonymous via Digitalmars-d-learn
On 25.01.2016 15:51, pineapple wrote: class unitvalue{ double coefficient; int[unit] exponents; unitvalue copy(){ unitvalue value = new unitvalue(); value.coefficient = this.coefficient; value.exponents = this.exponents.dup; return value;

Re: Error using templates: "cannot use template to add field to aggregate ''"

2016-01-25 Thread Chris Wright via Digitalmars-d-learn
On Mon, 25 Jan 2016 14:51:21 +, pineapple wrote: > I'm getting several of these since I'm trying to do the same thing in a > few places. Here's a complete error: > > path\to\file.d(55): Error: variable > units.unitvalue.opmethod!("sum(in unitvalue value)", > "add(value)").methodtemplate

Re: First project: questions on how-to, and on language features

2016-01-25 Thread Ali Çehreli via Digitalmars-d-learn
On 01/24/2016 04:26 AM, Marc Schütz wrote: >> (2) In the unittest code, I have a block that I want to rewrite using >> assertThrown, but I can't figure out from either the book or the >> website the correct usage. What's the right way to specify a >> StringException with a particular message I

Re: D Dll's usefulness

2016-01-25 Thread Kagamin via Digitalmars-d-learn
Um... A closed-source library is one thing, DLL is another thing, DLL class library is a third thing, seamless linking of DLL class library is a fourth thing. Well... see what you can get working.

Re: D Dll's usefulness

2016-01-25 Thread Igor via Digitalmars-d-learn
On Monday, 25 January 2016 at 21:42:07 UTC, Kagamin wrote: Um... A closed-source library is one thing, DLL is another thing, DLL class library is a third thing, seamless linking of DLL class library is a fourth thing. Well... see what you can get working. Thanks for the help! I really

New Win32 Core api broke?

2016-01-25 Thread Igor via Digitalmars-d-learn
error LNK2019: unresolved external symbol GetStockObject referenced in function _D2Application10createWindowMFPFZvZi (int Application.createWindow(void function()*)) and the line of code is wc.hbrBackground = GetStockObject(WHITE_BRUSH); I've tried to import core.sys.windows.wingdi; But

static assignment

2016-01-25 Thread Igor via Digitalmars-d-learn
how can I have a static assignment static bool isStarted = false; public static Application Start(string Name, void function(Application) entryPoint) { if (isStarted) assert("Can only call Start once"); isStarted = true;

Re: static assignment

2016-01-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/25/16 8:40 PM, Igor wrote: how can I have a static assignment static bool isStarted = false; public static Application Start(string Name, void function(Application) entryPoint) { if (isStarted) assert("Can only call Start once");

how to allocate class without gc?

2016-01-25 Thread Igor via Digitalmars-d-learn
Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired?

Re: Collapsing n-dimensional array to linear (1 dimensional)

2016-01-25 Thread abad via Digitalmars-d-learn
On Monday, 25 January 2016 at 02:27:57 UTC, Solomon E wrote: On Saturday, 23 January 2016 at 07:57:55 UTC, Ali Çehreli wrote: auto collapse(R)(R r) if (isArray!R) { return r.joiner.collapse.joiner; } auto collapse(R)(R r) if (!isArray!R) { return r; } Ali, that code

How can i track the GC when it's runing?

2016-01-25 Thread Dsby via Digitalmars-d-learn
I want to know How can i track the GC when it's runing? And Which algorithm is D's GC used,only Scan-Mark?

Re: How can i track the GC when it's runing?

2016-01-25 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 25 January 2016 at 09:33:15 UTC, Dsby wrote: I want to know How can i track the GC when it's runing? And Which algorithm is D's GC used,only Scan-Mark? There is a good resource here: https://dlang.org/spec/garbage.html It details compiler flags to use to profile and log the GC

nogc Array

2016-01-25 Thread Igor via Digitalmars-d-learn
Is there a GC-less array that we can use out of the box or do I have to create my own?

Re: nogc Array

2016-01-25 Thread maik klein via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 03:03:40 UTC, Igor wrote: Is there a GC-less array that we can use out of the box or do I have to create my own? https://dlang.org/phobos/std_container_array.html

Re: nogc Array

2016-01-25 Thread Nemo via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 03:03:40 UTC, Igor wrote: Is there a GC-less array that we can use out of the box or do I have to create my own? There's one in emsi containers.