Changeset 178


Ignore:
Timestamp:
07/27/13 22:51:43 (12 years ago)
Author:
epyon
Message:
  • flags - now properly working with non-enum types
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/flags.hh

    r162 r178  
    2020namespace nv
    2121{
     22        template< typename T, typename IS_ENUM >
     23        struct base_underlying_type_helper
     24        {
     25                typedef T type;
     26        };
     27
     28        template< typename T >
     29        struct base_underlying_type_helper< T, std::true_type >
     30        {
     31                typedef typename std::underlying_type<T>::type type;
     32        };
     33
     34
     35        template< typename T >
     36        struct base_underlying_type
     37        {
     38                typedef typename base_underlying_type_helper< T, typename std::is_enum<T>::type >::type type;
     39        };
    2240
    2341        template < uint32 SIZE, typename T = uint32 >
     
    6583                typedef T      index_type;
    6684                typedef uint32 size_type;
    67                 typedef typename std::underlying_type<T>::type raw_index_type;
     85                typedef typename base_underlying_type<T>::type raw_index_type;
    6886
    6987                static const size_type data_type_size = sizeof( data_type ) * 8;
Note: See TracChangeset for help on using the changeset viewer.