TypeSafe< T, Derived > Class Template Reference
|
CPP API
|
Public Types |
Public Member Functions |
Static Public Member Functions |
Private Attributes |
Friends |
List of all members
mio::TypeSafe< T, Derived > Class Template Reference
typesafe wrapper around any type to make function arguments, tuple elements, etc. More...
#include <type_safe.h>
Public Types | |
| using | ValueType = T |
Public Member Functions | |
| T | get () const |
| operator T () const | |
| conversion to underlying type. More... | |
| template<class IOContext > | |
| void | serialize (IOContext &io) const |
| serialize this. More... | |
| TypeSafe ()=default | |
| default constructor. More... | |
| TypeSafe (T t) | |
| value constructor. More... | |
Static Public Member Functions | |
| template<class IOContext > | |
| static IOResult< Derived > | deserialize (IOContext &io) |
| deserialize an object of this class. More... | |
Private Attributes | |
| T | m_t |
Friends | |
| bool | operator!= (const Derived &a, const Derived &b) |
| std::ostream & | operator<< (std::ostream &os, const Derived &ts) |
| stream operators. More... | |
| bool | operator== (const Derived &a, const Derived &b) |
| equality operators. More... | |
Detailed Description
template<class T, class Derived>
class mio::TypeSafe< T, Derived >
typesafe wrapper around any type to make function arguments, tuple elements, etc.
easily distinguishable. e.g. class Foo : public Type<int, Foo>() {}; class Bar : public Type<int, Bar>() {}; void work(Foo f, Bar b); instead of void work(int f, int b);
- Template Parameters
-
T type of the underlying value Derived Concrete type derived from this type for CRTP.
Member Typedef Documentation
◆ ValueType
template<class T , class Derived >
| using mio::TypeSafe< T, Derived >::ValueType = T |
Constructor & Destructor Documentation
◆ TypeSafe() [1/2]
template<class T , class Derived >
|
default |
default constructor.
◆ TypeSafe() [2/2]
template<class T , class Derived >
|
inlineexplicit |
value constructor.
Member Function Documentation
◆ deserialize()
template<class T , class Derived >
template<class IOContext >
|
inlinestatic |
deserialize an object of this class.
- See also
- mio::deserialize
◆ get()
template<class T , class Derived >
|
inline |
◆ operator T()
template<class T , class Derived >
|
inlineexplicit |
conversion to underlying type.
◆ serialize()
template<class T , class Derived >
template<class IOContext >
|
inline |
serialize this.
- See also
- mio::serialize
Friends And Related Function Documentation
◆ operator!=
template<class T , class Derived >
|
friend |
◆ operator<<
template<class T , class Derived >
|
friend |
stream operators.
◆ operator==
template<class T , class Derived >
|
friend |
equality operators.
Member Data Documentation
◆ m_t
template<class T , class Derived >
|
private |
Generated by