Instigate Open Source Documentation

instigate::generic::type_to_type< T > Struct Template Reference

creates distinct type for each type. Below is an example where we can use it. Suppose we have a generic function: More...

#include <base.hpp>

List of all members.

Public Types

typedef T original_type
 The primary type T.


Detailed Description

template<typename T>
struct instigate::generic::type_to_type< T >

creates distinct type for each type. Below is an example where we can use it. Suppose we have a generic function:

 template <typename T, typename U>
 T function(U u)
 {
        // we want the code here to be different when T is some TYPE.
 }

As we can not partially specialize the function, we can solve the problem in following way:

 template <typename T, typename U>
 T function(U u, type_to_type<T>)
 {
 }

 template <typename U>
 TYPE function(U u, type_to_type<TYPE>)
 {
 }

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


© Instigate CJSC, Open Source