10 #ifndef INCLUDED_IMATHTYPETRAITS_H
11 #define INCLUDED_IMATHTYPETRAITS_H
13 #include <type_traits>
17 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
21 #if (IMATH_CPLUSPLUS_VERSION >= 14)
25 template <
bool B,
class T =
void>
32 #define IMATH_ENABLE_IF(...) IMATH_INTERNAL_NAMESPACE::enable_if_t<(__VA_ARGS__), int> = 0
35 #if IMATH_FOREIGN_VECTOR_INTEROP
82 template <
typename T,
typename Base>
95 template<
typename C>
static No&
test(...);
97 enum {
value = (
sizeof(test<T>(0)) ==
sizeof(
Yes)
98 &&
sizeof(
T) == 2*
sizeof(Base))
106 template <
typename T,
typename Base>
120 template<
typename C>
static No&
test(...);
122 enum {
value = (
sizeof(test<T>(0)) ==
sizeof(
Yes)
123 &&
sizeof(
T) == 3*
sizeof(Base))
131 template <
typename T,
typename Base>
146 template<
typename C>
static No&
test(...);
148 enum {
value = (
sizeof(test<T>(0)) ==
sizeof(
Yes)
149 &&
sizeof(
T) == 4*
sizeof(Base))
158 template <
typename T,
typename Base,
int Nelem>
159 struct has_subscript {
170 template<
typename C>
static No&
test(...);
172 enum {
value = (
sizeof(test<T>(0)) ==
sizeof(
Yes)
173 &&
sizeof(
T) == Nelem*
sizeof(Base))
179 template<
typename Base,
int Nelem>
180 struct has_subscript<Base[Nelem], Base, Nelem> :
public std::true_type { };
187 template <
typename T,
typename Base,
int Rows,
int Cols>
188 struct has_double_subscript {
199 template<
typename C>
static No&
test(...);
201 enum {
value = (
sizeof(test<T>(0)) ==
sizeof(
Yes)
202 &&
sizeof(
T) == (Rows*Cols)*
sizeof(Base))
208 template<
typename Base,
int Rows,
int Cols>
209 struct has_double_subscript<Base[Rows][Cols], Base, Rows, Cols> :
public std::true_type { };
215 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
217 #endif // INCLUDED_IMATHTYPETRAITS_H
typename std::enable_if< B, T >::type enable_if_t
Define Imath::enable_if_t to be std for C++14, equivalent for C++11.
cvex test(vector P=0;int unbound=3;export float s=0;export vector Cf=0;)
GLdouble GLdouble GLdouble z
#define IMATH_ENABLE_IF(...)
GLubyte GLubyte GLubyte GLubyte w