Dune Core Modules (2.8.0)

allocator.hh
1#ifndef DUNE_ISTL_ALLOCATOR_HH
2#define DUNE_ISTL_ALLOCATOR_HH
3
4#include <memory>
5#include <type_traits>
6
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
Traits for type conversions and type information.
typename Impl::voider< Types... >::type void_t
Is void for all valid input types. The workhorse for C++11 SFINAE-techniques.
Definition: typetraits.hh:38
Dune namespace.
Definition: alignedallocator.hh:11
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 22, 23:33, 2024)