c++-gtk-utils

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

std::hash Class Reference
handles and smart pointers

A specialization of std::hash for Cgu::Callback::FunctorArg, Cgu::Callback::SafeFunctorArg, Cgu::GobjHandle, Cgu::GvarHandle, Cgu::IntrusivePtr, Cgu::SharedHandle, Cgu::SharedLockHandle, Cgu::SharedPtr and Cgu::SharedLockPtr so that such objects may be keys of unordered associative containers. More...

## Detailed Description

A specialization of std::hash for Cgu::Callback::FunctorArg, Cgu::Callback::SafeFunctorArg, Cgu::GobjHandle, Cgu::GvarHandle, Cgu::IntrusivePtr, Cgu::SharedHandle, Cgu::SharedLockHandle, Cgu::SharedPtr and Cgu::SharedLockPtr so that such objects may be keys of unordered associative containers.

These specializations of std::hash are available from version 2.0.0-rc3. Their constructors will not throw. A call to their operator()() methods will not throw, unless std::hash<T*>'s constructor or operator()() method throws, which would not happen with any sane implementation (hashing a pointer generally consists only of reinterpret_cast<>ing the address held by the pointer to std::size_t).

The specializations for Cgu::Callback::FunctorArg and Cgu::Callback::SafeFunctorArg are in c++-gtk-utils/callback.h and hash the address of the Cgu::Callback::CallbackArg object contained by the Cgu::Callback::FunctorArg or Cgu::Callback::SafeFunctorArg object, by handing that address off to std::hash<T*>. Two FunctorArg or SafeFunctorArg objects will be treated as equivalent if the addresses of the CallbackArg objects they contain are the same.

The specializations for the smart handles and smart pointers hash the address of the managed object, by handing that address off to std::hash<T*>. They are contained in the header file for the relevant smart handle/pointer. Two smart handle/pointer objects will be treated as equivalent if the addresses of the managed objects are the same.

The documentation for this class was generated from the following file:

- doxygen.main