sqlite3 library which can read class instances (not structs)?
Ali Çehreli
acehreli at yahoo.com
Mon Mar 10 22:55:03 UTC 2025
On 3/10/25 2:31 PM, Andy Valencia wrote:
> Is there a static-if
> which can tell if a type is of a struct, as opposed to a class?
[...]
> Something like:
>
>> static if (__traits(isClass, T)) {
>> ...
>> } else if (__traits(isStruct, T)) {
>> ...
>> } else {
>> (failure)
>> }
>
> Thanks,
> Andy
>
You would expect that to be provided by one of the following:
https://dlang.org/phobos/std_traits.html
https://dlang.org/spec/traits.html
But in this case it's the "is expression":
https://dlang.org/spec/expression.html#is_expression
static assert (is (S == struct));
Ali
More information about the Digitalmars-d-learn
mailing list