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

Шаблон:param list/doc

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

This is one of the family of templates used for creation of parameter list.

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.

{{param list begin}}

starts the parameter list

{{param list end}}

ends the parameter list

{{param list item| parameter| explanation}}

adds an item to the parameter list.

{{param list hreq}}

results in "Type requirements"

{{param list req| requirement}}

adds a generic type requirement

{{param list req concept| parameter_name| concept| concept2 (необязательно)| ...| concept_n (необязательно)| notes=notes}}

adds a concept requirement

{{param list req concept deref| expression| concept| concept2 (необязательно)| ...| concept_n (необязательно)| notes=notes}}

adds a concept requirement on the result of dereference of type

Specific cases

functions passed as parameters:

{{param list pred0| parameter_name| value=return_value (необязательно)| condition}}

predicate with no arguments

{{param list pred1| parameter_name| value=return_value (необязательно)| condition| t1=type or p1=pointer_type}}

unary predicate

{{param list pred2| parameter_name| value=return_value (необязательно)| condition| t1=type or p1=pointer_type| t2=type or p2=pointer_type (необязательно)}}

binary predicate

{{param list pred2 eq| parameter_name| t1=type or p1=pointer_type| t2=type or p2=pointer_type (необязательно)}}

binary equality predicate

{{param list cmp| parameter_name| value=return_value (необязательно)| condition| t1=type or p1=pointer_type| t2=type or p2=pointer_type (необязательно)}}

comparison function

{{param list ccmp| parameter_name| additional_explanation (необязательно)}}

C-style comparison function

{{param list opf| parameter_name| action| t1=type or p1=pointer_type}}

function

{{param list op1| parameter_name| action| rt=type or rp=pointer_type| t1=type or p1=pointer_type}}

unary operation

{{param list op2| parameter_name| action| rt=type or rp=pointer_type| t1=type or p1=pointer_type| t2=type or p2=pointer_type (необязательно)}}

binary operation

{{param list gen| parameter_name| action| rt=type or rp=pointer_type}}

generator
Parameters
  • parameter_name is the name of the predicate parameter.
  • value is the expected return value when the condition is satisfied (defaults to true).
  • t1, t2, p1, p2 are types that the predicate is required to accept as its first and second parameters respectively. p1 and p2 describe a pointer parameter, i.e. it will be dereferenced before passed to the predicate. For each parameter, only one of either t* or p* can be used. If t2/p2 are not defined, t1,p1 are used for the second parameter instead.

[править] Example

  {{par begin}}
  {{par | count | the size of the list}}
  {{par pred2 | p | p1=ForwardIt | t2=T | if the elements should be exchanged}}
  {{par end}}

The above results in the following:

count the size of the list
p бинарный предикат, который возвращает ​true if the elements should be exchanged.

Определение функции предиката должно быть эквивалентно следующему:

 bool pred(const Type1 &a, const Type2 &b);

Определение не должно обязательно содержать const &, но функция не должна модифицировать принимаемые объекты.
Тип Type1 должен быть таков, что объект типа ForwardIt может быть разыменован и затем неявно преобразован в Type1. Тип Type2 должен быть таков, что объект типа T может быть неявно преобразован в Type2.