Re: Using private constructor with std.experimental.allocater:make

2016-05-01 Thread Lass Safin via Digitalmars-d-learn
On Sunday, 1 May 2016 at 11:17:27 UTC, earthfront wrote: Hello! [...] class A { int b; private this(int a){b=a;} } [...] I don't think classes are supposed to be able to have a private constructor...

Will the GC scan this pointer?

2016-04-24 Thread Lass Safin via Digitalmars-d-learn
// Omitting the required imports. void[] ptr; void main() { uint buffer; glCreateBuffers(1, ); // Filling the buffer with data and such... ptr = glMapNamedBufferRange(buffer, 0, 512, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT)[0 .. 512]; } So the question is:

Re: Why does map take lambda as a template parameter

2016-04-23 Thread Lass Safin via Digitalmars-d-learn
On Saturday, 23 April 2016 at 20:06:39 UTC, xtreak wrote: map takes lambda as a template parameter and so does filter and many other functions. Sometimes they take something other than lambda as a template parameter. Eg. In case of to!int("5") int is a type and hence might need it as a

Re: VariantPointer

2016-04-21 Thread Lass Safin via Digitalmars-d-learn
On Wednesday, 20 April 2016 at 20:07:31 UTC, Nordlöw wrote: On Wednesday, 20 April 2016 at 16:08:32 UTC, Lass Safin wrote: core.memory.GC.setAttr can set attributes for a block of memory, with which you can set the attribute NO_SCAN, which as it implies, forces that no scan be done in the

Re: VariantPointer

2016-04-20 Thread Lass Safin via Digitalmars-d-learn
On Wednesday, 20 April 2016 at 14:36:54 UTC, Nordlöw wrote: On Wednesday, 20 April 2016 at 13:41:27 UTC, Nordlöw wrote: At https://github.com/nordlow/phobos-next/blob/master/src/variant_pointer.d Further: What to do with fact that the GC will fail to scan VariantPointers? Can the GC be

Re: VariantPointer

2016-04-20 Thread Lass Safin via Digitalmars-d-learn
On Wednesday, 20 April 2016 at 13:41:27 UTC, Nordlöw wrote: At https://github.com/nordlow/phobos-next/blob/master/src/variant_pointer.d I've implemented a pointer-only version of Variant called VariantPointer. [...] It safe to assume that `typeBits` most significant bits of a pointer on a

Re: Cancelling a stdin.read?

2016-04-11 Thread Lass Safin via Digitalmars-d-learn
On Monday, 11 April 2016 at 14:53:31 UTC, Adam D. Ruppe wrote: On Sunday, 10 April 2016 at 08:29:22 UTC, Lass Safin wrote: Thus, my question is: Is there any way to cancel the read from stdin prematurely from another thread, so that the thread can finish? What operating system are you on? I

Re: Cancelling a stdin.read?

2016-04-10 Thread Lass Safin via Digitalmars-d-learn
On Sunday, 10 April 2016 at 18:00:31 UTC, hilop wrote: On Sunday, 10 April 2016 at 08:29:22 UTC, Lass Safin wrote: I have a multi-threaded program, one thread drawing to a window and handling it, the other handling stdin. [...] The external program that writes to the input has to close it

Cancelling a stdin.read?

2016-04-10 Thread Lass Safin via Digitalmars-d-learn
I have a multi-threaded program, one thread drawing to a window and handling it, the other handling stdin. The thread which handles stdin is something like this: char[] buf; while(true) { readln(buf); } The window thread also has to receive close-events from the OS, such as when the

Re: How do I extend an enum?

2016-03-19 Thread Lass Safin via Digitalmars-d-learn
On Saturday, 19 March 2016 at 17:40:27 UTC, Lass Safin wrote: Why: enum Base { A, B, } enum Derived : Base { C, // Gives error, says it can't implicitly convert expression to Base. D = 1, // Same error E = cast(Base)294, // Finally works. Can only be cast(Derived)

How do I extend an enum?

2016-03-19 Thread Lass Safin via Digitalmars-d-learn
Why: enum Base { A, B, } enum Derived : Base { C, // Gives error, says it can't implicitly convert expression to Base. D = 1, // Same error E = cast(Base)294, // Finally works. Can only be cast(Derived) instead. } void func(Derived d) {} func(Derived.E); // works.

Re: Is D a good choice for embedding python/octave/julia

2016-03-13 Thread Lass Safin via Digitalmars-d-learn
On Sunday, 13 March 2016 at 13:02:16 UTC, Bastien wrote: Hi, apologies for what may be a fairly obvious question to some. ## The background: I have been tasked with building software to process data output by scientific instruments for non-experts - basically with GUI, menus, easy config