How do you test whether a variable is static or not?

Steven Schveighoffer schveiguy at yahoo.com
Sat Jun 16 18:55:51 UTC 2018


On 7/30/16 8:47 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
> I'm writing some serialization code where I need to skip static variables.
> So, I have a symbol from a struct, and I'd like to test whether it's static
> or not. Ideally, I'd be able to do something like
> 
> is(field == static)

std.traits.hasStaticMember ?

https://dlang.org/phobos/std_traits.html#hasStaticMember

-Steve


More information about the Digitalmars-d-learn mailing list