#include <stlsoft/util/true_typedef.hpp>
For example, the following code creates two types based on the int type:
STLSOFT_GEN_OPAQUE(h_protocol_tt) STLSOFT_GEN_OPAQUE(h_port_tt) typedef true_typedef<long, h_protocol_tt> protocol_tt; typedef true_typedef<long, h_port_tt> port_tt; protocol_tt pro1(3); // Ok port_tt prt1(8088); // Ok protocol_tt pro2(pro1); // Ok, can copy from another protocol_tt port_tt prt2(pro2); // Error, cannot copy from a protocol_tt
| T | The base type, e.g. int, std::wstring | |
| U | The unique type, usually created by using STLSOFT_GEN_OPAQUE() |
Public Types | |
| typedef T | value_type |
| The value type. | |
| typedef U | unique_type |
| The unique type. | |
| typedef true_typedef< T, U > | class_type |
| The type of the current parameterisation. | |
| typedef T & | reference |
| The reference type. | |
| typedef T const & | const_reference |
| The non-mutating (const) reference type. | |
Public Member Functions | |
| true_typedef () | |
| Default constructor. | |
| true_typedef (value_type const &value) | |
| Construct from a value type instance. | |
| true_typedef (class_type const &rhs) | |
| Copy constructor. | |
| class_type const & | operator= (class_type const &rhs) |
| Copy assignment operator. | |
| const_reference | base_type_value () const |
| Provides non-mutating (const) access to the base type value. | |
| reference | base_type_value () |
| Provides mutating access to the base type value. | |
| typedef T value_type |
The value type.
| typedef U unique_type |
The unique type.
| typedef true_typedef<T, U> class_type |
The type of the current parameterisation.
| typedef T& reference |
The reference type.
| typedef T const& const_reference |
The non-mutating (const) reference type.
| true_typedef | ( | ) | [inline] |
Default constructor.
| true_typedef | ( | value_type const & | value | ) | [inline, explicit] |
Construct from a value type instance.
| true_typedef | ( | class_type const & | rhs | ) | [inline] |
Copy constructor.
| class_type const& operator= | ( | class_type const & | rhs | ) | [inline] |
| const_reference base_type_value | ( | ) | const [inline] |
Provides non-mutating (const) access to the base type value.
| reference base_type_value | ( | ) | [inline] |
Provides mutating access to the base type value.
1.5.6