You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find I have to do this sort of thing fairly often:
T endianToNative(T, bool little)(refconstubyte[T.sizeof] bytes)
if (is(T == U[N], U, size_t N))
{
// repeat function constraint inside static if to capture U and Nstaticif (is(T == U[N], U, size_t N))
{
// use `U`, `N`...
}
}
You can see here I write a static-if repeating the function constraint so I can refer to U and N inside the function.
Is there a reason why deduced material from function constraints are not made available to the function?
The text was updated successfully, but these errors were encountered:
Doesn't that mean T can implicitly convert to a U[N], or does colon mean == in this case?
But even so, it sucks that U and N are now mangled into the function as additional template args; that's not a good thing.
I stand by my OP...
I find I have to do this sort of thing fairly often:
You can see here I write a static-if repeating the function constraint so I can refer to
U
andN
inside the function.Is there a reason why deduced material from function constraints are not made available to the function?
The text was updated successfully, but these errors were encountered: