How to check whether a struct is templated?
Balagopal Komarath via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jun 13 02:12:53 PDT 2017
Are you looking for something like this?
import std.typecons;
import std.traits;
alias yes = Nullable!int;
struct no {}
template isNullable(T : Nullable!X, X)
{
enum isNullable = true;
}
template isNullable(T)
{
enum isNullable = false;
}
void main()
{
static assert(isNullable!yes);
static assert(!isNullable!no);
}
More information about the Digitalmars-d-learn
mailing list