diff --git a/doc/00_optional.qbk b/doc/00_optional.qbk index e48c8e4..5ff5981 100644 --- a/doc/00_optional.qbk +++ b/doc/00_optional.qbk @@ -2,7 +2,7 @@ [quickbook 1.4] [authors [Cacciola Carballal, Fernando Luis]] [copyright 2003-2007 Fernando Luis Cacciola Carballal] - [copyright 2014-2021 Andrzej Krzemieński] + [copyright 2014-2022 Andrzej Krzemieński] [category miscellaneous] [id optional] [dirname optional] diff --git a/doc/27_ref_optional_synopsis.qbk b/doc/27_ref_optional_synopsis.qbk index bcd18e8..9af4d76 100644 --- a/doc/27_ref_optional_synopsis.qbk +++ b/doc/27_ref_optional_synopsis.qbk @@ -73,6 +73,16 @@ } // namespace boost + namespace std { + + template + struct hash > ; ``[link reference_std_hash_spec __GO_TO__]`` + + template + struct hash > ; ``[link reference_std_hash_spec __GO_TO__]`` + + } // namespace std + [endsect] diff --git a/doc/28_ref_optional_semantics.qbk b/doc/28_ref_optional_semantics.qbk index 2fa7500..d14e7d9 100644 --- a/doc/28_ref_optional_semantics.qbk +++ b/doc/28_ref_optional_semantics.qbk @@ -1408,3 +1408,37 @@ assert (addressof(*opt0) == addressof(y)); `` [endsect] + + +[section Detailed Semantics - std::hash Specializations] + +__SPACE__ +[#reference_std_hash_spec] + +`` +namespace std { + +template +struct hash > ; + +template +struct hash > ; + +} // namespace std +`` + +The specialization `hash>`` is enabled if and only if +`hash> is enabled. When enabled, for an object `o` +of type `optional``, if `o.has_­value() == true`, then `hash>()(o)` + evaluates to the same value as `hash>()(*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 +`std::hash>`. If this happens, define macro +`BOOST_OPTIONAL_CONFIG_DO_NOT_SPECIALIZE_STD_HASH` to suppress the specializations +of `std::hash` in this library. +] + +[endsect] diff --git a/doc/91_relnotes.qbk b/doc/91_relnotes.qbk index d61b289..8db03b0 100644 --- a/doc/91_relnotes.qbk +++ b/doc/91_relnotes.qbk @@ -1,7 +1,7 @@ [/ Boost.Optional - Copyright (c) 2015 - 2021 Andrzej Krzemienski + Copyright (c) 2015 - 2022 Andrzej Krzemienski Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at @@ -11,6 +11,10 @@ [section:relnotes Release Notes] +[heading Boost Release 1.80] + +* Added specializations for `std::hash>`. This fixes [@https://github.com/boostorg/optional/issues/55 issue #55]. + [heading Boost Release 1.79] * Fixed [@https://github.com/boostorg/optional/issues/98 issue #98].