Пространства имён
Варианты
Действия

Шаблон:dcl/doc

Материал из cppreference.com

This is one of the family of templates used for creation of declaration lists.

List template families

  • dcl list **** : For creation of member variable/function lists.
  • ddcl list **** : For creation of detailed declaration lists (those including actual declaration code)
  • sdcl list **** : For creation of lists representing various syntaxes of a language feature. Used in subpages of cpp/language
  • param list **** : For creation of lists explaining function parameters.
  • sb list **** : For creation of feature lists in navbars.

{{dcl begin}}

starts the declaration list

{{dcl end}}

ends the declaration list. This template automatically adds {{dcl sep}} above the item.

{{dcl rev begin| num=num}}

starts versioned declaration list. The num parameter is optional and may be used for numbering purposes (overrides the num parameter of the {{dcl}} templates used within the versioned list (i.e., until {{dcl rev end}}).

{{dcl rev end}}

ends versioned declaration list.

{{dcl header}}

adds explanation which header the feature comes from

{{dcl sep}}

adds a separator

{{dcl h| heading}}

adds a small heading. Useful to split and describe large groups of related declarations.

{{dcl| notes=notes| num=num| since=since-std| until=until-std| deprecated=deprecated-std| removed=see below| declaration}}

adds an item to the declaration list. The notes parameter is optional and may be used to add notes about the feature. The num parameter is also optional and may be used for numbering purposes. declaration is the declaration of the feature. This template automatically adds {{dcl sep}} above the item.
since specifies the first standard the definition appears in, until specifies the first standard that does not include this definition, deprecated either specifies the first standard that deprecated this definition, or is equal to yes, in which case it specifies that the definition has always been deprecated.
removed can be used in one of two ways:
  • when until is specified, it specifies whether the "until" marker should be rendered as "removed in" instead, and can be either yes or no. If missing, defaults to yes if deprecated is specified and no otherwise.
  • when until is not specified, removed=x is equivalent to until=x|removed=yes.

{{dcl rev multi| num=num| notesX=notes| sinceX=since-std| untilX=until-std| dclX = declaration| ...}}

single-template versioned declaration list; up to 7 versions are supported. The default for sinceX is untilX-1 and the default for untilX is sinceX+1. This template may be substituted.

[править] Example

 
    {{dcl header | abcd.h}}
    {{dcl | notes=Faster than {{c|foo_slow}} | num=1 |
    int foo( char a );
    }}
    {{dcl | since=c++11 | num=2 |
    int foo( char a, int b );
    }}
    {{dcl rev begin | num=3}}
    {{dcl | until=c++11 | 1=
    int foo( char a, char b = 'a' );
    }}
    {{dcl | since=c++11 | until=c++14 | 1=
    int foo( char a, char b = 'b' );
    }}
    {{dcl | since=c++14 | 1=
    int foo( char a, char b = 'c' );
    }}
    {{dcl rev end}}
    {{dcl rev begin}}
    {{dcl | until=c++11 | num=4 | 1=
    int foo( char a, char b = 'a' );
    }}
    {{dcl | since=c++11 | until=c++14 | num=5 | 1=
    int foo( char a, char b = 'b' );
    }}
    {{dcl | since=c++14 | num=6 | 1=
    int foo( char a, char b = 'c' );
    }}
    {{dcl rev end}}
    {{dcl rev multi | num=7 | dcl1=
    int foo( char a, char b = 'a' );
    |since2=c++11 | dcl2=
    int foo( char a, char b = 'b' );
    |since3=c++14 | dcl3=
    int foo( char a, char b = 'c' );
    |since4=c++17 | dcl4=
    int foo( char a, char b = 'd' );
    }}
  

The above results in the following:

Определён в заголовочном файле <abcd.h>
int foo( char a );
(1) Faster than foo_slow
int foo( char a, int b );
(2) (начиная с C++11)
(3)
int foo( char a, char b = 'a' );
(до C++11)
int foo( char a, char b = 'b' );
(начиная с C++11)
(до C++14)
int foo( char a, char b = 'c' );
(начиная с C++14)
int foo( char a, char b = 'a' );
(4) (до C++11)
int foo( char a, char b = 'b' );
(5) (начиная с C++11)
(до C++14)
int foo( char a, char b = 'c' );
(6) (начиная с C++14)
(7)
int foo( char a, char b = 'a' );
(до C++11)
int foo( char a, char b = 'b' );
(начиная с C++11)
(до C++14)
int foo( char a, char b = 'c' );
(начиная с C++14)
(до C++17)
int foo( char a, char b = 'd' );
(начиная с C++17)