Freigeben über


priority_queue::push (STL/CLR)

 

The latest version of this topic can be found at priority_queue::push (STL/CLR).

Adds a new element.

Syntax

void push(value_type val);  

Remarks

The member function inserts an element with value val into the the controlled sequence, and reorders the controlled sequence to maintain the heap discipline. You use it to add another element to the queue.

Example

// cliext_priority_queue_push.cpp   
// compile with: /clr   
#include <cliext/queue>   
  
typedef cliext::priority_queue<wchar_t> Mypriority_queue;   
int main()   
    {   
    Mypriority_queue c1;   
    c1.push(L'a');   
    c1.push(L'b');   
    c1.push(L'c');   
  
// display contents " a b c"   
    for each (wchar_t elem in c1.get_container())   
        System::Console::Write(" {0}", elem);   
    System::Console::WriteLine();   
    return (0);   
    }  
  
c a b  

Requirements

Header: <cliext/queue>

Namespace: cliext

See Also

priority_queue (STL/CLR)
priority_queue::pop (STL/CLR)