diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/src/index.rst | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/src/index.rst b/doc/src/index.rst index 07f5fc3..133ab7e 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -1,5 +1,9 @@ .. cpp:namespace-push:: nt +.. |BaseTypeDoc| replace:: The type of the contained object +.. |TagTypeDoc| replace:: A tag to uniquely identify an instance of :cpp:class:`nt::new_type` +.. |DerivationClauseDoc| replace:: A (possibly empty) list of derivation tags as generated by :cpp:func:`nt::deriving` + .. only:: html .. contents:: Table of Contents @@ -395,6 +399,26 @@ Arithmetic Operators **enablement:** This operator shall be available iff. a) :cpp:type:`new_type<BaseType, TagType, DerivationClause>::base_type` is divide-assignable using the operator :literal:`/=` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Arithmetic`. +:cpp:struct:`std::hash` Support +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. cpp:namespace-pop:: + +.. cpp:struct:: template<typename BaseType, typename TagType, auto DerivationClause> \ + std::hash<nt::new_type<BaseType, TagType, DerivationClause>> + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + + .. cpp:function:: constexpr std::size operator()(nt::new_type<BaseType, TagType, DerivationClause> const &) const + + **enablement:** This operator shall be available iff. a) :cpp:type:`nt::new_type::base_type` is hashable and b) :cpp:var:`DerivationClause` contains :cpp:var:`nt::Hash`. + + .. versionadded:: 1.0.0 + +.. cpp:namespace-push:: nt + Header :literal:`<newtype/derivable.hpp>` ========================================= @@ -433,6 +457,12 @@ Standard derivation tags .. versionadded:: 1.0.0 +.. cpp:var:: auto constexpr Hash = derivable<struct hash_tag>{} + + This tag enables the derivation of a specialization of :cpp:struct:`std::hash` + + .. versionadded:: 1.0.0 + .. cpp:var:: auto constexpr Indirection = derivable<struct indirection_tag>{} This tag enables the derivation of the "member access through pointer" operators :cpp:func:`new_type::operator->` |
