plll  1.0
plll::helper::SelectFirstType< cond, A, B > Class Template Reference

A type selector template. More...

#include <helper.hpp>

Public Types

typedef
implementation::select_first_type_impl
< cond, A, B >::result 
result
 The result type. Either A or B, depending on the value of cond.
 

Detailed Description

template<bool cond, typename A, typename B>
class plll::helper::SelectFirstType< cond, A, B >

A type selector template.

Defines SelectFirstType<cond, A, B>::result as A in case cond is true, and B in case cond is false. This is used in template metaprogramming to realize certain compile time if clauses.

Template Parameters
condAn expression which evaluates to a bool at compile time.
AA type name; result will have this type in case cond evalutes to true.
BA type name; result will have this type in case cond evalutes to false.

This was taken from "Modern C++ Design" by Andrei Alexandrescu. Note that in C++11, std::conditional<> provides the same functionality.

Definition at line 120 of file helper.hpp.


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