operator!= (<stack>)
Pokud objekt zásobníku na levé straně operátoru není rovno skládat zkoušky objekt na pravé straně.
bool operator!=(
const stack <Type, Container>& _Left,
const stack <Type, Container>& _Right,
);
Parametry
_Left
Objekt typu zásobníku._Right
Objekt typu zásobníku.
Vrácená hodnota
True Pokud hromádky nebo hromádky není stejný; FALSE Pokud hromádky nebo hromádky stejný.
Poznámky
Srovnání hromádky objektů je založena na párový porovnání jejich prvků.Pokud mají stejný počet prvků a jejich příslušné prvky mají stejné hodnoty rovnají dvěma zásobníkyJinak nerovné.
Příklad
// stack_op_me.cpp
// compile with: /EHsc
#include <stack>
#include <vector>
#include <iostream>
int main( )
{
using namespace std;
// Declares stacks with vector base containers
stack <int, vector<int> > s1, s2, s3;
// The following would have cause an error because stacks with
// different base containers are not equality comparable
// stack <int, list<int> > s3;
s1.push( 1 );
s2.push( 2 );
s3.push( 1 );
if ( s1 != s2 )
cout << "The stacks s1 and s2 are not equal." << endl;
else
cout << "The stacks s1 and s2 are equal." << endl;
if ( s1 != s3 )
cout << "The stacks s1 and s3 are not equal." << endl;
else
cout << "The stacks s1 and s3 are equal." << endl;
}
Požadavky
Záhlaví: <stack>
Obor názvů: std