Re: Struct that destroys its original handle on copy-by-value

2015-07-26 Thread Martijn Pot via Digitalmars-d-learn
On Sunday, 26 July 2015 at 11:30:16 UTC, Joseph Rushton Wakeling wrote: Hello all, A design question that came up during the hackathon held during the last Berlin D Meetup. [...] Sounds like unique_ptr (so UniqueRange might be a nice name). Maybe you can get some ideas from that.

Re: Class parameters that are either setable at run-time or compile-time

2014-08-10 Thread Martijn Pot via Digitalmars-d-learn
On Sunday, 10 August 2014 at 10:47:34 UTC, Markus Mayr wrote: Hello, I am new to D. I am sorry if this question was already answered or if it is trivial. I am having a class. That class takes several parameters that may be known at either compile time or run time. I want users of my class to

Re: Max/Min values in an associative array

2014-08-06 Thread Martijn Pot via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 17:57:55 UTC, TJB wrote: I am trying to find the max and min values in an associative array. Say I have: double[char] bids; bid['A'] = 37.50; bid['B'] = 38.11; bid['C'] = 36.12; How can I find the max and min values. I am thinking that I need to use max and min

map reduce for functioneren with two parameters

2014-08-06 Thread Martijn Pot via Digitalmars-d-learn
I was wondering whether there is a way to use map reduce to calculate e.g. the weighted mean and weighted standard deviation. These would not only need the values, but also the weights.

Re: Inner struct accessing host member

2014-08-05 Thread Martijn Pot via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 20:32:08 UTC, Philippe Sigaud wrote: I'd have thought that this would work: struct A { int[] i; B b; struct B { void foo() { i ~= 1;} } } void main() { A a; a.b.foo(); } But the compiler tells me 'need this for i of type

Re: auto ref function parameters in a free function

2014-08-03 Thread Martijn Pot via Digitalmars-d-learn
On Sunday, 3 August 2014 at 19:07:32 UTC, Vlad Levenfeld wrote: This doesn't work: bool less_than (T)(auto ref T a, auto ref T b) { return a b; } Error: auto can only be used for template function parameters What am I doing wrong? Is this not a template function? I think you can

Re: auto ref function parameters in a free function

2014-08-03 Thread Martijn Pot via Digitalmars-d-learn
On Sunday, 3 August 2014 at 19:25:32 UTC, Vlad Levenfeld wrote: This would make the function always take its argument by reference. I'm trying to use the feature here: http://dlang.org/template.html from the section Function Templates with Auto Ref Parameters I thought I finally saw a

Re: Grabing C(++) stdout

2014-07-23 Thread Martijn Pot via Digitalmars-d-learn
On Wednesday, 23 July 2014 at 15:35:59 UTC, Chris wrote: The C++ code does this: size_t fwrite ( const void * ptr, size_t size, size_t count, FILE * stream ); // stream is stdout and text appears in the console (a string). I don't how to grab the text that is written to console. I might

Re: Extended math library

2014-07-17 Thread Martijn Pot via Digitalmars-d-learn
On Thursday, 17 July 2014 at 15:21:40 UTC, John Colvin wrote: On Tuesday, 15 July 2014 at 20:46:32 UTC, Martijn Pot wrote: To make a long story short: Is there any math library with e.g. mean, std, polynomial fitting, ...? http://forum.dlang.org/post/nscscdomihmvqplxf...@forum.dlang.org

Re: Extended math library

2014-07-16 Thread Martijn Pot via Digitalmars-d-learn
On Tuesday, 15 July 2014 at 22:09:43 UTC, ponce wrote: On Tuesday, 15 July 2014 at 20:46:32 UTC, Martijn Pot wrote: To make a long story short: Is there any math library with e.g. mean, std, polynomial fitting, ...? https://github.com/kyllingstad/scid https://github.com/dsimcha/dstats

Extended math library

2014-07-15 Thread Martijn Pot via Digitalmars-d-learn
To make a long story short: Is there any math library with e.g. mean, std, polynomial fitting, ...?