tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_trivially_destructible.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_TYPE_TRAITS_IS_TRVIALLY_DETRUCTIBLE_HPP
5#define TETL_TYPE_TRAITS_IS_TRVIALLY_DETRUCTIBLE_HPP
6
7#include <etl/_config/all.hpp>
8
9#include <etl/_type_traits/bool_constant.hpp>
10
11namespace etl {
12
13/// \brief Storage occupied by trivially destructible objects may be reused
14/// without calling the destructor.
15///
16/// https://en.cppreference.com/w/cpp/types/is_destructible
17template <typename T>
18struct is_trivially_destructible;
19
20#if __has_builtin(__is_trivially_destructible)
21
22template <typename T>
23struct is_trivially_destructible : bool_constant<__is_trivially_destructible(T)> { };
24
25template <typename T>
26inline constexpr bool is_trivially_destructible_v = __is_trivially_destructible(T);
27
28#else
29
30template <typename T>
31struct is_trivially_destructible : bool_constant<__has_trivial_destructor(T)> { };
32
33template <typename T>
34inline constexpr bool is_trivially_destructible_v = __has_trivial_destructor(T);
35
36#endif
37} // namespace etl
38
39#endif // TETL_TYPE_TRAITS_IS_TRVIALLY_DETRUCTIBLE_HPP
Definition adjacent_find.hpp:9