DUNE ISTL (2.8)

allocator.hh
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
9namespace Dune {
10
11 template<typename T>
12 struct exists{
13 static const bool value = true;
14 };
15
16 template<typename T, typename = void>
17 struct DefaultAllocatorTraits
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>
32 using AllocatorType = typename AllocatorTraits<T>::type;
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
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (May 27, 22:36, 2026)