...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
namespace std { template <typename T> struct hash<boost::optional<T> > ; template <typename T> struct hash<boost::optional<T&> > ; } // namespace std
The specialization hash<optional<T>>
is enabled if and only if hash<remove_const_t<T>>
is enabled. When enabled, for an object o
of type optional<T>
,
if o.has_value() == true
,
then hash<optional<T>>()(o)
evaluates
to the same value as hash<remove_const_t<T>>()(*o)
; otherwise
it evaluates to an unspecified value. The member functions are not guaranteed
to be noexcept
.
Caution | |
---|---|
You may get compiler errors when your program provides specializations
for |