Espaços nominais
Variantes
Acções

<div class="t-tr-text">operador<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">operator</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> new<div class="t-tr-text">, Operador<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">, operator</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> new[]

Da cppreference.com
< cpp‎ | memory‎ | new

 
 
Biblioteca de utilitários
Digite apoio (basic types, RTTI, type traits)
Gerenciamento de memória dinâmica
De tratamento de erros
Utilidades do programa
Variadic funções
Data e hora
Objetos de função
initializer_list(C++11)
bitset
hash(C++11)
Os operadores relacionais
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Pares e tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
Troque, avançar e avançar
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
Gerenciamento de memória dinâmica
Gerenciamento de memória de baixo nível
Alocadores
Original:
Allocators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
allocator
allocator_traits(C++11)
allocator_arg_t(C++11)
allocator_arg(C++11)
uses_allocator(C++11)
scoped_allocator_adaptor(C++11)
Uninitialized armazenamento
Original:
Uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
uninitialized_copy
uninitialized_copy_n(C++11)
uninitialized_fill
uninitialized_fill_n
raw_storage_iterator
get_temporary_buffer
return_temporary_buffer
Ponteiros inteligentes
Original:
Smart pointers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
unique_ptr(C++11)
shared_ptr(C++11)
weak_ptr(C++11)
auto_ptr(obsoleta)
owner_less(C++11)
enable_shared_from_this(C++11)
bad_weak_ptr(C++11)
default_delete(C++11)
Apoio a coleta de lixo
Original:
Garbage collection support
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
declare_reachable(C++11)
undeclare_reachable(C++11)
declare_no_pointers(C++11)
undeclare_no_pointers(C++11)
pointer_safety(C++11)
get_pointer_safety(C++11)
Diversos
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pointer_traits(C++11)
addressof(C++11)
align(C++11)
C Library
Original:
C Library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Gerenciamento de memória de baixo nível
Funções
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator new
operator new[]
operator delete
operator delete[]
get_new_handler(C++11)
set_new_handler
Classes
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bad_alloc
bad_array_new_length(C++11)
nothrow_t
Tipos
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
new_handler
Objetos
Original:
Objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
nothrow
 
Defined in header <new>
void* operator new  ( std::size_t count );
(1)
void* operator new[]( std::size_t count );
(2)
void* operator new  ( std::size_t count, const std::nothrow_t& );
(3)
void* operator new[]( std::size_t count, const std::nothrow_t& );
(4)
void* operator new  ( std::size_t, void* ptr );
(5)
void* operator new[]( std::size_t, void* ptr );
(6)
Aloca solicitado número de bytes. Estas funções de alocação são chamados por novos-expressões para alocar memória em que novo objeto, então, ser inicializado.
Original:
Allocates requested number of bytes. These allocation functions are called by novos-expressões to allocate memory in which new object would then be initialized.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1-2)
Aloca count bytes de armazenamento gratuito. Chama o ponteiro de função retornado por std::get_new_handler em caso de falha e repete tentativas de alocação de até novo manipulador não retornar ou se torna um ponteiro nulo, momento em que joga std::bad_alloc.
Original:
Allocates count bytes from free store. Calls the function pointer returned by std::get_new_handler on failure and repeats allocation attempts until new handler does not return or becomes a null pointer, at which time throws std::bad_alloc.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3-4)
Mesmo que 1-2, mas retorna um ponteiro nulo quando 1-2 jogaria std::bad_alloc
Original:
Same as 1-2, but returns a null pointer when 1-2 would throw std::bad_alloc
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5-6)
não faz nada, ptr retornos. Essas versões são chamados por expressão nova que construir objetos no armazenamento previamente alocado.
Original:
does nothing, returns ptr. These versions are called by new-expression which construct objects in previously allocated storage.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Substituindo e sobrecarga

As versões 1-4) são implicitamente declarado em cada unidade de tradução, mesmo se o cabeçalho <new> não está incluído. Estas funções são' substituível: a fornecida pelo usuário função não-membro com a mesma assinatura substitui a versão implícita. No máximo uma substituição pode ser fornecido para cada uma das quatro funções de alocação implícitas. Além disso, o programa pode definir versões de membro de classe destas funções ou definir funções de alocação com assinaturas diferentes (exceto que ele não está autorizado a substituir (5-6) versões da função de alocação). A assinatura adicionado deve se parecer com o seguinte, onde count é o número de bytes para alocar e placement_params são os parâmetros fornecidos para a expressão new:
Original:
The versions 1-4) are implicitly declared in each translation unit even if the <new> header is not included. These functions are replaceable: a user-provided non-member function with the same signature replaces the implicit version. At most one replacement may be provided for each of the four implicit allocation functions. Also, program can define class member versions of these functions or define allocation functions with different signatures (except that it is not permitted to replace (5-6) versions of the allocation function). The added signature should look like the following, where count is number of bytes to allocate and placement_params are the parameters supplied to the new expression:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
void* operator new  (size_t count/*, placement_params*/);
for the new version
void* operator new[](size_t count/*, placement_params*/);
for the new[] version
A função de distribuição pode ser substituído / sobrecarregado de duas formas:
Original:
The allocation function can be replaced/overloaded in two ways:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
'No escopo global': a fim de chamá-lo, a assinatura das funções de alocação sobrecarregadas deve ser visível no local de distribuição, exceto para as funções de alocação declaradas implicitamente padrão. Esta função de distribuição irá ser utilizado para todas as alocações com os parâmetros correspondentes do programa actual
Original:
in the global scope: in order to call it, the signature of the overloaded allocation functions must be visible at the place of allocation, except for implicitly declared default allocation functions. This allocation function will be used for all allocations with corresponding parameters in the current program
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
'No âmbito local': o operator new sobrecarregado deve ser função de membro estático público da classe. Esta função de alocação será usado apenas para alocações dessa classe em particular.
Original:
in the local scope: the overloaded operator new must be static public member function of the class. This allocation function will be used only for allocations of that particular class.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Durante a compilação, cada expressão new olha para o nome de função de alocação adequada de primeiro lugar no escopo da classe e depois que no âmbito global. Ele pode ser instruído a pular o primeiro passo chamando new como ::new. Note que, como por sobrecarga regras, quaisquer funções de alocação declarou em escopo de classe esconde todas as funções de alocação global. Para mais informações, consulte NJ expressão. Note que não é possível colocar função de alocação em um espaço.
Original:
During compilation, each new expression looks up for appropriate allocation function's name firstly in the class scope and after that in the global scope. It can be instructed to skip the first step by calling new as ::new. Note, that as per sobrecarga regras, any allocation functions declared in class scope hides all global allocation functions. For more information see NJ expressão. Note, that it is not possible to place allocation function in a namespace.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Parâmetros

count -
número de bytes para alocar
Original:
number of bytes to allocate
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ptr -
ponteiro para uma área de memória para inicializar o objeto a
Original:
pointer to a memory area to initialize the object at
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Valor de retorno

1-4)
ponteiro para a área de memória alocada
Original:
pointer to allocated memory area
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

5-6) ptr

[editar] Exceções

1-2)
joga std::bad_alloc em caso de falha ao alocar memória
Original:
throws std::bad_alloc on failure to allocate memory
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3-6)
noexcept specification:  
noexcept
  (a partir do C++ 11)

[editar] Veja também

funções desalocação
Original:
deallocation functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função) [edit]
obtém o manipulador de corrente de novo
Original:
obtains the current new handler
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função) [edit]
registra um novo manipulador
Original:
registers a new handler
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função) [edit]
Obtém o armazenamento não inicializado
Original:
obtains uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função)
aloca memória
Original:
allocates memory
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função)