28 #ifndef TOMOGRAPHER_TOOLS_NEEDOWNOPERATORNEW_H 29 #define TOMOGRAPHER_TOOLS_NEEDOWNOPERATORNEW_H 39 #include <type_traits> 41 #include <Eigen/Eigen> 68 namespace tomo_internal {
71 template<
typename T>
static auto test_has_ownopnewprovidertype_member(
int)
72 ->
typename sfinae_yes<typename T::OperatorNewProviderType>::yes&;
73 template<
typename T>
static auto test_has_ownopnewprovidertype_member(
long)
74 ->
typename sfinae_no<>::no&;
76 struct has_ownopnewprovidertype_member {
77 static constexpr
bool value = (
sizeof(tomo_internal::test_has_ownopnewprovidertype_member<T>(0))
78 ==
sizeof(
typename tomo_internal::sfinae_yes<>::yes));
80 template<
bool has_own_prov
ider,
typename T>
81 struct need_own_op_new_prov_helper {
85 struct need_own_op_new_prov_helper<true, T> {
86 typedef typename T::OperatorNewProviderType
ProviderType;
144 template<
typename... Types>
155 typedef typename tomo_internal::need_own_op_new_prov_helper<
161 typedef typename ProviderType::template OperatorNewAllocatorType<T>::Type AllocatorType;
174 template<
typename Type1,
typename Type2,
typename... OtherTypes>
178 namespace tomo_internal {
180 template<
bool same_provider_type,
bool t1_trivial_provider,
bool t2_trivial_provider,
181 typename Type1,
typename Type2,
typename... OtherTypes>
182 struct need_own_operator_new_combination_helper {
184 static_assert(!same_provider_type && !t1_trivial_provider && !t2_trivial_provider,
185 "ERROR: you have a type which requested a NeedOwnOperatorNew<T1,T2> " 186 "with incompatible needs.") ;
189 template<
bool t1_trivial_provider,
bool t2_trivial_provider,
190 typename Type1,
typename Type2,
typename... OtherTypes>
191 struct need_own_operator_new_combination_helper<true, t1_trivial_provider, t2_trivial_provider,
192 Type1, Type2, OtherTypes...> {
197 template<
bool t2_trivial_provider,
198 typename Type1,
typename Type2,
typename... OtherTypes>
199 struct need_own_operator_new_combination_helper<false, true, t2_trivial_provider,
200 Type1, Type2, OtherTypes...> {
205 template<
typename Type1,
typename Type2,
typename... OtherTypes>
206 struct need_own_operator_new_combination_helper<false, false, true,
207 Type1, Type2, OtherTypes...> {
216 template<
typename Type1,
typename Type2,
typename... OtherTypes>
219 typedef tomo_internal::need_own_operator_new_combination_helper<
222 std::is_same<typename NeedOwnOperatorNew<Type1>::ProviderType,
226 Type1, Type2, OtherTypes...
248 EIGEN_MAKE_ALIGNED_OPERATOR_NEW ;
255 #ifdef TOMOGRAPHER_TEST_TOOLS_NEEDOWNOPERATORNEW_DEBUG_MEMBERS 258 : EigenAlignedOperatorNewIsActive(
true)
261 const bool EigenAlignedOperatorNewIsActive;
267 template<
bool ReallyNeeded = true>
290 template<
typename Scalar,
int FixedRows,
int FixedCols,
int Options,
int MaxRows,
int MaxCols>
296 template<
typename Scalar,
int FixedRows,
int FixedCols,
int Options,
int MaxRows,
int MaxCols>
Base namespace for the Tomographer project.
Some C++ utilities, with a tad of C++11 tricks.
VarValueDecoder< T >::RetType value(const Var &var)
Access the value of the given variable, as a C++ type.