diff --git a/src/amdis/common/TypeTraits.hpp b/src/amdis/common/TypeTraits.hpp index 743bc76265ad8a3b334f4238f0dcd80202660022..72d5ed416a4084bf1a470a21079a4bc5ea12acf9 100644 --- a/src/amdis/common/TypeTraits.hpp +++ b/src/amdis/common/TypeTraits.hpp @@ -103,13 +103,22 @@ namespace AMDiS constexpr bool is_template() { return true; } #if AMDIS_HAS_CXX_AUTO_TEMPLATE_PARAMETER - template <template <class,auto...> class> + template <template <auto...> class> + constexpr bool is_template() { return true; } + + template <template <class,auto,auto...> class> constexpr bool is_template() { return true; } #else - template <template <class,int...> class> + template <template <int...> class> + constexpr bool is_template() { return true; } + + template <template <class,int,int...> class> + constexpr bool is_template() { return true; } + + template <template <std::size_t...> class> constexpr bool is_template() { return true; } - template <template <class,std::size_t...> class> + template <template <class,std::size_t,std::size_t...> class> constexpr bool is_template() { return true; } #endif diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 82bc31b7a3f9b06f6c17f75c590d8e96bff22789..c7d0fecd5f5b2da4abdbd3ffada9415bb6a7f090 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -72,3 +72,6 @@ dune_add_test(SOURCES TreeDataTest.cpp dune_add_test(SOURCES TreeContainerTest.cpp LINK_LIBRARIES amdis) + +dune_add_test(SOURCES TypeTraitsTest.cpp + LINK_LIBRARIES amdis) diff --git a/test/TypeTraitsTest.cpp b/test/TypeTraitsTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d267744700225acee5d3377a23345b38b966f628 --- /dev/null +++ b/test/TypeTraitsTest.cpp @@ -0,0 +1,31 @@ +#include <amdis/AMDiS.hpp> +#include <amdis/common/TypeTraits.hpp> + +using namespace AMDiS; + +template <std::size_t i> +struct A {}; + +template <class T> +struct B {}; + +template <class T, std::size_t i> +struct C {}; + + +struct D {}; + + +int main(int argc, char** argv) +{ + Environment env(argc, argv); + + static_assert(is_template<A>(), ""); + static_assert(is_template<B>(), ""); + static_assert(is_template<C>(), ""); + + static_assert(not is_template<std::size_t>(), ""); + static_assert(not is_template<D>(), ""); + + return 0; +}