such an expression using a kind of type set? If
only for cleaning the code; but also because such a set may get long.
T check (T) () if (is (T in validTypeSet)) {
...
}
Denis
--
_
vita es estrany
spir.wikidot.com
) ||
is(T == DUnit)
) {
...
}
Is there a way to factor out such an expression using a kind of type
set? If only for cleaning the code; but also because such a set may get
long.
T check (T) () if (is (T in validTypeSet)) {
...
}
This should probably work
)
) {
...
}
Is there a way to factor out such an expression using a kind of type set?
If only for cleaning the code; but also because such a set may get long.
T check (T) () if (is (T in validTypeSet)) {
...
}
This should probably work:
template isOneOf(X, T...)
{
static if(!T.length)
enum bool
On 02/28/2011 03:50 PM, Steven Schveighoffer wrote:
On Mon, 28 Feb 2011 09:27:36 -0500, spir denis.s...@gmail.com wrote:
By the way, the block of the function is a series of static if-s, one for
each allowed type. Is there any static switch? Or any other nicer way to
write it than:
T check
On Mon, 28 Feb 2011 12:50:21 -0500, spir denis.s...@gmail.com wrote:
PS: Is it your email client that eats whitespace (see my code above)?
Only in your reply does the code appear indented improperly, so I think
it's your client, not mine.
-steve
Steven Schveighoffer:
Not sure if this exists in std.traits or not, but that's where I'd look.
std.typetuple.anySatisfy helps here.
---
spir:
Is there any static switch?
foreach done on a typetuple is a static foreach.
Or any other nicer way to write it than:
I suggest to put the