BloombergLP::bslstl::HashTable_HashWrapper

Wrapper ensuring a hash functor's call operator is const-qualified.

Synopsis

Declared in <bslstl_hashtable.h>

template<class FUNCTOR>
class HashTable_HashWrapper;

Description

This class provides a wrapper around a functor satisfying the Hash requirements ({bslstl_hash}) such that the function call operator is always declared as const qualified.

TBD Provide an optimization for the case of an empty base functor, where we can safely const_cast want calling the base class operator.

Note that we would only one class, not two, with C++11 variadic templates and perfect forwarding, and we could also easily detect whether or not FUNCTOR provided a const-qualified operator().

Member Functions

NameDescription
HashTable_HashWrapper [constructor]Constructors
functor Return a reference to the wrapped hash functor.
operator() Call the wrapped hash functor with arg.
swap Exchange the wrapped hash functor with that of other.

Specializations

NameDescription
HashTable_HashWrapper<FUNCTOR const> Partial specialization for const-qualified hash functors.
HashTable_HashWrapper<FUNCTOR&> Partial specialization for const-qualified hash functors.

Non-Member Functions

NameDescription
swapSwap the functors wrapped by a and b.