Value categories
De cppreference.com
[] |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
Quand une expression C + + (un oprateur avec ses arguments) est valu, il en rsulte une valeur d'un type non-rfrence. Chaque expression appartient exactement l'une des catgories de valeurs primaires .
Original:
When a C++ expression (an operator with its arguments) is evaluated, it results in a value of some non-reference type. Each expression belongs to exactly one of the primary value categories.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Catgories principales
lvalue
Une lvalue' est une expression qui identifie un objet non-temporaire ou une fonction non-membre .
Original:
An lvalue is an expression that identifies a non-temporary object or a non-member function.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Les expressions suivantes sont lvalues:
Original:
The following expressions are lvalues:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Le nom d'un objet ou d'une fonction dans la porte, peu importe le type, comme
std::cinoustd::endl. Mme si le type de l'objet est une rfrence rvalue, l'expression compose de son nom est une expression lvalue .Original:The name of an object or function in scope, regardless of type, such asstd::cinorstd::endl. Even if the object's type is rvalue reference, the expression consisting of its name is an lvalue expression.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Appel de fonction ou de l'expression oprateur si le type de retour ou de la fonction de l'oprateur est une rfrence lvalue, comme
std::getline(cin, str)oucout << 1ouou++nou*pOriginal:Function call or operator expression if the function's or operator's return type is an lvalue reference, such asstd::getline(cin, str)orcout << 1oror++nor*pThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Cast expression lvalue de rfrence type .Original:Cast expression to lvalue reference type.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Expression d'appel de fonction si le type de retour de la fonction est la rfrence rvalue de type de fonction (rare)Original:Function call expression if the function's return type is rvalue reference to function type (rare)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Cast expression rvalue rfrence la fonction .Original:Cast expression to rvalue reference to function.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Proprits:
Original:
Properties:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Mme que glvalue (ci-dessous)Original:Same as glvalue (below)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Adresse d'une lvalue peuvent tre prises:
&++iet&std::endlsont des expressions valides .Original:Address of an lvalue may be taken:&++iand&std::endlare valid expressions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Une lvalue modifiable peut tre utilis comme le premier ( gauche) de l'argument de l'oprateur d'affectation intgr .Original:A modifiable lvalue may be used as the first (left) argument of the built-in assignment operator.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Une lvalue peut tre utilis pour initialiser une rfrence lvalue, ce qui associe un nouveau nom avec l'objet identifi par l'expression .Original:An lvalue may be used to initialiser une rfrence lvalue; this associates a new name with the object identified by the expression.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rvalue / prvalue
Un prvalue est une expression qui identifie un objet temporaire (ou un de ses sous-objet) ou est une valeur associe aucun objet .
Original:
A prvalue is an expression that identifies a temporary object (or a subobject thereof) or is a value not associated with any object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Les expressions suivantes sont prvalues:
Original:
The following expressions are prvalues:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Littrale, comme
42outrueounullptr.Original:Literal, such as42ortrueornullptr.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Appel de fonction / expression oprateur si la fonction ou le type de retour de l'oprateur n'est pas une rfrence, comme
str.substr(1, 2)ou2+2Original:Function call/operator expression if the function's or the operator's return type is not a reference, such asstr.substr(1, 2)or2+2The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Cast expression un autre type que le type de rfrence .Original:Cast expression to any type other than reference type.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Les expressions lambda, comme
[](int x){return x*x;}Original:Lambda expressions, such as[](int x){return x*x;}The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Proprits:
Original:
Properties:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Mme que rvalue (ci-dessous)Original:Same as rvalue (below)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - un prvalue ne peut pas tre polymorphe: le type dynamique de l'objet qu'il identifie est toujours le type de l'expression .Original:a prvalue cannot be polymorphic: the dynamic type of the object it identifies is always the type of the expression.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - un prvalue non-classe ne peut pas tre qualifi const .Original:a non-class prvalue cannot be const-qualified.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
xValue
Un xValue est une expression qui identifie une "chance" objet, c'est l'objet qui peut tre dplac d'. L'objet identifi par une expression xValue peut tre temporaire sans nom, il peut tre un objet nomm dans la porte, ou tout autre type d'objet, mais s'il est utilis comme un argument de fonction, xValue toujours se lier la surcharge de rfrence rvalue si disponible .
Original:
An xvalue is an expression that identifies an "expiring" object, that is, the object that may be moved from. The object identified by an xvalue expression may be a nameless temporary, it may be a named object in scope, or any other kind of object, but if used as a function argument, xvalue will always bind to the rvalue reference overload if available.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Seules les expressions suivantes sont XValues:
Original:
Only the following expressions are xvalues:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Une expression d'appel de la fonction, si le type de retour de la fonction est une rfrence rvalue de type d'objet, comme
std::move(val)Original:A function call expression, if the function's return type is an rvalue reference to object type, such asstd::move(val)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Une expression de cast pour une rfrence rvalue de type d'objet, comme
static_cast<T&&>(val)ou(T&&)valOriginal:A cast expression to an rvalue reference to object type, such asstatic_cast<T&&>(val)or(T&&)valThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - une expression non statique classe lment d'accs, dans lequel l'objet est une expression xValueOriginal:a non-static class member access expression, in which the object expression is an xvalueThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Une expression pointeur de membre dans lequel le premier oprande est un xValue et le second oprande est un pointeur vers un membre de donnes .Original:A pointer-to-member expression in which the first operand is an xvalue and the second operand is a pointer to data member.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Proprits:
Original:
Properties:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Mme que rvalue (ci-dessous)Original:Same as rvalue (below)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Mme que glvalue (ci-dessous)Original:Same as glvalue (below)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Comme prvalues, XValues lier rvalue rfrences, mais contrairement prvalues, un xValue peut tre polymorphe, et un xValue non-classe peut tre cv-qualifi .
Original:
Like prvalues, xvalues bind to rvalue references, but unlike prvalues, an xvalue may be polymorphic, and a non-class xvalue may be cv-qualified.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Catgories confondues
glvalue
Un glvalue est une expression qui est soit une lvalue ou un xValue .
Original:
A glvalue is an expression that is either an lvalue or an xvalue.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Proprits:
Original:
Properties:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Un glvalue peut tre implicitement converti en prvalue avec lvalue--rvalue, array--pointeur, ou de la fonction pointeur conversion implicite .Original:A glvalue may be implicitly converted to prvalue with lvalue-to-rvalue, array-to-pointer, or function-to-pointer conversion implicite.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Un glvalue peut tre polymorphe: le type dynamique de l'objet qu'il identifie n'est pas ncessairement le type statique de l'expression .Original:A glvalue may be polymorphic: the dynamic type of the object it identifies is not necessarily the static type of the expression.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rvalue
Une rvalue est une expression qui est soit un prvalue ou un xValue .
Original:
An rvalue is an expression that is either a prvalue or an xvalue.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Proprits (note, celles-ci s'appliquent la fois aux XValues et prvalues, ce qui signifie qu'elles s'appliquent la pr-C + 11 rvalues aussi)
Original:
Properties (note, these apply to both xvalues and prvalues, which means they apply to the pre-C++11 rvalues as well)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Adresse d'un rvalue ne peuvent tre prises:
&i++et&42et&std::move(val)ne sont pas valides .Original:Address of an rvalue may not be taken:&i++and&42and&std::move(val)are invalid.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Une rvalue peuvent tre utiliss pour initialiser une rfrence const lvalue, auquel cas la dure de vie de l'objet identifi par le rvalue est prolong jusqu' la porte des extrmits de rfrence .Original:An rvalue may be used to initialiser une rfrence const lvalue, in which case the lifetime of the object identified by the rvalue is extended until the scope of the reference ends.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Une rvalue peuvent tre utiliss pour initialiser une rfrence rvalue, auquel cas la dure de vie de l'objet identifi par le rvalue est prolong jusqu' la porte des extrmits de rfrence .Original:An rvalue may be used to initialiser une rfrence rvalue, in which case the lifetime of the object identified by the rvalue is extended until the scope of the reference ends.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Lorsqu'il est utilis comme un argument de fonction et lorsque deux surcharges de la fonction sont disponibles, l'un prenant paramtre de rfrence rvalue et l'autre prise de rfrence lvalue au paramtre const, rvalues se lier la surcharge de rfrence rvalue (ainsi, si les deux constructeurs de copie et de dplacement sont disponibles, rvalue arguments invoquer la dplacer constructeur, et de mme avec copier et dplacer des oprateurs d'affectation) .Original:When used as a function argument and when two overloads of the function are available, one taking rvalue reference parameter and the other taking lvalue reference to const parameter, rvalues bind to the rvalue reference overload (thus, if both copy and move constructors are available, rvalue arguments invoke the dplacer constructeur, and likewise with copy and move assignment operators).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Catgories spciales
Dans l'attente de l'appel de fonction membre
Les expressions
obj.*mfp et ptr->*mfp o mfp est un pointeur vers une fonction membre, sont classs comme des expressions prvalue, mais ils ne peuvent pas tre utiliss pour initialiser les rfrences, comme arguments de la fonction, ou pour n'importe quelle fin, sauf comme argument de gauche d'une fonction appelez expression, par exemple (pobj->*ptr)(args) .Original:
The expressions
obj.*mfp and ptr->*mfp where mfp is a pointer to member function, are classified as prvalue expressions, but they cannot be used to initialize references, as function arguments, or for any purpose at all, except as the left-hand argument of a function call expression, e.g. (pobj->*ptr)(args).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Annuler expressions
Expressions d'appel de fonction retournant
void, rabattre les expressions de void, et jetez-expressions sont classs comme des expressions prvalue, mais ils ne peuvent pas tre utiliss pour initialiser les rfrences ou comme arguments de la fonction. Ils peuvent tre utiliss dans un contexte jet valeur (par exemple, sur une ligne qui lui est propre, que l'argument de gauche de l'oprateur virgule, etc) et dans la dclaration return dans un void fonction retournant. En outre, jette-expressions (mais pas d'autres prvalues vides) peuvent tre utiliss en tant que deuxime et troisime oprandes de la oprateur conditionnel?: .Original:
Function call expressions returning
void, cast expressions to void, and throw-expressions are classified as prvalue expressions, but they cannot be used to initialize references or as function arguments. They can be used in a discarded-value context (e.g. on a line of its own, as the left argument of the comma operator, etc) and in the return statement in a function returning void. In addition, throw-expressions (but not other void prvalues) may be used as the second and the third operands of the oprateur conditionnel?:.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.