Dune Core Modules (2.9.0)

allocator.hh
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3#ifndef DUNE_ISTL_ALLOCATOR_HH
4#define DUNE_ISTL_ALLOCATOR_HH
5
6#include <memory>
7#include <type_traits>
8
10
11namespace Dune {
12
13 template<typename T>
14 struct exists{
15 static const bool value = true;
16 };
17
18 template<typename T, typename = void>
19 struct DefaultAllocatorTraits
20 {
21 using type = std::allocator<T>;
22 };
23
24 template<typename T>
25 struct DefaultAllocatorTraits<T, std::void_t<typename T::allocator_type> >
26 {
27 using type = typename T::allocator_type;
28 };
29
30 template<typename T>
31 struct AllocatorTraits : public DefaultAllocatorTraits<T> {};
32
33 template<typename T>
34 using AllocatorType = typename AllocatorTraits<T>::type;
35
36 template<typename T, typename X>
37 using ReboundAllocatorType = typename std::allocator_traits<typename AllocatorTraits<T>::type>::template rebind_alloc<X>;
38
39} // end namespace Dune
40
41#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:40
Dune namespace.
Definition: alignedallocator.hh:13
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)