1/*!
2@file
3Defines macros for commonly used type traits.
4
5Copyright Louis Dionne 2013-2022
6Distributed under the Boost Software License, Version 1.0.
7(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
8 */
9
10#ifndef BOOST_HANA_DETAIL_INTRINSICS_HPP
11#define BOOST_HANA_DETAIL_INTRINSICS_HPP
12
13#include <boost/hana/config.hpp>
14
15
16// We use intrinsics if they are available because it speeds up the
17// compile-times.
18#if defined(BOOST_HANA_CONFIG_CLANG)
19# if __has_extension(is_empty)
20# define BOOST_HANA_TT_IS_EMPTY(T) __is_empty(T)
21# endif
22
23# if __has_extension(is_final)
24# define BOOST_HANA_TT_IS_FINAL(T) __is_final(T)
25# endif
26
27// TODO: Right now, this intrinsic is never used directly because of
28// https://llvm.org/bugs/show_bug.cgi?id=24173
29# if __has_extension(is_constructible) && false
30# define BOOST_HANA_TT_IS_CONSTRUCTIBLE(...) __is_constructible(__VA_ARGS__)
31# endif
32
33# if __has_extension(is_assignable)
34# define BOOST_HANA_TT_IS_ASSIGNABLE(T, U) __is_assignable(T, U)
35# endif
36
37# if __has_extension(is_convertible)
38# define BOOST_HANA_TT_IS_CONVERTIBLE(T, U) __is_convertible(T, U)
39# endif
40#endif
41
42#if !defined(BOOST_HANA_TT_IS_EMPTY)
43# include <type_traits>
44# define BOOST_HANA_TT_IS_EMPTY(T) ::std::is_empty<T>::value
45#endif
46
47#if !defined(BOOST_HANA_TT_IS_FINAL)
48# include <type_traits>
49# define BOOST_HANA_TT_IS_FINAL(T) ::std::is_final<T>::value
50#endif
51
52#if !defined(BOOST_HANA_TT_IS_CONSTRUCTIBLE)
53# include <type_traits>
54# define BOOST_HANA_TT_IS_CONSTRUCTIBLE(...) ::std::is_constructible<__VA_ARGS__>::value
55#endif
56
57#if !defined(BOOST_HANA_TT_IS_ASSIGNABLE)
58# include <type_traits>
59# define BOOST_HANA_TT_IS_ASSIGNABLE(T, U) ::std::is_assignable<T, U>::value
60#endif
61
62#if !defined(BOOST_HANA_TT_IS_CONVERTIBLE)
63# include <type_traits>
64# define BOOST_HANA_TT_IS_CONVERTIBLE(T, U) ::std::is_convertible<T, U>::value
65#endif
66
67#endif // !BOOST_HANA_DETAIL_INTRINSICS_HPP
68

source code of boost/libs/hana/include/boost/hana/detail/intrinsics.hpp