Loading...
Searching...
No Matches
allocator.hh
Go to the documentation of this file.
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
#ifndef DUNE_ISTL_ALLOCATOR_HH
#define DUNE_ISTL_ALLOCATOR_HH
#include <memory>
#include <type_traits>
#include <dune/common/typetraits.hh>
namespace Dune {
template<typename T>
struct exists{
static const bool value = true;
};
template<typename T, typename = void>
struct DefaultAllocatorTraits
{
using type = std::allocator<T>;
};
template<typename T>
struct DefaultAllocatorTraits<T, std::void_t<typename T::allocator_type> >
{
using type = typename T::allocator_type;
};
template<typename T>
struct AllocatorTraits : public DefaultAllocatorTraits<T> {};
template<typename T>
using AllocatorType = typename AllocatorTraits<T>::type;
template<typename T, typename X>
using ReboundAllocatorType = typename std::allocator_traits<typename AllocatorTraits<T>::type>::template rebind_alloc<X>;
} // end namespace Dune
#endif // DUNE_ISTL_ALLOCATOR_HH
std
STL namespace.
Dune
Definition allocator.hh:11
Dune::ReboundAllocatorType
typename std::allocator_traits< typename AllocatorTraits< T >::type >::template rebind_alloc< X > ReboundAllocatorType
Definition allocator.hh:37
Dune::AllocatorType
typename AllocatorTraits< T >::type AllocatorType
Definition allocator.hh:34
Dune::exists
Definition allocator.hh:14
Dune::exists::value
static const bool value
Definition allocator.hh:15
Dune::DefaultAllocatorTraits
Definition allocator.hh:20
Dune::DefaultAllocatorTraits::type
std::allocator< T > type
Definition allocator.hh:21
Dune::DefaultAllocatorTraits< T, std::void_t< typename T::allocator_type > >::type
typename T::allocator_type type
Definition allocator.hh:27
Dune::AllocatorTraits
Definition allocator.hh:31