Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 1382

Show
Ignore:
Timestamp:
12/14/09 09:37:54 (15 years ago)
Author:
walter
Message:

bugzilla 3592 ClassTemplateDeclaration? and FunctionTemplateDeclaration? rules are unreferenced

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docsrc/class.dd

    r1377 r1382  
    1818    $(P A class can be exported, which means its name and all its 
    1919    non-private 
    2020    members are exposed externally to the DLL or EXE. 
    2121    ) 
    2222 
    2323    $(P A class declaration is defined: 
    2424    ) 
    2525 
    2626$(GRAMMAR 
    2727$(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)) 
    2930 
    3031$(GNAME BaseClassList): 
     32    $(I Empty) 
    3133    $(B :) $(I SuperClass) 
    3234    $(B :) $(I SuperClass) $(B ,) $(I InterfaceClasses) 
    3335    $(B :) $(I InterfaceClass) 
    3436 
    3537$(GNAME SuperClass): 
    3638    $(I Identifier) 
    3739    $(I Protection) $(I Identifier) 
    3840 
    3941$(GNAME InterfaceClasses): 
    4042    $(I InterfaceClass) 
  • trunk/docsrc/declaration.dd

    r1338 r1382  
    7272        $(I BasicType2) $(I Identifier) $(I DeclaratorSuffixes)$(OPT) 
    7373 
    7474$(GNAME DeclaratorSuffixes): 
    7575        $(I DeclaratorSuffix) 
    7676        $(I DeclaratorSuffix) $(I DeclaratorSuffixes) 
    7777 
    7878$(GNAME DeclaratorSuffix): 
    7979        $(B [ ]) 
    8080        $(B [) $(VEXPRESSION) $(B ]) 
    8181        $(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>) 
    8383 
    8484$(GNAME IdentifierList): 
    8585        $(I Identifier) 
    8686        $(I Identifier) $(B .) $(I IdentifierList) 
    8787        $(I TemplateInstance) 
    8888        $(I TemplateInstance) $(B .) $(I IdentifierList) 
    8989 
    9090$(GNAME StorageClasses): 
    9191    $(I StorageClass) 
    9292    $(I StorageClass) $(I StorageClasses) 
  • trunk/docsrc/interface.dd

    r1372 r1382  
    11Ddoc 
    22 
    33$(SPEC_S Interfaces, 
    44 
    55$(GRAMMAR 
    66$(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)
    1313 
    1414$(GNAME InterfaceBody): 
    1515    $(B {) DeclDefs $(B }) 
    1616) 
    1717 
    1818    $(P Interfaces describe a list of functions that a class that inherits 
    1919    from the interface must implement. 
    2020    A class that implements an interface can be converted to a reference 
    2121    to that interface.) 
    2222 
  • trunk/docsrc/struct.dd

    r1327 r1382  
    329329    $(TD $(LINK2 class.html#nested, YES)) 
    330330    $(NO) 
    331331    $(NO) 
    332332    $(NO) 
    333333    ) 
    334334) 
    335335    ) 
    336336 
    337337$(GRAMMAR 
    338338$(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)
    345345 
    346346$(GNAME StructBody): 
    347347    $(B {) $(B }) 
    348348    $(B {) $(I StructBodyDeclarations) $(B }) 
    349349 
    350350$(GNAME StructBodyDeclarations): 
    351351    $(I StructBodyDeclaration) 
    352352    $(I StructBodyDeclaration) $(I StructBodyDeclarations) 
    353353 
    354354$(GNAME StructBodyDeclaration): 
  • trunk/docsrc/template.dd

    r1379 r1382  
    741741void test() 
    742742{ 
    743743    $(B Foo)!(int) = 6; // instead of Foo!(int).Foo 
    744744} 
    745745------ 
    746746 
    747747<h2>Class Templates</h2> 
    748748 
    749749$(GRAMMAR 
    750750$(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) 
    752752) 
    753753 
    754754    $(P If a template declares exactly one member, and that member is a class 
    755755    with the same name as the template: 
    756756    ) 
    757757 
    758758------ 
    759759template $(B Bar)(T) 
    760760{ 
    761761    class $(B Bar) 
     
    771771 
    772772------ 
    773773class $(B Bar)(T) 
    774774{ 
    775775    T member; 
    776776} 
    777777------ 
    778778 
    779779<h2>Struct, Union, and Interface Templates</h2> 
    780780 
     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 
    781792    $(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. 
    783794    ) 
    784795 
    785796<h2>$(LNAME2 function-templates, Function Templates)</h2> 
    786797 
    787798    $(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    ) 
    795804 
    796805    $(P A function template to compute the square of type $(I T) is: 
    797806    ) 
    798807------ 
    799808T $(B Square)(T)(T t) 
    800809{ 
    801810    return t * t; 
    802811} 
    803812------ 
    804813