matio-cpp  v0.2.5
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
ExogenousConversionHelpers.tpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Fondazione Istituto Italiano di Tecnologia
3  *
4  * This software may be modified and distributed under the terms of the
5  * BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
6  */
7 #ifndef MATIOCPP_EXOGENOUSCONVERSIONHELPERS_TPP
8 #define MATIOCPP_EXOGENOUSCONVERSIONHELPERS_TPP
9 
10 namespace matioCpp
11 {
15 template <typename T, typename = void, typename = void>
17 {
18 };
19 
20 #ifdef MATIOCPP_HAS_EIGEN
21 
28 template <typename Derived>
29 struct is_eigen_matrix<Derived,
30  typename std::enable_if_t<std::is_base_of<Eigen::MatrixBase<Derived>, Derived>::value>,
31  typename std::enable_if_t<Eigen::MatrixBase<Derived>::RowsAtCompileTime != 1 &&
32  Eigen::MatrixBase<Derived>::ColsAtCompileTime != 1>>: std::true_type
33 {
34 };
35 
36 #endif
37 
41 template <typename T, typename = void, typename = void>
43 {
44 };
45 
54 template <typename T>
55  struct is_vector_compatible<T,
56  typename std::enable_if<(std::is_array<T>::value || matioCpp::SpanUtils::has_type_member<T>::value || matioCpp::SpanUtils::has_data_method<T>::value) && !is_eigen_matrix<T>::value>::type,
57  typename std::enable_if<matioCpp::SpanUtils::is_make_span_callable<T>::value &&
58  !std::is_same<typename matioCpp::SpanUtils::container_data<T>::type, bool>::value>::type> : std::true_type
59 {
60 };
61 
65 template <typename, typename = void, typename = void>
66 struct is_pair : std::false_type
67 { };
68 
72 template <typename T>
73 struct is_pair<T, matioCpp::SpanUtils::void_t<decltype(std::declval<T>().first)>, matioCpp::SpanUtils::void_t<decltype(std::declval<T>().second)>> : std::true_type
74 { };
75 
79 template <typename, typename = void, typename = void>
80 struct is_pair_iterator_string : std::false_type
81 { };
82 
86 template <typename T>
87 struct is_pair_iterator_string<T,
88  typename std::enable_if_t<is_pair<decltype(*std::declval<T>())>::value>,
89  typename std::enable_if_t<std::is_convertible<decltype(std::declval<T>()->first), std::string>::value>> : std::true_type
90 { };
91 
92 }
93 
94 #endif // MATIOCPP_EXOGENOUSCONVERSIONHELPERS_TPP
typename make_void< Ts... >::type void_t
Definition: Span.h:38
STL namespace.
is_eigen_matrix is a template metafunction to check if T is an Eigen matrix.
is_vector_compatible is a utility metafunction to check if the input vector T is compatible with mati...