Re: Pointer to private structure

2016-12-18 Thread Nikhil Jacob via Digitalmars-d-learn
On Monday, 19 December 2016 at 06:21:10 UTC, ketmar wrote: i bet that just trying this with D compiler will take less time than writing forum post. I did try but it seems to give compilation failure... Let me try once more and I will get back with more details.

Re: Pointer to private structure

2016-12-18 Thread ketmar via Digitalmars-d-learn
i bet that just trying this with D compiler will take less time than writing forum post.

Re: Pointer to private structure

2016-12-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 19 December 2016 at 05:51:09 UTC, Nikhil Jacob wrote: In C, we can define a struct without body in an include file and use pointer to that structure For examples in public header file. struct data; data* new_data(); We can then define the elements of struct data privately inside

Pointer to private structure

2016-12-18 Thread Nikhil Jacob via Digitalmars-d-learn
In C, we can define a struct without body in an include file and use pointer to that structure For examples in public header file. struct data; data* new_data(); We can then define the elements of struct data privately inside the implementation of library. Can we do this in D without

Re: Returning structs from COM

2016-12-18 Thread evilrat via Digitalmars-d-learn
On Saturday, 3 December 2016 at 09:51:00 UTC, John C wrote: Some DirectX methods return structs by value, but when I try calling them I either get garbage or an access violation. Usually COM methods return structs by pointer as a parameter, but these are returning the struct as the actual

Re: sort, .array and folding on immutable data (finding most common character in column of matrix)

2016-12-18 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 18 December 2016 at 22:26:50 UTC, Ali wrote: Hey, so I have this data file that has a list of a string of characters separated by new lines. The task is to find the most common letter in each column. Ie if file is: abc axy cxc Then the letters are a (column 1), x and c. I've

sort, .array and folding on immutable data (finding most common character in column of matrix)

2016-12-18 Thread Ali via Digitalmars-d-learn
Hey, so I have this data file that has a list of a string of characters separated by new lines. The task is to find the most common letter in each column. Ie if file is: abc axy cxc Then the letters are a (column 1), x and c. I've written the code to do this at compile time. But I have a

Re: meaning of "auto ref const"?

2016-12-18 Thread Picaud Vincent via Digitalmars-d-learn
On Sunday, 18 December 2016 at 14:32:08 UTC, kinke wrote: TypeInfo_Struct apparently requires (or used to require) an `int opCmp(ref const T rhs)` overload, i.e., a version taking the rhs lvalue argument by reference (see https://dlang.org/spec/operatoroverloading.html#compare). Note that

Re: meaning of "auto ref const"?

2016-12-18 Thread Picaud Vincent via Digitalmars-d-learn
On Sunday, 18 December 2016 at 14:25:04 UTC, Basile B. wrote: ... As you can see, auto ref is more flexible with the parameter. This make sense for templated functions. Thank you for your detailed answer, things are perfectly clear now. Also sorry for the doc linksI should have found it

Re: meaning of "auto ref const"?

2016-12-18 Thread kinke via Digitalmars-d-learn
On Sunday, 18 December 2016 at 13:14:08 UTC, Picaud Vincent wrote: bool opEquals()(auto ref const BigInt y) const pure @nogc { return sign == y.sign && y.data == data; } my problem is that I do not understand the role/meaning of "auto" in this context. See

Re: meaning of "auto ref const"?

2016-12-18 Thread Basile B. via Digitalmars-d-learn
On Sunday, 18 December 2016 at 13:14:08 UTC, Picaud Vincent wrote: Reading std/bigint.d code: https://github.com/dlang/phobos/blob/00c1cc3b0d354363793c8b419ce84da722578138/std/bigint.d#L589 I have seen this: bool opEquals()(auto ref const BigInt y) const pure @nogc { return sign == y.sign

meaning of "auto ref const"?

2016-12-18 Thread Picaud Vincent via Digitalmars-d-learn
Reading std/bigint.d code: https://github.com/dlang/phobos/blob/00c1cc3b0d354363793c8b419ce84da722578138/std/bigint.d#L589 I have seen this: bool opEquals()(auto ref const BigInt y) const pure @nogc { return sign == y.sign && y.data == data; } my problem is that I do not understand the

Re: Using tango with dub

2016-12-18 Thread albert-j via Digitalmars-d-learn
Have you seen https://github.com/economicmodeling/containers it has a HashSet http://economicmodeling.github.io/containers/containers/hashset.HashSet.html Just curious, how is it different from Tango's implementation?

Re: Using tango with dub

2016-12-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-12-17 21:15, bauss wrote: I thought Tango was obsolete a long time ago. It's a third party library like any other library. -- /Jacob Carlborg

Re: Using tango with dub

2016-12-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-12-18 10:43, albert-j wrote: Try an older version. Before resorting to that, I am also trying to "dub build --compiler=gdc". Getting different types of errors: ../../../.dub/packages/tango-1.0.3_2.068/tango/tango/math/IEEE.d:614:17: error: instead of C-style syntax, use D-style syntax

Re: Using tango with dub

2016-12-18 Thread albert-j via Digitalmars-d-learn
Try an older version. Before resorting to that, I am also trying to "dub build --compiler=gdc". Getting different types of errors: ../../../.dub/packages/tango-1.0.3_2.068/tango/tango/math/IEEE.d:614:17: error: instead of C-style syntax, use D-style syntax 'real[3][] vals' [-Werror]