On 5/6/14, bearophile via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
There is now std.traits.isInstanceOf that could do what you need.
Someone resurrected a thread from 2011. Of course there's isInstanceOf
when I added it myself at the end of 2012.
template IsAFoo(T) {
static if (is(T t == Foo!U, U)) {
enum IsAFoo = true;
} else {
enum IsAFoo = false;
}
}
Can we make Foo a template parameters aswell, here?
I tried this
template IsA(T, K) {
static if (is(T t == K!U, U)) {
enum IsA = true;
}
On Monday, 5 May 2014 at 23:28:58 UTC, Nordlöw wrote:
template IsAFoo(T) {
static if (is(T t == Foo!U, U)) {
enum IsAFoo = true;
} else {
enum IsAFoo = false;
}
}
Can we make Foo a template parameters aswell, here?
I tried this
template IsA(T, K) {
static if (is(T
Andrej Mitrovic:
I can do this:
struct Foo(T) { }
template bar(T : Foo!int) { }
I can check if T is a specific instantiation of Foo. But I want
to
check whether T is *any* instantiation of Foo. Is this possible
to do?
There is now std.traits.isInstanceOf that could do what you need.
Its
I can do this:
struct Foo(T) { }
template bar(T : Foo!int) { }
I can check if T is a specific instantiation of Foo. But I want to
check whether T is *any* instantiation of Foo. Is this possible to do?
Otherwise I'm currently having to hardcode via:
template bar(T) if (isOneOf!(T, Foo!int,
On Thu, 15 Sep 2011 22:24:50 +0200, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
I can do this:
struct Foo(T) { }
template bar(T : Foo!int) { }
I can check if T is a specific instantiation of Foo. But I want to
check whether T is *any* instantiation of Foo. Is this possible to do?
On 09/15/2011 10:24 PM, Andrej Mitrovic wrote:
I can do this:
struct Foo(T) { }
template bar(T : Foo!int) { }
I can check if T is a specific instantiation of Foo. But I want to
check whether T is *any* instantiation of Foo. Is this possible to do?
Otherwise I'm currently having to hardcode
Cool, that works, thanks. Is this in Phobos by any chance? Otherwise
I'll just use a more flexible version of that.
On Thursday, September 15, 2011 13:24 Andrej Mitrovic wrote:
I can do this:
struct Foo(T) { }
template bar(T : Foo!int) { }
I can check if T is a specific instantiation of Foo. But I want to
check whether T is *any* instantiation of Foo. Is this possible to do?
Otherwise I'm currently
On 9/15/11, Timon Gehr timon.g...@gmx.ch wrote:
template bar(T : Foo!S,S){ }
Yeah, that should do it too. Thanks.
On Thursday, September 15, 2011 13:45 Andrej Mitrovic wrote:
Cool, that works, thanks. Is this in Phobos by any chance?
How could it be? It's specific to the template that you're testing.
- Jonathan M Davis
On 9/15/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
Every template instantiation is a new set of code with _zero_ assocation
with
any other template instantation.
Yeah, I know. But I don't think this has to be set in stone. Having
some specific compile-time type information about a
On Thu, 15 Sep 2011 22:45:21 +0200, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
Cool, that works, thanks. Is this in Phobos by any chance? Otherwise
I'll just use a more flexible version of that.
No more flexible version available, sadly. I wish this worked (I think
it's in Bugzilla
On Thursday, September 15, 2011 14:17 Andrej Mitrovic wrote:
On 9/15/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
Every template instantiation is a new set of code with _zero_ assocation
with
any other template instantation.
Yeah, I know. But I don't think this has to be set in stone.
14 matches
Mail list logo