4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::strong_typedef< T, Tag > Class Template Reference

Detailed Description

template<typename T, typename Tag>
class fcppt::strong_typedef< T, Tag >

Used to create strong typedefs.

Template Parameters
TThe underlying type to be wrapped.
TagSome unique type.

A strong typedef is a wrapper around a type. It has an explicit constructor and a get member function.

Public Types

using value_type = T
 A type that represents the data stored in the strong typedef.
 
using tag_type = Tag
 typedef for the Tag template parameter
 

Public Member Functions

constexpr strong_typedef (T const &) noexcept(std::is_nothrow_copy_constructible_v< T >)
 Constructs a strong typedef by copying.
 
constexpr strong_typedef (T &&) noexcept(std::is_nothrow_move_constructible_v< T >)
 Constructs a strong typedef by moving.
 
 strong_typedef (fcppt::no_init const &)
 Creates an uninitialized strong typedef.
 
constexpr T & get ()
 Return the strong typedef's value.
 
constexpr T const & get () const
 Return the strong typedef's value.
 

Member Typedef Documentation

◆ tag_type

template<typename T , typename Tag >
using fcppt::strong_typedef< T, Tag >::tag_type = Tag

typedef for the Tag template parameter

◆ value_type

template<typename T , typename Tag >
using fcppt::strong_typedef< T, Tag >::value_type = T

A type that represents the data stored in the strong typedef.

Constructor & Destructor Documentation

◆ strong_typedef() [1/3]

template<typename T , typename Tag >
fcppt::strong_typedef< T, Tag >::strong_typedef ( T const & ) const
explicitconstexprnoexcept

Constructs a strong typedef by copying.

◆ strong_typedef() [2/3]

template<typename T , typename Tag >
fcppt::strong_typedef< T, Tag >::strong_typedef ( T && ) const
explicitconstexprnoexcept

Constructs a strong typedef by moving.

◆ strong_typedef() [3/3]

template<typename T , typename Tag >
fcppt::strong_typedef< T, Tag >::strong_typedef ( fcppt::no_init const & )
explicit

Creates an uninitialized strong typedef.

Member Function Documentation

◆ get() [1/2]

template<typename T , typename Tag >
T & fcppt::strong_typedef< T, Tag >::get ( )
nodiscardconstexpr

Return the strong typedef's value.

◆ get() [2/2]

template<typename T , typename Tag >
T const & fcppt::strong_typedef< T, Tag >::get ( ) const
nodiscardconstexpr

Return the strong typedef's value.