@@ -206,7 +206,7 @@ template<> class factorial<1>
206
206
based on Template Arguments)
207
207
$(TD Yes:
208
208
---
209
- template void foo(T)(T i)
209
+ void foo(T)(T i)
210
210
{
211
211
static if (can_fast_foo!(T))
212
212
FastFoo f = fast_foo(i);
@@ -313,6 +313,8 @@ return Foo<char, int>::foo('c', 3);
313
313
$(TR
314
314
$(TD Compile time execution of functions)
315
315
$(TD $(DDSUBLINK spec/function, interpretation, Yes):
316
+
317
+ $(RUNNABLE_EXAMPLE_COMPILE
316
318
---
317
319
int factorial(int i)
318
320
{
@@ -321,8 +323,9 @@ int factorial(int i)
321
323
else
322
324
return i * factorial(i - 1);
323
325
}
324
- static f = factorial(6);
326
+ pragma(msg, factorial(6) );
325
327
---
328
+ )
326
329
)
327
330
$(TD
328
331
$(B$(U C++98))$(BR)
@@ -722,19 +725,18 @@ void foo(int i) { }
722
725
$(TD Can extract arguments of
723
726
template instance)
724
727
$(TD Yes:
725
- ---
726
- class Foo(T)
727
- {
728
- static if (is(T x : T!A, A...))
729
- {
730
- pragma(msg, A); // (int, float)
731
- }
732
- }
733
728
729
+ $(RUNNABLE_EXAMPLE_COMPILE
730
+ ---
734
731
struct Bar(T1, T2) { }
735
732
alias BarInst = Bar!(int, float);
736
- Foo!(BarInst) f;
733
+
734
+ static if (is(BarInst : Template!Args, alias Template, Args...))
735
+ {
736
+ pragma(msg, Args); // (int, float)
737
+ }
737
738
---
739
+ )
738
740
See $(DDSUBLINK spec/expression, IsExpression, is expressions).)
739
741
$(TD No)
740
742
)
0 commit comments