iceoryx_hoofs 2.0.3
|
Implementation of the haskell NewType pattern: https://wiki.haskell.org/Newtype Lets say you would like to have an index which is in the end an integer but with certain restraints. The users should be forced to set it when they are creating it but afterwards it should be immutable. You would like to be able to compare the type as well as to sort it so that it can be stored in a map for instance. An example could be that you would like to have an index class with those properties and some additional methods. Then you can inherit from NewType and add your methods. More...
#include <iceoryx_hoofs/cxx/newtype.hpp>
Public Types | |
using | ThisType = NewType< T, Policies... > |
the type of *this | |
using | value_type = T |
the type of the underlying value | |
Public Member Functions | |
NewType () noexcept | |
default constructor | |
NewType (const T &rhs) noexcept | |
construct with value copy | |
NewType (const NewType &rhs) noexcept | |
copy constructor | |
NewType (NewType &&rhs) noexcept | |
move constructor | |
NewType & | operator= (const NewType &rhs) noexcept |
copy assignment | |
NewType & | operator= (NewType &&rhs) noexcept |
move assignment | |
NewType & | operator= (const T &rhs) noexcept |
copy by value assignment | |
NewType & | operator= (T &&rhs) noexcept |
copy by value assignment | |
operator T () const noexcept | |
conversion operator | |
Protected Member Functions | |
NewType (newtype::internal::ProtectedConstructor_t, const T &rhs) noexcept | |
Implementation of the haskell NewType pattern: https://wiki.haskell.org/Newtype Lets say you would like to have an index which is in the end an integer but with certain restraints. The users should be forced to set it when they are creating it but afterwards it should be immutable. You would like to be able to compare the type as well as to sort it so that it can be stored in a map for instance. An example could be that you would like to have an index class with those properties and some additional methods. Then you can inherit from NewType and add your methods.