Przestrzenie nazw
Warianty

Szablon:param list begin

Z cppreference.com
[edit] [{{purge}}] Dokumentacja szablonu
This is one of the family of templates used for creation of parameter list.

Rodzina szablonów do wyświetlania list

  • dcl list **** : Do tworzenia list funkcji/pól składowych.
  • ddcl list **** : Do tworzenia szczegółowych list deklaracji (tych zawiuerających faktyczny kod deklaracji)
  • tdcl list **** : Do tworzenia list typu identyfikator - definicja (lub wyjaśnienie). Wykorzystywane m.in. przy definicjach typów (typedef) i wartościach typów wyliczeniowych.
  • sdcl list **** : Do tworzenia list reprezentujących różne składnie of a language feature. Używane na podstronach cpp/language
  • param list **** : Do tworzenia list objaśniających parametry funkcji.

{{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.

Specific cases - functions passed as parameters:

{{param list pred0| parameter_name| value=return_value (opcjonalne)| condition}} - predicate with no arguments

{{param list pred1| parameter_name| value=return_value (opcjonalne)| condition| t1=type or p1=pointer_type}} - unary predicate

{{param list pred2| parameter_name| value=return_value (opcjonalne)| condition| t1=type or p1=pointer_type| t2=type or p2=pointer_type (opcjonalne)}} - binary predicate

{{param list pred2 eq| parameter_name| t1=type or p1=pointer_type| t2=type or p2=pointer_type (optional)}} - binary equality predicate

{{param list cmp| parameter_name| value=return_value (opcjonalne)| condition| t1=type or p1=pointer_type| t2=type or p2=pointer_type (optional)}} - comparison function

{{param list ccmp| parameter_name| additional_explanation}}(opcjonalne) }} - 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 (optional)}} - binary operation

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

  • 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

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

The above results in the following:

count - the size of the list
p - binary predicate which returns ​true if the elements should be exchanged.

The signature of the predicate function should be equivalent to the following:

<tbody> </tbody>
bool pred(const Type1 &a, const Type2 &b);

The signature does not need to have const &, but the function must not modify the objects passed to it.
The type Type1 must be such that an object of type ForwardIterator can be dereferenced and then implicitly converted to Type1. The type Type2 must be such that an object of type T can be implicitly converted to Type2.