Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

priority queue in cpp

// priority_queue::swap
#include <iostream>       // std::cout
#include <queue>          // std::priority_queue

int main ()
{
  std::priority_queue<int> foo,bar;
  foo.push (15); foo.push(30); foo.push(10);
  bar.push (101); bar.push(202);

  foo.swap(bar);

  std::cout << "size of foo: " << foo.size() << '
';
  std::cout << "size of bar: " << bar.size() << '
';

  return 0;
}
Source by m.cplusplus.com #
 
PREVIOUS NEXT
Tagged: #priority #queue #cpp
ADD COMMENT
Topic
Name
7+5 =