dune-pdelab  2.5-dev
typetraits.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 
4 #ifndef DUNE_PDELAB_COMMON_TYPETRAITS_HH
5 #define DUNE_PDELAB_COMMON_TYPETRAITS_HH
6 
7 #include <dune/common/typetraits.hh>
8 #include <dune/typetree/typetraits.hh>
9 
10 namespace Dune {
11  namespace PDELab {
12 
13  // Import AlwaysVoid from TypeTree library
14  using TypeTree::AlwaysVoid;
15 
16  // forward decl of Tag defined in function.hh
17  struct GridFunctionTag;
18  struct PowerGridFunctionTag;
19  struct CompositeGridFunctionTag;
20 
21 #ifndef DOXYGEN
22 
23  namespace impl {
24 
25  template<typename T, typename = void>
26  struct IsGridFunction
27  {
28  static const bool value = false;
29  };
30 
31  template<typename T>
32  struct IsGridFunction<T, typename AlwaysVoid<TypeTree::ImplementationTag<T>>::type >
33  {
34  using A = TypeTree::ImplementationTag<T>;
35  static const bool value = std::is_same<A, GridFunctionTag>::value ||
38  };
39 
40  } // namespace impl
41 
42 #endif // DOXYGEN
43 
44  template<typename T>
45  using IsGridFunction = std::integral_constant<bool,impl::IsGridFunction<std::decay_t<T>>::value>;
46 
47  } // end namespace PDELab
48 } // end namespace Dune
49 
50 #endif // DUNE_PDELAB_COMMON_TYPETRAITS_HH
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
std::integral_constant< bool, impl::IsGridFunction< std::decay_t< T > >::value > IsGridFunction
Definition: typetraits.hh:45