Re: Why getting private member fails using getMember trait in a template?

2015-09-30 Thread Atila Neves via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 09:40:41 UTC, Alexandru Ermicioi wrote: On Saturday, 26 September 2015 at 10:10:39 UTC, Alexandru Ermicioi wrote: Suppose we have, two modules: module testOne; [...] So, is this behavior correct? If yes, then why? Yes, because private members aren't

Re: Why getting private member fails using getMember trait in a template?

2015-09-30 Thread Marc Schütz via Digitalmars-d-learn
On Wednesday, 30 September 2015 at 07:57:59 UTC, Atila Neves wrote: On Tuesday, 29 September 2015 at 09:40:41 UTC, Alexandru Ermicioi wrote: On Saturday, 26 September 2015 at 10:10:39 UTC, Alexandru Ermicioi wrote: Suppose we have, two modules: module testOne; [...] So, is this behavior

Re: Range of variables

2015-09-30 Thread anonymous via Digitalmars-d-learn
On Wednesday, 30 September 2015 at 20:11:56 UTC, Freddy wrote: Is there a way to make a range of a variables lazily? --- int var1; int var2; void func() { int var3; auto range = /*range of var1,var2,var3*/ ; } --- There's std.range.only which gives you a range over the arguments you

Range of variables

2015-09-30 Thread Freddy via Digitalmars-d-learn
Is there a way to make a range of a variables lazily? --- int var1; int var2; void func() { int var3; auto range = /*range of var1,var2,var3*/ ; } ---

Re: Threading Questions

2015-09-30 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, September 29, 2015 22:38:42 Johannes Pfau via Digitalmars-d-learn wrote: > Am Tue, 29 Sep 2015 15:10:58 -0400 > schrieb Steven Schveighoffer : > > > > > > 3) Why do I have to pass a "Mutex" to "Condition"? Why can't I just > > > pass an "Object"? > > > > An object

How to do unittests

2015-09-30 Thread Namal via Digitalmars-d-learn
Hello, can someone give me a complete example please how to do unittests? I tried this with the example from german wikipedia, but the flag -unittest didn't make any difference.

Re: How to do unittests

2015-09-30 Thread Rikki Cattermole via Digitalmars-d-learn
On 01/10/15 1:59 AM, Namal wrote: Hello, can someone give me a complete example please how to do unittests? I tried this with the example from german wikipedia, but the flag -unittest didn't make any difference. Example file with loads of unittests:

Checking that a template parameter is an enum

2015-09-30 Thread Nordlöw via Digitalmars-d-learn
How do I check that a template parameter is a CT-value or an enum symbol? I want this to restrict the following template: /** Returns: true iff all values $(D V) are the same. */ template allSame(V...) // TODO restrict to values only { static if (V.length <= 1) enum bool

address of overloaded function

2015-09-30 Thread Freddy via Digitalmars-d-learn
How do you take the address of a specific overloaded function. This won't compile --- import std.range; void main() { ForwardAssignable!int range; int delegate() @property get = void delegate(int) @property set = } ---

Re: an example of parallel calculation of metrics

2015-09-30 Thread Jay Norwood via Digitalmars-d-learn
On Wednesday, 30 September 2015 at 22:24:25 UTC, Jay Norwood wrote: // various metric definitions // the Tuples could also define names for each member and use the names here in the metrics. long met1( TI m){ return m[0] + m[1] + m[2]; } long met2( TI m){ return m[1] + m[2] + m[3]; } long

Re: address of overloaded function

2015-09-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 30 September 2015 at 22:48:03 UTC, Freddy wrote: How do you take the address of a specific overloaded function. This won't compile You can write a helper function that uses __traits(getOverloads) and searches them for the right signature:

an example of parallel calculation of metrics

2015-09-30 Thread Jay Norwood via Digitalmars-d-learn
This is something I'm playing with for work. We do this a lot, capture counter events for some number of on-chip performance counters, compute some metrics, display the outputs. This seems ideal for the application. import std.algorithm, std.parallelism, std.range; import std.stdio; import

Regex start/end position of match?

2015-09-30 Thread Gerald via Digitalmars-d-learn
I'm using the std.regex API as part of Linux GUI grep utility I'm trying to create. I've got the GUI going fine using gtkd, the code to iterate over files (wow that was succinct in D, very impressive!), and getting matches via regex using the matchAll function. I'm stuck though on how to get

Re: an example of parallel calculation of metrics

2015-09-30 Thread Jay Norwood via Digitalmars-d-learn
This compiles and appears to execute correctly, but if I uncomment the taskPool line I get a compile error message about wrong buffer type. Am I breaking some rule for std.parallelism.amap? import std.algorithm, std.parallelism, std.range; import std.stdio; import std.datetime; import

Re: Checking that a template parameter is an enum

2015-09-30 Thread Fusxfaranto via Digitalmars-d-learn
On Thursday, 1 October 2015 at 00:04:18 UTC, Nordlöw wrote: How do I check that a template parameter is a CT-value or an enum symbol? I want this to restrict the following template: /** Returns: true iff all values $(D V) are the same. */ template allSame(V...) // TODO restrict to

WTF does "Enforcement failed" actually mean?

2015-09-30 Thread Russel Winder via Digitalmars-d-learn
I have the code: reduce!"a+b"(x) where x is a int[] and I get an exception "Enforcement failed" at run time. This gives me enough information to say ¿que? -- Russel. = Dr Russel Winder t: +44 20 7585 2200

Re: How to do unittests

2015-09-30 Thread Namal via Digitalmars-d-learn
On Wednesday, 30 September 2015 at 13:03:52 UTC, Rikki Cattermole wrote: On 01/10/15 1:59 AM, Namal wrote: Hello, can someone give me a complete example please how to do unittests? I tried this with the example from german wikipedia, but the flag -unittest didn't make any difference.

Re: How to do unittests

2015-09-30 Thread qsdf via Digitalmars-d-learn
On Wednesday, 30 September 2015 at 14:20:28 UTC, Namal wrote: On Wednesday, 30 September 2015 at 13:03:52 UTC, Rikki Cattermole wrote: On 01/10/15 1:59 AM, Namal wrote: Hello, can someone give me a complete example please how to do unittests? I tried this with the example from german