operator<= (hash_map)
Comprueba si es el objeto de hash_map en el lado izquierdo del operador menor o igual que el objeto de hash_map en el lado derecho.
bool operator<=(
const hash_map <Key, Type, Traits, Allocator>& _Left,
const hash_map <Key, Type, Traits, Allocator>& _Right
);
Parámetros
_Left
Objeto de tipo hash_map._Right
Objeto de tipo hash_map.
Valor devuelto
TRUE si el hash_map en el lado izquierdo del operador es menor o igual que el hash_map a la derecha del operador; si no Falso.
nota
La comparación entre los objetos de hash_map se basa en pares una comparación de sus elementos. Menor o igual que la relación entre dos objetos se basa en una comparación del primer par de elementos distintos.
En Visual C++ .NET 2003, los miembros de los archivos de encabezado de <hash_map> y de <hash_set> ya no están en el espacio de nombres std, pero se han movido bastante al espacio de nombres stdext. Vea El espacio de nombres stdext para obtener más información.
Ejemplo
// hash_map_op_le.cpp
// compile with: /EHsc
#define _DEFINE_DEPRECATED_HASH_CLASSES 0
#include <hash_map>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_map <int, int> hm1, hm2, hm3, hm4;
int i;
typedef pair <int, int> Int_Pair;
for ( i = 1 ; i < 3 ; i++ )
{
hm1.insert ( Int_Pair ( i, i ) );
hm2.insert ( Int_Pair ( i, i * i ) );
hm3.insert ( Int_Pair ( i, i - 1 ) );
hm4.insert ( Int_Pair ( i, i ) );
}
if ( hm1 <= hm2 )
cout << "The hash_map hm1 is less than or equal to the hash_map hm2." << endl;
else
cout << "The hash_map hm1 is greater than the hash_map hm2." << endl;
if ( hm1 <= hm3 )
cout << "The hash_map hm1 is less than or equal to the hash_map hm3." << endl;
else
cout << "The hash_map hm1 is greater than the hash_map hm3." << endl;
if ( hm1 <= hm4 )
cout << "The hash_map hm1 is less than or equal to the hash_map hm4." << endl;
else
cout << "The hash_map hm1 is greater than the hash_map hm4." << endl;
}
Requisitos
encabezado: <hash_map>
espacio de nombres: stdext