Adapting Interface-Incomplete Types at Compile Time
By Matthew Wilson, December 01, 2005
When an adapter template makes demands that a potential underlying type cannot fulfill, Interred Interface Adaptation can expand the number of adaptable types.
December, 2005: Adapting Interface-Incomplete Types At Compile Time
Example 4: Type Selection consists of a primary template and a partial specialization.
template< typename T1
, typename T2
, bool CHOOSE_FIRST_TYPE
>
struct select_first_type
{
typedef T1 type; // The first type
};
template< typename T1
, typename T2
>
struct select_first_type<T1, T2, false>
{
typedef T2 type; // The second type
};