Thread overview | |||||
---|---|---|---|---|---|
|
May 20, 2008 test if a parameter is a struct | ||||
---|---|---|---|---|
| ||||
I need to test if a template parameter is a struct. Is there a way to find out? - thanks |
May 20, 2008 Re: test if a parameter is a struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Moritz Warning | Moritz Warning escribió: > I need to test if a template parameter is a struct. > Is there a way to find out? > - thanks template Foo(T) { static if(is(T == struct)) { } } http://digitalmars.com/d/1.0/expression.html#IsExpression |
May 20, 2008 Re: test if a parameter is a struct | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Borenszweig | On Tue, 20 May 2008 00:28:27 -0300, Ary Borenszweig wrote:
> Moritz Warning escribió:
>> I need to test if a template parameter is a struct. Is there a way to
>> find out?
>> - thanks
>
> template Foo(T) {
> static if(is(T == struct)) {
> }
> }
>
> http://digitalmars.com/d/1.0/expression.html#IsExpression
I didn't thought it would be that easy. :)
|
Copyright © 1999-2021 by the D Language Foundation