std::stack::stack
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
explicit stack( const Container& cont = Container() ); explicit stack( const Container& cont ); |
(1) | (C++11以前) (C++11およびそれ以降) |
explicit stack( Container&& cont = Container() ); |
(2) | (C++11およびそれ以降) |
stack( const stack& other ); |
(3) | |
stack( stack&& other ); |
(4) | (C++11およびそれ以降) |
template< class Alloc > explicit stack( const Alloc& alloc ); |
(5) | (C++11およびそれ以降) |
template< class Alloc > stack( const Container& cont, const Alloc& alloc ); |
(6) | (C++11およびそれ以降) |
template< class Alloc > stack( Container&& cont, const Alloc& alloc ); |
(7) | (C++11およびそれ以降) |
template< class Alloc > stack( const stack& other, const Alloc& alloc ); |
(8) | (C++11およびそれ以降) |
template< class Alloc > stack( stack&& other, const Alloc& alloc ); |
(9) | (C++11およびそれ以降) |
さまざまなデータソースからのコンテナアダプタの新しい基盤となるコンテナを構築し.
Original:
Constructs new underlying container of the container adaptor from a variety of data sources.
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.
1)
コピー構築
c
の内容で、基礎となるコンテナcont
を。また、これは、既定のコンストラクタ(C++11以前)ですOriginal:
Copy-constructs the underlying container
c
with the contents of cont
. This is also the default constructor (C++11以前)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.
2)
c
基になるコンテナstd::move(cont)は、Move-構築します。また、これは、既定のコンストラクタ(C++11およびそれ以降)ですOriginal:
Move-constructs the underlying container
c
with std::move(cont). This is also the default constructor (C++11およびそれ以降)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.
3)
コンストラクタをコピーします。アダプタはother.cの内容とコピー構築されます。 (暗黙的に宣言された)
Original:
Copy constructor. The adaptor is copy-constructed with the contents of other.c. (暗黙的に宣言された)
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.
4)
コンストラクタを移動します。アダプタはstd::move(other.c)を使って構築されます。 (暗黙的に宣言された)
Original:
Move constructor. The adaptor is constructed with std::move(other.c). (暗黙的に宣言された)
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.
5-9)
次のコンストラクタは、基になるコンテナはアロケータ対応の容器(すべての標準ライブラリコンテナの真)であれば、あるstd::uses_allocator<container_type, Alloc>::value == true、もし定義されています.
Original:
The following constructors are only defined if std::uses_allocator<container_type, Alloc>::value == true, that is, if the underlying container is an allocator-aware container (true for all standard library containers).
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.
5)
アロケータとして
alloc
を使用して、基になるコンテナを構築します。効果的にc(alloc)呼び出し.Original:
Constructs the underlying container using
alloc
as allocator. Effectively calls c(alloc).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.
6)
cont
の内容とアロケータとしてalloc
を使用して基になるコンテナを構築します。効果的にc(cont, alloc)呼び出し.Original:
Constructs the underlying container with the contents of
cont
and using alloc
as allocator. Effectively calls c(cont, alloc).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.
7)
アロケータとして
cont
を活用しながら移動セマンティクスを使用してalloc
の内容を基になるコンテナを構築します。効果的にc(std::move(cont), alloc)呼び出し.Original:
Constructs the underlying container with the contents of
cont
using move semantics while utilising alloc
as allocator. Effectively calls c(std::move(cont), alloc).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.
8)
other.c
の内容とアロケータとしてalloc
を使用して、アダプタを構築します。効果的にc(athor.c, alloc)呼び出し.Original:
Constructs the adaptor with the contents of
other.c
and using alloc
as allocator. Effectively calls c(athor.c, alloc).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.
9)
アロケータとして
other
を活用しながら移動セマンティクスを使用してalloc
の内容を持つアダプタを構築します。効果的にc(std::move(other.c), alloc)呼び出し.Original:
Constructs the adaptor with the contents of
other
using move semantics while utilising alloc
as allocator. Effectively calls c(std::move(other.c), alloc).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.
目次 |
[編集] パラメータ
alloc | - | 基になるコンテナのすべてのメモリ割り当てに使用するアロケータ
Original: allocator to use for all memory allocations of the underlying container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
other | - | 基になるコンテナを初期化するために、ソースとして使用する別のコンテナアダプタ
Original: another container adaptor to be used as source to initialize the underlying container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
cont | - | コンテナは、基礎となるコンテナを初期化するためのソースとして使用される
Original: container to be used as source to initialize the underlying container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
first, last | - | で初期化する要素の範囲
Original: range of elements to initialize with The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
型の要件 | ||
-Alloc は Allocator
の要求を満足しなければなりません。 | ||
-Container は Container
の要求を満足しなければなりません。 The constructors (5-10) are only defined if | ||
-InputIt は InputIterator
の要求を満足しなければなりません。 |
[編集] 複雑
1、3、5、6、8:
cont
またはother
で線形Original:
1, 3, 5, 6, 8: linear in
cont
or other
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.
2、4、7、9:定数
Original:
2, 4, 7, 9: constant
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.
This section is incomplete |
[編集] 例
このコードを実行します
#include <stack> #include <deque> #include <iostream> int main() { std::stack<int> c1; c1.push(5); std::cout << c1.size() << '\n'; std::stack<int> c2(c1); std::cout << c2.size() << '\n'; std::deque<int> deq {3, 1, 4, 1, 5}; std::stack<int> c3(deq); std::cout << c3.size() << '\n'; }
出力:
1 1 5
[編集] も参照してください
コンテナアダプタに値を割り当てます Original: assigns values to the container adaptor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) |