priority_queue::priority_queue (STL/CLR)
建構容器配接器物件。
priority_queue();
priority_queue(priority_queue<Value, Container> right);
priority_queue(priority_queue<Value, Container> right);
explicit priority_queue(value_compare^ pred);
priority_queue(value_compare^ pred, container_type% cont);
template<typename InIt>
priority_queue(InIt first, InIt last);
template<typename InIt>
priority_queue(InIt first, InIt last,
value_compare^ pred);
template<typename InIt>
priority_queue(InIt first, InIt last,
value_compare^ pred, container_type% cont);
參數
接續
若要複製的容器。第一個
若要插入範圍的開頭。last
若要插入範圍的結尾。pred
排序受控制序列的述詞。right
物件,則要插入的範圍。
備註
建構函式:
priority_queue();
以預設順序的述詞,會建立一個空白換行的容器。 您可以用它來指定空的初始受控制的序列,以預設順序的述詞。
建構函式:
priority_queue(priority_queue<Value, Container>% right);
會建立一個包裝的容器,是一份right.get_container(),排序的述詞與right.value_comp()。 您會用它來指定初始的受控制的序列是一份由佇列物件來控制序列的right,以相同順序的述詞。
建構函式:
priority_queue(priority_queue<Value, Container>^ right);
會建立一個包裝的容器,是一份right->get_container(),排序的述詞與right->value_comp()。 您會用它來指定初始的受控制的序列是一份由佇列物件來控制序列的*right,以相同順序的述詞。
建構函式:
explicit priority_queue(value_compare^ pred);
建立一個空白換行的容器,排序的述詞與pred。 您可以用它來指定空的初始受控制的序列,以指定順序的述詞。
建構函式:
priority_queue(value_compare^ pred, container_type cont);
建立一個空白換行的容器,排序的述詞與pred,然後將推入的所有項目cont您用它來指定排序的述詞與指定初始受控制的序列都算一個從一個現存的容器。
建構函式:
template<typename InIt>
priority_queue(InIt first, InIt last);
會建立一個空白換行的容器,具有預設排序述詞,然後將推入序列[first, last)。 您可以用它來指定初始受控制的序列都算一個從指定的 eqeuence,以指定順序的述詞。
建構函式:
template<typename InIt>
priority_queue(InIt first, InIt last,
value_compare^ pred);
建立一個空白換行的容器,排序的述詞與pred,然後將推入序列[first, last)。 您可以用它來指定初始受控制的序列都算一個從指定的 seqeuence,以指定順序的述詞。
建構函式:
template<typename InIt>
priority_queue(InIt first, InIt last,
value_compare^ pred, container_type% cont);
建立一個空白換行的容器,排序的述詞與pred,然後將推入的所有項目cont再加上順序[first, last)。 您可以用它來指定排序的述詞與指定初始受控制的序列都算一個指定的 seqeuence,和一個現存的容器。
範例
// cliext_priority_queue_construct.cpp
// compile with: /clr
#include <cliext/queue>
#include <cliext/deque>
typedef cliext::priority_queue<wchar_t> Mypriority_queue;
typedef cliext::deque<wchar_t> Mydeque;
int main()
{
// construct an empty container
Mypriority_queue c1;
Mypriority_queue::container_type^ wc1 = c1.get_container();
System::Console::WriteLine("size() = {0}", c1.size());
c1.push(L'a');
c1.push(L'b');
c1.push(L'c');
for each (wchar_t elem in wc1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an ordering rule
Mypriority_queue c2 = cliext::greater<wchar_t>();
System::Console::WriteLine("size() = {0}", c2.size());
for each (wchar_t elem in wc1)
c2.push(elem);
for each (wchar_t elem in c2.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an ordering rule by copying an underlying container
Mypriority_queue c2x =
gcnew Mypriority_queue(cliext::greater<wchar_t>(), *wc1);
for each (wchar_t elem in c2x.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an iterator range
Mypriority_queue c3(wc1->begin(), wc1->end());
for each (wchar_t elem in c3.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an iterator range and an ordering rule
Mypriority_queue c4(wc1->begin(), wc1->end(),
cliext::greater<wchar_t>());
for each (wchar_t elem in c4.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an iterator range, another container, and an ordering rule
Mypriority_queue c5(wc1->begin(), wc1->end(),
cliext::greater<wchar_t>(), *wc1);
for each (wchar_t elem in c5.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct from a generic container
Mypriority_queue c6(c3);
for each (wchar_t elem in c6.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct by copying another container
Mypriority_queue c7(%c3);
for each (wchar_t elem in c7.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// construct with an ordering rule, by copying an underlying container
Mypriority_queue c8 =
gcnew Mypriority_queue(cliext::greater<wchar_t>(), *wc1);
for each (wchar_t elem in c8.get_container())
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
需求
標頭: < cliext/佇列 >
Namespace: cliext
請參閱
參考
priority_queue::assign (STL/CLR)