From 4458a0506f6262b9df7a461d393376bac7819741 Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Mon, 6 May 2019 11:23:56 +0200 Subject: [PATCH] add traits for testing whether something is a template or a type and add enable_if_all --- src/amdis/common/TypeTraits.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/amdis/common/TypeTraits.hpp b/src/amdis/common/TypeTraits.hpp index f1af06ae..743bc762 100644 --- a/src/amdis/common/TypeTraits.hpp +++ b/src/amdis/common/TypeTraits.hpp @@ -97,4 +97,29 @@ namespace AMDiS return std::make_unique<TYPEOF(obj)>(FWD(obj)); } + + + template <template <class...> class> + constexpr bool is_template() { return true; } + +#if AMDIS_HAS_CXX_AUTO_TEMPLATE_PARAMETER + template <template <class,auto...> class> + constexpr bool is_template() { return true; } +#else + template <template <class,int...> class> + constexpr bool is_template() { return true; } + + template <template <class,std::size_t...> class> + constexpr bool is_template() { return true; } +#endif + + template <class> + constexpr bool is_template() { return false; } + + + template <bool... b> + using enable_if_all_t + = std::enable_if_t<std::is_same<std::integer_sequence<bool,true,b...>, + std::integer_sequence<bool,b...,true>>::value>; + } // end namespace AMDiS -- GitLab