diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2019-12-28 15:12:24 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2019-12-28 15:12:24 +0100 |
| commit | aca0416ba6f13d087348089fb4cc5d4c85b3705f (patch) | |
| tree | 9f1b0a6f11d19479f4338254eb8e171ee986c194 | |
| parent | 4d1b14ab52d7f0ba24b2a1383476a60031f6f87c (diff) | |
| download | newtype-aca0416ba6f13d087348089fb4cc5d4c85b3705f.tar.xz newtype-aca0416ba6f13d087348089fb4cc5d4c85b3705f.zip | |
doc: add outline for nt::derivation_clause
| -rw-r--r-- | doc/src/index.rst | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/doc/src/index.rst b/doc/src/index.rst index 41f9675..e9c69c0 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -14,7 +14,7 @@ It provides detailed descriptions of the types and functions designed to be used Additionally, this section provides usage examples that demonstrate the use and properties of the public API. Class template :cpp:class:`new_type` ----------------------------------------- +------------------------------------ .. cpp:class:: template<typename BaseType, typename TagType, auto DerivationClause = deriving()> \ new_type @@ -24,7 +24,7 @@ Class template :cpp:class:`new_type` :tparam BaseType: The underlying type of the new strong alias :tparam TagType: A type uniquely identifying this string alias - :tparam DerivationClause: A :cpp:struct:`derivation_clause` listing all features that shall be automatically derived. + :tparam DerivationClause: A :cpp:class:`derivation_clause` listing all features that shall be automatically derived. Usage @@ -202,5 +202,62 @@ Free Relational Operators Free Stream Input/Ouput Operators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Class template :cpp:class:`derivation_clause` +--------------------------------------------- + +.. cpp:class:: template<typename... DerivableTags> \ + derivation_clause + + Derivation clauses are used by :cpp:class:`new_type` to allow users to specify a set of automatically derived support functions. + + :tparam DerivableTags: A (possibly empty) list of derivation tags to mark automatically derived features + +Synopsis +~~~~~~~~ + +.. code-block:: c++ + + namespace nt + { + template<typename... DerivableTags> + class derivation_clause + { + public: + // Constructors + + constexpr derivation_clause(derivable<DerivableTags>...) noexcept; + + // Evaluation functions + + template<typename DerivableTag> + auto constexpr operator()(derivable<DerivableTag>) const noexcept -> bool; + + template<typename DerivableTag, typename... RemainingDerivableTags> + auto constexpr operator()(derivable<DerivableTag>, derivable<RemainingDerivableTags>...) const noexcept -> bool; + + // Equality comparison operators + + template<typename... OtherDerivableTags> + auto constexpr operator==(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool; + + template<typename... OtherDerivableTags> + auto constexpr operator!=(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool; + + // Relational operators + + template<typename... OtherDerivableTags> + auto constexpr operator<(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool; + + template<typename... OtherDerivableTags> + auto constexpr operator>(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool; + + template<typename... OtherDerivableTags> + auto constexpr operator<=(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool; + + template<typename... OtherDerivableTags> + auto constexpr operator>=(derivation_clause<OtherDerivableTags...> other) const noexcept -> bool; + }; + } + Unit Tests ========== |
