mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
63 lines
1.4 KiB
C++
63 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <algorithm>
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <string>
|
|
#include <type_traits>
|
|
|
|
using Int8 = int8_t;
|
|
using Int16 = int16_t;
|
|
using Int32 = int32_t;
|
|
using Int64 = int64_t;
|
|
|
|
#if __cplusplus <= 201703L
|
|
using char8_t = unsigned char;
|
|
#endif
|
|
|
|
using UInt8 = char8_t;
|
|
using UInt16 = uint16_t;
|
|
using UInt32 = uint32_t;
|
|
using UInt64 = uint64_t;
|
|
|
|
using String = std::string;
|
|
|
|
/// The standard library type traits, such as std::is_arithmetic, with one exception
|
|
/// (std::common_type), are "set in stone". Attempting to specialize them causes undefined behavior.
|
|
/// So instead of using the std type_traits, we use our own version which allows extension.
|
|
template <typename T>
|
|
struct is_signed
|
|
{
|
|
static constexpr bool value = std::is_signed_v<T>;
|
|
};
|
|
|
|
template <typename T>
|
|
inline constexpr bool is_signed_v = is_signed<T>::value;
|
|
|
|
template <typename T>
|
|
struct is_unsigned
|
|
{
|
|
static constexpr bool value = std::is_unsigned_v<T>;
|
|
};
|
|
|
|
template <typename T>
|
|
inline constexpr bool is_unsigned_v = is_unsigned<T>::value;
|
|
|
|
template <typename T>
|
|
struct is_integral
|
|
{
|
|
static constexpr bool value = std::is_integral_v<T>;
|
|
};
|
|
|
|
template <typename T>
|
|
inline constexpr bool is_integral_v = is_integral<T>::value;
|
|
|
|
template <typename T>
|
|
struct is_arithmetic
|
|
{
|
|
static constexpr bool value = std::is_arithmetic_v<T>;
|
|
};
|
|
|
|
template <typename T>
|
|
inline constexpr bool is_arithmetic_v = is_arithmetic<T>::value;
|