diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2020-01-02 22:38:18 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2020-01-02 22:39:49 +0100 |
| commit | b196e2c10ed8823c681623dfd7bc09b0eb3ad1d2 (patch) | |
| tree | 68a0670dba2ac95f71189383ce202e08345d9373 /doc | |
| parent | 6998183b580b60ac72f79b3ebc4f206fa35937ac (diff) | |
| download | newtype-b196e2c10ed8823c681623dfd7bc09b0eb3ad1d2.tar.xz newtype-b196e2c10ed8823c681623dfd7bc09b0eb3ad1d2.zip | |
new_type: implement support for base comparison
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/src/index.rst | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/doc/src/index.rst b/doc/src/index.rst index 3ef593d..0a92d90 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -181,6 +181,30 @@ Equality Comparison Operators .. cpp:function:: template<typename BaseType, \ typename TagType, \ auto DerivationClause> \ + constexpr bool operator==(new_type<BaseType, TagType, DerivationClause> const &,\ + BaseType const &) + + **noexcept specification:** This comparison operator shall be noexcept iff. :cpp:type:`new_type<BaseType, TagType, DerivationClause>::base_type` is nothrow equals-comparable. + + **enablement:** This operator shall be available iff. a) :cpp:type:`new_type<BaseType, TagType, DerivationClause>::base_type` supports comparison using the operator :literal:`==` and b) the derivation clause contains :cpp:var:`EqBase` + + .. versionadded:: 1.0.0 + +.. cpp:function:: template<typename BaseType, \ + typename TagType, \ + auto DerivationClause> \ + constexpr bool operator==(BaseType const &,\ + new_type<BaseType, TagType, DerivationClause> const &) + + **noexcept specification:** This comparison operator shall be noexcept iff. :cpp:type:`new_type<BaseType, TagType, DerivationClause>::base_type` is nothrow equals-comparable. + + **enablement:** This operator shall be available iff. a) :cpp:type:`new_type<BaseType, TagType, DerivationClause>::base_type` supports comparison using the operator :literal:`==` and b) the derivation clause contains :cpp:var:`EqBase` + + .. versionadded:: 1.0.0 + +.. cpp:function:: template<typename BaseType, \ + typename TagType, \ + auto DerivationClause> \ constexpr bool operator!=(new_type<BaseType, TagType, DerivationClause> const &,\ new_type<BaseType, TagType, DerivationClause> const &) @@ -190,6 +214,30 @@ Equality Comparison Operators .. versionadded:: 1.0.0 +.. cpp:function:: template<typename BaseType, \ + typename TagType, \ + auto DerivationClause> \ + constexpr bool operator!=(new_type<BaseType, TagType, DerivationClause> const &,\ + BaseType const &) + + **noexcept specification:** This comparison operator shall be noexcept iff. :cpp:type:`new_type<BaseType, TagType, DerivationClause>::base_type` is nothrow equals-comparable. + + **enablement:** This operator shall be available iff. a) :cpp:type:`new_type<BaseType, TagType, DerivationClause>::base_type` supports comparison using the operator :literal:`!=` and b) the derivation clause contains :cpp:var:`EqBase` + + .. versionadded:: 1.0.0 + +.. cpp:function:: template<typename BaseType, \ + typename TagType, \ + auto DerivationClause> \ + constexpr bool operator!=(BaseType const &,\ + new_type<BaseType, TagType, DerivationClause> const &) + + **noexcept specification:** This comparison operator shall be noexcept iff. :cpp:type:`new_type<BaseType, TagType, DerivationClause>::base_type` is nothrow equals-comparable. + + **enablement:** This operator shall be available iff. a) :cpp:type:`new_type<BaseType, TagType, DerivationClause>::base_type` supports comparison using the operator :literal:`!=` and b) the derivation clause contains :cpp:var:`EqBase` + + .. versionadded:: 1.0.0 + Relational Comparison Operators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -355,8 +403,8 @@ This header defines the alias template :cpp:type:`derivable` as well as the set Alias template :cpp:type:`derivable` ------------------------------------ -.. cpp:type:: template<typename NameTag> \ - derivable = type<NameTag> +.. cpp:struct:: template<typename NameTag> \ + derivable .. versionadded:: 1.0.0 @@ -373,7 +421,7 @@ Standard derivation tags .. cpp:var:: auto constexpr EqBase = derivable<struct eq_base_tag>{} - This tag enables the derivation of "Equality comparison with base type" operators :literal:`==` and :literal:`!=` + This tag enables the derivation of "Equality comparison with base type" operators :cpp:func:`template\<typename BaseType, typename TagType, auto DerivationClause> constexpr bool nt::operator==(BaseType const &, new_type<BaseType, TagType, DerivationClause> const &)`, :cpp:func:`template\<typename BaseType, typename TagType, auto DerivationClause> constexpr bool nt::operator==(new_type<BaseType, TagType, DerivationClause> const &, BaseType const &)` :cpp:func:`template\<typename BaseType, typename TagType, auto DerivationClause> constexpr bool nt::operator!=(BaseType const &, new_type<BaseType, TagType, DerivationClause> const &)`, and :cpp:func:`template\<typename BaseType, typename TagType, auto DerivationClause> constexpr bool nt::operator!=(new_type<BaseType, TagType, DerivationClause> const &, BaseType const &)` By virtue of its nature, deriving this feature compromises the strength of the given :cpp:class:`new_type`. .. versionadded:: 1.0.0 |
