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