dune-istl  2.6-git
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 AllocatorTraits<T>::type::template rebind<X>::other;
34 
35 } // end namespace Dune
36 
37 #endif // DUNE_ISTL_ALLOCATOR_HH
Dune::AllocatorTraits
Definition: allocator.hh:27
Dune::exists
Definition: allocator.hh:10
Dune::exists::value
static const bool value
Definition: allocator.hh:11
Dune::ReboundAllocatorType
typename AllocatorTraits< T >::type::template rebind< X >::other ReboundAllocatorType
Definition: allocator.hh:33
Dune::DefaultAllocatorTraits< T >::type
std::allocator< T > type
Definition: allocator.hh:17
Dune
Definition: allocator.hh:7
Dune::AllocatorType
typename AllocatorTraits< T >::type AllocatorType
Definition: allocator.hh:30
Dune::DefaultAllocatorTraits
Definition: allocator.hh:15
Dune::DefaultAllocatorTraits< T, void_t< typename T::allocator_type > >::type
typename T::allocator_type type
Definition: allocator.hh:23