Compartir a través de


operator<= (hash_multimap)

Tests if the hash_multimap object on the left side of the operator is less than or equal to the hash_multimap object on the right side.

bool operator<=(
   const hash_multimap <Key, Type, Traits, Allocator>& _Left,
   const hash_multimap <Key, Type, Traits, Allocator>& _Right
);

Parameters

  • _Left
    An object of type hash_multimap.

  • _Right
    An object of type hash_multimap.

Return Value

true if the hash_multimap on the left side of the operator is less than or equal to the hash_multimap on the right side of the operator; otherwise false.

Remark

The comparison between hash_multimap objects is based on a pairwise comparison of their elements. The less than or equal to relationship between two objects is based on a comparison of the first pair of unequal elements.

In Visual C++ .NET 2003, members of the <hash_map> and <hash_set> header files are no longer in the std namespace, but rather have been moved into the stdext namespace. See The stdext Namespace for more information.

Example

// hash_multimap_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_multimap <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_multimap hm1 is less than or equal to the hash_multimap hm2." << endl;
   else
      cout << "The hash_multimap hm1 is greater than the hash_multimap hm2." << endl;

   if ( hm1 <= hm3 )
      cout << "The hash_multimap hm1 is less than or equal to the hash_multimap hm3." << endl;
   else
      cout << "The hash_multimap hm1 is greater than the hash_multimap hm3." << endl;

   if ( hm1 <= hm4 )
      cout << "The hash_multimap hm1 is less than or equal to the hash_multimap hm4." << endl;
   else
      cout << "The hash_multimap hm1 is greater than the hash_multimap hm4." << endl;
}
The hash_multimap hm1 is less than or equal to the hash_multimap hm2.
The hash_multimap hm1 is greater than the hash_multimap hm3.
The hash_multimap hm1 is less than or equal to the hash_multimap hm4.

Requirements

Header: <hash_map>

Namespace: stdext

See Also

Reference

Standard Template Library

Other Resources

<hash_map> Members