cosmopolitan/ctl/is_integral.h

79 lines
1.3 KiB
C
Raw Permalink Normal View History

// -*-mode:c++;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8-*-
// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :vi
2024-06-29 02:07:35 +00:00
#ifndef CTL_IS_INTEGRAL_H_
#define CTL_IS_INTEGRAL_H_
#include "integral_constant.h"
namespace ctl {
template<typename T>
2024-07-01 10:48:28 +00:00
struct is_integral : ctl::false_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<bool> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<char> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<signed char> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<unsigned char> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<short> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<unsigned short> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<int> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<unsigned int> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<long> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<unsigned long> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<long long> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<unsigned long long> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<char16_t> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<char32_t> : ctl::true_type
{};
template<>
2024-07-01 10:48:28 +00:00
struct is_integral<wchar_t> : ctl::true_type
{};
template<typename T>
inline constexpr bool is_integral_v = is_integral<T>::value;
} // namespace ctl
2024-06-29 02:07:35 +00:00
#endif // CTL_IS_INTEGRAL_H_