名前空間
変種
操作

<div class="t-tr-text">オペレーター<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">、演算子<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[]

提供: cppreference.com
< cpp‎ | memory‎ | new

 
 
ユーティリティライブラリ
支援を入力します (basic types, RTTI, type traits)
動的なメモリ管理
エラー処理
プログラムユーティリティ
可変個引数関数
日付と時刻
関数オブジェクト
initializer_list(C++11)
bitset
hash(C++11)
関係演算子
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>=
ペアとタプル
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)
フォワード、スワップ、および移動
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)
 
動的なメモリ管理
低レベルのメモリ管理
アロケータ
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)
ストレージを初期化されていない
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
スマートポインタ
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(廃止予定)
owner_less(C++11)
enable_shared_from_this(C++11)
bad_weak_ptr(C++11)
default_delete(C++11)
ガベージコレクションをサポートしています
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)
その他
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ライブラリ
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.
 
低レベルのメモリ管理
機能します
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
クラス
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
タイプ
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
オブジェクト
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)
割り当てはバイト数を要求され​​た。これらの割り当て関数は初期化されるであろう新たなどのオブジェクトにメモリを割り当てるために新しい式によって呼び出されます。.
Original:
Allocates requested number of bytes. These allocation functions are called by 新しい式 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)
フリーストアから割り当てcountバイト。失敗を繰り返し割り当て試行の新しいハンドラが返すか、時間がstd::get_new_handlerスローするには、nullポインタになるしなくなるまでに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)
1-2と同様ですが、1-2std::bad_allocをスローしたときにnullポインタを返します
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)
何も、返品ptrはありません。これらのバージョンは、以前に割り当てられたストレージにオブジェクトを構築する新しい式によって呼び出されます。.
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.

目次

[編集] 交換とオーバーロード

バージョン1-4)は暗黙<new>ヘッダが含まれていない場合でも、各翻訳単位で宣言されています。これらの関数は、交換可能な':同じシグネチャを持つユーザが提供する非メンバ関数は暗黙のバージョンを置き換えます。たかだか1交換は4暗黙の割り当て関数ごとに設けることができる。また、プログラムは、これらの関数のクラスメンバのバージョンを定義したり、異なるシグネチャ(それが割り当て関数の(5-6)のバージョンを置換することは許されないことを除いて)で割り当て関数を定義することができます。 countに割り当てるバイト数です追加された署名は、次のようになりますと' placement_paramsnew式に指定されたパラメータは次のとおりです
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
割り当て関数は二つの方法で置き換え/オーバーロードすることができます
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.
'グローバルスコープで':それを呼び出すためには、オーバーロードの割り当て関数のシグネチャが暗黙的に宣言されたデフォルトの割り当て関数を除いて、配分の代わりに可視でなければなりません。この割り当て機能は、現在のプログラムで対応するパラメータを指定して、すべての割り当てに使用されます
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.
'ローカルスコープの':オーバーロードoperator newはクラスの静的パブリックメンバ関数でなければなりません。この割り当て機能は、その特定のクラスの割り当てのためにのみ使用されます.
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.
コンパイル時に、各new式はクラススコープ内およびグローバルスコープでその後、まず適切な資源配分機能の名前のルックアップします。それはnewとして::newを呼び出すことにより、最初のステップをスキップするように指示することができます。 オーバーロードの規則に従って、任意の割り当て関数がクラススコープで宣言されたノートは、すべてのグローバル割り当て関数を非表示にします。詳細についてはNJ式を参照してください。それは名前空間に割り当て関数を配置することはできません注意してください.
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 オーバーロードの規則, any allocation functions declared in class scope hides all global allocation functions. For more information see NJ式. 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.

[編集] パラメータ

count -
割り当てるバイト数
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 -
でオブジェクトを初期化するメモリ領域へのポインタ
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.

[編集] 値を返します

1-4)
割り当てられたメモリ領域へのポインタ
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

[編集] 例外

1-2)
メモリの割り当てに失敗してstd::bad_allocをスローします
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
  (C + + 11以来)

[編集] も参照してください

解除関数
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.

(機能) [edit]
現在、新しいハンドラを取得します
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.

(機能) [edit]
新しいハンドラを登録します
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.

(機能) [edit]
初期化されていないストレージを取得します
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.

(機能)
メモリを割り当てます
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.

(機能)