STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - Template Software for the Active Template Library COMSTL - The Standard Template Library meets the Component Object Model .netSTL - Standard Template Library meets the Microsoft.NET Common Language Runtime InetSTL - The Standard Template Library meets WinInet MFCSTL - Template Software for the Microsoft Foundation Classes UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

true_typedef Class Template Reference

This class is used to create strong types from base types, to facilitate type disambiguation, overloading and mutual incompatibility. More...

#include <stlsoft_true_typedef.h>

List of all members.

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 Methods

 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.


Detailed Description

template<typename T, typename U>
class stlsoft::true_typedef< T, U >

This class is used to create strong types from base types, to facilitate type disambiguation, overloading and mutual incompatibility.

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

Parameters:
T  The base type, e.g. int, std::wstring
U  The unique type, usually created by using stlsoft_gen_opaque()


Member Typedef Documentation

typedef true_typedef<T, U> class_type
 

The type of the current parameterisation.

typedef T const& const_reference
 

The non-mutating (const) reference type.

typedef T& reference
 

The reference type.

typedef U unique_type
 

The unique type.

typedef T value_type
 

The value type.


Constructor & Destructor Documentation

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.


Member Function Documentation

reference base_type_value   [inline]
 

Provides mutating access to the base type value.

const_reference base_type_value   const [inline]
 

Provides non-mutating (const) access to the base type value.

class_type const& operator= class_type const &    rhs [inline]
 

Copy assignment operator.


The documentation for this class was generated from the following file:

STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004