@@ -1507,6 +1507,26 @@ $(H2 $(LNAME2 nested-templates, Nested Templates))
1507
1507
of class $(D C), and $(D Bar!().bar) will work just the same as a nested
1508
1508
function within function $(D main$(LPAREN)$(RPAREN)).)
1509
1509
1510
+ $(H3 $(LNAME2 limitations, Limitations))
1511
+
1512
+ $(P Templates cannot be used to add non-static fields or
1513
+ virtual functions to classes or interfaces.
1514
+ For example:)
1515
+
1516
+ ------
1517
+ class Foo
1518
+ {
1519
+ template TBar(T)
1520
+ {
1521
+ T xx; // becomes a static field of Foo
1522
+ int func(T) { ... } // non-virtual
1523
+
1524
+ static T yy; // Ok
1525
+ static int func(T t, int y) { ... } // Ok
1526
+ }
1527
+ }
1528
+ ------
1529
+
1510
1530
$(H3 $(LNAME2 implicit-nesting, Implicit Nesting))
1511
1531
1512
1532
$(P If a template has a $(RELATIVE_LINK2 aliasparameters, template alias parameter),
@@ -1730,26 +1750,6 @@ $(GNAME Constraint):
1730
1750
auto y = Bar!double; // Error, double does not satisfy constraint
1731
1751
---
1732
1752
1733
- $(H2 $(LNAME2 limitations, Limitations))
1734
-
1735
- $(P Templates cannot be used to add non-static fields or
1736
- virtual functions to classes or interfaces.
1737
- For example:)
1738
-
1739
- ------
1740
- class Foo
1741
- {
1742
- template TBar(T)
1743
- {
1744
- T xx; // becomes a static field of Foo
1745
- int func(T) { ... } // non-virtual
1746
-
1747
- static T yy; // Ok
1748
- static int func(T t, int y) { ... } // Ok
1749
- }
1750
- }
1751
- ------
1752
-
1753
1753
$(SPEC_SUBNAV_PREV_NEXT operatoroverloading, Operator Overloading, template-mixin, Template Mixins)
1754
1754
)
1755
1755
0 commit comments