Skip to content

Instantly share code, notes, and snippets.

@jmarrec
Created January 28, 2023 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmarrec/8a28cf529742b9c5c603ec77696f86af to your computer and use it in GitHub Desktop.
Save jmarrec/8a28cf529742b9c5c603ec77696f86af to your computer and use it in GitHub Desktop.
better enums expansion
namespace std {
inline namespace __1 {}
} // namespace std
typedef long int ptrdiff_t;
typedef long unsigned int size_t;
typedef long double max_align_t;
namespace std {
typedef decltype(nullptr) nullptr_t;
}
namespace std {
inline namespace __1 {
using ::ptrdiff_t __attribute__((using_if_exists));
using ::size_t __attribute__((using_if_exists));
using ::max_align_t __attribute__((using_if_exists));
template <class _Tp>
struct __libcpp_is_integral
{
enum
{
value = 0
};
};
template <>
struct __libcpp_is_integral<bool>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<char>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<signed char>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<unsigned char>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<wchar_t>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<char8_t>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<char16_t>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<char32_t>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<short>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<unsigned short>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<int>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<unsigned int>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<long>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<unsigned long>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<long long>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<unsigned long long>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<__int128_t>
{
enum
{
value = 1
};
};
template <>
struct __libcpp_is_integral<__uint128_t>
{
enum
{
value = 1
};
};
} // namespace __1
} // namespace std
namespace std {
enum class byte : unsigned char
{
};
template <bool>
struct __enable_if_integral_imp
{
};
template <>
struct __enable_if_integral_imp<true>
{
using type = byte;
};
template <class _Tp>
using _EnableByteOverload = typename __enable_if_integral_imp<__libcpp_is_integral<_Tp>::value>::type;
constexpr byte operator|(byte __lhs, byte __rhs) noexcept {
return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)));
}
constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept {
return __lhs = __lhs | __rhs;
}
constexpr byte operator&(byte __lhs, byte __rhs) noexcept {
return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)));
}
constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept {
return __lhs = __lhs & __rhs;
}
constexpr byte operator^(byte __lhs, byte __rhs) noexcept {
return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)));
}
constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept {
return __lhs = __lhs ^ __rhs;
}
constexpr byte operator~(byte __b) noexcept {
return static_cast<byte>(static_cast<unsigned char>(~static_cast<unsigned int>(__b)));
}
template <class _Integer>
constexpr _EnableByteOverload<_Integer>& operator<<=(byte& __lhs, _Integer __shift) noexcept {
return __lhs = __lhs << __shift;
}
template <class _Integer>
constexpr _EnableByteOverload<_Integer> operator<<(byte __lhs, _Integer __shift) noexcept {
return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) << __shift));
}
template <class _Integer>
constexpr _EnableByteOverload<_Integer>& operator>>=(byte& __lhs, _Integer __shift) noexcept {
return __lhs = __lhs >> __shift;
}
template <class _Integer>
constexpr _EnableByteOverload<_Integer> operator>>(byte __lhs, _Integer __shift) noexcept {
return static_cast<byte>(static_cast<unsigned char>(static_cast<unsigned int>(__lhs) >> __shift));
}
template <class _Integer, class = _EnableByteOverload<_Integer>>
constexpr _Integer to_integer(byte __b) noexcept {
return static_cast<_Integer>(__b);
}
} // namespace std
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
typedef long __darwin_intptr_t;
typedef unsigned int __darwin_natural_t;
typedef int __darwin_ct_rune_t;
typedef union
{
char __mbstate8[128];
long long _mbstateL;
} __mbstate_t;
typedef __mbstate_t __darwin_mbstate_t;
typedef long int __darwin_ptrdiff_t;
typedef long unsigned int __darwin_size_t;
typedef __builtin_va_list __darwin_va_list;
typedef int __darwin_wchar_t;
typedef __darwin_wchar_t __darwin_rune_t;
typedef int __darwin_wint_t;
typedef unsigned long __darwin_clock_t;
typedef __uint32_t __darwin_socklen_t;
typedef long __darwin_ssize_t;
typedef long __darwin_time_t;
typedef __int64_t __darwin_blkcnt_t;
typedef __int32_t __darwin_blksize_t;
typedef __int32_t __darwin_dev_t;
typedef unsigned int __darwin_fsblkcnt_t;
typedef unsigned int __darwin_fsfilcnt_t;
typedef __uint32_t __darwin_gid_t;
typedef __uint32_t __darwin_id_t;
typedef __uint64_t __darwin_ino64_t;
typedef __darwin_ino64_t __darwin_ino_t;
typedef __darwin_natural_t __darwin_mach_port_name_t;
typedef __darwin_mach_port_name_t __darwin_mach_port_t;
typedef __uint16_t __darwin_mode_t;
typedef __int64_t __darwin_off_t;
typedef __int32_t __darwin_pid_t;
typedef __uint32_t __darwin_sigset_t;
typedef __int32_t __darwin_suseconds_t;
typedef __uint32_t __darwin_uid_t;
typedef __uint32_t __darwin_useconds_t;
typedef unsigned char __darwin_uuid_t[16];
typedef char __darwin_uuid_string_t[37];
struct __darwin_pthread_handler_rec
{
void (*__routine)(void*);
void* __arg;
struct __darwin_pthread_handler_rec* __next;
};
struct _opaque_pthread_attr_t
{
long __sig;
char __opaque[56];
};
struct _opaque_pthread_cond_t
{
long __sig;
char __opaque[40];
};
struct _opaque_pthread_condattr_t
{
long __sig;
char __opaque[8];
};
struct _opaque_pthread_mutex_t
{
long __sig;
char __opaque[56];
};
struct _opaque_pthread_mutexattr_t
{
long __sig;
char __opaque[8];
};
struct _opaque_pthread_once_t
{
long __sig;
char __opaque[8];
};
struct _opaque_pthread_rwlock_t
{
long __sig;
char __opaque[192];
};
struct _opaque_pthread_rwlockattr_t
{
long __sig;
char __opaque[16];
};
struct _opaque_pthread_t
{
long __sig;
struct __darwin_pthread_handler_rec* __cleanup_stack;
char __opaque[8176];
};
typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t;
typedef struct _opaque_pthread_cond_t __darwin_pthread_cond_t;
typedef struct _opaque_pthread_condattr_t __darwin_pthread_condattr_t;
typedef unsigned long __darwin_pthread_key_t;
typedef struct _opaque_pthread_mutex_t __darwin_pthread_mutex_t;
typedef struct _opaque_pthread_mutexattr_t __darwin_pthread_mutexattr_t;
typedef struct _opaque_pthread_once_t __darwin_pthread_once_t;
typedef struct _opaque_pthread_rwlock_t __darwin_pthread_rwlock_t;
typedef struct _opaque_pthread_rwlockattr_t __darwin_pthread_rwlockattr_t;
typedef struct _opaque_pthread_t* __darwin_pthread_t;
typedef int __darwin_nl_item;
typedef int __darwin_wctrans_t;
typedef __uint32_t __darwin_wctype_t;
extern "C"
{
void* memchr(const void* __s, int __c, size_t __n);
int memcmp(const void* __s1, const void* __s2, size_t __n);
void* memcpy(void* __dst, const void* __src, size_t __n);
void* memmove(void* __dst, const void* __src, size_t __len);
void* memset(void* __b, int __c, size_t __len);
char* strcat(char* __s1, const char* __s2);
char* strchr(const char* __s, int __c);
int strcmp(const char* __s1, const char* __s2);
int strcoll(const char* __s1, const char* __s2);
char* strcpy(char* __dst, const char* __src);
size_t strcspn(const char* __s, const char* __charset);
char* strerror(int __errnum) __asm("_"
"strerror");
size_t strlen(const char* __s);
char* strncat(char* __s1, const char* __s2, size_t __n);
int strncmp(const char* __s1, const char* __s2, size_t __n);
char* strncpy(char* __dst, const char* __src, size_t __n);
char* strpbrk(const char* __s, const char* __charset);
char* strrchr(const char* __s, int __c);
size_t strspn(const char* __s, const char* __charset);
char* strstr(const char* __big, const char* __little);
char* strtok(char* __str, const char* __sep);
size_t strxfrm(char* __s1, const char* __s2, size_t __n);
}
extern "C"
{
char* strtok_r(char* __str, const char* __sep, char** __lasts);
}
extern "C"
{
int strerror_r(int __errnum, char* __strerrbuf, size_t __buflen);
char* strdup(const char* __s1);
void* memccpy(void* __dst, const void* __src, int __c, size_t __n);
}
extern "C"
{
char* stpcpy(char* __dst, const char* __src);
char* stpncpy(char* __dst, const char* __src, size_t __n) __attribute__((availability(macosx, introduced = 10.7)));
char* strndup(const char* __s1, size_t __n) __attribute__((availability(macosx, introduced = 10.7)));
size_t strnlen(const char* __s1, size_t __n) __attribute__((availability(macosx, introduced = 10.7)));
char* strsignal(int __sig);
}
typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef long long int64_t;
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
typedef unsigned long long u_int64_t;
typedef int64_t register_t;
typedef __darwin_intptr_t intptr_t;
typedef unsigned long uintptr_t;
typedef u_int64_t user_addr_t;
typedef u_int64_t user_size_t;
typedef int64_t user_ssize_t;
typedef int64_t user_long_t;
typedef u_int64_t user_ulong_t;
typedef int64_t user_time_t;
typedef int64_t user_off_t;
typedef u_int64_t syscall_arg_t;
typedef __darwin_ssize_t ssize_t;
extern "C"
{
void* memmem(const void* __big, size_t __big_len, const void* __little, size_t __little_len)
__attribute__((availability(macosx, introduced = 10.7)));
void memset_pattern4(void* __b, const void* __pattern4, size_t __len) __attribute__((availability(macosx, introduced = 10.5)));
void memset_pattern8(void* __b, const void* __pattern8, size_t __len) __attribute__((availability(macosx, introduced = 10.5)));
void memset_pattern16(void* __b, const void* __pattern16, size_t __len) __attribute__((availability(macosx, introduced = 10.5)));
char* strcasestr(const char* __big, const char* __little);
char* strnstr(const char* __big, const char* __little, size_t __len);
size_t strlcat(char* __dst, const char* __source, size_t __size);
size_t strlcpy(char* __dst, const char* __source, size_t __size);
void strmode(int __mode, char* __bp);
char* strsep(char** __stringp, const char* __delim);
void swab(const void*, void*, ssize_t);
__attribute__((availability(macosx, introduced = 10.12.1))) __attribute__((availability(ios, introduced = 10.1)))
__attribute__((availability(tvos, introduced = 10.0.1))) __attribute__((availability(watchos, introduced = 3.1))) int
timingsafe_bcmp(const void* __b1, const void* __b2, size_t __len);
__attribute__((availability(macosx, introduced = 11.0))) __attribute__((availability(ios, introduced = 14.0)))
__attribute__((availability(tvos, introduced = 14.0))) __attribute__((availability(watchos, introduced = 7.0))) int
strsignal_r(int __sig, char* __strsignalbuf, size_t __buflen);
}
extern "C"
{
int bcmp(const void*, const void*, size_t);
void bcopy(const void*, void*, size_t);
void bzero(void*, size_t);
char* index(const char*, int);
char* rindex(const char*, int);
int ffs(int);
int strcasecmp(const char*, const char*);
int strncasecmp(const char*, const char*, size_t);
}
extern "C"
{
int ffsl(long) __attribute__((availability(macosx, introduced = 10.5)));
int ffsll(long long) __attribute__((availability(macosx, introduced = 10.9)));
int fls(int) __attribute__((availability(macosx, introduced = 10.5)));
int flsl(long) __attribute__((availability(macosx, introduced = 10.5)));
int flsll(long long) __attribute__((availability(macosx, introduced = 10.9)));
}
extern "C++"
{
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) char* __libcpp_strchr(const char* __s, int __c) {
return (char*)strchr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const char*
strchr(const char* __s, int __c) {
return __libcpp_strchr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) char* strchr(char* __s,
int __c) {
return __libcpp_strchr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) char* __libcpp_strpbrk(const char* __s1, const char* __s2) {
return (char*)strpbrk(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const char*
strpbrk(const char* __s1, const char* __s2) {
return __libcpp_strpbrk(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) char*
strpbrk(char* __s1, const char* __s2) {
return __libcpp_strpbrk(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) char* __libcpp_strrchr(const char* __s, int __c) {
return (char*)strrchr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const char*
strrchr(const char* __s, int __c) {
return __libcpp_strrchr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) char* strrchr(char* __s,
int __c) {
return __libcpp_strrchr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void* __libcpp_memchr(const void* __s, int __c, size_t __n) {
return (void*)memchr(__s, __c, __n);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const void*
memchr(const void* __s, int __c, size_t __n) {
return __libcpp_memchr(__s, __c, __n);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) void*
memchr(void* __s, int __c, size_t __n) {
return __libcpp_memchr(__s, __c, __n);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) char* __libcpp_strstr(const char* __s1, const char* __s2) {
return (char*)strstr(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const char*
strstr(const char* __s1, const char* __s2) {
return __libcpp_strstr(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) char*
strstr(char* __s1, const char* __s2) {
return __libcpp_strstr(__s1, __s2);
}
}
namespace std {
inline namespace __1 {
using ::size_t __attribute__((using_if_exists));
using ::memcpy __attribute__((using_if_exists));
using ::memmove __attribute__((using_if_exists));
using ::strcpy __attribute__((using_if_exists));
using ::strncpy __attribute__((using_if_exists));
using ::strcat __attribute__((using_if_exists));
using ::strncat __attribute__((using_if_exists));
using ::memcmp __attribute__((using_if_exists));
using ::strcmp __attribute__((using_if_exists));
using ::strncmp __attribute__((using_if_exists));
using ::strcoll __attribute__((using_if_exists));
using ::strxfrm __attribute__((using_if_exists));
using ::memchr __attribute__((using_if_exists));
using ::strchr __attribute__((using_if_exists));
using ::strcspn __attribute__((using_if_exists));
using ::strpbrk __attribute__((using_if_exists));
using ::strrchr __attribute__((using_if_exists));
using ::strspn __attribute__((using_if_exists));
using ::strstr __attribute__((using_if_exists));
using ::strtok __attribute__((using_if_exists));
using ::memset __attribute__((using_if_exists));
using ::strerror __attribute__((using_if_exists));
using ::strlen __attribute__((using_if_exists));
} // namespace __1
} // namespace std
extern "C++"
{
using std::nullptr_t;
}
typedef __darwin_mbstate_t mbstate_t;
typedef __darwin_ct_rune_t ct_rune_t;
typedef __darwin_rune_t rune_t;
typedef __builtin_va_list va_list;
typedef __builtin_va_list __gnuc_va_list;
typedef __darwin_va_list va_list;
extern "C"
{
int renameat(int, const char*, int, const char*) __attribute__((availability(macosx, introduced = 10.10)));
int renamex_np(const char*, const char*, unsigned int) __attribute__((availability(macosx, introduced = 10.12)))
__attribute__((availability(ios, introduced = 10.0))) __attribute__((availability(tvos, introduced = 10.0)))
__attribute__((availability(watchos, introduced = 3.0)));
int renameatx_np(int, const char*, int, const char*, unsigned int) __attribute__((availability(macosx, introduced = 10.12)))
__attribute__((availability(ios, introduced = 10.0))) __attribute__((availability(tvos, introduced = 10.0)))
__attribute__((availability(watchos, introduced = 3.0)));
}
typedef __darwin_off_t fpos_t;
struct __sbuf
{
unsigned char* _base;
int _size;
};
struct __sFILEX;
typedef struct __sFILE
{
unsigned char* _p;
int _r;
int _w;
short _flags;
short _file;
struct __sbuf _bf;
int _lbfsize;
void* _cookie;
int (*_Nullable _close)(void*);
int (*_Nullable _read)(void*, char*, int);
fpos_t (*_Nullable _seek)(void*, fpos_t, int);
int (*_Nullable _write)(void*, const char*, int);
struct __sbuf _ub;
struct __sFILEX* _extra;
int _ur;
unsigned char _ubuf[3];
unsigned char _nbuf[1];
struct __sbuf _lb;
int _blksize;
fpos_t _offset;
} FILE;
extern "C"
{
extern FILE* __stdinp;
extern FILE* __stdoutp;
extern FILE* __stderrp;
}
extern "C"
{
void clearerr(FILE*);
int fclose(FILE*);
int feof(FILE*);
int ferror(FILE*);
int fflush(FILE*);
int fgetc(FILE*);
int fgetpos(FILE*, fpos_t*);
char* fgets(char*, int, FILE*);
FILE* fopen(const char* __filename, const char* __mode) __asm("_"
"fopen");
int fprintf(FILE*, const char*, ...) __attribute__((__format__(__printf__, 2, 3)));
int fputc(int, FILE*);
int fputs(const char*, FILE*) __asm("_"
"fputs");
size_t fread(void* __ptr, size_t __size, size_t __nitems, FILE* __stream);
FILE* freopen(const char*, const char*, FILE*) __asm("_"
"freopen");
int fscanf(FILE*, const char*, ...) __attribute__((__format__(__scanf__, 2, 3)));
int fseek(FILE*, long, int);
int fsetpos(FILE*, const fpos_t*);
long ftell(FILE*);
size_t fwrite(const void* __ptr, size_t __size, size_t __nitems, FILE* __stream) __asm("_"
"fwrite");
int getc(FILE*);
int getchar(void);
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of "
"gets(3), it is highly recommended that you use fgets(3) instead.")))
char*
gets(char*);
void perror(const char*) __attribute__((__cold__));
int printf(const char*, ...) __attribute__((__format__(__printf__, 1, 2)));
int putc(int, FILE*);
int putchar(int);
int puts(const char*);
int remove(const char*);
int rename(const char* __old, const char* __new);
void rewind(FILE*);
int scanf(const char*, ...) __attribute__((__format__(__scanf__, 1, 2)));
void setbuf(FILE*, char*);
int setvbuf(FILE*, char*, int, size_t);
__attribute__((__availability__(swift, unavailable, message="Use snprintf instead.")))
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")))
int sprintf(char * , const char * , ...) __attribute__((__format__ (__printf__, 2, 3)));
int sscanf(const char*, const char*, ...) __attribute__((__format__(__scanf__, 2, 3)));
FILE* tmpfile(void);
__attribute__((__availability__(swift, unavailable, message = "Use mkstemp(3) instead.")))
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of "
"tmpnam(3), it is highly recommended that you use mkstemp(3) instead.")))
char*
tmpnam(char*);
int ungetc(int, FILE*);
int vfprintf(FILE*, const char*, va_list) __attribute__((__format__(__printf__, 2, 0)));
int vprintf(const char*, va_list) __attribute__((__format__(__printf__, 1, 0)));
__attribute__((__availability__(swift, unavailable, message="Use vsnprintf instead.")))
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead.")))
int vsprintf(char * , const char * , va_list) __attribute__((__format__ (__printf__, 2, 0)));
}
extern "C"
{
extern "C"
{
char* ctermid(char*);
}
FILE* fdopen(int, const char*) __asm("_"
"fdopen");
int fileno(FILE*);
}
extern "C"
{
int pclose(FILE*) __attribute__((__availability__(swift, unavailable,
message = "Use posix_spawn APIs or NSTask instead. (On iOS, process spawning is unavailable.)")));
FILE* popen(const char*, const char*) __asm("_"
"popen")
__attribute__((__availability__(swift, unavailable,
message = "Use posix_spawn APIs or NSTask instead. (On iOS, process spawning is unavailable.)")));
}
extern "C"
{
int __srget(FILE*);
int __svfscanf(FILE*, const char*, va_list) __attribute__((__format__(__scanf__, 2, 0)));
int __swbuf(int, FILE*);
}
inline __attribute__((__always_inline__)) int __sputc(int _c, FILE* _p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
return (*_p->_p++ = _c);
else
return (__swbuf(_c, _p));
}
extern "C"
{
void flockfile(FILE*);
int ftrylockfile(FILE*);
void funlockfile(FILE*);
int getc_unlocked(FILE*);
int getchar_unlocked(void);
int putc_unlocked(int, FILE*);
int putchar_unlocked(int);
int getw(FILE*);
int putw(int, FILE*);
__attribute__((__availability__(swift, unavailable, message = "Use mkstemp(3) instead.")))
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of "
"tempnam(3), it is highly recommended that you use mkstemp(3) instead.")))
char*
tempnam(const char* __dir, const char* __prefix) __asm("_"
"tempnam");
}
typedef __darwin_off_t off_t;
extern "C"
{
int fseeko(FILE* __stream, off_t __offset, int __whence);
off_t ftello(FILE* __stream);
}
extern "C"
{
int snprintf(char* __str, size_t __size, const char* __format, ...) __attribute__((__format__(__printf__, 3, 4)));
int vfscanf(FILE* __stream, const char* __format, va_list) __attribute__((__format__(__scanf__, 2, 0)));
int vscanf(const char* __format, va_list) __attribute__((__format__(__scanf__, 1, 0)));
int vsnprintf(char* __str, size_t __size, const char* __format, va_list) __attribute__((__format__(__printf__, 3, 0)));
int vsscanf(const char* __str, const char* __format, va_list) __attribute__((__format__(__scanf__, 2, 0)));
}
extern "C"
{
int dprintf(int, const char*, ...) __attribute__((__format__(__printf__, 2, 3))) __attribute__((availability(macosx, introduced = 10.7)));
int vdprintf(int, const char*, va_list) __attribute__((__format__(__printf__, 2, 0))) __attribute__((availability(macosx, introduced = 10.7)));
ssize_t getdelim(char** __linep, size_t* __linecapp, int __delimiter, FILE* __stream) __attribute__((availability(macosx, introduced = 10.7)));
ssize_t getline(char** __linep, size_t* __linecapp, FILE* __stream) __attribute__((availability(macosx, introduced = 10.7)));
FILE* fmemopen(void* __buf, size_t __size, const char* __mode) __attribute__((availability(macos, introduced = 10.13)))
__attribute__((availability(ios, introduced = 11.0))) __attribute__((availability(tvos, introduced = 11.0)))
__attribute__((availability(watchos, introduced = 4.0)));
FILE* open_memstream(char** __bufp, size_t* __sizep) __attribute__((availability(macos, introduced = 10.13)))
__attribute__((availability(ios, introduced = 11.0))) __attribute__((availability(tvos, introduced = 11.0)))
__attribute__((availability(watchos, introduced = 4.0)));
}
extern "C"
{
extern const int sys_nerr;
extern const char* const sys_errlist[];
int asprintf(char**, const char*, ...) __attribute__((__format__(__printf__, 2, 3)));
char* ctermid_r(char*);
char* fgetln(FILE*, size_t*);
const char* fmtcheck(const char*, const char*) __attribute__((format_arg(2)));
int fpurge(FILE*);
void setbuffer(FILE*, char*, int);
int setlinebuf(FILE*);
int vasprintf(char**, const char*, va_list) __attribute__((__format__(__printf__, 2, 0)));
FILE* funopen(const void*, int (*_Nullable)(void*, char*, int), int (*_Nullable)(void*, const char*, int), fpos_t (*_Nullable)(void*, fpos_t, int),
int (*_Nullable)(void*));
}
typedef __darwin_clock_t clock_t;
typedef __darwin_time_t time_t;
struct timespec
{
__darwin_time_t tv_sec;
long tv_nsec;
};
struct tm
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
long tm_gmtoff;
char* tm_zone;
};
extern char* tzname[];
extern int getdate_err;
extern long timezone __asm("_"
"timezone");
extern int daylight;
extern "C"
{
char* asctime(const struct tm*);
clock_t clock(void) __asm("_"
"clock");
char* ctime(const time_t*);
double difftime(time_t, time_t);
struct tm* getdate(const char*);
struct tm* gmtime(const time_t*);
struct tm* localtime(const time_t*);
time_t mktime(struct tm*) __asm("_"
"mktime");
size_t strftime(char*, size_t, const char*, const struct tm*) __asm("_"
"strftime");
char* strptime(const char*, const char*, struct tm*) __asm("_"
"strptime");
time_t time(time_t*);
void tzset(void);
char* asctime_r(const struct tm*, char*);
char* ctime_r(const time_t*, char*);
struct tm* gmtime_r(const time_t*, struct tm*);
struct tm* localtime_r(const time_t*, struct tm*);
time_t posix2time(time_t);
void tzsetwall(void);
time_t time2posix(time_t);
time_t timelocal(struct tm* const);
time_t timegm(struct tm* const);
int nanosleep(const struct timespec* __rqtp, struct timespec* __rmtp) __asm("_"
"nanosleep");
typedef enum
{
_CLOCK_REALTIME __attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) = 0,
_CLOCK_MONOTONIC __attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) = 6,
_CLOCK_MONOTONIC_RAW __attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) = 4,
_CLOCK_MONOTONIC_RAW_APPROX __attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) = 5,
_CLOCK_UPTIME_RAW __attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) = 8,
_CLOCK_UPTIME_RAW_APPROX __attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) = 9,
_CLOCK_PROCESS_CPUTIME_ID __attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) = 12,
_CLOCK_THREAD_CPUTIME_ID __attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) = 16
} clockid_t;
__attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) int
clock_getres(clockid_t __clock_id, struct timespec* __res);
__attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) int
clock_gettime(clockid_t __clock_id, struct timespec* __tp);
__attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, introduced = 10.0)))
__attribute__((availability(tvos, introduced = 10.0))) __attribute__((availability(watchos, introduced = 3.0))) __uint64_t
clock_gettime_nsec_np(clockid_t __clock_id);
__attribute__((availability(macosx, introduced = 10.12))) __attribute__((availability(ios, unavailable)))
__attribute__((availability(tvos, unavailable))) __attribute__((availability(watchos, unavailable))) int
clock_settime(clockid_t __clock_id, const struct timespec* __tp);
__attribute__((availability(macosx, introduced = 10.15))) __attribute__((availability(ios, introduced = 13.0)))
__attribute__((availability(tvos, introduced = 13.0))) __attribute__((availability(watchos, introduced = 6.0))) int
timespec_get(struct timespec* ts, int base);
}
typedef __darwin_wint_t wint_t;
typedef __darwin_wctype_t wctype_t;
typedef struct
{
__darwin_rune_t __min;
__darwin_rune_t __max;
__darwin_rune_t __map;
__uint32_t* __types;
} _RuneEntry;
typedef struct
{
int __nranges;
_RuneEntry* __ranges;
} _RuneRange;
typedef struct
{
char __name[14];
__uint32_t __mask;
} _RuneCharClass;
typedef struct
{
char __magic[8];
char __encoding[32];
__darwin_rune_t (*__sgetrune)(const char*, __darwin_size_t, char const**);
int (*__sputrune)(__darwin_rune_t, char*, __darwin_size_t, char**);
__darwin_rune_t __invalid_rune;
__uint32_t __runetype[(1 << 8)];
__darwin_rune_t __maplower[(1 << 8)];
__darwin_rune_t __mapupper[(1 << 8)];
_RuneRange __runetype_ext;
_RuneRange __maplower_ext;
_RuneRange __mapupper_ext;
void* __variable;
int __variable_len;
int __ncharclasses;
_RuneCharClass* __charclasses;
} _RuneLocale;
extern "C"
{
extern _RuneLocale _DefaultRuneLocale;
extern _RuneLocale* _CurrentRuneLocale;
}
extern "C"
{
unsigned long ___runetype(__darwin_ct_rune_t);
__darwin_ct_rune_t ___tolower(__darwin_ct_rune_t);
__darwin_ct_rune_t ___toupper(__darwin_ct_rune_t);
}
inline int isascii(int _c) {
return ((_c & ~0x7F) == 0);
}
extern "C"
{
int __maskrune(__darwin_ct_rune_t, unsigned long);
}
inline int __istype(__darwin_ct_rune_t _c, unsigned long _f) {
return (isascii(_c) ? !!(_DefaultRuneLocale.__runetype[_c] & _f) : !!__maskrune(_c, _f));
}
inline __darwin_ct_rune_t __isctype(__darwin_ct_rune_t _c, unsigned long _f) {
return (_c < 0 || _c >= (1 << 8)) ? 0 : !!(_DefaultRuneLocale.__runetype[_c] & _f);
}
extern "C"
{
__darwin_ct_rune_t __toupper(__darwin_ct_rune_t);
__darwin_ct_rune_t __tolower(__darwin_ct_rune_t);
}
inline int __wcwidth(__darwin_ct_rune_t _c) {
unsigned int _x;
if (_c == 0) return (0);
_x = (unsigned int)__maskrune(_c, 0xe0000000L | 0x00040000L);
if ((_x & 0xe0000000L) != 0) return ((_x & 0xe0000000L) >> 30);
return ((_x & 0x00040000L) != 0 ? 1 : -1);
}
inline int isalnum(int _c) {
return (__istype(_c, 0x00000100L | 0x00000400L));
}
inline int isalpha(int _c) {
return (__istype(_c, 0x00000100L));
}
inline int isblank(int _c) {
return (__istype(_c, 0x00020000L));
}
inline int iscntrl(int _c) {
return (__istype(_c, 0x00000200L));
}
inline int isdigit(int _c) {
return (__isctype(_c, 0x00000400L));
}
inline int isgraph(int _c) {
return (__istype(_c, 0x00000800L));
}
inline int islower(int _c) {
return (__istype(_c, 0x00001000L));
}
inline int isprint(int _c) {
return (__istype(_c, 0x00040000L));
}
inline int ispunct(int _c) {
return (__istype(_c, 0x00002000L));
}
inline int isspace(int _c) {
return (__istype(_c, 0x00004000L));
}
inline int isupper(int _c) {
return (__istype(_c, 0x00008000L));
}
inline int isxdigit(int _c) {
return (__isctype(_c, 0x00010000L));
}
inline int toascii(int _c) {
return (_c & 0x7F);
}
inline int tolower(int _c) {
return (__tolower(_c));
}
inline int toupper(int _c) {
return (__toupper(_c));
}
inline int digittoint(int _c) {
return (__maskrune(_c, 0x0F));
}
inline int ishexnumber(int _c) {
return (__istype(_c, 0x00010000L));
}
inline int isideogram(int _c) {
return (__istype(_c, 0x00080000L));
}
inline int isnumber(int _c) {
return (__istype(_c, 0x00000400L));
}
inline int isphonogram(int _c) {
return (__istype(_c, 0x00200000L));
}
inline int isrune(int _c) {
return (__istype(_c, 0xFFFFFFF0L));
}
inline int isspecial(int _c) {
return (__istype(_c, 0x00100000L));
}
inline int iswalnum(wint_t _wc) {
return (__istype(_wc, 0x00000100L | 0x00000400L));
}
inline int iswalpha(wint_t _wc) {
return (__istype(_wc, 0x00000100L));
}
inline int iswcntrl(wint_t _wc) {
return (__istype(_wc, 0x00000200L));
}
inline int iswctype(wint_t _wc, wctype_t _charclass) {
return (__istype(_wc, _charclass));
}
inline int iswdigit(wint_t _wc) {
return (__isctype(_wc, 0x00000400L));
}
inline int iswgraph(wint_t _wc) {
return (__istype(_wc, 0x00000800L));
}
inline int iswlower(wint_t _wc) {
return (__istype(_wc, 0x00001000L));
}
inline int iswprint(wint_t _wc) {
return (__istype(_wc, 0x00040000L));
}
inline int iswpunct(wint_t _wc) {
return (__istype(_wc, 0x00002000L));
}
inline int iswspace(wint_t _wc) {
return (__istype(_wc, 0x00004000L));
}
inline int iswupper(wint_t _wc) {
return (__istype(_wc, 0x00008000L));
}
inline int iswxdigit(wint_t _wc) {
return (__isctype(_wc, 0x00010000L));
}
inline wint_t towlower(wint_t _wc) {
return (__tolower(_wc));
}
inline wint_t towupper(wint_t _wc) {
return (__toupper(_wc));
}
extern "C"
{
wctype_t wctype(const char*);
}
extern "C"
{
wint_t btowc(int);
wint_t fgetwc(FILE*);
wchar_t* fgetws(wchar_t*, int, FILE*);
wint_t fputwc(wchar_t, FILE*);
int fputws(const wchar_t*, FILE*);
int fwide(FILE*, int);
int fwprintf(FILE*, const wchar_t*, ...);
int fwscanf(FILE*, const wchar_t*, ...);
wint_t getwc(FILE*);
wint_t getwchar(void);
size_t mbrlen(const char*, size_t, mbstate_t*);
size_t mbrtowc(wchar_t*, const char*, size_t, mbstate_t*);
int mbsinit(const mbstate_t*);
size_t mbsrtowcs(wchar_t*, const char**, size_t, mbstate_t*);
wint_t putwc(wchar_t, FILE*);
wint_t putwchar(wchar_t);
int swprintf(wchar_t*, size_t, const wchar_t*, ...);
int swscanf(const wchar_t*, const wchar_t*, ...);
wint_t ungetwc(wint_t, FILE*);
int vfwprintf(FILE*, const wchar_t*, __darwin_va_list);
int vswprintf(wchar_t*, size_t, const wchar_t*, __darwin_va_list);
int vwprintf(const wchar_t*, __darwin_va_list);
size_t wcrtomb(char*, wchar_t, mbstate_t*);
wchar_t* wcscat(wchar_t*, const wchar_t*);
wchar_t* wcschr(const wchar_t*, wchar_t);
int wcscmp(const wchar_t*, const wchar_t*);
int wcscoll(const wchar_t*, const wchar_t*);
wchar_t* wcscpy(wchar_t*, const wchar_t*);
size_t wcscspn(const wchar_t*, const wchar_t*);
size_t wcsftime(wchar_t*, size_t, const wchar_t*, const struct tm*) __asm("_"
"wcsftime");
size_t wcslen(const wchar_t*);
wchar_t* wcsncat(wchar_t*, const wchar_t*, size_t);
int wcsncmp(const wchar_t*, const wchar_t*, size_t);
wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
wchar_t* wcsrchr(const wchar_t*, wchar_t);
size_t wcsrtombs(char*, const wchar_t**, size_t, mbstate_t*);
size_t wcsspn(const wchar_t*, const wchar_t*);
wchar_t* wcsstr(const wchar_t*, const wchar_t*);
size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
int wctob(wint_t);
double wcstod(const wchar_t*, wchar_t**);
wchar_t* wcstok(wchar_t*, const wchar_t*, wchar_t**);
long wcstol(const wchar_t*, wchar_t**, int);
unsigned long wcstoul(const wchar_t*, wchar_t**, int);
wchar_t* wmemchr(const wchar_t*, wchar_t, size_t);
int wmemcmp(const wchar_t*, const wchar_t*, size_t);
wchar_t* wmemcpy(wchar_t*, const wchar_t*, size_t);
wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t);
wchar_t* wmemset(wchar_t*, wchar_t, size_t);
int wprintf(const wchar_t*, ...);
int wscanf(const wchar_t*, ...);
int wcswidth(const wchar_t*, size_t);
int wcwidth(wchar_t);
}
extern "C"
{
int vfwscanf(FILE*, const wchar_t*, __darwin_va_list);
int vswscanf(const wchar_t*, const wchar_t*, __darwin_va_list);
int vwscanf(const wchar_t*, __darwin_va_list);
float wcstof(const wchar_t*, wchar_t**);
long double wcstold(const wchar_t*, wchar_t**);
long long wcstoll(const wchar_t*, wchar_t**, int);
unsigned long long wcstoull(const wchar_t*, wchar_t**, int);
}
extern "C"
{
size_t mbsnrtowcs(wchar_t*, const char**, size_t, size_t, mbstate_t*);
wchar_t* wcpcpy(wchar_t*, const wchar_t*) __attribute__((availability(macosx, introduced = 10.7)));
wchar_t* wcpncpy(wchar_t*, const wchar_t*, size_t) __attribute__((availability(macosx, introduced = 10.7)));
wchar_t* wcsdup(const wchar_t*) __attribute__((availability(macosx, introduced = 10.7)));
int wcscasecmp(const wchar_t*, const wchar_t*) __attribute__((availability(macosx, introduced = 10.7)));
int wcsncasecmp(const wchar_t*, const wchar_t*, size_t n) __attribute__((availability(macosx, introduced = 10.7)));
size_t wcsnlen(const wchar_t*, size_t) __attribute__((availability(macosx, introduced = 10.7)));
size_t wcsnrtombs(char*, const wchar_t**, size_t, size_t, mbstate_t*);
FILE* open_wmemstream(wchar_t** __bufp, size_t* __sizep) __attribute__((availability(macos, introduced = 10.13)))
__attribute__((availability(ios, introduced = 11.0))) __attribute__((availability(tvos, introduced = 11.0)))
__attribute__((availability(watchos, introduced = 4.0)));
}
extern "C"
{
wchar_t* fgetwln(FILE*, size_t*) __attribute__((availability(macosx, introduced = 10.7)));
size_t wcslcat(wchar_t*, const wchar_t*, size_t);
size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
}
extern "C++"
{
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {
return (wchar_t*)wcschr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const wchar_t*
wcschr(const wchar_t* __s, wchar_t __c) {
return __libcpp_wcschr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) wchar_t*
wcschr(wchar_t* __s, wchar_t __c) {
return __libcpp_wcschr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) wchar_t* __libcpp_wcspbrk(const wchar_t* __s1,
const wchar_t* __s2) {
return (wchar_t*)wcspbrk(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const wchar_t*
wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {
return __libcpp_wcspbrk(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) wchar_t*
wcspbrk(wchar_t* __s1, const wchar_t* __s2) {
return __libcpp_wcspbrk(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {
return (wchar_t*)wcsrchr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const wchar_t*
wcsrchr(const wchar_t* __s, wchar_t __c) {
return __libcpp_wcsrchr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) wchar_t*
wcsrchr(wchar_t* __s, wchar_t __c) {
return __libcpp_wcsrchr(__s, __c);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) wchar_t* __libcpp_wcsstr(const wchar_t* __s1,
const wchar_t* __s2) {
return (wchar_t*)wcsstr(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const wchar_t*
wcsstr(const wchar_t* __s1, const wchar_t* __s2) {
return __libcpp_wcsstr(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) wchar_t*
wcsstr(wchar_t* __s1, const wchar_t* __s2) {
return __libcpp_wcsstr(__s1, __s2);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c,
size_t __n) {
return (wchar_t*)wmemchr(__s, __c, __n);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) const wchar_t*
wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {
return __libcpp_wmemchr(__s, __c, __n);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) __attribute__((__enable_if__(true, ""))) wchar_t*
wmemchr(wchar_t* __s, wchar_t __c, size_t __n) {
return __libcpp_wmemchr(__s, __c, __n);
}
}
namespace std {
inline namespace __1 {
using ::mbstate_t __attribute__((using_if_exists));
}
} // namespace std
namespace std {
inline namespace __1 {
class __attribute__((__visibility__("default"))) ios_base;
template <class _CharT>
struct __attribute__((__type_visibility__("default"))) char_traits;
template <>
struct char_traits<char>;
template <>
struct char_traits<char8_t>;
template <>
struct char_traits<char16_t>;
template <>
struct char_traits<char32_t>;
template <>
struct char_traits<wchar_t>;
template <class _Tp>
class __attribute__((__type_visibility__("default"))) allocator;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_ios;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_streambuf;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_istream;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_ostream;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_iostream;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_stringbuf;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_istringstream;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_ostringstream;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_stringstream;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_filebuf;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_ifstream;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_ofstream;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_fstream;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT>>
class __attribute__((__type_visibility__("default"))) ostreambuf_iterator;
typedef basic_ios<char> ios;
typedef basic_ios<wchar_t> wios;
typedef basic_streambuf<char> streambuf;
typedef basic_istream<char> istream;
typedef basic_ostream<char> ostream;
typedef basic_iostream<char> iostream;
typedef basic_stringbuf<char> stringbuf;
typedef basic_istringstream<char> istringstream;
typedef basic_ostringstream<char> ostringstream;
typedef basic_stringstream<char> stringstream;
typedef basic_filebuf<char> filebuf;
typedef basic_ifstream<char> ifstream;
typedef basic_ofstream<char> ofstream;
typedef basic_fstream<char> fstream;
typedef basic_streambuf<wchar_t> wstreambuf;
typedef basic_istream<wchar_t> wistream;
typedef basic_ostream<wchar_t> wostream;
typedef basic_iostream<wchar_t> wiostream;
typedef basic_stringbuf<wchar_t> wstringbuf;
typedef basic_istringstream<wchar_t> wistringstream;
typedef basic_ostringstream<wchar_t> wostringstream;
typedef basic_stringstream<wchar_t> wstringstream;
typedef basic_filebuf<wchar_t> wfilebuf;
typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(ios))) __attribute__((__preferred_name__(wios))) basic_ios;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(streambuf))) __attribute__((__preferred_name__(wstreambuf))) basic_streambuf;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(istream))) __attribute__((__preferred_name__(wistream))) basic_istream;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(ostream))) __attribute__((__preferred_name__(wostream))) basic_ostream;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(iostream))) __attribute__((__preferred_name__(wiostream))) basic_iostream;
template <class _CharT, class _Traits, class _Allocator>
class __attribute__((__preferred_name__(stringbuf))) __attribute__((__preferred_name__(wstringbuf))) basic_stringbuf;
template <class _CharT, class _Traits, class _Allocator>
class __attribute__((__preferred_name__(istringstream))) __attribute__((__preferred_name__(wistringstream))) basic_istringstream;
template <class _CharT, class _Traits, class _Allocator>
class __attribute__((__preferred_name__(ostringstream))) __attribute__((__preferred_name__(wostringstream))) basic_ostringstream;
template <class _CharT, class _Traits, class _Allocator>
class __attribute__((__preferred_name__(stringstream))) __attribute__((__preferred_name__(wstringstream))) basic_stringstream;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(filebuf))) __attribute__((__preferred_name__(wfilebuf))) basic_filebuf;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(ifstream))) __attribute__((__preferred_name__(wifstream))) basic_ifstream;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(ofstream))) __attribute__((__preferred_name__(wofstream))) basic_ofstream;
template <class _CharT, class _Traits>
class __attribute__((__preferred_name__(fstream))) __attribute__((__preferred_name__(wfstream))) basic_fstream;
template <class _State>
class __attribute__((__type_visibility__("default"))) fpos;
typedef fpos<mbstate_t> streampos;
typedef fpos<mbstate_t> wstreampos;
typedef fpos<mbstate_t> u8streampos;
typedef fpos<mbstate_t> u16streampos;
typedef fpos<mbstate_t> u32streampos;
typedef long long streamoff;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT>>
class __attribute__((__type_visibility__("default"))) basic_string;
typedef basic_string<char, char_traits<char>, allocator<char>> string;
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t>> wstring;
template <class _CharT, class _Traits, class _Allocator>
class __attribute__((__preferred_name__(string))) __attribute__((__preferred_name__(wstring))) basic_string;
template <class _Tp, class _Alloc = allocator<_Tp>>
class __attribute__((__type_visibility__("default"))) vector;
template <class _CharT, class _Traits>
class __save_flags
{
typedef basic_ios<_CharT, _Traits> __stream_type;
typedef typename __stream_type::fmtflags fmtflags;
__stream_type& __stream_;
fmtflags __fmtflags_;
_CharT __fill_;
__save_flags(const __save_flags&);
__save_flags& operator=(const __save_flags&);
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit __save_flags(__stream_type& __stream)
: __stream_(__stream), __fmtflags_(__stream.flags()), __fill_(__stream.fill()) {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) ~__save_flags() {
__stream_.flags(__fmtflags_);
__stream_.fill(__fill_);
}
};
} // namespace __1
} // namespace std
namespace std {
inline namespace __1 {
template <class _Tp>
inline constexpr __attribute__((__no_sanitize__("cfi"))) __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) _Tp*
addressof(_Tp& __x) noexcept {
return __builtin_addressof(__x);
}
template <class _Tp>
_Tp* addressof(const _Tp&&) noexcept = delete;
} // namespace __1
} // namespace std
typedef enum
{
P_ALL,
P_PID,
P_PGID
} idtype_t;
typedef __darwin_pid_t pid_t;
typedef __darwin_id_t id_t;
typedef int sig_atomic_t;
struct __darwin_arm_exception_state
{
__uint32_t __exception;
__uint32_t __fsr;
__uint32_t __far;
};
struct __darwin_arm_exception_state64
{
__uint64_t __far;
__uint32_t __esr;
__uint32_t __exception;
};
struct __darwin_arm_thread_state
{
__uint32_t __r[13];
__uint32_t __sp;
__uint32_t __lr;
__uint32_t __pc;
__uint32_t __cpsr;
};
struct __darwin_arm_thread_state64
{
__uint64_t __x[29];
__uint64_t __fp;
__uint64_t __lr;
__uint64_t __sp;
__uint64_t __pc;
__uint32_t __cpsr;
__uint32_t __pad;
};
struct __darwin_arm_vfp_state
{
__uint32_t __r[64];
__uint32_t __fpscr;
};
struct __darwin_arm_neon_state64
{
__uint128_t __v[32];
__uint32_t __fpsr;
__uint32_t __fpcr;
};
struct __darwin_arm_neon_state
{
__uint128_t __v[16];
__uint32_t __fpsr;
__uint32_t __fpcr;
};
struct __arm_pagein_state
{
int __pagein_error;
};
struct __arm_legacy_debug_state
{
__uint32_t __bvr[16];
__uint32_t __bcr[16];
__uint32_t __wvr[16];
__uint32_t __wcr[16];
};
struct __darwin_arm_debug_state32
{
__uint32_t __bvr[16];
__uint32_t __bcr[16];
__uint32_t __wvr[16];
__uint32_t __wcr[16];
__uint64_t __mdscr_el1;
};
struct __darwin_arm_debug_state64
{
__uint64_t __bvr[16];
__uint64_t __bcr[16];
__uint64_t __wvr[16];
__uint64_t __wcr[16];
__uint64_t __mdscr_el1;
};
struct __darwin_arm_cpmu_state64
{
__uint64_t __ctrs[16];
};
struct __darwin_mcontext32
{
struct __darwin_arm_exception_state __es;
struct __darwin_arm_thread_state __ss;
struct __darwin_arm_vfp_state __fs;
};
struct __darwin_mcontext64
{
struct __darwin_arm_exception_state64 __es;
struct __darwin_arm_thread_state64 __ss;
struct __darwin_arm_neon_state64 __ns;
};
typedef struct __darwin_mcontext64* mcontext_t;
typedef __darwin_pthread_attr_t pthread_attr_t;
struct __darwin_sigaltstack
{
void* ss_sp;
__darwin_size_t ss_size;
int ss_flags;
};
typedef struct __darwin_sigaltstack stack_t;
struct __darwin_ucontext
{
int uc_onstack;
__darwin_sigset_t uc_sigmask;
struct __darwin_sigaltstack uc_stack;
struct __darwin_ucontext* uc_link;
__darwin_size_t uc_mcsize;
struct __darwin_mcontext64* uc_mcontext;
};
typedef struct __darwin_ucontext ucontext_t;
typedef __darwin_sigset_t sigset_t;
typedef __darwin_uid_t uid_t;
union sigval
{
int sival_int;
void* sival_ptr;
};
struct sigevent
{
int sigev_notify;
int sigev_signo;
union sigval sigev_value;
void (*sigev_notify_function)(union sigval);
pthread_attr_t* sigev_notify_attributes;
};
typedef struct __siginfo
{
int si_signo;
int si_errno;
int si_code;
pid_t si_pid;
uid_t si_uid;
int si_status;
void* si_addr;
union sigval si_value;
long si_band;
unsigned long __pad[7];
} siginfo_t;
union __sigaction_u
{
void (*__sa_handler)(int);
void (*__sa_sigaction)(int, struct __siginfo*, void*);
};
struct __sigaction
{
union __sigaction_u __sigaction_u;
void (*sa_tramp)(void*, int, int, siginfo_t*, void*);
sigset_t sa_mask;
int sa_flags;
};
struct sigaction
{
union __sigaction_u __sigaction_u;
sigset_t sa_mask;
int sa_flags;
};
typedef void (*sig_t)(int);
struct sigvec
{
void (*sv_handler)(int);
int sv_mask;
int sv_flags;
};
struct sigstack
{
char* ss_sp;
int ss_onstack;
};
extern "C"
{
void (*signal(int, void (*)(int)))(int);
}
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
typedef long int intmax_t;
typedef long unsigned int uintmax_t;
struct timeval
{
__darwin_time_t tv_sec;
__darwin_suseconds_t tv_usec;
};
typedef __uint64_t rlim_t;
struct rusage
{
struct timeval ru_utime;
struct timeval ru_stime;
long ru_maxrss;
long ru_ixrss;
long ru_idrss;
long ru_isrss;
long ru_minflt;
long ru_majflt;
long ru_nswap;
long ru_inblock;
long ru_oublock;
long ru_msgsnd;
long ru_msgrcv;
long ru_nsignals;
long ru_nvcsw;
long ru_nivcsw;
};
typedef void* rusage_info_t;
struct rusage_info_v0
{
uint8_t ri_uuid[16];
uint64_t ri_user_time;
uint64_t ri_system_time;
uint64_t ri_pkg_idle_wkups;
uint64_t ri_interrupt_wkups;
uint64_t ri_pageins;
uint64_t ri_wired_size;
uint64_t ri_resident_size;
uint64_t ri_phys_footprint;
uint64_t ri_proc_start_abstime;
uint64_t ri_proc_exit_abstime;
};
struct rusage_info_v1
{
uint8_t ri_uuid[16];
uint64_t ri_user_time;
uint64_t ri_system_time;
uint64_t ri_pkg_idle_wkups;
uint64_t ri_interrupt_wkups;
uint64_t ri_pageins;
uint64_t ri_wired_size;
uint64_t ri_resident_size;
uint64_t ri_phys_footprint;
uint64_t ri_proc_start_abstime;
uint64_t ri_proc_exit_abstime;
uint64_t ri_child_user_time;
uint64_t ri_child_system_time;
uint64_t ri_child_pkg_idle_wkups;
uint64_t ri_child_interrupt_wkups;
uint64_t ri_child_pageins;
uint64_t ri_child_elapsed_abstime;
};
struct rusage_info_v2
{
uint8_t ri_uuid[16];
uint64_t ri_user_time;
uint64_t ri_system_time;
uint64_t ri_pkg_idle_wkups;
uint64_t ri_interrupt_wkups;
uint64_t ri_pageins;
uint64_t ri_wired_size;
uint64_t ri_resident_size;
uint64_t ri_phys_footprint;
uint64_t ri_proc_start_abstime;
uint64_t ri_proc_exit_abstime;
uint64_t ri_child_user_time;
uint64_t ri_child_system_time;
uint64_t ri_child_pkg_idle_wkups;
uint64_t ri_child_interrupt_wkups;
uint64_t ri_child_pageins;
uint64_t ri_child_elapsed_abstime;
uint64_t ri_diskio_bytesread;
uint64_t ri_diskio_byteswritten;
};
struct rusage_info_v3
{
uint8_t ri_uuid[16];
uint64_t ri_user_time;
uint64_t ri_system_time;
uint64_t ri_pkg_idle_wkups;
uint64_t ri_interrupt_wkups;
uint64_t ri_pageins;
uint64_t ri_wired_size;
uint64_t ri_resident_size;
uint64_t ri_phys_footprint;
uint64_t ri_proc_start_abstime;
uint64_t ri_proc_exit_abstime;
uint64_t ri_child_user_time;
uint64_t ri_child_system_time;
uint64_t ri_child_pkg_idle_wkups;
uint64_t ri_child_interrupt_wkups;
uint64_t ri_child_pageins;
uint64_t ri_child_elapsed_abstime;
uint64_t ri_diskio_bytesread;
uint64_t ri_diskio_byteswritten;
uint64_t ri_cpu_time_qos_default;
uint64_t ri_cpu_time_qos_maintenance;
uint64_t ri_cpu_time_qos_background;
uint64_t ri_cpu_time_qos_utility;
uint64_t ri_cpu_time_qos_legacy;
uint64_t ri_cpu_time_qos_user_initiated;
uint64_t ri_cpu_time_qos_user_interactive;
uint64_t ri_billed_system_time;
uint64_t ri_serviced_system_time;
};
struct rusage_info_v4
{
uint8_t ri_uuid[16];
uint64_t ri_user_time;
uint64_t ri_system_time;
uint64_t ri_pkg_idle_wkups;
uint64_t ri_interrupt_wkups;
uint64_t ri_pageins;
uint64_t ri_wired_size;
uint64_t ri_resident_size;
uint64_t ri_phys_footprint;
uint64_t ri_proc_start_abstime;
uint64_t ri_proc_exit_abstime;
uint64_t ri_child_user_time;
uint64_t ri_child_system_time;
uint64_t ri_child_pkg_idle_wkups;
uint64_t ri_child_interrupt_wkups;
uint64_t ri_child_pageins;
uint64_t ri_child_elapsed_abstime;
uint64_t ri_diskio_bytesread;
uint64_t ri_diskio_byteswritten;
uint64_t ri_cpu_time_qos_default;
uint64_t ri_cpu_time_qos_maintenance;
uint64_t ri_cpu_time_qos_background;
uint64_t ri_cpu_time_qos_utility;
uint64_t ri_cpu_time_qos_legacy;
uint64_t ri_cpu_time_qos_user_initiated;
uint64_t ri_cpu_time_qos_user_interactive;
uint64_t ri_billed_system_time;
uint64_t ri_serviced_system_time;
uint64_t ri_logical_writes;
uint64_t ri_lifetime_max_phys_footprint;
uint64_t ri_instructions;
uint64_t ri_cycles;
uint64_t ri_billed_energy;
uint64_t ri_serviced_energy;
uint64_t ri_interval_max_phys_footprint;
uint64_t ri_runnable_time;
};
struct rusage_info_v5
{
uint8_t ri_uuid[16];
uint64_t ri_user_time;
uint64_t ri_system_time;
uint64_t ri_pkg_idle_wkups;
uint64_t ri_interrupt_wkups;
uint64_t ri_pageins;
uint64_t ri_wired_size;
uint64_t ri_resident_size;
uint64_t ri_phys_footprint;
uint64_t ri_proc_start_abstime;
uint64_t ri_proc_exit_abstime;
uint64_t ri_child_user_time;
uint64_t ri_child_system_time;
uint64_t ri_child_pkg_idle_wkups;
uint64_t ri_child_interrupt_wkups;
uint64_t ri_child_pageins;
uint64_t ri_child_elapsed_abstime;
uint64_t ri_diskio_bytesread;
uint64_t ri_diskio_byteswritten;
uint64_t ri_cpu_time_qos_default;
uint64_t ri_cpu_time_qos_maintenance;
uint64_t ri_cpu_time_qos_background;
uint64_t ri_cpu_time_qos_utility;
uint64_t ri_cpu_time_qos_legacy;
uint64_t ri_cpu_time_qos_user_initiated;
uint64_t ri_cpu_time_qos_user_interactive;
uint64_t ri_billed_system_time;
uint64_t ri_serviced_system_time;
uint64_t ri_logical_writes;
uint64_t ri_lifetime_max_phys_footprint;
uint64_t ri_instructions;
uint64_t ri_cycles;
uint64_t ri_billed_energy;
uint64_t ri_serviced_energy;
uint64_t ri_interval_max_phys_footprint;
uint64_t ri_runnable_time;
uint64_t ri_flags;
};
struct rusage_info_v6
{
uint8_t ri_uuid[16];
uint64_t ri_user_time;
uint64_t ri_system_time;
uint64_t ri_pkg_idle_wkups;
uint64_t ri_interrupt_wkups;
uint64_t ri_pageins;
uint64_t ri_wired_size;
uint64_t ri_resident_size;
uint64_t ri_phys_footprint;
uint64_t ri_proc_start_abstime;
uint64_t ri_proc_exit_abstime;
uint64_t ri_child_user_time;
uint64_t ri_child_system_time;
uint64_t ri_child_pkg_idle_wkups;
uint64_t ri_child_interrupt_wkups;
uint64_t ri_child_pageins;
uint64_t ri_child_elapsed_abstime;
uint64_t ri_diskio_bytesread;
uint64_t ri_diskio_byteswritten;
uint64_t ri_cpu_time_qos_default;
uint64_t ri_cpu_time_qos_maintenance;
uint64_t ri_cpu_time_qos_background;
uint64_t ri_cpu_time_qos_utility;
uint64_t ri_cpu_time_qos_legacy;
uint64_t ri_cpu_time_qos_user_initiated;
uint64_t ri_cpu_time_qos_user_interactive;
uint64_t ri_billed_system_time;
uint64_t ri_serviced_system_time;
uint64_t ri_logical_writes;
uint64_t ri_lifetime_max_phys_footprint;
uint64_t ri_instructions;
uint64_t ri_cycles;
uint64_t ri_billed_energy;
uint64_t ri_serviced_energy;
uint64_t ri_interval_max_phys_footprint;
uint64_t ri_runnable_time;
uint64_t ri_flags;
uint64_t ri_user_ptime;
uint64_t ri_system_ptime;
uint64_t ri_pinstructions;
uint64_t ri_pcycles;
uint64_t ri_energy_nj;
uint64_t ri_penergy_nj;
uint64_t ri_reserved[14];
};
typedef struct rusage_info_v6 rusage_info_current;
struct rlimit
{
rlim_t rlim_cur;
rlim_t rlim_max;
};
struct proc_rlimit_control_wakeupmon
{
uint32_t wm_flags;
int32_t wm_rate;
};
extern "C"
{
int getpriority(int, id_t);
int getiopolicy_np(int, int) __attribute__((availability(macosx, introduced = 10.5)));
int getrlimit(int, struct rlimit*) __asm("_"
"getrlimit");
int getrusage(int, struct rusage*);
int setpriority(int, id_t, int);
int setiopolicy_np(int, int, int) __attribute__((availability(macosx, introduced = 10.5)));
int setrlimit(int, const struct rlimit*) __asm("_"
"setrlimit");
}
static inline uint16_t _OSSwapInt16(uint16_t _data) {
return (uint16_t)(_data << 8 | _data >> 8);
}
static inline uint32_t _OSSwapInt32(uint32_t _data) {
_data = __builtin_bswap32(_data);
return _data;
}
static inline uint64_t _OSSwapInt64(uint64_t _data) {
return __builtin_bswap64(_data);
}
struct _OSUnalignedU16
{
volatile uint16_t __val;
} __attribute__((__packed__));
struct _OSUnalignedU32
{
volatile uint32_t __val;
} __attribute__((__packed__));
struct _OSUnalignedU64
{
volatile uint64_t __val;
} __attribute__((__packed__));
static inline uint16_t OSReadSwapInt16(const volatile void* _base, uintptr_t _offset) {
return _OSSwapInt16(((struct _OSUnalignedU16*)((uintptr_t)_base + _offset))->__val);
}
static inline uint32_t OSReadSwapInt32(const volatile void* _base, uintptr_t _offset) {
return _OSSwapInt32(((struct _OSUnalignedU32*)((uintptr_t)_base + _offset))->__val);
}
static inline uint64_t OSReadSwapInt64(const volatile void* _base, uintptr_t _offset) {
return _OSSwapInt64(((struct _OSUnalignedU64*)((uintptr_t)_base + _offset))->__val);
}
static inline void OSWriteSwapInt16(volatile void* _base, uintptr_t _offset, uint16_t _data) {
((struct _OSUnalignedU16*)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data);
}
static inline void OSWriteSwapInt32(volatile void* _base, uintptr_t _offset, uint32_t _data) {
((struct _OSUnalignedU32*)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data);
}
static inline void OSWriteSwapInt64(volatile void* _base, uintptr_t _offset, uint64_t _data) {
((struct _OSUnalignedU64*)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data);
}
union wait
{
int w_status;
struct
{
unsigned int w_Termsig : 7, w_Coredump : 1, w_Retcode : 8, w_Filler : 16;
} w_T;
struct
{
unsigned int w_Stopval : 8, w_Stopsig : 8, w_Filler : 16;
} w_S;
};
extern "C"
{
pid_t wait(int*) __asm("_"
"wait");
pid_t waitpid(pid_t, int*, int) __asm("_"
"waitpid");
int waitid(idtype_t, id_t, siginfo_t*, int) __asm("_"
"waitid");
pid_t wait3(int*, int, struct rusage*);
pid_t wait4(pid_t, int*, int, struct rusage*);
}
extern "C"
{
void* alloca(size_t);
}
typedef struct
{
int quot;
int rem;
} div_t;
typedef struct
{
long quot;
long rem;
} ldiv_t;
typedef struct
{
long long quot;
long long rem;
} lldiv_t;
extern int __mb_cur_max;
extern "C"
{
void* malloc(size_t __size) __attribute__((__warn_unused_result__)) __attribute__((alloc_size(1)));
void* calloc(size_t __count, size_t __size) __attribute__((__warn_unused_result__)) __attribute__((alloc_size(1, 2)));
void free(void*);
void* realloc(void* __ptr, size_t __size) __attribute__((__warn_unused_result__)) __attribute__((alloc_size(2)));
void* valloc(size_t) __attribute__((alloc_size(1)));
void* aligned_alloc(size_t __alignment, size_t __size) __attribute__((__warn_unused_result__)) __attribute__((alloc_size(2)))
__attribute__((availability(macosx, introduced = 10.15))) __attribute__((availability(ios, introduced = 13.0)))
__attribute__((availability(tvos, introduced = 13.0))) __attribute__((availability(watchos, introduced = 6.0)));
int posix_memalign(void** __memptr, size_t __alignment, size_t __size) __attribute__((availability(macosx, introduced = 10.6)));
}
extern "C"
{
void abort(void) __attribute__((__cold__)) __attribute__((__noreturn__));
int abs(int) __attribute__((__const__));
int atexit(void (*_Nonnull)(void));
double atof(const char*);
int atoi(const char*);
long atol(const char*);
long long atoll(const char*);
void* bsearch(const void* __key, const void* __base, size_t __nel, size_t __width, int (*_Nonnull __compar)(const void*, const void*));
div_t div(int, int) __attribute__((__const__));
void exit(int) __attribute__((__noreturn__));
char* getenv(const char*);
long labs(long) __attribute__((__const__));
ldiv_t ldiv(long, long) __attribute__((__const__));
long long llabs(long long);
lldiv_t lldiv(long long, long long);
int mblen(const char* __s, size_t __n);
size_t mbstowcs(wchar_t*, const char*, size_t);
int mbtowc(wchar_t*, const char*, size_t);
void qsort(void* __base, size_t __nel, size_t __width, int (*_Nonnull __compar)(const void*, const void*));
int rand(void) __attribute__((__availability__(swift, unavailable, message = "Use arc4random instead.")));
void srand(unsigned) __attribute__((__availability__(swift, unavailable, message = "Use arc4random instead.")));
double strtod(const char*, char**) __asm("_"
"strtod");
float strtof(const char*, char**) __asm("_"
"strtof");
long strtol(const char* __str, char** __endptr, int __base);
long double strtold(const char*, char**);
long long strtoll(const char* __str, char** __endptr, int __base);
unsigned long strtoul(const char* __str, char** __endptr, int __base);
unsigned long long strtoull(const char* __str, char** __endptr, int __base);
__attribute__((__availability__(swift, unavailable,
message = "Use posix_spawn APIs or NSTask instead. (On iOS, process spawning is unavailable.)")))
__attribute__((availability(macos, introduced = 10.0))) __attribute__((availability(ios, unavailable)))
__attribute__((availability(watchos, unavailable))) __attribute__((availability(tvos, unavailable))) int
system(const char*) __asm("_"
"system");
size_t wcstombs(char*, const wchar_t*, size_t);
int wctomb(char*, wchar_t);
void _Exit(int) __attribute__((__noreturn__));
long a64l(const char*);
double drand48(void);
char* ecvt(double, int, int*, int*);
double erand48(unsigned short[3]);
char* fcvt(double, int, int*, int*);
char* gcvt(double, int, char*);
int getsubopt(char**, char* const*, char**);
int grantpt(int);
char* initstate(unsigned, char*, size_t);
long jrand48(unsigned short[3]) __attribute__((__availability__(swift, unavailable, message = "Use arc4random instead.")));
char* l64a(long);
void lcong48(unsigned short[7]);
long lrand48(void) __attribute__((__availability__(swift, unavailable, message = "Use arc4random instead.")));
__attribute__((__deprecated__("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of "
"mktemp(3), it is highly recommended that you use mkstemp(3) instead.")))
char*
mktemp(char*);
int mkstemp(char*);
long mrand48(void) __attribute__((__availability__(swift, unavailable, message = "Use arc4random instead.")));
long nrand48(unsigned short[3]) __attribute__((__availability__(swift, unavailable, message = "Use arc4random instead.")));
int posix_openpt(int);
char* ptsname(int);
int ptsname_r(int fildes, char* buffer, size_t buflen) __attribute__((availability(macos, introduced = 10.13.4)))
__attribute__((availability(ios, introduced = 11.3))) __attribute__((availability(tvos, introduced = 11.3)))
__attribute__((availability(watchos, introduced = 4.3)));
int putenv(char*) __asm("_"
"putenv");
long random(void) __attribute__((__availability__(swift, unavailable, message = "Use arc4random instead.")));
int rand_r(unsigned*) __attribute__((__availability__(swift, unavailable, message = "Use arc4random instead.")));
char* realpath(const char*, char*) __asm("_"
"realpath"
"$DARWIN_EXTSN");
unsigned short* seed48(unsigned short[3]);
int setenv(const char* __name, const char* __value, int __overwrite) __asm("_"
"setenv");
void setkey(const char*) __asm("_"
"setkey");
char* setstate(const char*);
void srand48(long);
void srandom(unsigned);
int unlockpt(int);
int unsetenv(const char*) __asm("_"
"unsetenv");
typedef __darwin_dev_t dev_t;
typedef __darwin_mode_t mode_t;
uint32_t arc4random(void);
void arc4random_addrandom(unsigned char*, int) __attribute__((availability(macosx, introduced = 10.0)))
__attribute__((availability(macosx, deprecated = 10.12, message = "use arc4random_stir"))) __attribute__((availability(ios, introduced = 2.0)))
__attribute__((availability(ios, deprecated = 10.0, message = "use arc4random_stir"))) __attribute__((availability(tvos, introduced = 2.0)))
__attribute__((availability(tvos, deprecated = 10.0, message = "use arc4random_stir"))) __attribute__((availability(watchos, introduced = 1.0)))
__attribute__((availability(watchos, deprecated = 3.0, message = "use arc4random_stir")));
void arc4random_buf(void* __buf, size_t __nbytes) __attribute__((availability(macosx, introduced = 10.7)));
void arc4random_stir(void);
uint32_t arc4random_uniform(uint32_t __upper_bound) __attribute__((availability(macosx, introduced = 10.7)));
int atexit_b(void (^_Nonnull)(void)) __attribute__((availability(macosx, introduced = 10.6)));
void* bsearch_b(const void* __key, const void* __base, size_t __nel, size_t __width,
int (^_Nonnull __compar)(const void*, const void*) __attribute__((__noescape__)))
__attribute__((availability(macosx, introduced = 10.6)));
char* cgetcap(char*, const char*, int);
int cgetclose(void);
int cgetent(char**, char**, const char*);
int cgetfirst(char**, char**);
int cgetmatch(const char*, const char*);
int cgetnext(char**, char**);
int cgetnum(char*, const char*, long*);
int cgetset(const char*);
int cgetstr(char*, const char*, char**);
int cgetustr(char*, const char*, char**);
int daemon(int, int) __asm("_"
"daemon")
__attribute__((availability(macosx, introduced = 10.0, deprecated = 10.5, message = "Use posix_spawn APIs instead.")))
__attribute__((availability(watchos, unavailable))) __attribute__((availability(tvos, unavailable)));
char* devname(dev_t, mode_t);
char* devname_r(dev_t, mode_t, char* buf, int len);
char* getbsize(int*, long*);
int getloadavg(double[], int);
const char* getprogname(void);
void setprogname(const char*);
int heapsort(void* __base, size_t __nel, size_t __width, int (*_Nonnull __compar)(const void*, const void*));
int heapsort_b(void* __base, size_t __nel, size_t __width, int (^_Nonnull __compar)(const void*, const void*) __attribute__((__noescape__)))
__attribute__((availability(macosx, introduced = 10.6)));
int mergesort(void* __base, size_t __nel, size_t __width, int (*_Nonnull __compar)(const void*, const void*));
int mergesort_b(void* __base, size_t __nel, size_t __width, int (^_Nonnull __compar)(const void*, const void*) __attribute__((__noescape__)))
__attribute__((availability(macosx, introduced = 10.6)));
void psort(void* __base, size_t __nel, size_t __width, int (*_Nonnull __compar)(const void*, const void*))
__attribute__((availability(macosx, introduced = 10.6)));
void psort_b(void* __base, size_t __nel, size_t __width, int (^_Nonnull __compar)(const void*, const void*) __attribute__((__noescape__)))
__attribute__((availability(macosx, introduced = 10.6)));
void psort_r(void* __base, size_t __nel, size_t __width, void*, int (*_Nonnull __compar)(void*, const void*, const void*))
__attribute__((availability(macosx, introduced = 10.6)));
void qsort_b(void* __base, size_t __nel, size_t __width, int (^_Nonnull __compar)(const void*, const void*) __attribute__((__noescape__)))
__attribute__((availability(macosx, introduced = 10.6)));
void qsort_r(void* __base, size_t __nel, size_t __width, void*, int (*_Nonnull __compar)(void*, const void*, const void*));
int radixsort(const unsigned char** __base, int __nel, const unsigned char* __table, unsigned __endbyte);
int rpmatch(const char*) __attribute__((availability(macos, introduced = 10.15))) __attribute__((availability(ios, introduced = 13.0)))
__attribute__((availability(tvos, introduced = 13.0))) __attribute__((availability(watchos, introduced = 6.0)));
int sradixsort(const unsigned char** __base, int __nel, const unsigned char* __table, unsigned __endbyte);
void sranddev(void);
void srandomdev(void);
void* reallocf(void* __ptr, size_t __size) __attribute__((alloc_size(2)));
long long strtonum(const char* __numstr, long long __minval, long long __maxval, const char** __errstrp)
__attribute__((availability(macos, introduced = 11.0))) __attribute__((availability(ios, introduced = 14.0)))
__attribute__((availability(tvos, introduced = 14.0))) __attribute__((availability(watchos, introduced = 7.0)));
long long strtoq(const char* __str, char** __endptr, int __base);
unsigned long long strtouq(const char* __str, char** __endptr, int __base);
extern char* suboptarg;
}
extern "C++"
{
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) long abs(long __x) noexcept {
return __builtin_labs(__x);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) long long abs(long long __x) noexcept {
return __builtin_llabs(__x);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) float abs(float __lcpp_x) noexcept {
return __builtin_fabsf(__lcpp_x);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) double abs(double __lcpp_x) noexcept {
return __builtin_fabs(__lcpp_x);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) long double abs(long double __lcpp_x) noexcept {
return __builtin_fabsl(__lcpp_x);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) ldiv_t div(long __x, long __y) noexcept {
return ::ldiv(__x, __y);
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) lldiv_t div(long long __x, long long __y) noexcept {
return ::lldiv(__x, __y);
}
}
namespace std {
inline namespace __1 {
using ::size_t __attribute__((using_if_exists));
using ::div_t __attribute__((using_if_exists));
using ::ldiv_t __attribute__((using_if_exists));
using ::lldiv_t __attribute__((using_if_exists));
using ::atof __attribute__((using_if_exists));
using ::atoi __attribute__((using_if_exists));
using ::atol __attribute__((using_if_exists));
using ::atoll __attribute__((using_if_exists));
using ::strtod __attribute__((using_if_exists));
using ::strtof __attribute__((using_if_exists));
using ::strtold __attribute__((using_if_exists));
using ::strtol __attribute__((using_if_exists));
using ::strtoll __attribute__((using_if_exists));
using ::strtoul __attribute__((using_if_exists));
using ::strtoull __attribute__((using_if_exists));
using ::rand __attribute__((using_if_exists));
using ::srand __attribute__((using_if_exists));
using ::calloc __attribute__((using_if_exists));
using ::free __attribute__((using_if_exists));
using ::malloc __attribute__((using_if_exists));
using ::realloc __attribute__((using_if_exists));
using ::abort __attribute__((using_if_exists));
using ::atexit __attribute__((using_if_exists));
using ::exit __attribute__((using_if_exists));
using ::_Exit __attribute__((using_if_exists));
using ::getenv __attribute__((using_if_exists));
using ::system __attribute__((using_if_exists));
using ::bsearch __attribute__((using_if_exists));
using ::qsort __attribute__((using_if_exists));
using ::abs __attribute__((using_if_exists));
using ::labs __attribute__((using_if_exists));
using ::llabs __attribute__((using_if_exists));
using ::div __attribute__((using_if_exists));
using ::ldiv __attribute__((using_if_exists));
using ::lldiv __attribute__((using_if_exists));
using ::mblen __attribute__((using_if_exists));
using ::mbtowc __attribute__((using_if_exists));
using ::wctomb __attribute__((using_if_exists));
using ::mbstowcs __attribute__((using_if_exists));
using ::wcstombs __attribute__((using_if_exists));
using ::at_quick_exit __attribute__((using_if_exists));
using ::quick_exit __attribute__((using_if_exists));
using ::aligned_alloc __attribute__((using_if_exists));
} // namespace __1
} // namespace std
namespace std {
inline namespace __1 {
template <class _T1, class _T2>
struct __attribute__((__type_visibility__("default"))) pair;
template <class _Tp>
class __attribute__((__type_visibility__("default"))) reference_wrapper;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) hash;
template <class _Tp, _Tp __v>
struct __attribute__((__type_visibility__("default"))) integral_constant
{
static constexpr const _Tp value = __v;
typedef _Tp value_type;
typedef integral_constant type;
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr operator value_type() const noexcept {
return value;
}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr value_type operator()() const noexcept {
return value;
}
};
template <class _Tp, _Tp __v>
constexpr const _Tp integral_constant<_Tp, __v>::value;
template <bool __b>
using bool_constant = integral_constant<bool, __b>;
typedef bool_constant<(true)> true_type;
typedef bool_constant<(false)> false_type;
template <bool _Val>
using _BoolConstant = integral_constant<bool, _Val>;
template <bool>
struct _MetaBase;
template <>
struct _MetaBase<true>
{
template <class _Tp, class _Up>
using _SelectImpl = _Tp;
template <template <class...> class _FirstFn, template <class...> class, class... _Args>
using _SelectApplyImpl = _FirstFn<_Args...>;
template <class _First, class...>
using _FirstImpl = _First;
template <class, class _Second, class...>
using _SecondImpl = _Second;
template <class _Tp = void>
using _EnableIfImpl = _Tp;
template <class _Result, class _First, class... _Rest>
using _OrImpl = typename _MetaBase<_First::value != true && sizeof...(_Rest) != 0>::template _OrImpl<_First, _Rest...>;
};
template <>
struct _MetaBase<false>
{
template <class _Tp, class _Up>
using _SelectImpl = _Up;
template <template <class...> class, template <class...> class _SecondFn, class... _Args>
using _SelectApplyImpl = _SecondFn<_Args...>;
template <class _Result, class...>
using _OrImpl = _Result;
};
template <bool _Cond, class _Ret = void>
using _EnableIf = typename _MetaBase<_Cond>::template _EnableIfImpl<_Ret>;
template <bool _Cond, class _IfRes, class _ElseRes>
using _If = typename _MetaBase<_Cond>::template _SelectImpl<_IfRes, _ElseRes>;
template <class... _Rest>
using _Or = typename _MetaBase<sizeof...(_Rest) != 0>::template _OrImpl<false_type, _Rest...>;
template <class _Pred>
struct _Not : _BoolConstant<!_Pred::value>
{
};
template <class... _Args>
using _FirstType = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>;
template <class... _Args>
using _SecondType = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>;
template <class...>
using __expand_to_true = true_type;
template <class... _Pred>
__expand_to_true<_EnableIf<_Pred::value>...> __and_helper(int);
template <class...>
false_type __and_helper(...);
template <class... _Pred>
using _And = decltype(__and_helper<_Pred...>(0));
template <template <class...> class _Func, class... _Args>
struct _Lazy : _Func<_Args...>
{
};
template <template <class...> class _Templ, class... _Args, class = _Templ<_Args...>>
true_type __sfinae_test_impl(int);
template <template <class...> class, class...>
false_type __sfinae_test_impl(...);
template <template <class...> class _Templ, class... _Args>
using _IsValidExpansion = decltype(__sfinae_test_impl<_Templ, _Args...>(0));
template <class>
struct __void_t
{
typedef void type;
};
template <class _Tp>
struct __identity
{
typedef _Tp type;
};
template <class _Tp>
using __identity_t = typename __identity<_Tp>::type;
template <class _Tp, bool>
struct __attribute__((__type_visibility__("default"))) __dependent_type : public _Tp
{
};
template <bool _Bp, class _If, class _Then>
struct __attribute__((__type_visibility__("default"))) conditional
{
typedef _If type;
};
template <class _If, class _Then>
struct __attribute__((__type_visibility__("default"))) conditional<false, _If, _Then>
{
typedef _Then type;
};
template <bool _Bp, class _If, class _Then>
using conditional_t = typename conditional<_Bp, _If, _Then>::type;
template <bool, class _Tp = void>
struct __attribute__((__type_visibility__("default"))) enable_if
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) enable_if<true, _Tp>
{
typedef _Tp type;
};
template <bool _Bp, class _Tp = void>
using enable_if_t = typename enable_if<_Bp, _Tp>::type;
template <class _Tp, class _Up>
struct __attribute__((__type_visibility__("default"))) is_same : _BoolConstant<__is_same(_Tp, _Up)>
{
};
template <class _Tp, class _Up>
inline constexpr bool is_same_v = __is_same(_Tp, _Up);
template <class _Tp, class _Up>
using _IsSame = _BoolConstant<
__is_same(_Tp, _Up)
>;
template <class _Tp, class _Up>
using _IsNotSame = _BoolConstant<
!__is_same(_Tp, _Up)
>;
template <class _Tp>
using __test_for_primary_template = _EnableIf<_IsSame<_Tp, typename _Tp::__primary_template>::value>;
template <class _Tp>
using __is_primary_template = _IsValidExpansion<__test_for_primary_template, _Tp>;
struct __two
{
char __lx[2];
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_const : _BoolConstant<__is_const(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_const_v = __is_const(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_volatile : _BoolConstant<__is_volatile(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_volatile_v = __is_volatile(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_const
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_const<const _Tp>
{
typedef _Tp type;
};
template <class _Tp>
using remove_const_t = typename remove_const<_Tp>::type;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_volatile
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_volatile<volatile _Tp>
{
typedef _Tp type;
};
template <class _Tp>
using remove_volatile_t = typename remove_volatile<_Tp>::type;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_cv
{
typedef typename remove_volatile<typename remove_const<_Tp>::type>::type type;
};
template <class _Tp>
using remove_cv_t = typename remove_cv<_Tp>::type;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_void : _BoolConstant<__is_void(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_void_v = __is_void(_Tp);
template <class _Tp>
struct __is_nullptr_t_impl : public false_type
{
};
template <>
struct __is_nullptr_t_impl<nullptr_t> : public true_type
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) __is_nullptr_t : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_null_pointer : public __is_nullptr_t_impl<typename remove_cv<_Tp>::type>
{
};
template <class _Tp>
inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_integral : _BoolConstant<__is_integral(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_integral_v = __is_integral(_Tp);
template <class _Tp>
struct __libcpp_is_signed_integer : public false_type
{
};
template <>
struct __libcpp_is_signed_integer<signed char> : public true_type
{
};
template <>
struct __libcpp_is_signed_integer<signed short> : public true_type
{
};
template <>
struct __libcpp_is_signed_integer<signed int> : public true_type
{
};
template <>
struct __libcpp_is_signed_integer<signed long> : public true_type
{
};
template <>
struct __libcpp_is_signed_integer<signed long long> : public true_type
{
};
template <>
struct __libcpp_is_signed_integer<__int128_t> : public true_type
{
};
template <class _Tp>
struct __libcpp_is_unsigned_integer : public false_type
{
};
template <>
struct __libcpp_is_unsigned_integer<unsigned char> : public true_type
{
};
template <>
struct __libcpp_is_unsigned_integer<unsigned short> : public true_type
{
};
template <>
struct __libcpp_is_unsigned_integer<unsigned int> : public true_type
{
};
template <>
struct __libcpp_is_unsigned_integer<unsigned long> : public true_type
{
};
template <>
struct __libcpp_is_unsigned_integer<unsigned long long> : public true_type
{
};
template <>
struct __libcpp_is_unsigned_integer<__uint128_t> : public true_type
{
};
template <class _Tp>
struct __libcpp_is_floating_point : public false_type
{
};
template <>
struct __libcpp_is_floating_point<float> : public true_type
{
};
template <>
struct __libcpp_is_floating_point<double> : public true_type
{
};
template <>
struct __libcpp_is_floating_point<long double> : public true_type
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_floating_point : public __libcpp_is_floating_point<typename remove_cv<_Tp>::type>
{
};
template <class _Tp>
inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_array : _BoolConstant<__is_array(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_array_v = __is_array(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_pointer : _BoolConstant<__is_pointer(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_pointer_v = __is_pointer(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_reference : _BoolConstant<__is_reference(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_reference_v = __is_reference(_Tp);
template <class _Tp>
inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp);
template <class _Tp>
inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_union : public integral_constant<bool, __is_union(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_union_v = is_union<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_class : public integral_constant<bool, __is_class(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_class_v = is_class<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_function
: public _BoolConstant<
__is_function(_Tp)
>
{
};
template <class _Tp>
inline constexpr bool is_function_v = is_function<_Tp>::value;
template <class _Tp>
struct __libcpp_is_member_pointer
{
enum
{
__is_member = false,
__is_func = false,
__is_obj = false
};
};
template <class _Tp, class _Up>
struct __libcpp_is_member_pointer<_Tp _Up::*>
{
enum
{
__is_member = true,
__is_func = is_function<_Tp>::value,
__is_obj = !__is_func,
};
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_enum : public integral_constant<bool, __is_enum(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_enum_v = __is_enum(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_arithmetic
: public integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value>
{
};
template <class _Tp>
inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_fundamental : _BoolConstant<__is_fundamental(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_fundamental_v = __is_fundamental(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_scalar : _BoolConstant<__is_scalar(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_scalar_v = __is_scalar(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_object : _BoolConstant<__is_object(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_object_v = __is_object(_Tp);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_compound : _BoolConstant<__is_compound(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_compound_v = __is_compound(_Tp);
struct __is_referenceable_impl
{
template <class _Tp>
static _Tp& __test(int);
template <class _Tp>
static __two __test(...);
};
template <class _Tp>
struct __is_referenceable : integral_constant<bool, _IsNotSame<decltype(__is_referenceable_impl::__test<_Tp>(0)), __two>::value>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) add_const
{
typedef const _Tp type;
};
template <class _Tp>
using add_const_t = typename add_const<_Tp>::type;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) add_volatile
{
typedef volatile _Tp type;
};
template <class _Tp>
using add_volatile_t = typename add_volatile<_Tp>::type;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) add_cv
{
typedef const volatile _Tp type;
};
template <class _Tp>
using add_cv_t = typename add_cv<_Tp>::type;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_reference
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_reference<_Tp&>
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_reference<_Tp&&>
{
typedef _Tp type;
};
template <class _Tp>
using remove_reference_t = typename remove_reference<_Tp>::type;
template <class _Tp, bool = __is_referenceable<_Tp>::value>
struct __add_lvalue_reference_impl
{
typedef _Tp type;
};
template <class _Tp>
struct __add_lvalue_reference_impl<_Tp, true>
{
typedef _Tp& type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) add_lvalue_reference
{
typedef typename __add_lvalue_reference_impl<_Tp>::type type;
};
template <class _Tp>
using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type;
template <class _Tp, bool = __is_referenceable<_Tp>::value>
struct __add_rvalue_reference_impl
{
typedef _Tp type;
};
template <class _Tp>
struct __add_rvalue_reference_impl<_Tp, true>
{
typedef _Tp&& type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) add_rvalue_reference
{
typedef typename __add_rvalue_reference_impl<_Tp>::type type;
};
template <class _Tp>
using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type;
template <class _Tp>
_Tp&& __declval(int);
template <class _Tp>
_Tp __declval(long);
template <class _Tp>
decltype(__declval<_Tp>(0)) declval() noexcept;
template <class _Tp>
struct __uncvref
{
typedef typename remove_cv<typename remove_reference<_Tp>::type>::type type;
};
template <class _Tp>
struct __unconstref
{
typedef typename remove_const<typename remove_reference<_Tp>::type>::type type;
};
template <class _Tp>
using __uncvref_t = typename __uncvref<_Tp>::type;
template <class _Tp, class _Up>
struct __is_same_uncvref : _IsSame<typename __uncvref<_Tp>::type, typename __uncvref<_Up>::type>
{
};
template <class _Tp>
struct remove_cvref : public __uncvref<_Tp>
{
};
template <class _Tp>
using remove_cvref_t = typename remove_cvref<_Tp>::type;
struct __any
{
__any(...);
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_pointer
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_pointer<_Tp*>
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_pointer<_Tp* const>
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_pointer<_Tp* volatile>
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_pointer<_Tp* const volatile>
{
typedef _Tp type;
};
template <class _Tp>
using remove_pointer_t = typename remove_pointer<_Tp>::type;
template <class _Tp, bool = __is_referenceable<_Tp>::value || _IsSame<typename remove_cv<_Tp>::type, void>::value>
struct __add_pointer_impl
{
typedef typename remove_reference<_Tp>::type* type;
};
template <class _Tp>
struct __add_pointer_impl<_Tp, false>
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) add_pointer
{
typedef typename __add_pointer_impl<_Tp>::type type;
};
template <class _Tp>
using add_pointer_t = typename add_pointer<_Tp>::type;
template <class _Tp>
struct type_identity
{
typedef _Tp type;
};
template <class _Tp>
using type_identity_t = typename type_identity<_Tp>::type;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_signed : _BoolConstant<__is_signed(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_signed_v = __is_signed(_Tp);
template <class _Tp, bool = is_integral<_Tp>::value>
struct __libcpp_is_unsigned_impl : public bool_constant<(_Tp(0) < _Tp(-1))>
{
};
template <class _Tp>
struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type
{
};
template <class _Tp, bool = is_arithmetic<_Tp>::value>
struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp>
{
};
template <class _Tp>
struct __libcpp_is_unsigned<_Tp, false> : public false_type
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_unsigned : public __libcpp_is_unsigned<_Tp>
{
};
template <class _Tp>
inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) rank : public integral_constant<size_t, 0>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) rank<_Tp[]> : public integral_constant<size_t, rank<_Tp>::value + 1>
{
};
template <class _Tp, size_t _Np>
struct __attribute__((__type_visibility__("default"))) rank<_Tp[_Np]> : public integral_constant<size_t, rank<_Tp>::value + 1>
{
};
template <class _Tp>
inline constexpr size_t rank_v = rank<_Tp>::value;
template <class _Tp, size_t _Dim = 0>
struct __attribute__((__type_visibility__("default"))) extent : integral_constant<size_t, __array_extent(_Tp, _Dim)>
{
};
template <class _Tp, unsigned _Ip = 0>
inline constexpr size_t extent_v = __array_extent(_Tp, _Ip);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_extent
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_extent<_Tp[]>
{
typedef _Tp type;
};
template <class _Tp, size_t _Np>
struct __attribute__((__type_visibility__("default"))) remove_extent<_Tp[_Np]>
{
typedef _Tp type;
};
template <class _Tp>
using remove_extent_t = typename remove_extent<_Tp>::type;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_all_extents
{
typedef _Tp type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) remove_all_extents<_Tp[]>
{
typedef typename remove_all_extents<_Tp>::type type;
};
template <class _Tp, size_t _Np>
struct __attribute__((__type_visibility__("default"))) remove_all_extents<_Tp[_Np]>
{
typedef typename remove_all_extents<_Tp>::type type;
};
template <class _Tp>
using remove_all_extents_t = typename remove_all_extents<_Tp>::type;
template <class>
struct __attribute__((__type_visibility__("default"))) is_bounded_array : false_type
{
};
template <class _Tp, size_t _Np>
struct __attribute__((__type_visibility__("default"))) is_bounded_array<_Tp[_Np]> : true_type
{
};
template <class _Tp>
inline constexpr bool is_bounded_array_v = is_bounded_array<_Tp>::value;
template <class>
struct __attribute__((__type_visibility__("default"))) is_unbounded_array : false_type
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_unbounded_array<_Tp[]> : true_type
{
};
template <class _Tp>
inline constexpr bool is_unbounded_array_v = is_unbounded_array<_Tp>::value;
template <class _Up, bool>
struct __decay
{
typedef typename remove_cv<_Up>::type type;
};
template <class _Up>
struct __decay<_Up, true>
{
public:
typedef
typename conditional<is_array<_Up>::value, typename remove_extent<_Up>::type*,
typename conditional<is_function<_Up>::value, typename add_pointer<_Up>::type, typename remove_cv<_Up>::type>::type>::type
type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) decay
{
private:
typedef typename remove_reference<_Tp>::type _Up;
public:
typedef typename __decay<_Up, __is_referenceable<_Up>::value>::type type;
};
template <class _Tp>
using decay_t = typename decay<_Tp>::type;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_abstract : public integral_constant<bool, __is_abstract(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_abstract_v = is_abstract<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) __libcpp_is_final : public integral_constant<bool, __is_final(_Tp)>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_final : public integral_constant<bool, __is_final(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_final_v = is_final<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value;
template <class _Bp, class _Dp>
struct __attribute__((__type_visibility__("default"))) is_base_of : public integral_constant<bool, __is_base_of(_Bp, _Dp)>
{
};
template <class _Bp, class _Dp>
inline constexpr bool is_base_of_v = is_base_of<_Bp, _Dp>::value;
template <class _Tp, class _Up, class = void>
struct __is_core_convertible : public false_type
{
};
template <class _Tp, class _Up>
struct __is_core_convertible<_Tp, _Up, decltype(static_cast<void (*)(_Up)>(0)(static_cast<_Tp (*)()>(0)()))> : public true_type
{
};
template <class _T1, class _T2>
struct __attribute__((__type_visibility__("default"))) is_convertible : public integral_constant<bool, __is_convertible_to(_T1, _T2)>
{
};
template <class _From, class _To>
inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
template <typename _Tp>
static void __test_noexcept(_Tp) noexcept;
template <typename _Fm, typename _To>
static bool_constant<noexcept(std::__1::__test_noexcept<_To>(declval<_Fm>()))> __is_nothrow_convertible_test();
template <typename _Fm, typename _To>
struct __is_nothrow_convertible_helper : decltype(__is_nothrow_convertible_test<_Fm, _To>())
{
};
template <typename _Fm, typename _To>
struct is_nothrow_convertible
: _Or<_And<is_void<_To>, is_void<_Fm>>, _Lazy<_And, is_convertible<_Fm, _To>, __is_nothrow_convertible_helper<_Fm, _To>>>::type
{
};
template <typename _Fm, typename _To>
inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_empty : public integral_constant<bool, __is_empty(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_empty_v = is_empty<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_polymorphic : public integral_constant<bool, __is_polymorphic(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_polymorphic_v = is_polymorphic<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)>
{
};
template <class _Tp>
inline constexpr bool has_virtual_destructor_v = has_virtual_destructor<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) has_unique_object_representations
: public integral_constant<bool, __has_unique_object_representations(remove_cv_t<remove_all_extents_t<_Tp>>)>
{
};
template <class _Tp>
inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) alignment_of : public integral_constant<size_t, alignof(_Tp)>
{
};
template <class _Tp>
inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value;
template <class _Hp, class _Tp>
struct __type_list
{
typedef _Hp _Head;
typedef _Tp _Tail;
};
struct __nat
{
__nat() = delete;
__nat(const __nat&) = delete;
__nat& operator=(const __nat&) = delete;
~__nat() = delete;
};
template <class _Tp>
struct __align_type
{
static const size_t value = __alignof(_Tp);
typedef _Tp type;
};
struct __struct_double
{
long double __lx;
};
struct __struct_double4
{
double __lx[4];
};
typedef __type_list<
__align_type<unsigned char>,
__type_list<
__align_type<unsigned short>,
__type_list<
__align_type<unsigned int>,
__type_list<__align_type<unsigned long>,
__type_list<__align_type<unsigned long long>,
__type_list<__align_type<double>, __type_list<__align_type<long double>,
__type_list<__align_type<__struct_double>,
__type_list<__align_type<__struct_double4>,
__type_list<__align_type<int*>, __nat>>>>>>>>>>
__all_types;
template <size_t _Align>
struct alignas(_Align) __fallback_overaligned
{
};
template <class _TL, size_t _Align>
struct __find_pod;
template <class _Hp, size_t _Align>
struct __find_pod<__type_list<_Hp, __nat>, _Align>
{
typedef typename conditional<_Align == _Hp::value, typename _Hp::type, __fallback_overaligned<_Align>>::type type;
};
template <class _Hp, class _Tp, size_t _Align>
struct __find_pod<__type_list<_Hp, _Tp>, _Align>
{
typedef typename conditional<_Align == _Hp::value, typename _Hp::type, typename __find_pod<_Tp, _Align>::type>::type type;
};
template <class _TL, size_t _Len>
struct __find_max_align;
template <class _Hp, size_t _Len>
struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value>
{
};
template <size_t _Len, size_t _A1, size_t _A2>
struct __select_align
{
private:
static const size_t __min = _A2 < _A1 ? _A2 : _A1;
static const size_t __max = _A1 < _A2 ? _A2 : _A1;
public:
static const size_t value = _Len < __max ? __min : __max;
};
template <class _Hp, class _Tp, size_t _Len>
struct __find_max_align<__type_list<_Hp, _Tp>, _Len>
: public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value>
{
};
template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
struct __attribute__((__type_visibility__("default"))) aligned_storage
{
typedef typename __find_pod<__all_types, _Align>::type _Aligner;
union type
{
_Aligner __align;
unsigned char __data[(_Len + _Align - 1) / _Align * _Align];
};
};
template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
using aligned_storage_t = typename aligned_storage<_Len, _Align>::type;
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x1>
{
struct alignas(0x1) type
{
unsigned char __lx[(_Len + 0x1 - 1) / 0x1 * 0x1];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x2>
{
struct alignas(0x2) type
{
unsigned char __lx[(_Len + 0x2 - 1) / 0x2 * 0x2];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x4>
{
struct alignas(0x4) type
{
unsigned char __lx[(_Len + 0x4 - 1) / 0x4 * 0x4];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x8>
{
struct alignas(0x8) type
{
unsigned char __lx[(_Len + 0x8 - 1) / 0x8 * 0x8];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x10>
{
struct alignas(0x10) type
{
unsigned char __lx[(_Len + 0x10 - 1) / 0x10 * 0x10];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x20>
{
struct alignas(0x20) type
{
unsigned char __lx[(_Len + 0x20 - 1) / 0x20 * 0x20];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x40>
{
struct alignas(0x40) type
{
unsigned char __lx[(_Len + 0x40 - 1) / 0x40 * 0x40];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x80>
{
struct alignas(0x80) type
{
unsigned char __lx[(_Len + 0x80 - 1) / 0x80 * 0x80];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x100>
{
struct alignas(0x100) type
{
unsigned char __lx[(_Len + 0x100 - 1) / 0x100 * 0x100];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x200>
{
struct alignas(0x200) type
{
unsigned char __lx[(_Len + 0x200 - 1) / 0x200 * 0x200];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x400>
{
struct alignas(0x400) type
{
unsigned char __lx[(_Len + 0x400 - 1) / 0x400 * 0x400];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x800>
{
struct alignas(0x800) type
{
unsigned char __lx[(_Len + 0x800 - 1) / 0x800 * 0x800];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x1000>
{
struct alignas(0x1000) type
{
unsigned char __lx[(_Len + 0x1000 - 1) / 0x1000 * 0x1000];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x2000>
{
struct alignas(0x2000) type
{
unsigned char __lx[(_Len + 0x2000 - 1) / 0x2000 * 0x2000];
};
};
template <size_t _Len>
struct __attribute__((__type_visibility__("default"))) aligned_storage<_Len, 0x4000>
{
struct alignas(0x4000) type
{
unsigned char __lx[(_Len + 0x4000 - 1) / 0x4000 * 0x4000];
};
};
template <size_t _I0, size_t... _In>
struct __static_max;
template <size_t _I0>
struct __static_max<_I0>
{
static const size_t value = _I0;
};
template <size_t _I0, size_t _I1, size_t... _In>
struct __static_max<_I0, _I1, _In...>
{
static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : __static_max<_I1, _In...>::value;
};
template <size_t _Len, class _Type0, class... _Types>
struct aligned_union
{
static const size_t alignment_value = __static_max<__alignof(_Type0), __alignof(_Types)...>::value;
static const size_t __len = __static_max<_Len, sizeof(_Type0), sizeof(_Types)...>::value;
typedef typename aligned_storage<__len, alignment_value>::type type;
};
template <size_t _Len, class... _Types>
using aligned_union_t = typename aligned_union<_Len, _Types...>::type;
template <class _Tp>
struct __numeric_type
{
static void __test(...);
static float __test(float);
static double __test(char);
static double __test(int);
static double __test(unsigned);
static double __test(long);
static double __test(unsigned long);
static double __test(long long);
static double __test(unsigned long long);
static double __test(double);
static long double __test(long double);
typedef decltype(__test(declval<_Tp>())) type;
static const bool value = _IsNotSame<type, void>::value;
};
template <>
struct __numeric_type<void>
{
static const bool value = true;
};
template <class _A1, class _A2 = void, class _A3 = void, bool = __numeric_type<_A1>::value&& __numeric_type<_A2>::value&& __numeric_type<_A3>::value>
class __promote_imp
{
public:
static const bool value = false;
};
template <class _A1, class _A2, class _A3>
class __promote_imp<_A1, _A2, _A3, true>
{
private:
typedef typename __promote_imp<_A1>::type __type1;
typedef typename __promote_imp<_A2>::type __type2;
typedef typename __promote_imp<_A3>::type __type3;
public:
typedef decltype(__type1() + __type2() + __type3()) type;
static const bool value = true;
};
template <class _A1, class _A2>
class __promote_imp<_A1, _A2, void, true>
{
private:
typedef typename __promote_imp<_A1>::type __type1;
typedef typename __promote_imp<_A2>::type __type2;
public:
typedef decltype(__type1() + __type2()) type;
static const bool value = true;
};
template <class _A1>
class __promote_imp<_A1, void, void, true>
{
public:
typedef typename __numeric_type<_A1>::type type;
static const bool value = true;
};
template <class _A1, class _A2 = void, class _A3 = void>
class __promote : public __promote_imp<_A1, _A2, _A3>
{
};
typedef __type_list<signed char, __type_list<signed short, __type_list<signed int, __type_list<signed long, __type_list<signed long long,
__type_list<__int128_t,
__nat
>
>>>>>
__signed_types;
typedef __type_list<unsigned char,
__type_list<unsigned short, __type_list<unsigned int, __type_list<unsigned long, __type_list<unsigned long long,
__type_list<__uint128_t,
__nat
>
>>>>>
__unsigned_types;
template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)>
struct __find_first;
template <class _Hp, class _Tp, size_t _Size>
struct __find_first<__type_list<_Hp, _Tp>, _Size, true>
{
typedef _Hp type;
};
template <class _Hp, class _Tp, size_t _Size>
struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
{
typedef typename __find_first<_Tp, _Size>::type type;
};
template <class _Tp, class _Up, bool = is_const<typename remove_reference<_Tp>::type>::value,
bool = is_volatile<typename remove_reference<_Tp>::type>::value>
struct __apply_cv
{
typedef _Up type;
};
template <class _Tp, class _Up>
struct __apply_cv<_Tp, _Up, true, false>
{
typedef const _Up type;
};
template <class _Tp, class _Up>
struct __apply_cv<_Tp, _Up, false, true>
{
typedef volatile _Up type;
};
template <class _Tp, class _Up>
struct __apply_cv<_Tp, _Up, true, true>
{
typedef const volatile _Up type;
};
template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, false, false>
{
typedef _Up& type;
};
template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, true, false>
{
typedef const _Up& type;
};
template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, false, true>
{
typedef volatile _Up& type;
};
template <class _Tp, class _Up>
struct __apply_cv<_Tp&, _Up, true, true>
{
typedef const volatile _Up& type;
};
template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
struct __make_signed
{
};
template <class _Tp>
struct __make_signed<_Tp, true>
{
typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type;
};
template <>
struct __make_signed<bool, true>
{
};
template <>
struct __make_signed<signed short, true>
{
typedef short type;
};
template <>
struct __make_signed<unsigned short, true>
{
typedef short type;
};
template <>
struct __make_signed<signed int, true>
{
typedef int type;
};
template <>
struct __make_signed<unsigned int, true>
{
typedef int type;
};
template <>
struct __make_signed<signed long, true>
{
typedef long type;
};
template <>
struct __make_signed<unsigned long, true>
{
typedef long type;
};
template <>
struct __make_signed<signed long long, true>
{
typedef long long type;
};
template <>
struct __make_signed<unsigned long long, true>
{
typedef long long type;
};
template <>
struct __make_signed<__int128_t, true>
{
typedef __int128_t type;
};
template <>
struct __make_signed<__uint128_t, true>
{
typedef __int128_t type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) make_signed
{
typedef typename __apply_cv<_Tp, typename __make_signed<typename remove_cv<_Tp>::type>::type>::type type;
};
template <class _Tp>
using make_signed_t = typename make_signed<_Tp>::type;
template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
struct __make_unsigned
{
};
template <class _Tp>
struct __make_unsigned<_Tp, true>
{
typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type;
};
template <>
struct __make_unsigned<bool, true>
{
};
template <>
struct __make_unsigned<signed short, true>
{
typedef unsigned short type;
};
template <>
struct __make_unsigned<unsigned short, true>
{
typedef unsigned short type;
};
template <>
struct __make_unsigned<signed int, true>
{
typedef unsigned int type;
};
template <>
struct __make_unsigned<unsigned int, true>
{
typedef unsigned int type;
};
template <>
struct __make_unsigned<signed long, true>
{
typedef unsigned long type;
};
template <>
struct __make_unsigned<unsigned long, true>
{
typedef unsigned long type;
};
template <>
struct __make_unsigned<signed long long, true>
{
typedef unsigned long long type;
};
template <>
struct __make_unsigned<unsigned long long, true>
{
typedef unsigned long long type;
};
template <>
struct __make_unsigned<__int128_t, true>
{
typedef __uint128_t type;
};
template <>
struct __make_unsigned<__uint128_t, true>
{
typedef __uint128_t type;
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) make_unsigned
{
typedef typename __apply_cv<_Tp, typename __make_unsigned<typename remove_cv<_Tp>::type>::type>::type type;
};
template <class _Tp>
using make_unsigned_t = typename make_unsigned<_Tp>::type;
template <class _Tp>
[[nodiscard]] __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr typename make_unsigned<_Tp>::type
__to_unsigned_like(_Tp __x) noexcept {
return static_cast<typename make_unsigned<_Tp>::type>(__x);
}
template <class...>
using void_t = void;
template <class _Tp, class _Up>
using __cond_type = decltype(false ? declval<_Tp>() : declval<_Up>());
template <class _Tp, class _Up, class = void>
struct __common_type3
{
};
template <class _Tp, class _Up>
struct __common_type3<_Tp, _Up, void_t<__cond_type<const _Tp&, const _Up&>>>
{
using type = remove_cvref_t<__cond_type<const _Tp&, const _Up&>>;
};
template <class _Tp, class _Up, class = void>
struct __common_type2_imp : __common_type3<_Tp, _Up>
{
};
template <class _Tp, class _Up>
struct __common_type2_imp<_Tp, _Up, typename __void_t<decltype(true ? declval<_Tp>() : declval<_Up>())>::type>
{
typedef typename decay<decltype(true ? declval<_Tp>() : declval<_Up>())>::type type;
};
template <class, class = void>
struct __common_type_impl
{
};
template <class... _Tp>
struct __common_types;
template <class... _Tp>
struct __attribute__((__type_visibility__("default"))) common_type;
template <class _Tp, class _Up>
struct __common_type_impl<__common_types<_Tp, _Up>, typename __void_t<typename common_type<_Tp, _Up>::type>::type>
{
typedef typename common_type<_Tp, _Up>::type type;
};
template <class _Tp, class _Up, class _Vp, class... _Rest>
struct __common_type_impl<__common_types<_Tp, _Up, _Vp, _Rest...>, typename __void_t<typename common_type<_Tp, _Up>::type>::type>
: __common_type_impl<__common_types<typename common_type<_Tp, _Up>::type, _Vp, _Rest...>>
{
};
template <>
struct __attribute__((__type_visibility__("default"))) common_type<>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) common_type<_Tp> : public common_type<_Tp, _Tp>
{
};
template <class _Tp, class _Up>
struct __attribute__((__type_visibility__("default"))) common_type<_Tp, _Up>
: conditional<_IsSame<_Tp, typename decay<_Tp>::type>::value && _IsSame<_Up, typename decay<_Up>::type>::value, __common_type2_imp<_Tp, _Up>,
common_type<typename decay<_Tp>::type, typename decay<_Up>::type>>::type
{
};
template <class _Tp, class _Up, class _Vp, class... _Rest>
struct __attribute__((__type_visibility__("default")))
common_type<_Tp, _Up, _Vp, _Rest...> : __common_type_impl<__common_types<_Tp, _Up, _Vp, _Rest...>>
{
};
template <class... _Tp>
using common_type_t = typename common_type<_Tp...>::type;
template <class _From, class _To>
struct __copy_cv
{
using type = _To;
};
template <class _From, class _To>
struct __copy_cv<const _From, _To>
{
using type = add_const_t<_To>;
};
template <class _From, class _To>
struct __copy_cv<volatile _From, _To>
{
using type = add_volatile_t<_To>;
};
template <class _From, class _To>
struct __copy_cv<const volatile _From, _To>
{
using type = add_cv_t<_To>;
};
template <class _From, class _To>
using __copy_cv_t = typename __copy_cv<_From, _To>::type;
template <class _From, class _To>
struct __copy_cvref
{
using type = __copy_cv_t<_From, _To>;
};
template <class _From, class _To>
struct __copy_cvref<_From&, _To>
{
using type = add_lvalue_reference_t<__copy_cv_t<_From, _To>>;
};
template <class _From, class _To>
struct __copy_cvref<_From&&, _To>
{
using type = add_rvalue_reference_t<__copy_cv_t<_From, _To>>;
};
template <class _From, class _To>
using __copy_cvref_t = typename __copy_cvref<_From, _To>::type;
template <class _Xp, class _Yp>
using __cond_res = decltype(false ? declval<_Xp (&)()>()() : declval<_Yp (&)()>()());
template <class _Tp>
struct __xref
{
template <class _Up>
using __apply = __copy_cvref_t<_Tp, _Up>;
};
template <class _Ap, class _Bp, class _Xp = remove_reference_t<_Ap>, class _Yp = remove_reference_t<_Bp>>
struct __common_ref;
template <class _Xp, class _Yp>
using __common_ref_t = typename __common_ref<_Xp, _Yp>::__type;
template <class _Xp, class _Yp>
using __cv_cond_res = __cond_res<__copy_cv_t<_Xp, _Yp>&, __copy_cv_t<_Yp, _Xp>&>;
template <class _Ap, class _Bp, class _Xp, class _Yp>
requires requires {
typename __cv_cond_res<_Xp, _Yp>;
}
&&is_reference_v<__cv_cond_res<_Xp, _Yp>> struct __common_ref<_Ap&, _Bp&, _Xp, _Yp>
{
using __type = __cv_cond_res<_Xp, _Yp>;
};
template <class _Xp, class _Yp>
using __common_ref_C = remove_reference_t<__common_ref_t<_Xp&, _Yp&>>&&;
template <class _Ap, class _Bp, class _Xp, class _Yp>
requires requires {
typename __common_ref_C<_Xp, _Yp>;
}
&&is_convertible_v<_Ap&&, __common_ref_C<_Xp, _Yp>>&& is_convertible_v<_Bp&&, __common_ref_C<_Xp, _Yp>> struct __common_ref<_Ap&&, _Bp&&, _Xp, _Yp>
{
using __type = __common_ref_C<_Xp, _Yp>;
};
template <class _Tp, class _Up>
using __common_ref_D = __common_ref_t<const _Tp&, _Up&>;
template <class _Ap, class _Bp, class _Xp, class _Yp>
requires requires {
typename __common_ref_D<_Xp, _Yp>;
}
&&is_convertible_v<_Ap&&, __common_ref_D<_Xp, _Yp>> struct __common_ref<_Ap&&, _Bp&, _Xp, _Yp>
{
using __type = __common_ref_D<_Xp, _Yp>;
};
template <class _Ap, class _Bp, class _Xp, class _Yp>
struct __common_ref<_Ap&, _Bp&&, _Xp, _Yp> : __common_ref<_Bp&&, _Ap&>
{
};
template <class _Ap, class _Bp, class _Xp, class _Yp>
struct __common_ref
{
};
template <class...>
struct common_reference;
template <class... _Types>
using common_reference_t = typename common_reference<_Types...>::type;
template <>
struct common_reference<>
{
};
template <class _Tp>
struct common_reference<_Tp>
{
using type = _Tp;
};
template <class _Tp, class _Up>
struct __common_reference_sub_bullet3;
template <class _Tp, class _Up>
struct __common_reference_sub_bullet2 : __common_reference_sub_bullet3<_Tp, _Up>
{
};
template <class _Tp, class _Up>
struct __common_reference_sub_bullet1 : __common_reference_sub_bullet2<_Tp, _Up>
{
};
template <class _Tp, class _Up>
struct common_reference<_Tp, _Up> : __common_reference_sub_bullet1<_Tp, _Up>
{
};
template <class _Tp, class _Up>
requires is_reference_v<_Tp>&& is_reference_v<_Up>&& requires {
typename __common_ref_t<_Tp, _Up>;
}
struct __common_reference_sub_bullet1<_Tp, _Up>
{
using type = __common_ref_t<_Tp, _Up>;
};
template <class, class, template <class> class, template <class> class>
struct basic_common_reference
{
};
template <class _Tp, class _Up>
using __basic_common_reference_t =
typename basic_common_reference<remove_cvref_t<_Tp>, remove_cvref_t<_Up>, __xref<_Tp>::template __apply, __xref<_Up>::template __apply>::type;
template <class _Tp, class _Up>
requires requires {
typename __basic_common_reference_t<_Tp, _Up>;
}
struct __common_reference_sub_bullet2<_Tp, _Up>
{
using type = __basic_common_reference_t<_Tp, _Up>;
};
template <class _Tp, class _Up>
requires requires {
typename __cond_res<_Tp, _Up>;
}
struct __common_reference_sub_bullet3<_Tp, _Up>
{
using type = __cond_res<_Tp, _Up>;
};
template <class _Tp, class _Up>
struct __common_reference_sub_bullet3 : common_type<_Tp, _Up>
{
};
template <class _Tp, class _Up, class _Vp, class... _Rest>
requires requires {
typename common_reference_t<_Tp, _Up>;
}
struct common_reference<_Tp, _Up, _Vp, _Rest...> : common_reference<common_reference_t<_Tp, _Up>, _Vp, _Rest...>
{
};
template <class...>
struct common_reference
{
};
template <typename, typename _Tp>
struct __select_2nd
{
typedef _Tp type;
};
template <class _Tp, class _Up>
struct __attribute__((__type_visibility__("default"))) is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)>
{
};
template <class _Tp, class _Arg>
inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg);
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_copy_assignable
: public is_assignable<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<typename add_const<_Tp>::type>::type>
{
};
template <class _Tp>
inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_move_assignable
: public is_assignable<typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type>
{
};
template <class _Tp>
inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value;
template <class>
struct __is_destructible_apply
{
typedef int type;
};
template <typename _Tp>
struct __is_destructor_wellformed
{
template <typename _Tp1>
static char __test(typename __is_destructible_apply<decltype(declval<_Tp1&>().~_Tp1())>::type);
template <typename _Tp1>
static __two __test(...);
static const bool value = sizeof(__test<_Tp>(12)) == sizeof(char);
};
template <class _Tp, bool>
struct __destructible_imp;
template <class _Tp>
struct __destructible_imp<_Tp, false> : public integral_constant<bool, __is_destructor_wellformed<typename remove_all_extents<_Tp>::type>::value>
{
};
template <class _Tp>
struct __destructible_imp<_Tp, true> : public true_type
{
};
template <class _Tp, bool>
struct __destructible_false;
template <class _Tp>
struct __destructible_false<_Tp, false> : public __destructible_imp<_Tp, is_reference<_Tp>::value>
{
};
template <class _Tp>
struct __destructible_false<_Tp, true> : public false_type
{
};
template <class _Tp>
struct is_destructible : public __destructible_false<_Tp, is_function<_Tp>::value>
{
};
template <class _Tp>
struct is_destructible<_Tp[]> : public false_type
{
};
template <>
struct is_destructible<void> : public false_type
{
};
template <class _Tp>
inline constexpr bool is_destructible_v = is_destructible<_Tp>::value;
template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
struct __member_pointer_traits_imp
{
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
{
typedef _Class _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
{
typedef _Class _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
{
typedef _Class const _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false>
{
typedef _Class const _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
{
typedef _Class volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false>
{
typedef _Class volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
{
typedef _Class const volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false>
{
typedef _Class const volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...)&, true, false>
{
typedef _Class& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...)&, true, false>
{
typedef _Class& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
{
typedef _Class const& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false>
{
typedef _Class const& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
{
typedef _Class volatile& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false>
{
typedef _Class volatile& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
{
typedef _Class const volatile& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false>
{
typedef _Class const volatile& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...)&&, true, false>
{
typedef _Class&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...)&&, true, false>
{
typedef _Class&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
{
typedef _Class const&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false>
{
typedef _Class const&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
{
typedef _Class volatile&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false>
{
typedef _Class volatile&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
{
typedef _Class const volatile&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param...);
};
template <class _Rp, class _Class, class... _Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false>
{
typedef _Class const volatile&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class>
struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
{
typedef _Class _ClassType;
typedef _Rp _ReturnType;
};
template <class _MP>
struct __member_pointer_traits
: public __member_pointer_traits_imp<typename remove_cv<_MP>::type, is_member_function_pointer<_MP>::value, is_member_object_pointer<_MP>::value>
{
};
template <class _DecayedFp>
struct __member_pointer_class_type
{
};
template <class _Ret, class _ClassType>
struct __member_pointer_class_type<_Ret _ClassType::*>
{
typedef _ClassType type;
};
template <class _Tp, class... _Args>
struct __attribute__((__type_visibility__("default"))) is_constructible : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
{
};
template <class _Tp, class... _Args>
inline constexpr bool is_constructible_v = is_constructible<_Tp, _Args...>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_default_constructible : public is_constructible<_Tp>
{
};
template <class _Tp>
inline constexpr bool is_default_constructible_v = is_default_constructible<_Tp>::value;
template <class _Tp>
void __test_implicit_default_constructible(_Tp);
template <class _Tp, class = void, class = typename is_default_constructible<_Tp>::type>
struct __is_implicitly_default_constructible : false_type
{
};
template <class _Tp>
struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), true_type> : true_type
{
};
template <class _Tp>
struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_default_constructible<_Tp const&>({})), false_type> : false_type
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_copy_constructible
: public is_constructible<_Tp, typename add_lvalue_reference<typename add_const<_Tp>::type>::type>
{
};
template <class _Tp>
inline constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_move_constructible : public is_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
{
};
template <class _Tp>
inline constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value;
template <class _Tp, class... _Args>
struct __attribute__((__type_visibility__("default"))) is_trivially_constructible
: integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
{
};
template <class _Tp, class... _Args>
inline constexpr bool is_trivially_constructible_v = is_trivially_constructible<_Tp, _Args...>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_trivially_default_constructible : public is_trivially_constructible<_Tp>
{
};
template <class _Tp>
inline constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_trivially_copy_constructible
: public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type>
{
};
template <class _Tp>
inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_trivially_move_constructible
: public is_trivially_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
{
};
template <class _Tp>
inline constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible<_Tp>::value;
template <class _Tp, class _Arg>
struct is_trivially_assignable : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)>
{
};
template <class _Tp, class _Arg>
inline constexpr bool is_trivially_assignable_v = is_trivially_assignable<_Tp, _Arg>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_trivially_copy_assignable
: public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<typename add_const<_Tp>::type>::type>
{
};
template <class _Tp>
inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_trivially_move_assignable
: public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type>
{
};
template <class _Tp>
inline constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_trivially_destructible : public integral_constant<bool, __is_trivially_destructible(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<_Tp>::value;
template <class _Tp, class... _Args>
struct __attribute__((__type_visibility__("default"))) is_nothrow_constructible
: public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)>
{
};
template <class _Tp, class... _Args>
inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_nothrow_default_constructible : public is_nothrow_constructible<_Tp>
{
};
template <class _Tp>
inline constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_nothrow_copy_constructible
: public is_nothrow_constructible<_Tp, typename add_lvalue_reference<typename add_const<_Tp>::type>::type>
{
};
template <class _Tp>
inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_nothrow_move_constructible
: public is_nothrow_constructible<_Tp, typename add_rvalue_reference<_Tp>::type>
{
};
template <class _Tp>
inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value;
template <class _Tp, class _Arg>
struct __attribute__((__type_visibility__("default"))) is_nothrow_assignable : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)>
{
};
template <class _Tp, class _Arg>
inline constexpr bool is_nothrow_assignable_v = is_nothrow_assignable<_Tp, _Arg>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_nothrow_copy_assignable
: public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<typename add_const<_Tp>::type>::type>
{
};
template <class _Tp>
inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_nothrow_move_assignable
: public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type, typename add_rvalue_reference<_Tp>::type>
{
};
template <class _Tp>
inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable<_Tp>::value;
template <bool, class _Tp>
struct __libcpp_is_nothrow_destructible;
template <class _Tp>
struct __libcpp_is_nothrow_destructible<false, _Tp> : public false_type
{
};
template <class _Tp>
struct __libcpp_is_nothrow_destructible<true, _Tp> : public integral_constant<bool, noexcept(declval<_Tp>().~_Tp())>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_nothrow_destructible
: public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
{
};
template <class _Tp, size_t _Ns>
struct __attribute__((__type_visibility__("default"))) is_nothrow_destructible<_Tp[_Ns]> : public is_nothrow_destructible<_Tp>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_nothrow_destructible<_Tp&> : public true_type
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_nothrow_destructible<_Tp&&> : public true_type
{
};
template <class _Tp>
inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_pod : public integral_constant<bool, __is_pod(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_pod_v = is_pod<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) __attribute__((deprecated)) is_literal_type
: public integral_constant<bool, __is_literal_type(_Tp)>
{
};
template <class _Tp>
__attribute__((deprecated)) inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_standard_layout
: public integral_constant<bool, __is_standard_layout(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_trivially_copyable
: public integral_constant<bool, __is_trivially_copyable(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value;
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_trivial
: public integral_constant<bool, __is_trivial(_Tp)>
{
};
template <class _Tp>
inline constexpr bool is_trivial_v = is_trivial<_Tp>::value;
template <class _Tp>
struct __is_reference_wrapper_impl : public false_type
{
};
template <class _Tp>
struct __is_reference_wrapper_impl<reference_wrapper<_Tp>> : public true_type
{
};
template <class _Tp>
struct __is_reference_wrapper : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type>
{
};
template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type,
class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
using __enable_if_bullet1 = typename enable_if<is_member_function_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value>::type;
template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type>
using __enable_if_bullet2 = typename enable_if<is_member_function_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value>::type;
template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type,
class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
using __enable_if_bullet3 = typename enable_if<is_member_function_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value
&& !__is_reference_wrapper<_DecayA0>::value>::type;
template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type,
class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
using __enable_if_bullet4 = typename enable_if<is_member_object_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value>::type;
template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type>
using __enable_if_bullet5 = typename enable_if<is_member_object_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value>::type;
template <class _Fp, class _A0, class _DecayFp = typename decay<_Fp>::type, class _DecayA0 = typename decay<_A0>::type,
class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
using __enable_if_bullet6 = typename enable_if<is_member_object_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value
&& !__is_reference_wrapper<_DecayA0>::value>::type;
template <class... _Args>
auto __invoke(__any, _Args&&... __args) -> __nat;
template <class... _Args>
auto __invoke_constexpr(__any, _Args&&... __args) -> __nat;
template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet1<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&&... __args) noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)))
-> decltype((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)) {
return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...);
}
template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet1<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&&... __args) noexcept(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)))
-> decltype((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)) {
return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...);
}
template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet2<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&&... __args) noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...)))
-> decltype((__a0.get().*__f)(static_cast<_Args&&>(__args)...)) {
return (__a0.get().*__f)(static_cast<_Args&&>(__args)...);
}
template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet2<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&&... __args) noexcept(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...)))
-> decltype((__a0.get().*__f)(static_cast<_Args&&>(__args)...)) {
return (__a0.get().*__f)(static_cast<_Args&&>(__args)...);
}
template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet3<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&&... __args) noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)))
-> decltype(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)) {
return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...);
}
template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet3<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke_constexpr(_Fp&& __f, _A0&& __a0, _Args&&... __args) noexcept(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)))
-> decltype(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)) {
return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...);
}
template <class _Fp, class _A0, class = __enable_if_bullet4<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke(_Fp&& __f, _A0&& __a0) noexcept(noexcept(static_cast<_A0&&>(__a0).*__f)) -> decltype(static_cast<_A0&&>(__a0).*__f) {
return static_cast<_A0&&>(__a0).*__f;
}
template <class _Fp, class _A0, class = __enable_if_bullet4<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke_constexpr(_Fp&& __f, _A0&& __a0) noexcept(noexcept(static_cast<_A0&&>(__a0).*__f)) -> decltype(static_cast<_A0&&>(__a0).*__f) {
return static_cast<_A0&&>(__a0).*__f;
}
template <class _Fp, class _A0, class = __enable_if_bullet5<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke(_Fp&& __f, _A0&& __a0) noexcept(noexcept(__a0.get().*__f)) -> decltype(__a0.get().*__f) {
return __a0.get().*__f;
}
template <class _Fp, class _A0, class = __enable_if_bullet5<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke_constexpr(_Fp&& __f, _A0&& __a0) noexcept(noexcept(__a0.get().*__f)) -> decltype(__a0.get().*__f) {
return __a0.get().*__f;
}
template <class _Fp, class _A0, class = __enable_if_bullet6<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke(_Fp&& __f, _A0&& __a0) noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f)) -> decltype((*static_cast<_A0&&>(__a0)).*__f) {
return (*static_cast<_A0&&>(__a0)).*__f;
}
template <class _Fp, class _A0, class = __enable_if_bullet6<_Fp, _A0>>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke_constexpr(_Fp&& __f, _A0&& __a0) noexcept(noexcept((*static_cast<_A0&&>(__a0)).*__f)) -> decltype((*static_cast<_A0&&>(__a0)).*__f) {
return (*static_cast<_A0&&>(__a0)).*__f;
}
template <class _Fp, class... _Args>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke(_Fp&& __f, _Args&&... __args) noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)))
-> decltype(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)) {
return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...);
}
template <class _Fp, class... _Args>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr auto
__invoke_constexpr(_Fp&& __f, _Args&&... __args) noexcept(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)))
-> decltype(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)) {
return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...);
}
template <class _Ret, class _Fp, class... _Args>
struct __invokable_r
{
template <class _XFp, class... _XArgs>
static auto __try_call(int) -> decltype(std::__1::__invoke(declval<_XFp>(), declval<_XArgs>()...));
template <class _XFp, class... _XArgs>
static __nat __try_call(...);
using _Result = decltype(__try_call<_Fp, _Args...>(0));
using type = typename conditional<_IsNotSame<_Result, __nat>::value,
typename conditional<is_void<_Ret>::value, true_type, is_convertible<_Result, _Ret>>::type, false_type>::type;
static const bool value = type::value;
};
template <class _Fp, class... _Args>
using __invokable = __invokable_r<void, _Fp, _Args...>;
template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class... _Args>
struct __nothrow_invokable_r_imp
{
static const bool value = false;
};
template <class _Ret, class _Fp, class... _Args>
struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...>
{
typedef __nothrow_invokable_r_imp _ThisT;
template <class _Tp>
static void __test_noexcept(_Tp) noexcept;
static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>(std::__1::__invoke(declval<_Fp>(), declval<_Args>()...)));
};
template <class _Ret, class _Fp, class... _Args>
struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...>
{
static const bool value = noexcept(std::__1::__invoke(declval<_Fp>(), declval<_Args>()...));
};
template <class _Ret, class _Fp, class... _Args>
using __nothrow_invokable_r = __nothrow_invokable_r_imp<__invokable_r<_Ret, _Fp, _Args...>::value, is_void<_Ret>::value, _Ret, _Fp, _Args...>;
template <class _Fp, class... _Args>
using __nothrow_invokable = __nothrow_invokable_r_imp<__invokable<_Fp, _Args...>::value, true, void, _Fp, _Args...>;
template <class _Fp, class... _Args>
struct __invoke_of : public enable_if<__invokable<_Fp, _Args...>::value, typename __invokable_r<void, _Fp, _Args...>::_Result>
{
};
template <class _Callable>
class __attribute__((deprecated)) result_of;
template <class _Fp, class... _Args>
class __attribute__((__type_visibility__("default"))) result_of<_Fp(_Args...)> : public __invoke_of<_Fp, _Args...>
{
};
template <class _Tp>
using result_of_t __attribute__((deprecated)) = typename result_of<_Tp>::type;
template <class _Fn, class... _Args>
struct __attribute__((__type_visibility__("default"))) invoke_result : __invoke_of<_Fn, _Args...>
{
};
template <class _Fn, class... _Args>
using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
template <class _Fn, class... _Args>
struct __attribute__((__type_visibility__("default"))) is_invocable : integral_constant<bool, __invokable<_Fn, _Args...>::value>
{
};
template <class _Ret, class _Fn, class... _Args>
struct __attribute__((__type_visibility__("default"))) is_invocable_r : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value>
{
};
template <class _Fn, class... _Args>
inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
template <class _Ret, class _Fn, class... _Args>
inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value;
template <class _Fn, class... _Args>
struct __attribute__((__type_visibility__("default"))) is_nothrow_invocable : integral_constant<bool, __nothrow_invokable<_Fn, _Args...>::value>
{
};
template <class _Ret, class _Fn, class... _Args>
struct __attribute__((__type_visibility__("default"))) is_nothrow_invocable_r
: integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value>
{
};
template <class _Fn, class... _Args>
inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value;
template <class _Ret, class _Fn, class... _Args>
inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
template <class _Tp>
struct __is_swappable;
template <class _Tp>
struct __is_nothrow_swappable;
template <class _Tp>
using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type;
template <class _Tp>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr __swap_result_t<_Tp>
swap(_Tp& __x, _Tp& __y) noexcept(is_nothrow_move_constructible<_Tp>::value&& is_nothrow_move_assignable<_Tp>::value);
template <class _Tp, size_t _Np>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr
typename enable_if<__is_swappable<_Tp>::value>::type swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) noexcept(__is_nothrow_swappable<_Tp>::value);
namespace __detail {
template <class _Tp, class _Up = _Tp, bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value>
struct __swappable_with
{
template <class _LHS, class _RHS>
static decltype(swap(declval<_LHS>(), declval<_RHS>())) __test_swap(int);
template <class, class>
static __nat __test_swap(long);
typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1;
typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2;
static const bool value = _IsNotSame<__swap1, __nat>::value && _IsNotSame<__swap2, __nat>::value;
};
template <class _Tp, class _Up>
struct __swappable_with<_Tp, _Up, false> : false_type
{
};
template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value>
struct __nothrow_swappable_with
{
static const bool value =
noexcept(swap(declval<_Tp>(), declval<_Up>()))&& noexcept(swap(declval<_Up>(), declval<_Tp>()));
};
template <class _Tp, class _Up>
struct __nothrow_swappable_with<_Tp, _Up, false> : false_type
{
};
} // namespace __detail
template <class _Tp>
struct __is_swappable : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value>
{
};
template <class _Tp>
struct __is_nothrow_swappable : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value>
{
};
template <class _Tp, class _Up>
struct __attribute__((__type_visibility__("default"))) is_swappable_with : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_swappable
: public conditional<__is_referenceable<_Tp>::value,
is_swappable_with<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<_Tp>::type>, false_type>::type
{
};
template <class _Tp, class _Up>
struct __attribute__((__type_visibility__("default"))) is_nothrow_swappable_with
: public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value>
{
};
template <class _Tp>
struct __attribute__((__type_visibility__("default"))) is_nothrow_swappable
: public conditional<__is_referenceable<_Tp>::value,
is_nothrow_swappable_with<typename add_lvalue_reference<_Tp>::type, typename add_lvalue_reference<_Tp>::type>,
false_type>::type
{
};
template <class _Tp, class _Up>
inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value;
template <class _Tp>
inline constexpr bool is_swappable_v = is_swappable<_Tp>::value;
template <class _Tp, class _Up>
inline constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with<_Tp, _Up>::value;
template <class _Tp>
inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value;
template <class _Tp, bool = is_enum<_Tp>::value>
struct __underlying_type_impl;
template <class _Tp>
struct __underlying_type_impl<_Tp, false>
{
};
template <class _Tp>
struct __underlying_type_impl<_Tp, true>
{
typedef __underlying_type(_Tp) type;
};
template <class _Tp>
struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value>
{
};
template <class _Tp>
using underlying_type_t = typename underlying_type<_Tp>::type;
template <class _Tp, bool = is_enum<_Tp>::value>
struct __sfinae_underlying_type
{
typedef typename underlying_type<_Tp>::type type;
typedef decltype(((type)1) + 0) __promoted_type;
};
template <class _Tp>
struct __sfinae_underlying_type<_Tp, false>
{
};
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr int __convert_to_integral(int __val) {
return __val;
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr unsigned __convert_to_integral(unsigned __val) {
return __val;
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr long __convert_to_integral(long __val) {
return __val;
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr unsigned long
__convert_to_integral(unsigned long __val) {
return __val;
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr long long __convert_to_integral(long long __val) {
return __val;
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr unsigned long long
__convert_to_integral(unsigned long long __val) {
return __val;
}
template <typename _Fp>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr
typename enable_if<is_floating_point<_Fp>::value, long long>::type
__convert_to_integral(_Fp __val) {
return __val;
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr __int128_t __convert_to_integral(__int128_t __val) {
return __val;
}
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr __uint128_t __convert_to_integral(__uint128_t __val) {
return __val;
}
template <class _Tp>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr typename __sfinae_underlying_type<_Tp>::__promoted_type
__convert_to_integral(_Tp __val) {
return __val;
}
template <class _Tp>
struct __has_operator_addressof_member_imp
{
template <class _Up>
static auto __test(int) -> typename __select_2nd<decltype(declval<_Up>().operator&()), true_type>::type;
template <class>
static auto __test(long) -> false_type;
static const bool value = decltype(__test<_Tp>(0))::value;
};
template <class _Tp>
struct __has_operator_addressof_free_imp
{
template <class _Up>
static auto __test(int) -> typename __select_2nd<decltype(operator&(declval<_Up>())), true_type>::type;
template <class>
static auto __test(long) -> false_type;
static const bool value = decltype(__test<_Tp>(0))::value;
};
template <class _Tp>
struct __has_operator_addressof
: public integral_constant<bool, __has_operator_addressof_member_imp<_Tp>::value || __has_operator_addressof_free_imp<_Tp>::value>
{
};
template <class... _Args>
struct conjunction : _And<_Args...>
{
};
template <class... _Args>
inline constexpr bool conjunction_v = conjunction<_Args...>::value;
template <class... _Args>
struct disjunction : _Or<_Args...>
{
};
template <class... _Args>
inline constexpr bool disjunction_v = disjunction<_Args...>::value;
template <class _Tp>
struct negation : _Not<_Tp>
{
};
template <class _Tp>
inline constexpr bool negation_v = negation<_Tp>::value;
struct __extract_key_fail_tag
{
};
struct __extract_key_self_tag
{
};
struct __extract_key_first_tag
{
};
template <class _ValTy, class _Key, class _RawValTy = typename __unconstref<_ValTy>::type>
struct __can_extract_key : conditional<_IsSame<_RawValTy, _Key>::value, __extract_key_self_tag, __extract_key_fail_tag>::type
{
};
template <class _Pair, class _Key, class _First, class _Second>
struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>
: conditional<_IsSame<typename remove_const<_First>::type, _Key>::value, __extract_key_first_tag, __extract_key_fail_tag>::type
{
};
template <class _ValTy, class _Key, class _ContainerValueTy, class _RawValTy = typename __unconstref<_ValTy>::type>
struct __can_extract_map_key : integral_constant<bool, _IsSame<_RawValTy, _Key>::value>
{
};
template <class _ValTy, class _Key, class _RawValTy>
struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> : false_type
{
};
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) inline constexpr bool is_constant_evaluated() noexcept {
return __builtin_is_constant_evaluated();
}
inline constexpr bool __libcpp_is_constant_evaluated() noexcept {
return __builtin_is_constant_evaluated();
}
template <class _CharT>
using _IsCharLikeType = _And<is_standard_layout<_CharT>, is_trivial<_CharT>>;
template <class _Tp>
using __make_const_lvalue_ref = const typename remove_reference<_Tp>::type&;
template <bool _Const, class _Tp>
using __maybe_const = conditional_t<_Const, const _Tp, _Tp>;
} // namespace __1
} // namespace std
namespace std {}
namespace std {
inline namespace __1 {
template <class _Tp>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr typename remove_reference<_Tp>::type&&
move(_Tp&& __t) noexcept {
typedef typename remove_reference<_Tp>::type _Up;
return static_cast<_Up&&>(__t);
}
template <class _Tp>
using __move_if_noexcept_result_t =
typename conditional<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>::type;
template <class _Tp>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr __move_if_noexcept_result_t<_Tp>
move_if_noexcept(_Tp& __x) noexcept {
return std::__1::move(__x);
}
} // namespace __1
} // namespace std
namespace std {
inline namespace __1 {
template <class _Tp>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr _Tp&&
forward(typename remove_reference<_Tp>::type& __t) noexcept {
return static_cast<_Tp&&>(__t);
}
template <class _Tp>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) constexpr _Tp&&
forward(typename remove_reference<_Tp>::type&& __t) noexcept {
static_assert(!is_lvalue_reference<_Tp>::value, "cannot forward an rvalue as an lvalue");
return static_cast<_Tp&&>(__t);
}
} // namespace __1
} // namespace std
namespace std {
class __attribute__((__visibility__("default"))) exception
{
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) exception() noexcept {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) exception(const exception&) noexcept = default;
virtual ~exception() noexcept;
virtual const char* what() const noexcept;
};
class __attribute__((__visibility__("default"))) bad_exception : public exception
{
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) bad_exception() noexcept {}
virtual ~bad_exception() noexcept;
virtual const char* what() const noexcept;
};
typedef void (*terminate_handler)();
__attribute__((__visibility__("default"))) terminate_handler set_terminate(terminate_handler) noexcept;
__attribute__((__visibility__("default"))) terminate_handler get_terminate() noexcept;
[[noreturn]] __attribute__((__visibility__("default"))) void terminate() noexcept;
__attribute__((__visibility__("default"))) bool uncaught_exception() noexcept;
__attribute__((__visibility__("default"))) __attribute__((availability(macosx, strict, introduced = 10.12)))
__attribute__((availability(ios, strict, introduced = 10.0))) __attribute__((availability(tvos, strict, introduced = 10.0)))
__attribute__((availability(watchos, strict, introduced = 3.0))) int
uncaught_exceptions() noexcept;
class __attribute__((__visibility__("default"))) exception_ptr;
__attribute__((__visibility__("default"))) exception_ptr current_exception() noexcept;
[[noreturn]] __attribute__((__visibility__("default"))) void rethrow_exception(exception_ptr);
class __attribute__((__visibility__("default"))) exception_ptr
{
void* __ptr_;
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) exception_ptr() noexcept : __ptr_() {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) exception_ptr(nullptr_t) noexcept : __ptr_() {}
exception_ptr(const exception_ptr&) noexcept;
exception_ptr& operator=(const exception_ptr&) noexcept;
~exception_ptr() noexcept;
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit operator bool() const noexcept {
return __ptr_ != nullptr;
}
friend __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) bool operator==(const exception_ptr& __x,
const exception_ptr& __y) noexcept {
return __x.__ptr_ == __y.__ptr_;
}
friend __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) bool operator!=(const exception_ptr& __x,
const exception_ptr& __y) noexcept {
return !(__x == __y);
}
friend __attribute__((__visibility__("default"))) exception_ptr current_exception() noexcept;
friend __attribute__((__visibility__("default"))) void rethrow_exception(exception_ptr);
};
template <class _Ep>
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) exception_ptr make_exception_ptr(_Ep __e) noexcept {
try {
throw __e;
} catch (...) {
return current_exception();
}
}
class __attribute__((__visibility__("default"))) nested_exception
{
exception_ptr __ptr_;
public:
nested_exception() noexcept;
virtual ~nested_exception() noexcept;
[[noreturn]] void rethrow_nested() const;
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) exception_ptr nested_ptr() const noexcept {
return __ptr_;
}
};
template <class _Tp>
struct __nested
: public _Tp
, public nested_exception
{
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit __nested(const _Tp& __t) : _Tp(__t) {}
};
template <class _Tp, class _Up, bool>
struct __throw_with_nested;
template <class _Tp, class _Up>
struct __throw_with_nested<_Tp, _Up, true>
{
[[noreturn]] static inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void __do_throw(_Tp&& __t) {
throw __nested<_Up>(static_cast<_Tp&&>(__t));
}
};
template <class _Tp, class _Up>
struct __throw_with_nested<_Tp, _Up, false>
{
[[noreturn]] static inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void
__do_throw(_Tp&& __t)
{
throw static_cast<_Tp&&>(__t);
}
};
template <class _Tp>
[[noreturn]] void throw_with_nested(_Tp&& __t) {
typedef typename decay<_Tp>::type _Up;
static_assert(is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible");
__throw_with_nested<_Tp, _Up, is_class<_Up>::value && !is_base_of<nested_exception, _Up>::value && !__libcpp_is_final<_Up>::value>::__do_throw(
static_cast<_Tp&&>(__t));
}
template <class _From, class _To>
struct __can_dynamic_cast
: public bool_constant<(is_polymorphic<_From>::value && (!is_base_of<_To, _From>::value || is_convertible<const _From*, const _To*>::value))>
{
};
template <class _Ep>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void
rethrow_if_nested(const _Ep& __e, typename enable_if<__can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0) {
const nested_exception* __nep = dynamic_cast<const nested_exception*>(std::__1::addressof(__e));
if (__nep) __nep->rethrow_nested();
}
template <class _Ep>
inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void
rethrow_if_nested(const _Ep&, typename enable_if<!__can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0) {}
} // namespace std
namespace std {
inline namespace __1 {
class __attribute__((__visibility__("hidden"))) __libcpp_refstring
{
const char* __imp_;
bool __uses_refcount() const;
public:
explicit __libcpp_refstring(const char* __msg);
__libcpp_refstring(const __libcpp_refstring& __s) noexcept;
__libcpp_refstring& operator=(const __libcpp_refstring& __s) noexcept;
~__libcpp_refstring();
const char* c_str() const noexcept {
return __imp_;
}
};
} // namespace __1
} // namespace std
namespace std {
class __attribute__((__visibility__("default"))) logic_error : public exception
{
private:
std::__1::__libcpp_refstring __imp_;
public:
explicit logic_error(const string&);
explicit logic_error(const char*);
logic_error(const logic_error&) noexcept;
logic_error& operator=(const logic_error&) noexcept;
virtual ~logic_error() noexcept;
virtual const char* what() const noexcept;
};
class __attribute__((__visibility__("default"))) runtime_error : public exception
{
private:
std::__1::__libcpp_refstring __imp_;
public:
explicit runtime_error(const string&);
explicit runtime_error(const char*);
runtime_error(const runtime_error&) noexcept;
runtime_error& operator=(const runtime_error&) noexcept;
virtual ~runtime_error() noexcept;
virtual const char* what() const noexcept;
};
class __attribute__((__visibility__("default"))) domain_error : public logic_error
{
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit domain_error(const string& __s) : logic_error(__s) {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit domain_error(const char* __s) : logic_error(__s) {}
domain_error(const domain_error&) noexcept = default;
virtual ~domain_error() noexcept;
};
class __attribute__((__visibility__("default"))) invalid_argument : public logic_error
{
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit invalid_argument(const string& __s) : logic_error(__s) {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit invalid_argument(const char* __s) : logic_error(__s) {}
invalid_argument(const invalid_argument&) noexcept = default;
virtual ~invalid_argument() noexcept;
};
class __attribute__((__visibility__("default"))) length_error : public logic_error
{
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit length_error(const string& __s) : logic_error(__s) {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit length_error(const char* __s) : logic_error(__s) {}
length_error(const length_error&) noexcept = default;
virtual ~length_error() noexcept;
};
class __attribute__((__visibility__("default"))) out_of_range : public logic_error
{
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit out_of_range(const string& __s) : logic_error(__s) {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit out_of_range(const char* __s) : logic_error(__s) {}
out_of_range(const out_of_range&) noexcept = default;
virtual ~out_of_range() noexcept;
};
class __attribute__((__visibility__("default"))) range_error : public runtime_error
{
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit range_error(const string& __s) : runtime_error(__s) {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit range_error(const char* __s) : runtime_error(__s) {}
range_error(const range_error&) noexcept = default;
virtual ~range_error() noexcept;
};
class __attribute__((__visibility__("default"))) overflow_error : public runtime_error
{
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit overflow_error(const string& __s) : runtime_error(__s) {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit overflow_error(const char* __s) : runtime_error(__s) {}
overflow_error(const overflow_error&) noexcept = default;
virtual ~overflow_error() noexcept;
};
class __attribute__((__visibility__("default"))) underflow_error : public runtime_error
{
public:
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit underflow_error(const string& __s) : runtime_error(__s) {}
__attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) explicit underflow_error(const char* __s) : runtime_error(__s) {}
underflow_error(const underflow_error&) noexcept = default;
virtual ~underflow_error() noexcept;
};
} // namespace std
namespace std {
inline namespace __1 {
[[noreturn]] __attribute__((__visibility__("default"))) void __throw_runtime_error(const char*);
[[noreturn]] inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void __throw_logic_error(const char* __msg) {
throw logic_error(__msg);
}
[[noreturn]] inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void __throw_domain_error(const char* __msg) {
throw domain_error(__msg);
}
[[noreturn]] inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void __throw_invalid_argument(const char* __msg) {
throw invalid_argument(__msg);
}
[[noreturn]] inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void __throw_length_error(const char* __msg) {
throw length_error(__msg);
}
[[noreturn]] inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void __throw_out_of_range(const char* __msg) {
throw out_of_range(__msg);
}
[[noreturn]] inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void __throw_range_error(const char* __msg) {
throw range_error(__msg);
}
[[noreturn]] inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void __throw_overflow_error(const char* __msg) {
throw overflow_error(__msg);
}
[[noreturn]] inline __attribute__((__visibility__("hidden"))) __attribute__((internal_linkage)) void __throw_underflow_error(const char* __msg) {
throw underflow_error(__msg);
}
} // namespace __1
} // namespace std
namespace better_enums {
template <typename T>
constexpr inline T _default() {
return static_cast<typename T::_enumerated>(0);
}
template <>
constexpr inline const char* _default<const char*>() {
return nullptr;
}
template <>
constexpr inline std::size_t _default<std::size_t>() {
return 0;
}
template <typename T>
struct optional
{
constexpr optional() : _valid(false), _value(_default<T>()) {}
constexpr optional(T v) : _valid(true), _value(v) {}
constexpr const T& operator*() const {
return _value;
}
constexpr const T* operator->() const {
return &_value;
}
constexpr operator bool() const {
return _valid;
}
constexpr const T& value() const {
return _value;
}
private:
bool _valid;
T _value;
};
template <typename CastTo, typename Element>
constexpr static optional<CastTo> _map_index(const Element* array, optional<std::size_t> index) {
return index ? static_cast<CastTo>(array[*index]) : optional<CastTo>();
}
template <typename T>
constexpr static T _or_throw(optional<T> maybe, const char* message) {
return maybe ? *maybe : throw std::runtime_error(message);
}
template <typename T>
constexpr static T* _or_null(optional<T*> maybe) {
return maybe ? *maybe : nullptr;
}
template <typename T>
constexpr static T _or_zero(optional<T> maybe) {
return maybe ? *maybe : T::_from_integral_unchecked(0);
}
template <typename T, typename U>
constexpr U continue_with(T, U value) {
return value;
}
template <typename EnumType>
struct _eat_assign
{
explicit constexpr _eat_assign(EnumType value) : _value(value) {}
template <typename Any>
constexpr const _eat_assign& operator=(Any) const {
return *this;
}
constexpr operator EnumType() const {
return _value;
}
private:
EnumType _value;
};
template <typename Element>
struct _iterable
{
typedef const Element* iterator;
constexpr iterator begin() const {
return iterator(_array);
}
constexpr iterator end() const {
return iterator(_array + _size);
}
constexpr std::size_t size() const {
return _size;
}
constexpr const Element& operator[](std::size_t index) const {
return _array[index];
}
constexpr _iterable(const Element* array, std::size_t s) : _array(array), _size(s) {}
private:
const Element* const _array;
const std::size_t _size;
};
constexpr static const char* _name_enders = "= \t\n";
constexpr inline bool _ends_name(char c, std::size_t index = 0) {
return c == _name_enders[index] ? true : _name_enders[index] == '\0' ? false : _ends_name(c, index + 1);
}
constexpr inline bool _has_initializer(const char* s, std::size_t index = 0) {
return s[index] == '\0' ? false : s[index] == '=' ? true : _has_initializer(s, index + 1);
}
constexpr inline std::size_t _constant_length(const char* s, std::size_t index = 0) {
return _ends_name(s[index]) ? index : _constant_length(s, index + 1);
}
constexpr inline char _select(const char* from, std::size_t from_length, std::size_t index) {
return index >= from_length ? '\0' : from[index];
}
constexpr inline char _to_lower_ascii(char c) {
return c >= 0x41 && c <= 0x5A ? static_cast<char>(c + 0x20) : c;
}
constexpr inline bool _names_match(const char* stringizedName, const char* referenceName, std::size_t index = 0) {
return _ends_name(stringizedName[index]) ? referenceName[index] == '\0'
: referenceName[index] == '\0' ? false
: stringizedName[index] != referenceName[index] ? false
: _names_match(stringizedName, referenceName, index + 1);
}
constexpr inline bool _names_match_nocase(const char* stringizedName, const char* referenceName, std::size_t index = 0) {
return _ends_name(stringizedName[index]) ? referenceName[index] == '\0'
: referenceName[index] == '\0' ? false
: _to_lower_ascii(stringizedName[index]) != _to_lower_ascii(referenceName[index])
? false
: _names_match_nocase(stringizedName, referenceName, index + 1);
}
inline void _trim_names(const char* const* raw_names, const char** trimmed_names, char* storage, std::size_t count) {
std::size_t offset = 0;
for (std::size_t index = 0; index < count; ++index) {
trimmed_names[index] = storage + offset;
std::size_t trimmed_length = std::strcspn(raw_names[index], _name_enders);
storage[offset + trimmed_length] = '\0';
std::size_t raw_length = std::strlen(raw_names[index]);
offset += raw_length + 1;
}
}
template <typename Enum>
struct _initialize_at_program_start
{
_initialize_at_program_start() {
Enum::initialize();
}
};
} // namespace better_enums
namespace better_enums {
template <typename T>
struct map_compare
{
constexpr static bool less(const T& a, const T& b) {
return a < b;
}
};
template <>
struct map_compare<const char*>
{
constexpr static bool less(const char* a, const char* b) {
return less_loop(a, b);
}
private:
constexpr static bool less_loop(const char* a, const char* b, size_t index = 0) {
return a[index] != b[index] ? a[index] < b[index] : a[index] == '\0' ? false : less_loop(a, b, index + 1);
}
};
template <>
struct map_compare<const wchar_t*>
{
constexpr static bool less(const wchar_t* a, const wchar_t* b) {
return less_loop(a, b);
}
private:
constexpr static bool less_loop(const wchar_t* a, const wchar_t* b, size_t index = 0) {
return a[index] != b[index] ? a[index] < b[index] : a[index] == L'\0' ? false : less_loop(a, b, index + 1);
}
};
template <typename Enum, typename T, typename Compare = map_compare<T>>
struct map
{
typedef T (*function)(Enum);
constexpr explicit map(function f) : _f(f) {}
constexpr T from_enum(Enum value) const {
return _f(value);
}
constexpr T operator[](Enum value) const {
return _f(value);
}
constexpr Enum to_enum(T value) const {
return _or_throw(to_enum_nothrow(value), "map::to_enum: invalid argument");
}
constexpr optional<Enum> to_enum_nothrow(T value, size_t index = 0) const {
return index >= Enum::_size() ? optional<Enum>()
: Compare::less(_f(Enum::_values()[index]), value) || Compare::less(value, _f(Enum::_values()[index])) ? to_enum_nothrow(value, index + 1)
: Enum::_values()[index];
}
private:
const function _f;
};
template <typename Enum, typename T>
constexpr map<Enum, T> make_map(T (*f)(Enum)) {
return map<Enum, T>(f);
}
} // namespace better_enums
namespace better_enums_data_LoadDist {}
class LoadDist
{
private:
typedef ::better_enums::optional<LoadDist> _optional;
typedef ::better_enums::optional<std::size_t> _optional_index;
public:
typedef int _integral;
enum _enumerated : int
{
Invalid = -1,
Sequential,
Uniform,
UniformPLR,
SequentialUniformPLR,
Num
};
constexpr LoadDist(_enumerated value) : _value(value) {}
constexpr operator _enumerated() const {
return _enumerated(_value);
}
constexpr _integral _to_integral() const;
constexpr static LoadDist _from_integral(_integral value);
constexpr static LoadDist _from_integral_unchecked(_integral value);
constexpr static _optional _from_integral_nothrow(_integral value);
constexpr std::size_t _to_index() const;
constexpr static LoadDist _from_index(std::size_t index);
constexpr static LoadDist _from_index_unchecked(std::size_t index);
constexpr static _optional _from_index_nothrow(std::size_t index);
const char* _to_string() const;
constexpr static LoadDist _from_string(const char* name);
constexpr static _optional _from_string_nothrow(const char* name);
constexpr static LoadDist _from_string_nocase(const char* name);
constexpr static _optional _from_string_nocase_nothrow(const char* name);
constexpr static bool _is_valid(_integral value);
constexpr static bool _is_valid(const char* name);
constexpr static bool _is_valid_nocase(const char* name);
typedef ::better_enums::_iterable<LoadDist> _value_iterable;
typedef ::better_enums::_iterable<const char*> _name_iterable;
typedef _value_iterable::iterator _value_iterator;
typedef _name_iterable::iterator _name_iterator;
constexpr static const std::size_t _size_constant = 6;
constexpr static std::size_t _size() {
return _size_constant;
}
constexpr static const char* _name();
constexpr static _value_iterable _values();
static _name_iterable _names();
_integral _value;
private:
LoadDist() : _value(0) {}
private:
explicit constexpr LoadDist(const _integral& value) : _value(value) {}
static int initialize();
constexpr static _optional_index _from_value_loop(_integral value, std::size_t index = 0);
constexpr static _optional_index _from_string_loop(const char* name, std::size_t index = 0);
constexpr static _optional_index _from_string_nocase_loop(const char* name, std::size_t index = 0);
friend struct ::better_enums::_initialize_at_program_start<LoadDist>;
};
namespace better_enums_data_LoadDist {
static ::better_enums::_initialize_at_program_start<LoadDist> _force_initialization;
enum _putNamesInThisScopeAlso
{
Invalid = -1,
Sequential,
Uniform,
UniformPLR,
SequentialUniformPLR,
Num
};
constexpr const LoadDist _value_array[] = {
(LoadDist)((::better_enums::_eat_assign<LoadDist>)LoadDist::Invalid = -1),
(LoadDist)((::better_enums::_eat_assign<LoadDist>)LoadDist::Sequential),
(LoadDist)((::better_enums::_eat_assign<LoadDist>)LoadDist::Uniform),
(LoadDist)((::better_enums::_eat_assign<LoadDist>)LoadDist::UniformPLR),
(LoadDist)((::better_enums::_eat_assign<LoadDist>)LoadDist::SequentialUniformPLR),
(LoadDist)((::better_enums::_eat_assign<LoadDist>)LoadDist::Num),
};
constexpr const char* _the_raw_names[] = {
"Invalid = -1", "Sequential", "Uniform", "UniformPLR", "SequentialUniformPLR", "Num",
};
constexpr const char* const* _raw_names() {
return _the_raw_names;
}
inline char* _name_storage() {
static char storage[] = "Invalid = -1"
","
"Sequential"
","
"Uniform"
","
"UniformPLR"
","
"SequentialUniformPLR"
","
"Num"
",";
return storage;
}
inline const char** _name_array() {
static const char* value[LoadDist::_size_constant];
return value;
}
inline bool& _initialized() {
static bool value = false;
return value;
}
} // namespace better_enums_data_LoadDist
__attribute__((__unused__)) constexpr inline const LoadDist operator+(LoadDist::_enumerated enumerated) {
return static_cast<LoadDist>(enumerated);
}
constexpr inline LoadDist::_optional_index LoadDist::_from_value_loop(LoadDist::_integral value, std::size_t index) {
return index == _size() ? _optional_index()
: better_enums_data_LoadDist::_value_array[index]._value == value ? _optional_index(index)
: _from_value_loop(value, index + 1);
}
constexpr inline LoadDist::_optional_index LoadDist::_from_string_loop(const char* name, std::size_t index) {
return index == _size() ? _optional_index()
: ::better_enums::_names_match(better_enums_data_LoadDist::_raw_names()[index], name) ? _optional_index(index)
: _from_string_loop(name, index + 1);
}
constexpr inline LoadDist::_optional_index LoadDist::_from_string_nocase_loop(const char* name, std::size_t index) {
return index == _size() ? _optional_index()
: ::better_enums::_names_match_nocase(better_enums_data_LoadDist::_raw_names()[index], name) ? _optional_index(index)
: _from_string_nocase_loop(name, index + 1);
}
constexpr inline LoadDist::_integral LoadDist::_to_integral() const {
return _integral(_value);
}
constexpr inline std::size_t LoadDist::_to_index() const {
return *_from_value_loop(_value);
}
constexpr inline LoadDist LoadDist::_from_index_unchecked(std::size_t index) {
return ::better_enums::_or_zero(_from_index_nothrow(index));
}
constexpr inline LoadDist::_optional LoadDist::_from_index_nothrow(std::size_t index) {
return index >= _size() ? _optional() : _optional(better_enums_data_LoadDist::_value_array[index]);
}
constexpr inline LoadDist LoadDist::_from_index(std::size_t index) {
return ::better_enums::_or_throw(_from_index_nothrow(index), "LoadDist"
"::_from_index: invalid argument");
}
constexpr inline LoadDist LoadDist::_from_integral_unchecked(_integral value) {
return static_cast<_enumerated>(value);
}
constexpr inline LoadDist::_optional LoadDist::_from_integral_nothrow(_integral value) {
return ::better_enums::_map_index<LoadDist>(better_enums_data_LoadDist::_value_array, _from_value_loop(value));
}
constexpr inline LoadDist LoadDist::_from_integral(_integral value) {
return ::better_enums::_or_throw(_from_integral_nothrow(value), "LoadDist"
"::_from_integral: invalid argument");
}
inline const char* LoadDist::_to_string() const {
return ::better_enums::_or_null(::better_enums::_map_index<const char*>(better_enums_data_LoadDist::_name_array(),
_from_value_loop(::better_enums::continue_with(initialize(), _value))));
}
constexpr inline LoadDist::_optional LoadDist::_from_string_nothrow(const char* name) {
return ::better_enums::_map_index<LoadDist>(better_enums_data_LoadDist::_value_array, _from_string_loop(name));
}
constexpr inline LoadDist LoadDist::_from_string(const char* name) {
return ::better_enums::_or_throw(_from_string_nothrow(name), "LoadDist"
"::_from_string: invalid argument");
}
constexpr inline LoadDist::_optional LoadDist::_from_string_nocase_nothrow(const char* name) {
return ::better_enums::_map_index<LoadDist>(better_enums_data_LoadDist::_value_array, _from_string_nocase_loop(name));
}
constexpr inline LoadDist LoadDist::_from_string_nocase(const char* name) {
return ::better_enums::_or_throw(_from_string_nocase_nothrow(name), "LoadDist"
"::_from_string_nocase: invalid argument");
}
constexpr inline bool LoadDist::_is_valid(_integral value) {
return _from_value_loop(value);
}
constexpr inline bool LoadDist::_is_valid(const char* name) {
return _from_string_loop(name);
}
constexpr inline bool LoadDist::_is_valid_nocase(const char* name) {
return _from_string_nocase_loop(name);
}
constexpr inline const char* LoadDist::_name() {
return "LoadDist";
}
constexpr inline LoadDist::_value_iterable LoadDist::_values() {
return _value_iterable(better_enums_data_LoadDist::_value_array, _size());
}
inline LoadDist::_name_iterable LoadDist::_names() {
return _name_iterable(better_enums_data_LoadDist::_name_array(), ::better_enums::continue_with(initialize(), _size()));
}
inline int LoadDist::initialize() {
if (better_enums_data_LoadDist::_initialized()) return 0;
::better_enums::_trim_names(better_enums_data_LoadDist::_raw_names(), better_enums_data_LoadDist::_name_array(),
better_enums_data_LoadDist::_name_storage(), _size());
better_enums_data_LoadDist::_initialized() = true;
return 0;
}
__attribute__((__unused__)) constexpr inline bool operator==(const LoadDist& a, const LoadDist& b) {
return a._to_integral() == b._to_integral();
}
__attribute__((__unused__)) constexpr inline bool operator!=(const LoadDist& a, const LoadDist& b) {
return a._to_integral() != b._to_integral();
}
__attribute__((__unused__)) constexpr inline bool operator<(const LoadDist& a, const LoadDist& b) {
return a._to_integral() < b._to_integral();
}
__attribute__((__unused__)) constexpr inline bool operator<=(const LoadDist& a, const LoadDist& b) {
return a._to_integral() <= b._to_integral();
}
__attribute__((__unused__)) constexpr inline bool operator>(const LoadDist& a, const LoadDist& b) {
return a._to_integral() > b._to_integral();
}
__attribute__((__unused__)) constexpr inline bool operator>=(const LoadDist& a, const LoadDist& b) {
return a._to_integral() >= b._to_integral();
}
template <typename Char, typename Traits>
std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& stream, const LoadDist& value) {
return stream << value._to_string();
}
template <typename Char, typename Traits>
std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& stream, LoadDist& value) {
std::basic_string<Char, Traits> buffer;
stream >> buffer;
::better_enums::optional<LoadDist> converted = LoadDist::_from_string_nothrow(buffer.c_str());
if (converted)
value = *converted;
else
stream.setstate(std::basic_istream<Char, Traits>::failbit);
return stream;
};
mkdir test_better_enum && cd test_better_enum
wget https://raw.githubusercontent.com/aantron/better-enums/1e8f499ddff8eec43129ac974eebdfb745920643/enum.h
echo "#include "enum.h" > test.cpp
echo "" >> test.cpp
echo "BETTER_ENUM(LoadDist, int, Invalid = -1, Sequential, Uniform, UniformPLR, SequentialUniformPLR, Num);" >> test.cpp
g++ -std=c++20 -O3 test.cpp -E -o expanded.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment