std::atomic::fetch_add
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/>
<tbody> </tbody> T fetch_add( T arg, memory_order = std::memory_order_seq_cst ); T fetch_add( T arg, memory_order = std::memory_order_seq_cst ) volatile; |
(único membro da atomic<Integral> especialização modelo)(desde C++11) |
|
T* fetch_add( std::ptrdiff_t arg, memory_order = std::memory_order_seq_cst ); T* fetch_add( std::ptrdiff_t arg, memory_order = std::memory_order_seq_cst ) volatile; |
(único membro da atomic<T*> especialização modelo)(desde C++11) |
|
Atomicamente substitui o valor da corrente com o resultado da adição aritmética do valor e
arg. A operação é ler-modificar-escrever a operação. A memória é afectada de acordo com o valor de memory_order.Original:
Atomically replaces the current value with the result of arithmetic addition of the value and
arg. The operation is read-modify-write operation. Memory is affected according to the value of memory_order.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.
Para os tipos de
Integral assinados, a aritmética é definida para usar dois representação de complemento. LáOriginal:
For signed
Integral types, arithmetic is defined to use two’s complement representation. ThereThe 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.
há resultados indefinidos. Para os tipos de
T*, o resultado pode ser um endereço indefinido, mas as operações de outra forma não têm um comportamento indefinido.Original:
are no undefined results. For
T* types, the result may be an undefined address, but the operations otherwise have no undefined behavior.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.
Parâmetros
| arg | - | o outro argumento de adição aritmética
Original: the other argument of arithmetic addition The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| memory_order | - | restrições de ordem memória de aplicar
Original: memory order constraints to enforce The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Valor de retorno
O valor da variável atómica antes da chamada.
Original:
The value of the atomic variable before the call.
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.
Exceções
Veja também
(C++11) (C++11) |
adiciona um valor não-atômica para um objeto atômico e obtém o valor anterior do nuclear Original: adds a non-atomic value to an atomic object and obtains the previous value of the atomic The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de função) |