Advertisement
Guest User

Untitled

a guest
May 26th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1.     // pick from two types based on a switch type
  2.     template<typename C0, typename C1, typename V0, typename V1> struct _select
  3.     {
  4.         template<typename S> struct _switch {};
  5.  
  6.         template<> struct _switch<C0> { typedef V0 result; };
  7.         template<> struct _switch<C1> { typedef V1 result; };
  8.     };
  9.  
  10.     //example
  11.     typedef typename _select<RowMajor, ColMajor, row_array, col_array>
  12.             ::_switch<ElementLayout>::result storage_array;
  13.  
  14.     storage_array m;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement