名前空間
変種
操作

std::stack::stack

提供: cppreference.com
< cpp‎ | container‎ | stack

 
 
 
のstd ::スタック
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
stack::stack
stack::~stack
stack::operator=
要素アクセスの循環参照を解除するために使用されている
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
stack::top
容量
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
stack::empty
stack::size
修飾子
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
stack::push
stack::emplace
stack::pop
stack::swap
 
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.

目次

[編集] パラメータ

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.
Type requirements
-
Alloc must meet the requirements of Allocator.
-
Container must meet the requirements of Container. The constructors (5-10) are only defined if Container meets the requirements of AllocatorAwareContainer
-
InputIt must meet the requirements of 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.
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.

[編集]

#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';
}

Output:

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.

(パブリックメンバ関数) [edit]