Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes and addition to template comparisons. #192

Merged
merged 1 commit into from Nov 9, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 29 additions & 6 deletions template-comparison.dd
Expand Up @@ -25,7 +25,7 @@ are subject to change.)

$(TR
$(TD Argument list delineation)
$(TD Uses !( ), as in Foo!(int))
$(TD Uses !( ), as in Foo!(int). $(BR)Can omit parens when the argument is a single lexical token: Foo!int)
$(TD Uses < > as in Foo<int>)
$(TD No change)
)
Expand Down Expand Up @@ -178,7 +178,7 @@ template<int n> class factorial
{
result =
n * factorial<n-1>::result
};
};
};
template<> class factorial<1>
{
Expand Down Expand Up @@ -218,7 +218,7 @@ template<int n> class factorial
result =
n * factorial<n-1>::result
#endif
};
};
};
)
)
Expand Down Expand Up @@ -631,6 +631,29 @@ void foo(int t) { }
$(TD No change)
)

$(TR
$(TD Can extract arguments of
template instance)
$(TD Yes:
---
class Foo(T)
{
static if (is(T x : T!A, A...))
{
pragma(msg, A); // (int, float)
}
}

struct Bar(T1, T2) { }
alias Bar!(int, float) BarInst;
Foo!(BarInst) f;
---
See $(LINK2 expression.html#IsExpression, is expressions).
)
$(TD No)
$(TD No change)
)

$(TR
$(TH Parsing Idiosyncracies)
$(TH D)
Expand All @@ -644,7 +667,7 @@ void foo(int t) { }
$(TD Context-Free Grammar)
$(TD Yes:
---
class Foo!(int i)
class Foo(int i)
{
...
}
Expand All @@ -668,11 +691,11 @@ Foo<3 $(B >) 4> f; // $(ERROR)
$(TD Distinguish template arguments from other operators)
$(TD Yes:
---
class Foo!(T)
class Foo(T)
{
...
}
class Bar!(int i)
class Bar(int i)
{
...
}
Expand Down