tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
uses_allocator.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_MEMORY_USES_ALLOCATOR_HPP
5#define TETL_MEMORY_USES_ALLOCATOR_HPP
6
7#include <etl/_type_traits/bool_constant.hpp>
8#include <etl/_type_traits/is_convertible.hpp>
9#include <etl/_type_traits/void_t.hpp>
10
11namespace etl {
12
13namespace detail {
14template <typename Type, typename Alloc, typename = void>
15struct uses_allocator_impl : false_type { };
16
17template <typename Type, typename Alloc>
18struct uses_allocator_impl<Type, Alloc, void_t<typename Type::allocator_type>>
19 : is_convertible<Alloc, typename Type::allocator_type>::type { };
20} // namespace detail
21
22/// \brief If T has a member typedef allocator_type which is convertible from
23/// Alloc, the member constant value is true. Otherwise value is false.
24template <typename Type, typename Alloc>
25struct uses_allocator : detail::uses_allocator_impl<Type, Alloc>::type { };
26
27/// \brief If T has a member typedef allocator_type which is convertible from
28/// Alloc, the member constant value is true. Otherwise value is false.
29template <typename Type, typename Alloc>
30inline constexpr auto uses_allocator_v = uses_allocator<Type, Alloc>::value;
31
32} // namespace etl
33
34#endif // TETL_MEMORY_USES_ALLOCATOR_HPP
Definition adjacent_find.hpp:9
constexpr auto uses_allocator_v
If T has a member typedef allocator_type which is convertible from Alloc, the member constant value i...
Definition uses_allocator.hpp:30
If the imaginary function definition To test() { return etl::declval<From>(); } is well-formed,...
Definition is_convertible.hpp:45
If T has a member typedef allocator_type which is convertible from Alloc, the member constant value i...
Definition uses_allocator.hpp:25