dune-istl  2.8.0
allocator.hh
Go to the documentation of this file.
1 #ifndef DUNE_ISTL_ALLOCATOR_HH
2 #define DUNE_ISTL_ALLOCATOR_HH
3 
4 #include <memory>
5 #include <type_traits>
6 
7 #include <dune/common/typetraits.hh>
8 
9 namespace Dune {
10 
11  template<typename T>
12  struct exists{
13  static const bool value = true;
14  };
15 
16  template<typename T, typename = void>
18  {
19  using type = std::allocator<T>;
20  };
21 
22  template<typename T>
23  struct DefaultAllocatorTraits<T, std::void_t<typename T::allocator_type> >
24  {
25  using type = typename T::allocator_type;
26  };
27 
28  template<typename T>
29  struct AllocatorTraits : public DefaultAllocatorTraits<T> {};
30 
31  template<typename T>
33 
34  template<typename T, typename X>
35  using ReboundAllocatorType = typename std::allocator_traits<typename AllocatorTraits<T>::type>::template rebind_alloc<X>;
36 
37 } // end namespace Dune
38 
39 #endif // DUNE_ISTL_ALLOCATOR_HH
Definition: allocator.hh:9
typename std::allocator_traits< typename AllocatorTraits< T >::type >::template rebind_alloc< X > ReboundAllocatorType
Definition: allocator.hh:35
typename AllocatorTraits< T >::type AllocatorType
Definition: allocator.hh:32
Definition: allocator.hh:12
static const bool value
Definition: allocator.hh:13
Definition: allocator.hh:18
std::allocator< T > type
Definition: allocator.hh:19
typename T::allocator_type type
Definition: allocator.hh:25
Definition: allocator.hh:29