From 24aaa570635ffde4e8182ef15d35be4b558d59ab Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 3 Jan 2020 23:44:40 +0100 Subject: doc: rework free-function documentation --- doc/src/index.rst | 413 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 291 insertions(+), 122 deletions(-) (limited to 'doc') diff --git a/doc/src/index.rst b/doc/src/index.rst index ce6df9e..ff32dd0 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -175,16 +175,11 @@ The functions and functions templates described in this section provide addition Equality Comparison Operators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. cpp:function:: template \ - constexpr bool operator==(new_type const & lhs,\ - new_type const & rhs) +.. cpp:function:: template \ + constexpr bool operator==(new_type const & lhs, new_type const & rhs) Check two instances of :cpp:class:`new_type\` for equality. - **enablement:** This operator shall be available iff. :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`==` - :tparam BaseType: |BaseTypeDoc| :tparam TagType: |TagTypeDoc| :tparam DerivationClause: |DerivationClauseDoc| @@ -193,19 +188,15 @@ Equality Comparison Operators :returns: The value returned by the comparison of the contained objects. :throws: Any exception thrown by the comparison operator of objects contained by :literal:`lhs` and :literal:`rhs`. This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow equals-comparable*. + :enablement: This operator shall be available iff. :cpp:type:`new_type::base_type` supports comparison using :literal:`==` .. versionadded:: 1.0.0 -.. cpp:function:: template \ - constexpr bool operator==(new_type const & lhs,\ - BaseType const & rhs) +.. cpp:function:: template \ + constexpr bool operator==(new_type const & lhs, BaseType const & rhs) Check an instance of :cpp:class:`new_type\` for equality with an instance of :cpp:type:`BaseType`. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`==` and b) the :cpp:var:`derivation clause ` contains :cpp:var:`EqBase` - :tparam BaseType: |BaseTypeDoc| :tparam TagType: |TagTypeDoc| :tparam DerivationClause: |DerivationClauseDoc| @@ -213,7 +204,10 @@ Equality Comparison Operators :param rhs: The right-hand side of the comparison :returns: The value returned by the comparison of object contained by :literal:`lhs` with an object of the :cpp:type:`base type `. :throws: Any exception thrown by the comparison of object contained by :literal:`lhs` with an object of the :cpp:type:`base type `. This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow equals-comparable*. - + :enablement: This operator shall be available iff. + + a. :cpp:type:`new_type::base_type` supports comparison using :literal:`==` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`EqBase` .. versionadded:: 1.0.0 @@ -222,8 +216,6 @@ Equality Comparison Operators Check an instance of :cpp:type:`BaseType` for equality with an instance of :cpp:class:`new_type\`. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`==` and b) the :cpp:var:`derivation clause ` contains :cpp:var:`EqBase` - :tparam BaseType: |BaseTypeDoc| :tparam TagType: |TagTypeDoc| :tparam DerivationClause: |DerivationClauseDoc| @@ -231,61 +223,55 @@ Equality Comparison Operators :param rhs: The right-hand side of the comparison :returns: The value returned by the comparison of an object of :cpp:type:`base type ` with the object contained by :literal:`rhs`. :throws: Any exception thrown by the comparison of an object of :cpp:type:`base type ` with the object contained by :literal:`rhs`. This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow equals-comparable*. - + :enablement: This operator shall be available iff. + + a. :cpp:type:`new_type::base_type` supports comparison using :literal:`==` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`EqBase` .. versionadded:: 1.0.0 -.. cpp:function:: template \ - constexpr bool operator!=(new_type const &,\ - new_type const &) +.. cpp:function:: template \ + constexpr bool operator!=(new_type const & lhs, new_type const & rhs) Check two instances of :cpp:class:`new_type\` for in-equality. - **enablement:** This operator shall be available iff. :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`!=` - :tparam BaseType: |BaseTypeDoc| :tparam TagType: |TagTypeDoc| :tparam DerivationClause: |DerivationClauseDoc| :param lhs: The left-hand side of the comparison :param rhs: The right-hand side of the comparison :returns: The value returned by the comparison of the contained objects. - :throws: Any exception thrown by the comparison operator of objects contained by :literal:`lhs` and :literal:`rhs`. + :throws: Any exception thrown by the comparison operator of theobjects contained by :literal:`lhs` and :literal:`rhs`. This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow not-equals-comparable*. + :enablement: This operator shall be available iff. :cpp:type:`new_type::base_type` supports comparison using :literal:`!=` .. versionadded:: 1.0.0 -.. cpp:function:: template \ - constexpr bool operator!=(new_type const &,\ - BaseType const &) +.. cpp:function:: template \ + constexpr bool operator!=(new_type const & lhs, BaseType const & rhs) Check an instance of :cpp:class:`new_type\` for in-equality with an instance of :cpp:type:`BaseType`. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`!=` and b) the :cpp:var:`derivation clause ` contains :cpp:var:`EqBase` - :tparam BaseType: |BaseTypeDoc| :tparam TagType: |TagTypeDoc| :tparam DerivationClause: |DerivationClauseDoc| :param lhs: The left-hand side of the comparison :param rhs: The right-hand side of the comparison - :returns: The value returned by the comparison of object contained by :literal:`lhs` with an object of the :cpp:type:`base type `. - :throws: Any exception thrown by the comparison of object contained by :literal:`lhs` with an object of the :cpp:type:`base type `. This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow not-equals-comparable*. + :returns: The value returned by the comparison of the object contained by :literal:`lhs` with an object of the :cpp:type:`base type `. + :throws: Any exception thrown by the comparison of the object contained by :literal:`lhs` with an object of the :cpp:type:`base type `. + This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow not-equals-comparable*. + :enablement: This operator shall be available iff. + + a) :cpp:type:`new_type::base_type` supports comparison using :literal:`!=` and + b) the :cpp:var:`derivation clause ` contains :cpp:var:`EqBase` .. versionadded:: 1.0.0 -.. cpp:function:: template \ - constexpr bool operator!=(BaseType const &,\ - new_type const &) +.. cpp:function:: template \ + constexpr bool operator!=(BaseType const & lhs, new_type const & rhs) Check an instance of :cpp:type:`BaseType` for in-equality with an instance of :cpp:class:`new_type\`. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`!=` and b) the :cpp:var:`derivation clause ` contains :cpp:var:`EqBase` - :tparam BaseType: |BaseTypeDoc| :tparam TagType: |TagTypeDoc| :tparam DerivationClause: |DerivationClauseDoc| @@ -293,57 +279,93 @@ Equality Comparison Operators :param rhs: The right-hand side of the comparison :returns: The value returned by the comparison of an object of :cpp:type:`base type ` with the object contained by :literal:`rhs`. :throws: Any exception thrown by the comparison of an object of :cpp:type:`base type ` with the object contained by :literal:`rhs`. This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow not-equals-comparable*. + :enablement: This operator shall be available iff. + + a. :cpp:type:`new_type::base_type` supports comparison using :literal:`!=` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`EqBase` .. versionadded:: 1.0.0 Relational Comparison Operators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. cpp:function:: template \ - constexpr bool operator<(new_type const &, \ - new_type const &) +.. cpp:function:: template \ + constexpr bool operator<(new_type const & lhs, new_type const & rhs) - **noexcept specification:** This comparison operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow less-than-comparable. + Compare two instances of the same :cpp:class:`new_type` using :literal:`<` (*less-than*). + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the comparison + :param rhs: The right-hand side of the comparison + :returns: The value returned by the comparison of the contained objects. + :throws: Any exception thrown by the comparison operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow less-than-comparable*. + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`<` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Relational`. + a. :cpp:type:`new_type::base_type` supports comparison using :literal:`<` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Relational` .. versionadded:: 1.0.0 -.. cpp:function:: template \ - constexpr bool operator>(new_type const &, \ - new_type const &) +.. cpp:function:: template \ + constexpr bool operator>(new_type const & lhs, new_type const & rhs) - **noexcept specification:** This comparison operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow greater-than-comparable. + Compare two instances of the same :cpp:class:`new_type` using :literal:`>` (*greater-than*). + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the comparison + :param rhs: The right-hand side of the comparison + :returns: The value returned by the comparison of the contained objects. + :throws: Any exception thrown by the comparison operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow greater-than-comparable*. + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`>` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Relational`. + a. :cpp:type:`new_type::base_type` supports comparison using :literal:`>` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Relational` .. versionadded:: 1.0.0 -.. cpp:function:: template \ - constexpr bool operator<=(new_type const &, \ - new_type const &) +.. cpp:function:: template \ + constexpr bool operator<=(new_type const & lhs, new_type const & rhs) - **noexcept specification:** This comparison operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow less-than-or-equal-comparable. + Compare two instances of the same :cpp:class:`new_type` using :literal:`<=` (*less-than-equal*). + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the comparison + :param rhs: The right-hand side of the comparison + :returns: The value returned by the comparison of the contained objects. + :throws: Any exception thrown by the comparison operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow less-than-equal-comparable*. + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`<=` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Relational`. + a. :cpp:type:`new_type::base_type` supports comparison using :literal:`<=` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Relational` .. versionadded:: 1.0.0 -.. cpp:function:: template \ - constexpr bool operator>=(new_type const &, \ - new_type const &) +.. cpp:function:: template \ + constexpr bool operator>=(new_type const & lhs, new_type const & rhs) - **noexcept specification:** This comparison operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow greater-than-or-equal-comparable. + Compare two instances of the same :cpp:class:`new_type` using :literal:`>=` (*greater-than-equal*). + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the comparison + :param rhs: The right-hand side of the comparison + :returns: The value returned by the comparison of the contained objects. + :throws: Any exception thrown by the comparison operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow greater-than-equal-comparable*. + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports comparison using the operator :literal:`>=` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Relational`. + a. :cpp:type:`new_type::base_type` supports comparison using :literal:`>=` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Relational` .. versionadded:: 1.0.0 @@ -355,12 +377,22 @@ Stream I/O Operators auto DerivationClause, \ typename CharType, \ typename StreamTraits> \ - std::basic_ostream & operator<<(std::basic_ostream &, \ - new_type const &) + std::basic_ostream & operator<<(std::basic_ostream & out, new_type const & value) - **noexcept specification:** This output operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow output streamable. - - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports being output to a stream using the operator :literal:`<<` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Show`. + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :tparam CharType: The stream character type + :tparam StreamTraits: The traits of the output stream + :param out: The output stream + :param value: A :cpp:class:`new_type` value to write to the output stream + :returns: A reference to the output stream + :throws: Any exception thrown by the stream-output operator of the object contained by :literal:`value`. + This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow output-streamable*. + :enablement: This operator shall be available iff. + + a. :cpp:type:`new_type::base_type` supports being written to an output stream using :literal:`<<` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Show` .. versionadded:: 1.0.0 @@ -369,89 +401,218 @@ Stream I/O Operators auto DerivationClause, \ typename CharType, \ typename StreamTraits> \ - std::basic_istream & operator>>(std::basic_istream &, \ - new_type &) - - **noexcept specification:** This input operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow input streamable. + std::basic_istream & operator>>(std::basic_istream & in, new_type & value) - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` supports being read from a stream using the operator :literal:`>>` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Read`. + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :tparam CharType: The stream character type + :tparam StreamTraits: The traits of the input stream + :param in: The input stream + :param value: A :cpp:class:`new_type` value to be read from the output stream + :returns: A reference to the input stream + :throws: Any exception thrown by the stream-input operator of the object contained by :literal:`value`. + This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is *nothrow input-streamable*. + :enablement: This operator shall be available iff. + + a. :cpp:type:`new_type::base_type` supports being read from an input stream using :literal:`>>` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Read` .. versionadded:: 1.0.0 Arithmetic Operators ~~~~~~~~~~~~~~~~~~~~ -.. cpp:function:: template \ +.. cpp:function:: template \ constexpr new_type operator+(new_type const & lhs, new_type const & rhs) - **noexcept specification:** This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow addable as well as nothrow copy-constructible. + Add two instances of the same :cpp:class:`new_type`. + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the addition + :param rhs: The right-hand side of the addition + :returns: A new instance of :cpp:class:`new_type\` containing the result of applying :literal:`+` to the objects contained by :literal:`lhs` and :literal:`rhs`. + :throws: Any exception thrown by the addition operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. + + a. :cpp:type:`new_type::base_type` is *nothrow addable* and + b. :cpp:type:`new_type::base_type` is *nothrow copy-constructible* + + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` is addable using the operator :literal:`+` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Arithmetic`. + a. :cpp:type:`new_type::base_type` supports addition using :literal:`+` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Arithmetic` -.. cpp:function:: template \ + .. versionadded:: 1.0.0 + +.. cpp:function:: template \ constexpr new_type & operator+=(new_type & lhs, new_type const & rhs) - **noexcept specification:** This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow add-assignable. + Add two instances of the same :cpp:class:`new_type` by overwriting the first one. + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the addition + :param rhs: The right-hand side of the addition + :returns: A reference to the first argument containing the value modified by applying :literal:`+=` to the objects contained by :literal:`lhs` and :literal:`rhs`. + :throws: Any exception thrown by the addition-assignment operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. + + a. :cpp:type:`new_type::base_type` is *nothrow add-assignable* and + b. :cpp:type:`new_type::base_type` is *nothrow copy-constructible* + + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` is add-assignable using the operator :literal:`+=` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Arithmetic`. + a. :cpp:type:`new_type::base_type` supports addition using :literal:`+=` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Arithmetic` -.. cpp:function:: template \ + .. versionadded:: 1.0.0 + +.. cpp:function:: template \ constexpr new_type operator-(new_type const & lhs, new_type const & rhs) - **noexcept specification:** This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow subtractable as well as nothrow copy-constructible. + Subtract two instances of the same :cpp:class:`new_type`. + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the subtraction + :param rhs: The right-hand side of the subtraction + :returns: A new instance of :cpp:class:`new_type\` containing the result of applying :literal:`-` to the objects contained by :literal:`lhs` and :literal:`rhs`. + :throws: Any exception thrown by the subtraction operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. + + a. :cpp:type:`new_type::base_type` is *nothrow subtractable* and + b. :cpp:type:`new_type::base_type` is *nothrow copy-constructible* + + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` is subtractable using the operator :literal:`-` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Arithmetic`. + a. :cpp:type:`new_type::base_type` supports subtraction using :literal:`-` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Arithmetic` -.. cpp:function:: template \ + .. versionadded:: 1.0.0 + +.. cpp:function:: template \ constexpr new_type & operator-=(new_type & lhs, new_type const & rhs) - **noexcept specification:** This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow subtract-assignable. + Subtract two instances of the same :cpp:class:`new_type` by overwriting the first one. + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the subtraction + :param rhs: The right-hand side of the subtraction + :returns: A reference to the first argument containing the value modified by applying :literal:`-=` to the objects contained by :literal:`lhs` and :literal:`rhs`. + :throws: Any exception thrown by the subtraction-assignment operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. + + a. :cpp:type:`new_type::base_type` is *nothrow subtract-assignable* and + b. :cpp:type:`new_type::base_type` is *nothrow copy-constructible* + + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` is subtract-assignable using the operator :literal:`-=` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Arithmetic`. + a. :cpp:type:`new_type::base_type` supports subtraction using :literal:`-=` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Arithmetic` -.. cpp:function:: template \ + .. versionadded:: 1.0.0 + +.. cpp:function:: template \ constexpr new_type operator*(new_type const & lhs, new_type const & rhs) - **noexcept specification:** This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow multipliable as well as nothrow copy-constructible. + Multiply two instances of the same :cpp:class:`new_type`. + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the multiplication + :param rhs: The right-hand side of the multiplication + :returns: A new instance of :cpp:class:`new_type\` containing the result of applying :literal:`*` to the objects contained by :literal:`lhs` and :literal:`rhs`. + :throws: Any exception thrown by the multiplication operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. + + a. :cpp:type:`new_type::base_type` is *nothrow multipliable* and + b. :cpp:type:`new_type::base_type` is *nothrow copy-constructible* + + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` is multipliable using the operator :literal:`*` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Arithmetic`. + a. :cpp:type:`new_type::base_type` supports multiplication using :literal:`*` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Arithmetic` -.. cpp:function:: template \ + .. versionadded:: 1.0.0 + +.. cpp:function:: template \ constexpr new_type & operator*=(new_type & lhs, new_type const & rhs) - **noexcept specification:** This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow multiply-assignable. + Multiply two instances of the same :cpp:class:`new_type` by overwriting the first one. + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the multiplication + :param rhs: The right-hand side of the multiplication + :returns: A reference to the first argument containing the value modified by applying :literal:`*=` to the objects contained by :literal:`lhs` and :literal:`rhs`. + :throws: Any exception thrown by the multiplication-assignment operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. + + a. :cpp:type:`new_type::base_type` is *nothrow multiply-assignable* and + b. :cpp:type:`new_type::base_type` is *nothrow copy-constructible* + + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` is multiply-assignable using the operator :literal:`*=` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Arithmetic`. + a. :cpp:type:`new_type::base_type` supports multiplication using :literal:`*=` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Arithmetic` -.. cpp:function:: template \ + .. versionadded:: 1.0.0 + +.. cpp:function:: template \ constexpr new_type operator/(new_type const & lhs, new_type const & rhs) - **noexcept specification:** This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow dividable as well as nothrow copy-constructible. + Divide two instances of the same :cpp:class:`new_type`. + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the division + :param rhs: The right-hand side of the division + :returns: A new instance of :cpp:class:`new_type\` containing the result of applying :literal:`/` to the objects contained by :literal:`lhs` and :literal:`rhs`. + :throws: Any exception thrown by the division operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. + + a. :cpp:type:`new_type::base_type` is *nothrow dividable* and + b. :cpp:type:`new_type::base_type` is *nothrow copy-constructible* + + :enablement: This operator shall be available iff. - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` is dividable using the operator :literal:`/` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Arithmetic`. + a. :cpp:type:`new_type::base_type` supports division using :literal:`/` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Arithmetic` -.. cpp:function:: template \ + .. versionadded:: 1.0.0 +.. cpp:function:: template \ constexpr new_type & operator/=(new_type & lhs, new_type const & rhs) - **noexcept specification:** This operator shall be noexcept iff. :cpp:type:`new_type::base_type` is nothrow divide-assignable. + Divide two instances of the same :cpp:class:`new_type` by overwriting the first one. + + :tparam BaseType: |BaseTypeDoc| + :tparam TagType: |TagTypeDoc| + :tparam DerivationClause: |DerivationClauseDoc| + :param lhs: The left-hand side of the division + :param rhs: The right-hand side of the division + :returns: A reference to the first argument containing the value modified by applying :literal:`/=` to the objects contained by :literal:`lhs` and :literal:`rhs`. + :throws: Any exception thrown by the division-assignment operator of the objects contained by :literal:`lhs` and :literal:`rhs`. + This operator shall be noexcept iff. + + a. :cpp:type:`new_type::base_type` is *nothrow divide-assignable* and + b. :cpp:type:`new_type::base_type` is *nothrow copy-constructible* - **enablement:** This operator shall be available iff. a) :cpp:type:`new_type::base_type` is divide-assignable using the operator :literal:`/=` and b) :cpp:type:`DerivationClause` includes :cpp:var:`Arithmetic`. + :enablement: This operator shall be available iff. + + a. :cpp:type:`new_type::base_type` supports division using :literal:`/=` and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Arithmetic` + + .. versionadded:: 1.0.0 :cpp:class:`std::hash` Support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -465,9 +626,15 @@ Arithmetic Operators :tparam TagType: |TagTypeDoc| :tparam DerivationClause: |DerivationClauseDoc| - .. cpp:function:: constexpr std::size operator()(nt::new_type const &) const + .. cpp:function:: constexpr std::size operator()(nt::new_type const & value) 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`. + :param value: A :cpp:class:`nt::new_type` value to be hashed + :returns: The result of applying :cpp:class:`std::hash` to the object contained by :literal:`value` + :throws: Any exception thrown by the call operator of the specialization of :cpp:class`std::hash` for the type of the object contained by :literal:`value`. + :enablement: This operator shall be available iff. + + a. :cpp:type:`nt::new_type::base_type` is hashable and + b. the :cpp:var:`derivation clause ` contains :cpp:var:`Hash `. .. versionadded:: 1.0.0 @@ -484,6 +651,8 @@ Class template :cpp:type:`derivable` .. cpp:class:: template \ derivable + :tparam NameTag: A tag uniquely identifing a specific derivation tag + .. versionadded:: 1.0.0 .. _sec-standard-derivation-tags: -- cgit v1.2.3