#ifndef YASLI_TRAITS_H_ #define YASLI_TRAITS_H_ // $Id$ namespace yasli_nstd { /* template struct enable_if {}; template struct enable_if { typedef T type; }; */ //!! TYPE SELECTORS //Used in place of enable_if: //not so neat or so versitile but they do compile template struct type_selector { typedef if_true result; }; template struct type_selector { typedef if_false result; }; // Types for differentiating compile-time choices typedef char (&yes_t)[1]; typedef char (&no_t)[2]; // Credit goes to Boost; // also found in the C++ Templates book by Vandevoorde and Josuttis //!! Wouldn't compile with these inside is_class template yes_t class_test(int U::*); template no_t class_test(...); template struct is_class { enum { value = (sizeof(class_test(0)) == sizeof(yes_t)) }; }; template struct is_pointer { enum { value = false }; }; template struct is_pointer { enum { value = true }; }; template struct is_memcopyable { enum { value = int(!is_class::value) }; }; template struct is_memmoveable { enum { value = int(!is_class::value) }; }; // For moving enum move_t { move }; } // namespace yasli_nstd #endif // YASLI_TRAITS_H_