Skip to content

Commit

Permalink
Merge pull request #192 from AndrejMitrovic/TemplateComparisonFix
Browse files Browse the repository at this point in the history
Small fixes and addition to template comparisons.
  • Loading branch information
Alex Rønne Petersen committed Nov 9, 2012
2 parents d75c047 + c19aab6 commit a81586a
Showing 1 changed file with 29 additions and 6 deletions.
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

0 comments on commit a81586a

Please sign in to comment.