Am Wed, 06 Nov 2013 14:22:13 +0100
schrieb simendsjo simend...@gmail.com:
template isFoo(T) {
static if(is(T:Foo!U, int U))
enum isFoo = true;
else
enum isFoo = false;
}
enum isFoo(T) = is(T:Foo!U, int U);
correct ?
--
Marco
On Thursday, 7 November 2013 at 15:46:53 UTC, Marco Leise wrote:
Am Wed, 06 Nov 2013 14:22:13 +0100
schrieb simendsjo simend...@gmail.com:
template isFoo(T) {
static if(is(T:Foo!U, int U))
enum isFoo = true;
else
enum isFoo = false;
}
On 11/07/2013 12:07 AM, H. S. Teoh wrote:
// This is possibly the single nastiest bit of syntax in all of D:
static if (is(func X == __parameters)) {
// Quick, without looking at the docs: what does X refer
// to?
Nothing.
The title isn't very clear but I wasn't sure how to phrase it
without code. Basically what I want to do is this (won't compile):
struct Foo(int N) {
}
void func(T)(T obj) if(is(T:Foo)) {
}
void func(T)(T obj) if(!is(T:Foo)) {
}
Foo by itself isn't a type, but I don't want to limit func
On Wednesday, 6 November 2013 at 13:00:17 UTC, Atila Neves wrote:
The title isn't very clear but I wasn't sure how to phrase it
without code. Basically what I want to do is this (won't
compile):
struct Foo(int N) {
}
void func(T)(T obj) if(is(T:Foo)) {
}
void func(T)(T obj) if(!is(T:Foo)) {
On Wednesday, 6 November 2013 at 13:00:17 UTC, Atila Neves wrote:
The title isn't very clear but I wasn't sure how to phrase it
without code. Basically what I want to do is this (won't
compile):
struct Foo(int N) {
}
void func(T)(T obj) if(is(T:Foo)) {
}
void func(T)(T obj) if(!is(T:Foo)) {
Wow. It didn't even occur to me that `is` could be used like
that. I think that operator is the hardest part of the language
for me to grok. Thanks guys!
On Wednesday, 6 November 2013 at 21:49:52 UTC, Atila Neves wrote:
Wow. It didn't even occur to me that `is` could be used like
that. I think that operator is the hardest part of the language
for me to grok. Thanks guys!
http://dlang.org/expression.html#IsExpression ;)
On Wednesday, 6 November 2013 at 21:52:04 UTC, Dicebot wrote:
On Wednesday, 6 November 2013 at 21:49:52 UTC, Atila Neves
wrote:
Wow. It didn't even occur to me that `is` could be used like
that. I think that operator is the hardest part of the
language for me to grok. Thanks guys!
On Wednesday, 6 November 2013 at 22:41:08 UTC, Atila Neves wrote:
I know, but I keep having to refer back to that and even then I
didn't know about the syntax these guys just posted! ;)
Well, it is mentioned in the list of `is` usage cases down that
link. It is very ugly part of the language
On Wednesday, 6 November 2013 at 22:43:18 UTC, Dicebot wrote:
On Wednesday, 6 November 2013 at 22:41:08 UTC, Atila Neves
wrote:
I know, but I keep having to refer back to that and even then
I didn't know about the syntax these guys just posted! ;)
Well, it is mentioned in the list of `is`
On Wed, Nov 06, 2013 at 11:52:56PM +0100, Namespace wrote:
On Wednesday, 6 November 2013 at 22:43:18 UTC, Dicebot wrote:
On Wednesday, 6 November 2013 at 22:41:08 UTC, Atila Neves wrote:
I know, but I keep having to refer back to that and even then I
didn't know about the syntax these guys
12 matches
Mail list logo