CppGraph Application Framework©
Copyright © 2004-202x Geoff Goldberg
Public Types | Public Member Functions | Static Public Member Functions | List of all members
cppgraph::named_type_t< T, Dummy_Parameter > Struct Template Reference

A named type narrows another type. More...

#include <named_type.h>

Inheritance diagram for cppgraph::named_type_t< T, Dummy_Parameter >:
Inheritance graph
[legend]

Public Types

using value_type = T
 Underlying type.
 

Public Member Functions

constexpr named_type_t () noexcept=default
 Default construction. More...
 
template<typename... Args>
constexpr named_type_t (Args &&... args)
 Constructor. More...
 
 operator T const & () const
 Value accessor. More...
 
T & operator* ()
 Accessor. More...
 
T const & operator* () const
 Accessor. More...
 
named_type_toperator*= (T const &t)
 Multiplies the value of this named type by the value of a specified named type. More...
 
named_type_toperator++ ()
 Pre-increments the value of this named type. More...
 
named_type_t operator++ (int)
 Post-increments the value of this named type. More...
 
named_type_toperator+= (T const &t)
 Adds the value of a specified named type to the value of this named type. More...
 
named_type_toperator-- ()
 Pre-decrements the value of this named type. More...
 
named_type_t operator-- (int)
 Post-decrements the value of this named type. More...
 
named_type_toperator-= (T const &t)
 Subtracts the value of a specified named type from the value of this named type. More...
 
T const * operator-> () const
 Accessor. More...
 
T * operator-> ()
 Accessor. More...
 
named_type_toperator/= (T const &t)
 Divides the value of this named type by the value of a specified named type. More...
 
template<typename U >
to_value () const
 Returns a reference to this named type's value converted to a specified type, which may be a derived named type or a type that can be static_cast from type T. More...
 

Static Public Member Functions

template<typename U >
static named_type_t from_value (U const &u)
 Creates a named_type_t from a value of a type that can be static_cast to T. More...
 
static named_type_t max ()
 Returns the maximum value for this named type's value_type. More...
 

Detailed Description

template<typename T, typename Dummy_Parameter>
struct cppgraph::named_type_t< T, Dummy_Parameter >

A named type narrows another type.

Template Parameters
TType of the value to be narrowed.
Dummy_ParameterA type unique to each instantiation. It is necessary but unused.
See also
CPPGRAPH_DECLARE_NAMED_TYPE(), CPPGRAPH_DECLARE_DERIVED_NAMED_TYPE(), CPPGRAPH_DECLARE_NAMED_TYPE_TYPENAME(), CPPGRAPH_DECLARE_LITERAL().

Constructor & Destructor Documentation

◆ named_type_t() [1/2]

template<typename T, typename Dummy_Parameter>
constexpr cppgraph::named_type_t< T, Dummy_Parameter >::named_type_t ( )
inlinedefaultnoexcept

Default construction.

The contained value is initialized to its default value;

◆ named_type_t() [2/2]

template<typename T, typename Dummy_Parameter>
template<typename... Args>
constexpr cppgraph::named_type_t< T, Dummy_Parameter >::named_type_t ( Args &&...  args)
inlineexplicit

Constructor.

Parameters
argsArguments to forward to the constructor of value_type.
Returns
A reference to this instance's value.

Member Function Documentation

◆ from_value()

template<typename T, typename Dummy_Parameter>
template<typename U >
static named_type_t cppgraph::named_type_t< T, Dummy_Parameter >::from_value ( U const &  u)
inlinestatic

Creates a named_type_t from a value of a type that can be static_cast to T.

Template Parameters
UA type that can be static_cast to T. It is deduced by the compiler and therefore need not be specified.
Parameters
uA value.
Returns
A named_type_t<T> constructed from u.

◆ max()

template<typename T, typename Dummy_Parameter>
static named_type_t cppgraph::named_type_t< T, Dummy_Parameter >::max ( )
inlinestatic

Returns the maximum value for this named type's value_type.

Returns
The maximum value for this named type's value_type.

◆ operator T const &()

template<typename T, typename Dummy_Parameter>
cppgraph::named_type_t< T, Dummy_Parameter >::operator T const & ( ) const
inline

Value accessor.

Returns
Const reference to this instance's value.

◆ operator*() [1/2]

template<typename T, typename Dummy_Parameter>
T& cppgraph::named_type_t< T, Dummy_Parameter >::operator* ( )
inline

Accessor.

Returns
A reference to this instance's value.

◆ operator*() [2/2]

template<typename T, typename Dummy_Parameter>
T const& cppgraph::named_type_t< T, Dummy_Parameter >::operator* ( ) const
inline

Accessor.

Returns
A const reference to this instance's value.

◆ operator*=()

template<typename T, typename Dummy_Parameter>
named_type_t& cppgraph::named_type_t< T, Dummy_Parameter >::operator*= ( T const &  t)
inline

Multiplies the value of this named type by the value of a specified named type.

Parameters
tA named type instance.
Returns
A reference to this named type.

◆ operator++() [1/2]

template<typename T, typename Dummy_Parameter>
named_type_t& cppgraph::named_type_t< T, Dummy_Parameter >::operator++ ( )
inline

Pre-increments the value of this named type.

Returns
A reference to this named type.

◆ operator++() [2/2]

template<typename T, typename Dummy_Parameter>
named_type_t cppgraph::named_type_t< T, Dummy_Parameter >::operator++ ( int  )
inline

Post-increments the value of this named type.

Returns
The value of this named type pre-increment.

◆ operator+=()

template<typename T, typename Dummy_Parameter>
named_type_t& cppgraph::named_type_t< T, Dummy_Parameter >::operator+= ( T const &  t)
inline

Adds the value of a specified named type to the value of this named type.

Parameters
tA value.
Returns
A reference to this named type.

◆ operator--() [1/2]

template<typename T, typename Dummy_Parameter>
named_type_t& cppgraph::named_type_t< T, Dummy_Parameter >::operator-- ( )
inline

Pre-decrements the value of this named type.

Returns
The value of this named type pre-decrement.

◆ operator--() [2/2]

template<typename T, typename Dummy_Parameter>
named_type_t cppgraph::named_type_t< T, Dummy_Parameter >::operator-- ( int  )
inline

Post-decrements the value of this named type.

Returns
The value of this named type pre-decrement.

◆ operator-=()

template<typename T, typename Dummy_Parameter>
named_type_t& cppgraph::named_type_t< T, Dummy_Parameter >::operator-= ( T const &  t)
inline

Subtracts the value of a specified named type from the value of this named type.

Parameters
tA named type instance.
Returns
A reference to this named type.

◆ operator->() [1/2]

template<typename T, typename Dummy_Parameter>
T const* cppgraph::named_type_t< T, Dummy_Parameter >::operator-> ( ) const
inline

Accessor.

Returns
A const pointer to this instance's value.

◆ operator->() [2/2]

template<typename T, typename Dummy_Parameter>
T* cppgraph::named_type_t< T, Dummy_Parameter >::operator-> ( )
inline

Accessor.

Returns
A pointer to this instance's value.

◆ operator/=()

template<typename T, typename Dummy_Parameter>
named_type_t& cppgraph::named_type_t< T, Dummy_Parameter >::operator/= ( T const &  t)
inline

Divides the value of this named type by the value of a specified named type.

Parameters
tA named type instance.
Returns
A reference to this named type.

◆ to_value()

template<typename T, typename Dummy_Parameter>
template<typename U >
U cppgraph::named_type_t< T, Dummy_Parameter >::to_value ( ) const
inline

Returns a reference to this named type's value converted to a specified type, which may be a derived named type or a type that can be static_cast from type T.

Template Parameters
UA type.
Returns
A U constructed from * this.

The documentation for this struct was generated from the following files: