Value categories
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Quando un C + + espressione (un operatore, con i suoi argomenti) viene valutata, si traduce in un valore di qualche non-tipo di riferimento. Ogni espressione appartiene esattamente a una delle categorie di valori primari.
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.
Indice |
[modifica] Categorie principali
[modifica] lvalue
Un' lvalue è un'espressione che identifica una non temporaneo oggetto o un non-membro funzione.
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.
Le seguenti espressioni sono lvalue:
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.
- Il nome di un oggetto o di una funzione nel campo di applicazione, indipendentemente dal tipo, come ad esempio
std::cin
ostd::endl
. Anche se il tipo di oggetto è il riferimento rvalue, l'espressione consistente del suo nome è un'espressione lvalue.Original:The name of an object or function in scope, regardless of type, such asstd::cin
orstd::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. - Richiamo della funzione o un'espressione operatore se il tipo restituito della funzione o dell'operatore fa riferimento lvalue, come
std::getline(cin, str)
ocout << 1
oo
++n
o*p
Original:Function call or operator expression if the function's or operator's return type is an lvalue reference, such asstd::getline(cin, str)
orcout << 1
oror
++n
or*p
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Cast al tipo di espressione lvalue di riferimento.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. - Funzione di espressione chiamata se il tipo restituito dalla funzione è rvalue riferimento al tipo di funzione (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. - Cast espressione rvalue riferimento alla funzione.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.
Proprietà:
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.
- Stessa glvalue (sotto)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. - Indirizzo di un lvalue può essere preso:
&++i
e&std::endl
sono espressioni valide.Original:Address of an lvalue may be taken:&++i
and&std::endl
are 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 modificabile può essere utilizzato come il primo (sinistra) argomento del built-in operatore di assegnazione.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. - Lvalue può essere utilizzato per inizializzare un riferimento lvalue; questo associa un nuovo nome con l'oggetto identificato dall'espressione.Original:An lvalue may be used to inizializzare un riferimento 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.
[modifica] rvalue NJ / prvalue NJ
A' prvalue è un'espressione che identifica un oggetto temporaneo (o un suo sotto-oggetto), o è un valore non associato ad alcun oggetto.
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.
Le seguenti espressioni sono 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.
- Letterale, come 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. - La chiamata alla funzione / operatore espressione se la funzione o il tipo restituito dell'operatore non è un punto di riferimento, come ad esempio
str.substr(1, 2)
o2+2
Original:Function call/operator expression if the function's or the operator's return type is not a reference, such asstr.substr(1, 2)
or2+2
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Cast espressione a qualsiasi altro tipo di tipo di riferimento.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. - Le espressioni lambda, come [](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.
Proprietà:
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.
- Stessa rvalue (sotto)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 non può essere polimorfico: il tipo dinamica dell'oggetto identifica è sempre il tipo dell'espressione.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. - una non-classe prvalue non può essere const qualificati.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.
[modifica] xValue NJ
Un' xValue è un'espressione che identifica un oggetto "scadenza", cioè l'oggetto che può essere spostato da. L'oggetto identificato da un'espressione xValue può essere una temporanea senza nome, potrebbe essere un oggetto con nome nel campo di applicazione, o qualsiasi altro tipo di oggetto, ma se usato come argomento di funzione, xValue si legheranno sempre al sovraccarico di riferimento rvalue se disponibile.
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.
Solo le seguenti espressioni sono 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.
- Un'espressione chiamata di funzione, se il tipo restituito dalla funzione è un riferimento rvalue al tipo di oggetto, ad esempio
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. - Un'espressione cast di un riferimento rvalue al tipo di oggetto, ad esempio
static_cast<T&&>(val)
o(T&&)val
Original:A cast expression to an rvalue reference to object type, such asstatic_cast<T&&>(val)
or(T&&)val
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - un membro non statico espressione classe di accesso, in cui l'espressione è un oggetto 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. - Un puntatore-a-membro espressione in cui il primo operando è un xValue e il secondo operando è un puntatore a membro di dati.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.
Proprietà:
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.
- Stessa rvalue (sotto)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. - Stessa glvalue (sotto)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.
Come prvalues, XValues legano a rvalue riferimenti, ma a differenza di prvalues, un xValue può essere polimorfici, e non di classe può essere xValue cv-qualificati.
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.
[modifica] Categorie miste
[modifica] glvalueNJ
Un glvalue è un'espressione che è o un lvalue o 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.
Proprietà:
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 può essere convertito in modo implicito prvalue con lvalue a rvalue, array a puntatore, o una funzione a puntatore conversione implicita.Original:A glvalue may be implicitly converted to prvalue with lvalue-to-rvalue, array-to-pointer, or function-to-pointer conversione implicita.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Un glvalue può essere polimorfico: il tipo dinamica dell'oggetto identifica non è necessariamente il tipo statico dell'espressione.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.
[modifica] rvalue NJ
Un rvalue è un'espressione che è o un prvalue o 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.
Proprietà (nota, questi si applicano a entrambi i XValues e prvalues, il che significa che si applicano ai pre-C + 11 rvalues pure)
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.
- Indirizzo di un rvalue non possono essere prese:
&i++
e&42
e&std::move(val)
non sono validi.Original:Address of an rvalue may not be taken:&i++
and&42
and&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 rvalue può essere utilizzato per inizializzare un riferimento const lvalue, nel qual caso la durata dell'oggetto identificato dalla rvalue è estesa fino alla portata delle estremità riferimento.Original:An rvalue may be used to inizializzare un riferimento 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. - Un rvalue può essere utilizzato per inizializzare un riferimento rvalue, nel qual caso la durata dell'oggetto identificato dalla rvalue è estesa fino alla portata delle estremità riferimento.Original:An rvalue may be used to inizializzare un riferimento 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. - Quando viene utilizzato come argomento di funzione e quando due overload della funzione sono disponibili, uno dei parametri di riferimento prendendo rvalue e l'altra prendendo lvalue riferimento al parametro const, rvalues legano al sovraccarico di riferimento rvalue (quindi, se entrambi i costruttori di copia e spostamento sono disponibili, argomenti rvalue richiamare il spostare costruttore, e allo stesso modo con copia e spostare operatori di assegnamento).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 spostare costruttore, 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.
[modifica] Categorie speciali
[modifica] In attesa di chiamata di funzione membro
Le espressioni obj.*mfp e ptr->*mfp dove
mfp
è un puntatore alla funzione membro, sono classificati come espressioni prvalue, ma non possono essere utilizzati per inizializzare riferimenti, come argomenti di funzioni, o per qualsiasi scopo a tutti, salvo sinistra argomento di una funzione chiamare espressione, ad esempio, (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.
[modifica] Void espressioni
Le espressioni di funzione di chiamata di ritorno void, gettato espressioni per void, e gettare-espressioni sono classificate come espressioni prvalue, ma non possono essere utilizzati per inizializzare riferimenti o come argomenti di funzioni. Essi possono essere usati in un contesto scartato valore (ad esempio su una riga propria, come argomento sinistra dell'operatore virgola, etc) e nel conto return in funzione void ritorno. Inoltre, throw-espressioni (ma non prvalues altri vuoti) può essere utilizzato come il secondo e il terzo operandi del condizionale?:.
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 condizionale?:.
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.