diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2019-12-30 00:09:04 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2019-12-30 00:09:04 +0100 |
| commit | fc29ed3d33051078448d23ad7717e34037b261d6 (patch) | |
| tree | cd2a53c0abba7711316634d05dd63cf40134df8e | |
| parent | 17b5aca0e087820cf0545ac6923242676dd042d6 (diff) | |
| download | newtype-fc29ed3d33051078448d23ad7717e34037b261d6.tar.xz newtype-fc29ed3d33051078448d23ad7717e34037b261d6.zip | |
doc: document the deriving.hpp header
| -rw-r--r-- | doc/src/index.rst | 20 | ||||
| -rw-r--r-- | include/newtype/deriving.hpp | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/doc/src/index.rst b/doc/src/index.rst index 62e41f2..cf35ed9 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -15,6 +15,10 @@ The ``newtype`` library provides types and functions to facilitate the creation Example Usage ############# +.. note:: + + All examples shown in this section can be found in the directory :literal:`examples/src` within the source root. + :ref:`new-type-usage-basic` below demonstrates the basic usage of :cpp:class:`new_type`. In it, :cpp:class:`new_type` is used to create thre new strong aliases :literal:`Width`, :literal:`Height`, and :literal:`Area` that all alias :literal:`unsigned int`. @@ -262,6 +266,8 @@ Alias template :cpp:type:`derivable` .. cpp:type:: template<typename NameTag> \ derivable = type<NameTag> +.. _sec-standard-derivation-tags: + Standard derivation tags ------------------------ @@ -295,6 +301,20 @@ Standard derivation tags This tag enables the derivation of the "stream input" operator :cpp:func:`operator>>` +Header :literal:`<newtype/deriving.hpp>` +======================================== + +This header contains the definition of the function template :cpp:func:`deriving`. + +Function template :cpp:func:`deriving` +-------------------------------------- + +.. cpp:function:: template<typename... DerivableTags> \ + constexpr derivation_clause<DerivableTags...> deriving(derivable<DerivableTags>... features) noexcept + + This function can be used to create a new :cpp:class:`derivation_clause` for use in the definitions of instances of :cpp:class:`new_type`. + See :ref:`sec-standard-derivation-tags` for a list of standard derivation tags. + Header :literal:`<newtype/derivation_clause.hpp>` ================================================= diff --git a/include/newtype/deriving.hpp b/include/newtype/deriving.hpp index 7224d55..731e0ce 100644 --- a/include/newtype/deriving.hpp +++ b/include/newtype/deriving.hpp @@ -13,9 +13,9 @@ namespace nt * Create a new derivation clause with the given derivables */ template<typename... DerivableTags> - auto constexpr deriving(derivable<DerivableTags>... request) -> derivation_clause<DerivableTags...> + auto constexpr deriving(derivable<DerivableTags>... features) noexcept -> derivation_clause<DerivableTags...> { - return {request...}; + return {features...}; } } // namespace nt |
