traits.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2024 INRIA
3 //
4 //
5 
6 #ifndef __eigenpy_utils_traits_hpp__
7 #define __eigenpy_utils_traits_hpp__
8 
9 #include <type_traits>
10 #include <string>
11 #include <complex>
12 
13 namespace eigenpy {
14 
15 namespace details {
16 
18 template <typename T>
19 struct remove_cvref : std::remove_cv<typename std::remove_reference<T>::type> {
20 };
21 
23 template <typename T>
25  : std::integral_constant<bool, std::is_class<T>::value ||
26  std::is_union<T>::value> {};
27 
29 template <typename T>
30 struct is_python_complex : std::false_type {};
31 
33 template <>
34 struct is_python_complex<std::complex<float> > : std::true_type {};
35 template <>
36 struct is_python_complex<std::complex<double> > : std::true_type {};
37 template <>
38 struct is_python_complex<std::complex<long double> > : std::true_type {};
39 
40 template <typename T>
42  : std::integral_constant<bool, !is_class_or_union<T>::value ||
43  std::is_same<T, std::string>::value ||
44  std::is_same<T, std::wstring>::value ||
45  is_python_complex<T>::value> {};
46 
48 template <typename T>
50  : is_python_primitive_type_helper<typename remove_cvref<T>::type> {};
51 
52 } // namespace details
53 
54 } // namespace eigenpy
55 
56 #endif // ifndef __eigenpy_utils_traits_hpp__
eigenpy::details::is_python_complex
trait to detect if T is a std::complex managed by Boost Python
Definition: traits.hpp:30
eigenpy::details::is_class_or_union
Trait to detect if T is a class or an union.
Definition: traits.hpp:24
eigenpy
Definition: alignment.hpp:14
eigenpy::details::is_python_primitive_type
Trait to detect if T is a Python primitive type.
Definition: traits.hpp:49
eigenpy::details::is_python_primitive_type_helper
Definition: traits.hpp:41
eigenpy::details::remove_cvref
Trait to remove const&.
Definition: traits.hpp:19


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Fri Jun 14 2024 02:15:58