hash


A unary function object that returns the hash value of its operand.

Library

Standards<ToolKit>

Declaration


#include <ospace/osstd/hashfunc.h>

template< class T >
struct hash : unary_function< T, size_t >

Interface

()
size_t operator()( const T& key ) const
Returns (size_t) key .
Example <ospace/osstd/examples/hash1.cpp>
#include <iostream>
#include <ospace/osstd/hashfunc.h>

int array[ 4 ] = { 3, 1, 4, 2 };

void
main()
  {
  hash< int > hasher;

  for ( int i = 0; i < 4; ++i )
    cout
      << "The hash value for : "
      << array[ i ] << " is " << hasher( array[ i ] ) << endl;
  }


Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.