Parameter pack expansion

2019-05-30 Thread Tomas via Digitalmars-d-learn
I'm very new to D, coming from C++ I'm missing parameter pack expansion and fold expressions. For example, I want to write a function `f(x[0], ..., x[n])` which accepts any number of objects and calls `g(x[0].member, ..., x[n].member)`. In C++, I would write this: template void f(X

Re: Parameter pack expansion

2019-05-30 Thread Tomas via Digitalmars-d-learn
On Thursday, 30 May 2019 at 20:34:18 UTC, Adam D. Ruppe wrote: Foo foo; test(foo.tupleof); // works! This is really neat! I will definitely use this in the future. import std.meta; then staticMap is like what your myMap thing was.

Re: Parameter pack expansion

2019-05-30 Thread Tomas via Digitalmars-d-learn
On Thursday, 30 May 2019 at 20:55:00 UTC, Q. Schroll wrote: If it would be implemented, you could place your parameter pack into a Tuple-like structure with an opDispatch that returns such a Tuple again, but the contents would be the member components "projection" to the member. It's

Re: Parameter pack expansion

2019-05-30 Thread ag0aep6g via Digitalmars-d-learn
On 30.05.19 22:20, Tomas wrote: Surely, there has to be a standard function which does exactly(probably better) the same thing as what `myMap` does. Nope.

Re: Parameter pack expansion

2019-05-30 Thread Q. Schroll via Digitalmars-d-learn
On Thursday, 30 May 2019 at 20:20:47 UTC, Tomas wrote: I'm very new to D, coming from C++ I'm missing parameter pack expansion and fold expressions. I also miss the expansion operator and fold expressions. In D, there is no such thing, and simulating it in a general way has so much friction,

Re: Parameter pack expansion

2019-05-30 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 30 May 2019 at 20:20:47 UTC, Tomas wrote: How do I do something like this in D? D's built-in tuples expand automatically when they are used. Library tuples (from phobos std.typecons) have a `.expand` method you can use. Fun fact: all structs also have a `.tupleof` thing that

Re: Linker error: _D6object__T10RTInfoImplVAmA2i48i57ZQyyG2m

2019-05-30 Thread KnightMare via Digitalmars-d-learn
widgets.obj : error LNK2001: Nicht aufgelöstes externes Symbol "_D6object__T10RTInfoImplVAmA2i48i57ZQyyG2m". widgets.obj : error LNK2001: Nicht aufgelöstes externes Symbol "_D6object__T10RTInfoImplVAmA2i32i14ZQyyG2m". immutable(ulong[2]) object.RTInfoImpl!([48, 57]).RTInfoImpl

Re: Linker error: _D6object__T10RTInfoImplVAmA2i48i57ZQyyG2m

2019-05-30 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-30 16:06:48 +, KnightMare said: immutable(ulong[2]) object.RTInfoImpl!([48, 57]).RTInfoImpl immutable(ulong[2]) object.RTInfoImpl!([32, 14]).RTInfoImpl through writeln( demangle("_D6object__T10RTInfoImplVAmA2i48i57ZQyyG2m")); writeln(

Re: Linker error: _D6object__T10RTInfoImplVAmA2i48i57ZQyyG2m

2019-05-30 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-30 15:36:53 +, Robert M. Münch said: I updated to the latest DMD compiler and just re-compiled a project and now I get two unresolved external errors: widgets.obj : error LNK2001: Nicht aufgelöstes externes Symbol "_D6object__T10RTInfoImplVAmA2i48i57ZQyyG2m". widgets.obj :

Linker error: _D6object__T10RTInfoImplVAmA2i48i57ZQyyG2m

2019-05-30 Thread Robert M. Münch via Digitalmars-d-learn
I updated to the latest DMD compiler and just re-compiled a project and now I get two unresolved external errors: widgets.obj : error LNK2001: Nicht aufgelöstes externes Symbol "_D6object__T10RTInfoImplVAmA2i48i57ZQyyG2m". widgets.obj : error LNK2001: Nicht aufgelöstes externes Symbol

Re: Dub dependencies / How to use own Github fork?

2019-05-30 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 30 May 2019 at 16:45:45 UTC, Robert M. Münch wrote: Is there a best practice how I can use a fork if mine of a project that can be access via "dependencies": {...} so that my own code is used? I think that would make it pretty easy to switch between different versions. Github

How to create a template class using foreach delegate to filter objects in a member function call?

2019-05-30 Thread Robert M. Münch via Digitalmars-d-learn
I have myClass and I want to add a way where I can provide a delegate to iterate over myClass.objects when a member function put(...) of myClass is called. The idea is that a user of myClass can provide something like an "iterator filter" so that the function is only called on a subset of

Dub dependencies / How to use own Github fork?

2019-05-30 Thread Robert M. Münch via Digitalmars-d-learn
Is there a best practice how I can use a fork if mine of a project that can be access via "dependencies": {...} so that my own code is used? I think that would make it pretty easy to switch between different versions. -- Robert M. Münch http://www.saphirion.com smarter | better | faster

Re: Dub dependencies / How to use own Github fork?

2019-05-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/30/19 12:45 PM, Robert M. Münch wrote: Is there a best practice how I can use a fork if mine of a project that can be access via "dependencies": {...} so that my own code is used? I think that would make it pretty easy to switch between different versions. You can dub add-local your