Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread ParticlePeter via Digitalmars-d-learn
On Saturday, 29 April 2017 at 01:49:56 UTC, Atila Neves wrote: On Friday, 28 April 2017 at 18:41:22 UTC, kinke wrote: On Friday, 28 April 2017 at 18:07:49 UTC, ParticlePeter wrote: Interesting, your example corresponds to my third case, the linker error. I am on Window, building an x64 App, afa

Re: get parameters of a function

2017-04-28 Thread Alex via Digitalmars-d-learn
On Saturday, 29 April 2017 at 05:58:35 UTC, Stanislav Blinov wrote: On Friday, 28 April 2017 at 20:43:50 UTC, Alex wrote: void main() { foreach(o1; __traits(getOverloads, S1, "opCall")) { alias P1 = Parameters!o1; foreach(o2; __traits(getOverloads, S2, "opCall"))

Re: get parameters of a function

2017-04-28 Thread Stanislav Blinov via Digitalmars-d-learn
On Friday, 28 April 2017 at 20:43:50 UTC, Alex wrote: Hi all, I have a question about the Parameters trait from https://dlang.org/phobos/std_traits.html#Parameters The following code does not compile. Why? Is it mainly assumed to use it with functions without overloads? Rather, it is to be use

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread Atila Neves via Digitalmars-d-learn
On Friday, 28 April 2017 at 18:41:22 UTC, kinke wrote: On Friday, 28 April 2017 at 18:07:49 UTC, ParticlePeter wrote: Interesting, your example corresponds to my third case, the linker error. I am on Window, building an x64 App, afaik in that case the MS Visual Studio linker is used instead of

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 28 April 2017 at 19:08:18 UTC, ParticlePeter wrote: On Friday, 28 April 2017 at 17:57:34 UTC, Ali Çehreli wrote: On 04/28/2017 08:56 AM, ParticlePeter wrote: > C++ Function: > bool cppFunc( float[3] color ); > > D binding: > extern(C++) bool cppFunc( float[3] color ); > > Using with:

Re: COM Expertise needed: COM Callbacks

2017-04-28 Thread Nierjerson via Digitalmars-d-learn
On Friday, 28 April 2017 at 09:25:31 UTC, John Chapman wrote: On Thursday, 27 April 2017 at 20:20:23 UTC, Nierjerson wrote: QueryInterface is COM's version of opCast. It asks if you support the interface represented by an IID (riid). If you don't, then you return E_NOINTERFACE. If you do, t

Re: COM Expertise needed: COM Callbacks

2017-04-28 Thread Nierjerson via Digitalmars-d-learn
On Friday, 28 April 2017 at 09:25:31 UTC, John Chapman wrote: On Thursday, 27 April 2017 at 20:20:23 UTC, Nierjerson wrote: I think the main issue though, is that I really don't know what is going on when I invoke the PS function. It seems to call the server method that takes the interface an

get parameters of a function

2017-04-28 Thread Alex via Digitalmars-d-learn
Hi all, I have a question about the Parameters trait from https://dlang.org/phobos/std_traits.html#Parameters The following code does not compile. Why? import std.traits : Parameters; void main() { static assert(is(Parameters!S1 == Parameters!S2)); } struct S1 { auto opCall() {

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread ParticlePeter via Digitalmars-d-learn
On Friday, 28 April 2017 at 17:57:34 UTC, Ali Çehreli wrote: On 04/28/2017 08:56 AM, ParticlePeter wrote: > C++ Function: > bool cppFunc( float[3] color ); > > D binding: > extern(C++) bool cppFunc( float[3] color ); > > Using with: > float[3] my_color; > cppFunc( my_color ); > > -> Error: Intern

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread kinke via Digitalmars-d-learn
On Friday, 28 April 2017 at 18:07:49 UTC, ParticlePeter wrote: Interesting, your example corresponds to my third case, the linker error. I am on Window, building an x64 App, afaik in that case the MS Visual Studio linker is used instead of optilink. Will add your findings to the bug report. A

Re: problem with std.variant rounding

2017-04-28 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Apr 28, 2017 at 04:42:28PM +, via Digitalmars-d-learn wrote: [...] > writefln(text("%.", i, "f"), x); [...] There's no need to use text() here: writefln("%.*f", i, x); does what you want. T -- "You know, maybe we don't *need* enemies." "Yeah, best friends are abou

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread ParticlePeter via Digitalmars-d-learn
On Friday, 28 April 2017 at 17:57:34 UTC, Ali Çehreli wrote: On 04/28/2017 08:56 AM, ParticlePeter wrote: > C++ Function: > bool cppFunc( float[3] color ); > > D binding: > extern(C++) bool cppFunc( float[3] color ); > > Using with: > float[3] my_color; > cppFunc( my_color ); > > -> Error: Intern

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread Ali Çehreli via Digitalmars-d-learn
On 04/28/2017 08:56 AM, ParticlePeter wrote: > C++ Function: > bool cppFunc( float[3] color ); > > D binding: > extern(C++) bool cppFunc( float[3] color ); > > Using with: > float[3] my_color; > cppFunc( my_color ); > > -> Error: Internal Compiler Error: unable to pass static array to That part i

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread ParticlePeter via Digitalmars-d-learn
On Friday, 28 April 2017 at 17:15:54 UTC, kinke wrote: On Friday, 28 April 2017 at 15:56:17 UTC, ParticlePeter wrote: So what next? How can I interface to the cpp function? *** C++: bool cppFunc(float (&color)[3]) { color[0] = 1; color[1] = 2; color[2] = 3; return true; } ***

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread kinke via Digitalmars-d-learn
On Friday, 28 April 2017 at 15:56:17 UTC, ParticlePeter wrote: So what next? How can I interface to the cpp function? *** C++: bool cppFunc(float (&color)[3]) { color[0] = 1; color[1] = 2; color[2] = 3; return true; } *** D: extern(C++) bool cppFunc(ref float[3] color); void

Re: problem with std.variant rounding

2017-04-28 Thread via Digitalmars-d-learn
On Friday, 28 April 2017 at 16:42:28 UTC, Petar Kirov [ZombineDev] wrote: On Friday, 28 April 2017 at 16:24:55 UTC, Suliman wrote: On Friday, 28 April 2017 at 15:45:25 UTC, Suliman wrote: I am using https://github.com/mysql-d/mysql-native It's return from DB variant data-type. My DB include va

Re: problem with std.variant rounding

2017-04-28 Thread Suliman via Digitalmars-d-learn
On Friday, 28 April 2017 at 16:49:18 UTC, kinke wrote: On Friday, 28 April 2017 at 16:24:55 UTC, Suliman wrote: import std.stdio; import std.variant; void main() { Variant b = 56.051151; float x = b.coerce!float; writeln(x); } 56.0512 void main() { import core.st

Re: problem with std.variant rounding

2017-04-28 Thread kinke via Digitalmars-d-learn
On Friday, 28 April 2017 at 16:24:55 UTC, Suliman wrote: import std.stdio; import std.variant; void main() { Variant b = 56.051151; float x = b.coerce!float; writeln(x); } 56.0512 void main() { import core.stdc.stdio; import std.stdio; double d = 56.05115

Re: C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread Kagamin via Digitalmars-d-learn
Report a bug.

Re: problem with std.variant rounding

2017-04-28 Thread via Digitalmars-d-learn
On Friday, 28 April 2017 at 16:24:55 UTC, Suliman wrote: On Friday, 28 April 2017 at 15:45:25 UTC, Suliman wrote: I am using https://github.com/mysql-d/mysql-native It's return from DB variant data-type. My DB include value: 56.051151 (double type in DB) I need to extract it. I tried several v

Re: problem with std.variant rounding

2017-04-28 Thread Suliman via Digitalmars-d-learn
On Friday, 28 April 2017 at 15:45:25 UTC, Suliman wrote: I am using https://github.com/mysql-d/mysql-native It's return from DB variant data-type. My DB include value: 56.051151 (double type in DB) I need to extract it. I tried several variants: writeln(point[3].coerce!float); writeln(point[3]

Re: Persistent key-value-store for D?

2017-04-28 Thread krylon via Digitalmars-d-learn
On Friday, 28 April 2017 at 16:01:58 UTC, yawniek wrote: On Wednesday, 26 April 2017 at 17:06:52 UTC, krylon wrote: I looked at the DUB package registry and asked Google quite a bit now, but I did not found such a package for D. So my first question is - did I not look hard enough? I found a r

Re: Persistent key-value-store for D?

2017-04-28 Thread yawniek via Digitalmars-d-learn
On Wednesday, 26 April 2017 at 17:06:52 UTC, krylon wrote: I looked at the DUB package registry and asked Google quite a bit now, but I did not found such a package for D. So my first question is - did I not look hard enough? I found a reimplentation of QDBM [1] (the spiritual ancestor of Toky

C++ Interfacing:'static' array function parameter contradiction

2017-04-28 Thread ParticlePeter via Digitalmars-d-learn
C++ Function: bool cppFunc( float[3] color ); D binding: extern(C++) bool cppFunc( float[3] color ); Using with: float[3] my_color; cppFunc( my_color ); -> Error: Internal Compiler Error: unable to pass static array to extern(C++) function. Error: Use pointer instead. Using with: cppFunc( m

problem with std.variant rounding

2017-04-28 Thread Suliman via Digitalmars-d-learn
I am using https://github.com/mysql-d/mysql-native It's return from DB variant data-type. My DB include value: 56.051151 (double type in DB) I need to extract it. I tried several variants: writeln(point[3].coerce!float); writeln(point[3].coerce!string); writeln(point[3].coerce!double); but all

Re: COM Expertise needed: COM Callbacks

2017-04-28 Thread John Chapman via Digitalmars-d-learn
On Thursday, 27 April 2017 at 20:20:23 UTC, Nierjerson wrote: I think the main issue though, is that I really don't know what is going on when I invoke the PS function. It seems to call the server method that takes the interface and then the server does it's "magic"(which is calling my QueryI

Re: Understanding lvalue and rvalue

2017-04-28 Thread ANtlord via Digitalmars-d-learn
On Friday, 28 April 2017 at 05:21:26 UTC, ag0aep6g wrote: Instead of removing `in`/`const` from the ref overload, you can also add it to the non-ref overload. Again, the overloads will have the same match level ("match with conversion to const"), and the ref version will win. It works. I do