Re: Get template parameter value

2015-09-29 Thread Artur Skawina via Digitalmars-d-learn
On 09/29/15 12:13, rumbu via Digitalmars-d-learn wrote: > On Tuesday, 29 September 2015 at 09:53:39 UTC, Kagamin wrote: >> On Tuesday, 29 September 2015 at 09:11:15 UTC, John Colvin wrote: >>> Welcome to the weird and wonderful work of >>> http://dlang.org/expression.html#IsExpression >> >> No, u

Re: Get template parameter value

2015-09-29 Thread rumbu via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 09:53:39 UTC, Kagamin wrote: On Tuesday, 29 September 2015 at 09:11:15 UTC, John Colvin wrote: Welcome to the weird and wonderful work of http://dlang.org/expression.html#IsExpression No, use template pattern matching instead: struct A(int s){} template B(T:A

Re: Get template parameter value

2015-09-29 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 09:53:39 UTC, Kagamin wrote: On Tuesday, 29 September 2015 at 09:11:15 UTC, John Colvin wrote: Welcome to the weird and wonderful work of http://dlang.org/expression.html#IsExpression No, use template pattern matching instead: struct A(int s){} template B(T:A

Re: Get template parameter value

2015-09-29 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 09:11:15 UTC, John Colvin wrote: Welcome to the weird and wonderful work of http://dlang.org/expression.html#IsExpression No, use template pattern matching instead: struct A(int s){} template B(T:A!s, int s){ enum B=s; } static assert(B!(A!4)==4);

Re: Get template parameter value

2015-09-29 Thread John Colvin via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 07:50:42 UTC, rumbu wrote: Having a template: struct SomeStruct(int size) { } Is there any language trait returning the value of size template parameter for the template instantiation SomeStruct!10? This should do it (untested): template SomeStructSize(T) {

Re: Get template parameter value

2015-09-29 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 08:44:03 UTC, Andrea Fontana wrote: On Tuesday, 29 September 2015 at 07:50:42 UTC, rumbu wrote: Having a template: struct SomeStruct(int size) { } Is there any language trait returning the value of size template parameter for the template instantiation SomeS

Re: Get template parameter value

2015-09-29 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 29 September 2015 at 07:50:42 UTC, rumbu wrote: Having a template: struct SomeStruct(int size) { } Is there any language trait returning the value of size template parameter for the template instantiation SomeStruct!10? Something like this is ok? struct SomeStruct(int size) {