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. |
Cuando un C + + expresión (un operador con sus argumentos) se evalúa, da lugar a un valor de algún tipo de no referencia. Cada expresión pertenece exactamente a una de las categorías de valor primarios .
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.
Contenido |
[editar] Categorías principales
[editar] valori
Un' lvalue es una expresión que identifica a un objeto no temporal o una función no miembro .
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.
Las siguientes expresiones son 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.
- El nombre de un objeto o función en su alcance, independientemente del tipo, tal como
std::cinostd::endl. Aun cuando el tipo de objeto es una referencia rvalue, la expresión consistente en su nombre es una expresión 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. - Llamada a función o expresión de operador si el tipo de la función o el operador de retorno es una referencia de valor-, como
std::getline(cin, str)ocout << 1oo++no*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. - Reparto de expresión a lvalue tipo de referencia .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. - Función de expresión de llamada si el tipo devuelto por la función es rvalue referencia al tipo de función (raro)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. - Reparto de expresión a DVALOR referencia a la función .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.
Propiedades:
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.
- Igual que glvalue (abajo)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. - Dirección de un valor-se pueden tomar:
&++iy&std::endlson expresiones válidas .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. - Un lvalue modificable puede ser utilizado como la primera (izquierda) argumento del operador de asignación incorporado .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. - Un valor-I se puede usar para inicializar una referencia de valor-; este asocia un nombre nuevo con el objeto identificado por la expresión .Original:An lvalue may be used to inicializar una referencia de valor-; 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.
[editar] rvalue NJ / prvalue NJ
A prvalue es una expresión que identifica un objeto temporal (o un subobjeto de los mismos) o es un valor no asociado con cualquier objeto .
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.
Las siguientes expresiones son 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.
- Literal, como 42 o true o nullptr .Original:Literal, such as 42 or true or nullptr.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Función de llamada / operador si la expresión de la función o el tipo del operador de retorno no es una referencia, tal como
str.substr(1, 2)o2+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. - Reparto de expresión a cualquier otro tipo de tipo de referencia .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. - Las expresiones lambda, como [](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.
Propiedades:
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.
- Igual que el valor p (abajo)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 no puede ser polimórfica: el tipo dinámico del objeto que identifica siempre es el tipo de la expresión .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. - prvalue un no-clase no puede ser calificado 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.
[editar] xValue NJ
Una xValue es una expresión que identifica un "expira" objeto, es decir, el objeto que se puede mover desde. El objeto identificado por una expresión xValue puede ser una sin nombre temporal, puede ser un objeto designado en su alcance, o cualquier otro tipo de objeto, pero si se usa como un argumento de la función, xValue siempre se unirá a la sobrecarga de referencia rvalue si está 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.
Sólo las siguientes expresiones son 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.
- Una expresión de llamada a la función, si el tipo devuelto por la función es una referencia al tipo de valor-objeto, como
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. - Una expresión de conversión a una referencia rvalue al tipo de objeto, tal como
static_cast<T&&>(val)o(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. - un miembro no estático clase de expresión de acceso, en el que la expresión de objeto es un 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. - Una expresión de puntero a miembro en el que el primer operando es un xValue y el segundo operando es un puntero al miembro de datos .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.
Propiedades:
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.
- Igual que el valor p (abajo)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. - Igual que glvalue (abajo)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.
Al igual que prvalues, XValues unen a DVALOR referencias, pero a diferencia de prvalues, un xValue puede ser polimórfico, y un xValue no-clase puede ser calificado cv .
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.
[editar] Categorías mixtas
[editar] glvalueNJ
A glvalue es una expresión que puede ser un valor-o xValue an .
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.
Propiedades:
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.
- A glvalue puede convertirse implícitamente a prvalue con lvalue a rvalue, array a puntero, o función a puntero conversión implícita .Original:A glvalue may be implicitly converted to prvalue with lvalue-to-rvalue, array-to-pointer, or function-to-pointer conversión implícita.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - A glvalue puede ser polimórfico: el tipo dinámico del objeto que identifica no es necesariamente el tipo estático de la expresión .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.
[editar] rvalue NJ
Un valor p es una expresión que puede ser un prvalue o xValue an .
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.
Propiedades (nota, estos se aplican tanto a XValues y prvalues, lo que significa que se aplican a los pre-C + 11 rvalues también)
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.
- Dirección de un valor-no pueden ser tomadas:
&i++y&42y&std::move(val)no son válidos .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. - Un valor R puede utilizarse para inicializar una constante referencia valori, en cuyo caso el tiempo de vida del objeto identificado por el valor p se extiende hasta el alcance de los extremos de referencia .Original:An rvalue may be used to inicializar una constante referencia valori, 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. - Un valor R puede utilizarse para inicializar una referencia de valor-, en cuyo caso el tiempo de vida del objeto identificado por el valor p se extiende hasta el alcance de los extremos de referencia .Original:An rvalue may be used to inicializar una referencia de valor-, 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. - Cuando se usa como un argumento de la función y cuando dos sobrecargas de la función están disponibles, uno teniendo rvalue parámetro de referencia y el otro tomando referencia a lvalue parámetro const, rvalues se unen a la sobrecarga de referencia rvalue (por lo tanto, si ambos copia y constructores de movimiento están disponibles, argumentos rvalue invocar la mover constructor, y lo mismo con copiar y mover los operadores de asignación) .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 mover constructor, 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.
[editar] Categorías especiales
[editar] En espera de llamada de función miembro
Las expresiones obj.*mfp y ptr->*mfp donde
mfp es un puntero a la función miembro, se clasifican como expresiones prvalue, pero no puede ser utilizado para inicializar referencias, como argumentos de la función, o para cualquier propósito en absoluto, excepto como el argumento de la izquierda de una función llame expresión, por ejemplo, (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.
[editar] Nulo expresiones
Las expresiones de función de llamada de regresar void, emitir expresiones para void y tirar-expresiones se clasifican como expresiones prvalue, pero no se puede utilizar para inicializar o referencias como argumentos de la función. Se pueden utilizar en un contexto descartado-valor (por ejemplo, en una línea propia, como el argumento de la izquierda del operador de coma, etc) y en la declaración return en un void función que devuelve. Además, banda expresiones (pero no prvalues otros void) se puede usar como el segundo y tercero de los operandos de la operador condicional?: .
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 operador condicional?:.
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.