priority_queue:
優先順序付きキュー。pushされた要素はtop/popのたんびに大きい順で取り出される。
#include <cliext/queue>
using namespace System;
using namespace System::Collections::Generic;
using namespace cliext;
int main() {
priority_queue<String^> q;
for each ( String^ item in
gcnew array<String^> { L"zero", L"one", L"two", L"three", L"four" } ) {
q.push(item); // push: 末尾に追加
}
while ( !q.empty() ) {
Console::WriteLine(q.top()); // queueの先頭(=最大要素)
q.pop(); // pop() の戻り値はvoid つまり先頭要素を廃棄する
}
return 0;
}