Changeset 1382
- Timestamp:
- 12/14/09 09:37:54 (15 years ago)
- Files:
-
- trunk/docsrc/class.dd (modified) (1 diff)
- trunk/docsrc/declaration.dd (modified) (1 diff)
- trunk/docsrc/interface.dd (modified) (1 diff)
- trunk/docsrc/struct.dd (modified) (1 diff)
- trunk/docsrc/template.dd (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/docsrc/class.dd
r1377 r1382 18 18 $(P A class can be exported, which means its name and all its 19 19 non-private 20 20 members are exposed externally to the DLL or EXE. 21 21 ) 22 22 23 23 $(P A class declaration is defined: 24 24 ) 25 25 26 26 $(GRAMMAR 27 27 $(GNAME ClassDeclaration): 28 $(B class) $(I Identifier) $(I BaseClassList)<sub>opt</sub> $(I ClassBody) 28 $(B class) $(I Identifier) $(I BaseClassList) $(I ClassBody) 29 $(LINK2 template.html#ClassTemplateDeclaration, $(I ClassTemplateDeclaration)) 29 30 30 31 $(GNAME BaseClassList): 32 $(I Empty) 31 33 $(B :) $(I SuperClass) 32 34 $(B :) $(I SuperClass) $(B ,) $(I InterfaceClasses) 33 35 $(B :) $(I InterfaceClass) 34 36 35 37 $(GNAME SuperClass): 36 38 $(I Identifier) 37 39 $(I Protection) $(I Identifier) 38 40 39 41 $(GNAME InterfaceClasses): 40 42 $(I InterfaceClass) trunk/docsrc/declaration.dd
r1338 r1382 72 72 $(I BasicType2) $(I Identifier) $(I DeclaratorSuffixes)$(OPT) 73 73 74 74 $(GNAME DeclaratorSuffixes): 75 75 $(I DeclaratorSuffix) 76 76 $(I DeclaratorSuffix) $(I DeclaratorSuffixes) 77 77 78 78 $(GNAME DeclaratorSuffix): 79 79 $(B [ ]) 80 80 $(B [) $(VEXPRESSION) $(B ]) 81 81 $(B [) $(I Type) $(B ]) 82 $( I TemplateParameterList)$(OPT) $(GLINK Parameters) $(V2 $(GLINK MemberFunctionAttributes)<sub>opt</sub>)82 $(LINK2 template.html#TemplateParameterList, $(I TemplateParameterList))$(OPT) $(GLINK Parameters) $(V2 $(GLINK MemberFunctionAttributes)<sub>opt</sub>) 83 83 84 84 $(GNAME IdentifierList): 85 85 $(I Identifier) 86 86 $(I Identifier) $(B .) $(I IdentifierList) 87 87 $(I TemplateInstance) 88 88 $(I TemplateInstance) $(B .) $(I IdentifierList) 89 89 90 90 $(GNAME StorageClasses): 91 91 $(I StorageClass) 92 92 $(I StorageClass) $(I StorageClasses) trunk/docsrc/interface.dd
r1372 r1382 1 1 Ddoc 2 2 3 3 $(SPEC_S Interfaces, 4 4 5 5 $(GRAMMAR 6 6 $(GNAME InterfaceDeclaration): 7 $(B interface) $(I Identifier) $( I InterfaceBody)8 $( B interface) $(I Identifier) $(B :) $(I SuperInterfaces) $(I InterfaceBody)9 10 $(GNAME SuperInterfaces):11 $(I Identifier)12 $( I Identifier) $(B ,) $(I SuperInterfaces)7 $(B interface) $(I Identifier) $(BaseInterfaceList) $(I InterfaceBody) 8 $(LINK2 template.html#InterfaceTemplateDeclaration, $(I InterfaceTemplateDeclaration)) 9 10 $(GNAME BaseInterfaceList): 11 $(I Empty) 12 $(B :) $(LINK2 class.html#InterfaceClasses, $(I InterfaceClasses)) 13 13 14 14 $(GNAME InterfaceBody): 15 15 $(B {) DeclDefs $(B }) 16 16 ) 17 17 18 18 $(P Interfaces describe a list of functions that a class that inherits 19 19 from the interface must implement. 20 20 A class that implements an interface can be converted to a reference 21 21 to that interface.) 22 22 trunk/docsrc/struct.dd
r1327 r1382 329 329 $(TD $(LINK2 class.html#nested, YES)) 330 330 $(NO) 331 331 $(NO) 332 332 $(NO) 333 333 ) 334 334 ) 335 335 ) 336 336 337 337 $(GRAMMAR 338 338 $(GNAME AggregateDeclaration): 339 $( I Tag) $(I Identifier) $(I StructBody)340 $( I Tag) $(I Identifier) $(B ;)341 342 $(GNAME Tag): 343 $( B struct)344 $( B union)339 $(B struct) $(I Identifier) $(I StructBody) 340 $(B union) $(I Identifier) $(I StructBody) 341 $(B struct) $(I Identifier) $(B ;) 342 $(B union) $(I Identifier) $(B ;) 343 $(LINK2 template.html#StructTemplateDeclaration, $(I StructTemplateDeclaration)) 344 $(LINK2 template.html#UnionTemplateDeclaration, $(I UnionTemplateDeclaration)) 345 345 346 346 $(GNAME StructBody): 347 347 $(B {) $(B }) 348 348 $(B {) $(I StructBodyDeclarations) $(B }) 349 349 350 350 $(GNAME StructBodyDeclarations): 351 351 $(I StructBodyDeclaration) 352 352 $(I StructBodyDeclaration) $(I StructBodyDeclarations) 353 353 354 354 $(GNAME StructBodyDeclaration): trunk/docsrc/template.dd
r1379 r1382 741 741 void test() 742 742 { 743 743 $(B Foo)!(int) = 6; // instead of Foo!(int).Foo 744 744 } 745 745 ------ 746 746 747 747 <h2>Class Templates</h2> 748 748 749 749 $(GRAMMAR 750 750 $(GNAME ClassTemplateDeclaration): 751 $(B class) $(I Identifier) $(B $(LPAREN)) $( I TemplateParameterList) $(B $(RPAREN)) [$(I SuperClass) {$(B ,) $(I InterfaceClass) }]$(I ClassBody)751 $(B class) $(I Identifier) $(B $(LPAREN)) $(GLINK TemplateParameterList) $(B $(RPAREN)) $(I BaseClassList) $(I ClassBody) 752 752 ) 753 753 754 754 $(P If a template declares exactly one member, and that member is a class 755 755 with the same name as the template: 756 756 ) 757 757 758 758 ------ 759 759 template $(B Bar)(T) 760 760 { 761 761 class $(B Bar) … … 771 771 772 772 ------ 773 773 class $(B Bar)(T) 774 774 { 775 775 T member; 776 776 } 777 777 ------ 778 778 779 779 <h2>Struct, Union, and Interface Templates</h2> 780 780 781 $(GRAMMAR 782 $(GNAME StructTemplateDeclaration): 783 $(B struct) $(I Identifier) $(B $(LPAREN)) $(GLINK TemplateParameterList) $(B $(RPAREN)) $(LINK2 struct.html#StructBody, $(I StructBody)) 784 785 $(GNAME UnionTemplateDeclaration): 786 $(B union) $(I Identifier) $(B $(LPAREN)) $(GLINK TemplateParameterList) $(B $(RPAREN)) $(LINK2 struct.html#StructBody, $(I StructBody)) 787 788 $(GNAME InterfaceTemplateDeclaration): 789 $(B interface) $(I Identifier) $(B $(LPAREN)) $(GLINK TemplateParameterList) $(B $(RPAREN)) $(LINK2 interface.html#BaseInterfaceList, $(I BaseInterfaceList)) $(LINK2 interface.html#InterfaceBody, $(I InterfaceBody)) 790 ) 791 781 792 $(P Analogously to class templates, struct, union and interfaces 782 can be transformed into templates by supplying a parameter list.793 can be transformed into templates by supplying a template parameter list. 783 794 ) 784 795 785 796 <h2>$(LNAME2 function-templates, Function Templates)</h2> 786 797 787 798 $(P If a template declares exactly one member, and that member is a function 788 with the same name as the template: 789 ) 790 791 $(GRAMMAR 792 $(GNAME FunctionTemplateDeclaration): 793 $(I Type) $(I Identifier) $(B $(LPAREN)) $(I TemplateParameterList) $(B $(RPAREN)) $(B $(LPAREN)) $(LINK2 declaration.html#ParameterList, $(I ParameterList)) $(B $(RPAREN)) $(I FunctionBody) 794 ) 799 with the same name as the template, it is a function template declaration. 800 Alternatively, a function template declaration is a function declaration 801 with a $(GLINK TemplateParameterList) immediately preceding the 802 $(LINK2 declaration.html#Parameters, $(I Parameters)). 803 ) 795 804 796 805 $(P A function template to compute the square of type $(I T) is: 797 806 ) 798 807 ------ 799 808 T $(B Square)(T)(T t) 800 809 { 801 810 return t * t; 802 811 } 803 812 ------ 804 813
