名前空間
変種
操作

std::priority_queue::priority_queue

提供: cppreference.com

 
 
 
のstd :: priority_queue
メンバ関数
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.
priority_queue::priority_queue
priority_queue::~priority_queue
priority_queue::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.
priority_queue::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.
priority_queue::empty
priority_queue::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.
priority_queue::push
priority_queue::emplace
priority_queue::pop
priority_queue::swap
 
explicit priority_queue( const Compare& compare = Compare(),

                         const Container& cont = Container());

priority_queue( const Compare& compare, const Container& cont);
(1) (C + + 11時まで)

(C + + 11以来)
explicit priority_queue( const Compare& compare = Compare(),
                         Container&& cont = Container());
(2) (C + + 11以来)
priority_queue( const priority_queue& other );
(3)
priority_queue( priority_queue&& other );
(4) (C + + 11以来)
template< class Alloc >
explicit priority_queue( const Alloc& alloc );
(5) (C + + 11以来)
template< class Alloc >
priority_queue( const Compare& compare, const Alloc& alloc );
(6) (C + + 11以来)
template< class Alloc >

priority_queue( const Compare& compare, const Container& cont,

                const Alloc& alloc );
(7) (C + + 11以来)
template< class Alloc >

priority_queue( const Compare& compare, Container&& cont,

                const Alloc& alloc );
(8) (C + + 11以来)
template< class Alloc >
priority_queue( const priority_queue& other, const Alloc& alloc );
(9) (C + + 11以来)
template< class Alloc >
priority_queue( priority_queue&& other, const Alloc& alloc );
(10) (C + + 11以来)
template< class InputIt >

priority_queue( InputIt first, InputIt last,

                const Compare& compare, const Container& cont );
(11) (C + + 11以来)
template< class InputIt >

priority_queue(InputIt first, InputIt last,

               const Compare& compare = Compare(), Container&& cont = Container());
(12) (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を。 compの内容との比較ファンクタcompareは、コピー構築する。 std::make_heap(c.begin(), c.end(), comp)呼び出します。
Original:
{{{2}}}
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
これは、デフォルトのコンストラクタ(C + + 11時まで)です|Copy-constructs the underlying container c with the contents of cont. Copy-constructs the comparison functor comp with the contents of compare. Calls std::make_heap(c.begin(), c.end(), comp).}} This is also the default constructor (C + + 11時まで)}}
2)
c基になるコンテナstd::move(cont)は、Move-構築します。 compとの比較ファンクタstd::move(compare)は移動·構築します。 std::make_heap(c.begin(), c.end(), comp)呼び出します。また、これは、既定のコンストラクタ(C + + 11以来)です
Original:
Move-constructs the underlying container c with std::move(cont). Move-constructs the comparison functor comp with std::move(compare). Calls std::make_heap(c.begin(), c.end(), comp). 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の内容とコピー構築されます。比較ファンクタはstd::move(other.comp)を使って構築されます。 (暗黙的に宣言された)
Original:
Copy constructor. The adaptor is copy-constructed with the contents of other.c. The comparison functor is constructed with std::move(other.comp). (暗黙的に宣言された)
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).The比較ファンクタがstd::move(other.comp)で構築されているアダプタが構成されている。 (暗黙的に宣言された)
Original:
Move constructor. The adaptor is constructed with std::move(other.c).The comparison functor is constructed with std::move(other.comp). (暗黙的に宣言された)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5-10)
次のコンストラクタは、基になるコンテナはアロケータ対応の容器(すべての標準ライブラリコンテナの真)であれば、ある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)呼び出します。 comp is value-initialized.
Original:
Constructs the underlying container using alloc as allocator. Effectively calls c(alloc). comp is value-initialized.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
アロケータとしてallocを使用して、基になるコンテナを構築します。効果的にc(alloc)呼び出します。コピーコンストラクトcompcompareから.
Original:
Constructs the underlying container using alloc as allocator. Effectively calls c(alloc). Copy-constructs comp from compare.
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(cont, alloc)呼び出します。コピーコンストラクトcompcompareから.
Original:
Constructs the underlying container with the contents of cont and using alloc as allocator. Effectively calls c(cont, alloc). Copy-constructs comp from compare.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
アロケータとしてcontを活用しながら移動セマンティクスを使用してallocの内容を基になるコンテナを構築します。効果的にc(std::move(cont), alloc)呼び出します。コピーコンストラクトcompcompareから.
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). Copy-constructs comp from compare.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
other.cの内容とアロケータとしてallocを使用して、アダプタを構築します。効果的にc(athor.c, alloc)呼び出します。コピーコンストラクトcompother.compから.
Original:
Constructs the adaptor with the contents of other.c and using alloc as allocator. Effectively calls c(athor.c, alloc). Copy-constructs comp from other.comp.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
10)
アロケータとしてotherを活用しながら移動セマンティクスを使用してallocの内容を持つアダプタを構築します。効果的にc(std::move(other.c), alloc)呼び出します。 compother.compから構築物を移動.
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). Move-constructs comp from other.comp.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
11)
ccontからとcompcompareからコピーコンストラクト。その後c.insert(c.end(), first, last);呼び出し、次にstd::make_heap(c.begin(), c.end(), comp);呼び出し.
Original:
Copy-constructs c from cont and comp from compare. Then calls c.insert(c.end(), first, last);, and then calls std::make_heap(c.begin(), c.end(), comp);.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
12)
cstd::move(cont)からとcompstd::move(compare)から移動構築物。その後c.insert(c.end(), first, last);呼び出し、次にstd::make_heap(c.begin(), c.end(), comp);呼び出し.
Original:
Move-constructs c from std::move(cont) and comp from std::move(compare). Then calls c.insert(c.end(), first, last);, and then calls std::make_heap(c.begin(), c.end(), comp);.
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.
compare -
比較関数オブジェクトには、基になる比較ファンクタを初期化します
Original:
the comparison function object to initialize the underlying comparison functor
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 <queue>
#include <deque>
#include <iostream>
 
int main()
{
    std::priority_queue<int> c1;
    c1.push(5);
    std::cout << c1.size() << '\n';
 
    std::priority_queue<int> c2(c1);
    std::cout << c2.size() << '\n';
 
    std::deque<int> deq {3, 1, 4, 1, 5};
    std::priority_queue<int> c3(std::less<int>(), 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]