Spec-Zone.ru › C++

std::hash<std::indirect>

Defined in header <memory>
template< class T, class Allocator >
struct hash<std::indirect<T, Allocator>>;
(since C++26)

The partial specialization of std::hash for std::indirect allows users to obtain hashes of the objects owned by indirect objects.

The specialization std::hash<std::indirect<T,Allocator>> is enabled if std::hash<T> is enabled, and is disabled otherwise.

When enabled, for an object obj of type std::indirect<T,Allocator>, std::hash<std::indirect<T, Allocator>>()(obj) evaluates to:

  • std::hash<T>()(*obj), if obj is not valueless.
  • An implementation-defined value, if obj is valueless.

The member functions of this specialization are not guaranteed to be noexcept because the hash of T might throw.

Example

See also

hash
(C++11)
hash function object
(class template)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/memory/indirect/hash

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API