Testing template parameter has given API
NaN
divide at by.zero
Sat May 16 01:11:54 UTC 2020
Howdy, any idea what Im doing wrong? Given a type T i want to
test the presence of certain methods. I looked in phobos to see
how isInputRange was defined but it didnt really help as all the
methods have no parameters and it used some weird lamda stuff i
think.
template isPathType(T)
{
alias FloatType = ReturnType!(T.x);
enum isPathType = (isFloatOrDouble!(FloatType)
&& (is(typeof(&T.x) == FloatType delegate(size_t idx)))
&& (is(typeof(&T.y) == FloatType delegate(size_t idx)))
&& (is(typeof(&T.cmd) == PathCmd delegate(size_t idx)))
&& (is(typeof(&T.points) == Point!FloatType
delegate(size_t idx)))
&& (is(typeof(&T.length) == size_t delegate())));
}
More information about the Digitalmars-d-learn
mailing list