Re: Given two AliasSeq (A and B) and template T, how to make AliasSeq!(T!(A[0], B[0]) ... T!(A[n], B[n])) ?

2016-11-26 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 27 November 2016 at 06:01:13 UTC, Tofu Ninja wrote: Basically the title says it all. alias A = AliasSeq!(...); alias B = AliasSeq!(...); static assert(A.length == B.length); template T(An, Bn){ ... } alias C = AliasSeq!(T!(A[0], B[0]) ... T!(A[n], B[n])); // how to make this :/ How

Re: Given two AliasSeq (A and B) and template T, how to make AliasSeq!(T!(A[0], B[0]) ... T!(A[n], B[n])) ?

2016-11-26 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 27 November 2016 at 06:01:13 UTC, Tofu Ninja wrote: Basically the title says it all. alias A = AliasSeq!(...); alias B = AliasSeq!(...); static assert(A.length == B.length); template T(An, Bn){ ... } alias C = AliasSeq!(T!(A[0], B[0]) ... T!(A[n], B[n])); // how to make this :/ How

How to get hash value of an object?

2016-11-26 Thread panmengh via Digitalmars-d-learn
How to get hash value of an object? Use hashOf? or typeid(T).getHash(&o)? I test with the following code: System: windows 10 dmd --version DMD32 D Compiler v2.072.0 (official download version) ldc2 --version LDC - the LLVM D compiler (1.1.0git-62a2252) (the latest git master version) base

Given two AliasSeq (A and B) and template T, how to make AliasSeq!(T!(A[0], B[0]) ... T!(A[n], B[n])) ?

2016-11-26 Thread Tofu Ninja via Digitalmars-d-learn
Basically the title says it all. alias A = AliasSeq!(...); alias B = AliasSeq!(...); static assert(A.length == B.length); template T(An, Bn){ ... } alias C = AliasSeq!(T!(A[0], B[0]) ... T!(A[n], B[n])); // how to make this :/ How do I actually make the sequence C?

Is there some trait like getOverloads that works with mixin templates?

2016-11-26 Thread ArturG via Digitalmars-d-learn
a simple example: mixin template v1() { void foo(){} } mixin template v2() { void foo(int){} } class Test { mixin v1; mixin v2; } void main() { __traits(getOverloads, Test, "foo").length.writeln; // 0 } i know you can use alias to manually make them visible for getOverloa

Re: non-constant expression ["foo":5, "bar":10, "baz":2000]

2016-11-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 26 November 2016 at 17:37:57 UTC, Paolo Invernizzi wrote: This is stated in documentation [1]: What's the link? This is a known limitation, it has never worked. The docs should reflect that, though some day, it might start working.

non-constant expression ["foo":5, "bar":10, "baz":2000]

2016-11-26 Thread Paolo Invernizzi via Digitalmars-d-learn
This is stated in documentation [1]: immutable long[string] aa = [ "foo": 5, "bar": 10, "baz": 2000 ]; unittest { assert(aa["foo"] == 5); assert(aa["bar"] == 10); assert(aa["baz"] == 2000); } But results to: Error: non-constant expression ["foo":5L, "bar":10L, "baz":2000L