tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_base_of.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_TYPE_TRAITS_IS_BASE_OF_HPP
4#define TETL_TYPE_TRAITS_IS_BASE_OF_HPP
5
8
9namespace etl {
10
11namespace detail {
12template <typename B>
13auto test_pre_ptr_convertible(B const volatile*) -> true_type;
14template <typename>
15auto test_pre_ptr_convertible(void const volatile*) -> false_type;
16
17template <typename, typename>
18auto test_pre_is_base_of(...) -> true_type;
19template <typename B, typename D>
20auto test_pre_is_base_of(int) -> decltype(test_pre_ptr_convertible<B>(static_cast<D*>(nullptr)));
21} // namespace detail
22
32template <typename Base, typename Derived>
35 is_class_v<Base> and is_class_v<Derived>and decltype(detail::test_pre_is_base_of<Base, Derived>(0))::value> {
36};
37
38template <typename Base, typename Derived>
40
41} // namespace etl
42
43#endif // TETL_TYPE_TRAITS_IS_BASE_OF_HPP
Definition adjacent_find.hpp:8
constexpr bool is_base_of_v
Definition is_base_of.hpp:39
bool_constant< true > true_type
Definition bool_constant.hpp:13
integral_constant< bool, B > bool_constant
Definition bool_constant.hpp:11
bool_constant< false > false_type
Definition bool_constant.hpp:14
static constexpr bool value
Definition integral_constant.hpp:10
If Derived is derived from Base or if both are the same non-union class (in both cases ignoring cv-qu...
Definition is_base_of.hpp:35