المتغيرات
فضاءات التسمية
أفعال

قالب:param list begin

من cppreference.com
[edit] [{{purge}}] Template documentation

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

{{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 (اختياري)| 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

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

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.