Commit 0d63a6a7 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

added tests for is_template

parent 4458a050
...@@ -103,13 +103,22 @@ namespace AMDiS ...@@ -103,13 +103,22 @@ namespace AMDiS
constexpr bool is_template() { return true; } constexpr bool is_template() { return true; }
#if AMDIS_HAS_CXX_AUTO_TEMPLATE_PARAMETER #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; } constexpr bool is_template() { return true; }
#else #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; } 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; } constexpr bool is_template() { return true; }
#endif #endif
......
...@@ -72,3 +72,6 @@ dune_add_test(SOURCES TreeDataTest.cpp ...@@ -72,3 +72,6 @@ dune_add_test(SOURCES TreeDataTest.cpp
dune_add_test(SOURCES TreeContainerTest.cpp dune_add_test(SOURCES TreeContainerTest.cpp
LINK_LIBRARIES amdis) LINK_LIBRARIES amdis)
dune_add_test(SOURCES TypeTraitsTest.cpp
LINK_LIBRARIES amdis)
#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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment