diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@alloca.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@alloca.h new file mode 100644 index 0000000..5700dd7 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@alloca.h @@ -0,0 +1,40 @@ +/* Copyright (C) 1992-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _ALLOCA_H +#define _ALLOCA_H 1 + +#include + +#define __need_size_t +#include + +__BEGIN_DECLS + +/* Remove any previous definition. */ +#undef alloca + +/* Allocate a block that will be freed when the calling function exits. */ +extern void *alloca (size_t __size) __THROW; + +#ifdef __GNUC__ +# define alloca(size) __builtin_alloca (size) +#endif /* GCC. */ + +__END_DECLS + +#endif /* alloca.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@alloca.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@alloca.h.blob new file mode 100644 index 0000000..8b8d93e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@alloca.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@bitsperlong.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@bitsperlong.h new file mode 100644 index 0000000..1fb4f0c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@bitsperlong.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_GENERIC_BITS_PER_LONG +#define __ASM_GENERIC_BITS_PER_LONG + +#ifndef __BITS_PER_LONG +/* + * In order to keep safe and avoid regression, only unify uapi + * bitsperlong.h for some archs which are using newer toolchains + * that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__. + * See the following link for more info: + * https://lore.kernel.org/linux-arch/b9624545-2c80-49a1-ac3c-39264a591f7b@app.fastmail.com/ + */ +#if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__) +#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__) +#else +/* + * There seems to be no way of detecting this automatically from user + * space, so 64 bit architectures should override this in their + * bitsperlong.h. In particular, an architecture that supports + * both 32 and 64 bit user space must not rely on CONFIG_64BIT + * to decide it, but rather check a compiler provided macro. + */ +#define __BITS_PER_LONG 32 +#endif +#endif + +#ifndef __BITS_PER_LONG_LONG +#define __BITS_PER_LONG_LONG 64 +#endif + +#endif /* __ASM_GENERIC_BITS_PER_LONG */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@bitsperlong.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@bitsperlong.h.blob new file mode 100644 index 0000000..9de9fdf Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@bitsperlong.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno-base.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno-base.h new file mode 100644 index 0000000..9653140 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno-base.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_GENERIC_ERRNO_BASE_H +#define _ASM_GENERIC_ERRNO_BASE_H + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math argument out of domain of func */ +#define ERANGE 34 /* Math result not representable */ + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno-base.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno-base.h.blob new file mode 100644 index 0000000..950ba49 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno-base.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno.h new file mode 100644 index 0000000..cf9c51a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno.h @@ -0,0 +1,123 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_GENERIC_ERRNO_H +#define _ASM_GENERIC_ERRNO_H + +#include + +#define EDEADLK 35 /* Resource deadlock would occur */ +#define ENAMETOOLONG 36 /* File name too long */ +#define ENOLCK 37 /* No record locks available */ + +/* + * This error code is special: arch syscall entry code will return + * -ENOSYS if users try to call a syscall that doesn't exist. To keep + * failures of syscalls that really do exist distinguishable from + * failures due to attempts to use a nonexistent syscall, syscall + * implementations should refrain from returning -ENOSYS. + */ +#define ENOSYS 38 /* Invalid system call number */ + +#define ENOTEMPTY 39 /* Directory not empty */ +#define ELOOP 40 /* Too many symbolic links encountered */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define ENOMSG 42 /* No message of desired type */ +#define EIDRM 43 /* Identifier removed */ +#define ECHRNG 44 /* Channel number out of range */ +#define EL2NSYNC 45 /* Level 2 not synchronized */ +#define EL3HLT 46 /* Level 3 halted */ +#define EL3RST 47 /* Level 3 reset */ +#define ELNRNG 48 /* Link number out of range */ +#define EUNATCH 49 /* Protocol driver not attached */ +#define ENOCSI 50 /* No CSI structure available */ +#define EL2HLT 51 /* Level 2 halted */ +#define EBADE 52 /* Invalid exchange */ +#define EBADR 53 /* Invalid request descriptor */ +#define EXFULL 54 /* Exchange full */ +#define ENOANO 55 /* No anode */ +#define EBADRQC 56 /* Invalid request code */ +#define EBADSLT 57 /* Invalid slot */ + +#define EDEADLOCK EDEADLK + +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 72 /* Multihop attempted */ +#define EDOTDOT 73 /* RFS specific error */ +#define EBADMSG 74 /* Not a data message */ +#define EOVERFLOW 75 /* Value too large for defined data type */ +#define ENOTUNIQ 76 /* Name not unique on network */ +#define EBADFD 77 /* File descriptor in bad state */ +#define EREMCHG 78 /* Remote address changed */ +#define ELIBACC 79 /* Can not access a needed shared library */ +#define ELIBBAD 80 /* Accessing a corrupted shared library */ +#define ELIBSCN 81 /* .lib section in a.out corrupted */ +#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define EILSEQ 84 /* Illegal byte sequence */ +#define ERESTART 85 /* Interrupted system call should be restarted */ +#define ESTRPIPE 86 /* Streams pipe error */ +#define EUSERS 87 /* Too many users */ +#define ENOTSOCK 88 /* Socket operation on non-socket */ +#define EDESTADDRREQ 89 /* Destination address required */ +#define EMSGSIZE 90 /* Message too long */ +#define EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 92 /* Protocol not available */ +#define EPROTONOSUPPORT 93 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define EADDRINUSE 98 /* Address already in use */ +#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define ENETDOWN 100 /* Network is down */ +#define ENETUNREACH 101 /* Network is unreachable */ +#define ENETRESET 102 /* Network dropped connection because of reset */ +#define ECONNABORTED 103 /* Software caused connection abort */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EISCONN 106 /* Transport endpoint is already connected */ +#define ENOTCONN 107 /* Transport endpoint is not connected */ +#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define ETIMEDOUT 110 /* Connection timed out */ +#define ECONNREFUSED 111 /* Connection refused */ +#define EHOSTDOWN 112 /* Host is down */ +#define EHOSTUNREACH 113 /* No route to host */ +#define EALREADY 114 /* Operation already in progress */ +#define EINPROGRESS 115 /* Operation now in progress */ +#define ESTALE 116 /* Stale file handle */ +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ +#define EDQUOT 122 /* Quota exceeded */ + +#define ENOMEDIUM 123 /* No medium found */ +#define EMEDIUMTYPE 124 /* Wrong medium type */ +#define ECANCELED 125 /* Operation Canceled */ +#define ENOKEY 126 /* Required key not available */ +#define EKEYEXPIRED 127 /* Key has expired */ +#define EKEYREVOKED 128 /* Key has been revoked */ +#define EKEYREJECTED 129 /* Key was rejected by service */ + +/* for robust mutexes */ +#define EOWNERDEAD 130 /* Owner died */ +#define ENOTRECOVERABLE 131 /* State not recoverable */ + +#define ERFKILL 132 /* Operation not possible due to RF-kill */ + +#define EHWPOISON 133 /* Memory page has hardware error */ + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno.h.blob new file mode 100644 index 0000000..a5cf2ce Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@errno.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@int-ll64.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@int-ll64.h new file mode 100644 index 0000000..db61e81 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@int-ll64.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* + * asm-generic/int-ll64.h + * + * Integer declarations for architectures which use "long long" + * for 64-bit types. + */ + +#ifndef _ASM_GENERIC_INT_LL64_H +#define _ASM_GENERIC_INT_LL64_H + +#include + +#ifndef __ASSEMBLY__ +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +#ifdef __GNUC__ +__extension__ typedef __signed__ long long __s64; +__extension__ typedef unsigned long long __u64; +#else +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif + +#endif /* __ASSEMBLY__ */ + + +#endif /* _ASM_GENERIC_INT_LL64_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@int-ll64.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@int-ll64.h.blob new file mode 100644 index 0000000..7a3a247 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@int-ll64.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@posix_types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@posix_types.h new file mode 100644 index 0000000..5df751f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@posix_types.h @@ -0,0 +1,100 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_GENERIC_POSIX_TYPES_H +#define __ASM_GENERIC_POSIX_TYPES_H + +#include +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. + * + * First the types that are often defined in different ways across + * architectures, so that you can override them. + */ + +#ifndef __kernel_long_t +typedef long __kernel_long_t; +typedef unsigned long __kernel_ulong_t; +#endif + +#ifndef __kernel_ino_t +typedef __kernel_ulong_t __kernel_ino_t; +#endif + +#ifndef __kernel_mode_t +typedef unsigned int __kernel_mode_t; +#endif + +#ifndef __kernel_pid_t +typedef int __kernel_pid_t; +#endif + +#ifndef __kernel_ipc_pid_t +typedef int __kernel_ipc_pid_t; +#endif + +#ifndef __kernel_uid_t +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; +#endif + +#ifndef __kernel_suseconds_t +typedef __kernel_long_t __kernel_suseconds_t; +#endif + +#ifndef __kernel_daddr_t +typedef int __kernel_daddr_t; +#endif + +#ifndef __kernel_uid32_t +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; +#endif + +#ifndef __kernel_old_uid_t +typedef __kernel_uid_t __kernel_old_uid_t; +typedef __kernel_gid_t __kernel_old_gid_t; +#endif + +#ifndef __kernel_old_dev_t +typedef unsigned int __kernel_old_dev_t; +#endif + +/* + * Most 32 bit architectures use "unsigned int" size_t, + * and all 64 bit architectures use "unsigned long" size_t. + */ +#ifndef __kernel_size_t +#if __BITS_PER_LONG != 64 +typedef unsigned int __kernel_size_t; +typedef int __kernel_ssize_t; +typedef int __kernel_ptrdiff_t; +#else +typedef __kernel_ulong_t __kernel_size_t; +typedef __kernel_long_t __kernel_ssize_t; +typedef __kernel_long_t __kernel_ptrdiff_t; +#endif +#endif + +#ifndef __kernel_fsid_t +typedef struct { + int val[2]; +} __kernel_fsid_t; +#endif + +/* + * anything below here should be completely generic + */ +typedef __kernel_long_t __kernel_off_t; +typedef long long __kernel_loff_t; +typedef unsigned long long __kernel_uoff_t; +typedef __kernel_long_t __kernel_old_time_t; +typedef __kernel_long_t __kernel_time_t; +typedef long long __kernel_time64_t; +typedef __kernel_long_t __kernel_clock_t; +typedef int __kernel_timer_t; +typedef int __kernel_clockid_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; + +#endif /* __ASM_GENERIC_POSIX_TYPES_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@posix_types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@posix_types.h.blob new file mode 100644 index 0000000..aa21d3a Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@posix_types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@types.h new file mode 100644 index 0000000..dfaa50d --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@types.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_GENERIC_TYPES_H +#define _ASM_GENERIC_TYPES_H +/* + * int-ll64 is used everywhere now. + */ +#include + +#endif /* _ASM_GENERIC_TYPES_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@types.h.blob new file mode 100644 index 0000000..ca8a4c6 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm-generic@types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@bitsperlong.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@bitsperlong.h new file mode 100644 index 0000000..5d72c84 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@bitsperlong.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_X86_BITSPERLONG_H +#define __ASM_X86_BITSPERLONG_H + +#if defined(__x86_64__) && !defined(__ILP32__) +# define __BITS_PER_LONG 64 +#else +# define __BITS_PER_LONG 32 +#endif + +#include + +#endif /* __ASM_X86_BITSPERLONG_H */ + diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@bitsperlong.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@bitsperlong.h.blob new file mode 100644 index 0000000..585ec67 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@bitsperlong.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@errno.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@errno.h new file mode 100644 index 0000000..4c82b50 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@errno.h @@ -0,0 +1 @@ +#include diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@errno.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@errno.h.blob new file mode 100644 index 0000000..e45a391 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@errno.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types.h new file mode 100644 index 0000000..fe9e6aa --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +# ifdef __i386__ +# include +# elif defined(__ILP32__) +# include +# else +# include +# endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types.h.blob new file mode 100644 index 0000000..f08d55d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types_64.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types_64.h new file mode 100644 index 0000000..515afb8 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types_64.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _ASM_X86_POSIX_TYPES_64_H +#define _ASM_X86_POSIX_TYPES_64_H + +/* + * This file is generally used by user-level software, so you need to + * be a little careful about namespace pollution etc. Also, we cannot + * assume GCC is being used. + */ + +typedef unsigned short __kernel_old_uid_t; +typedef unsigned short __kernel_old_gid_t; +#define __kernel_old_uid_t __kernel_old_uid_t + +typedef unsigned long __kernel_old_dev_t; +#define __kernel_old_dev_t __kernel_old_dev_t + +#include + +#endif /* _ASM_X86_POSIX_TYPES_64_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types_64.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types_64.h.blob new file mode 100644 index 0000000..1348097 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@posix_types_64.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@types.h new file mode 100644 index 0000000..b9e79bc --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@types.h @@ -0,0 +1 @@ +#include diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@types.h.blob new file mode 100644 index 0000000..2eb6c16 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@asm@types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@atomic_wide_counter.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@atomic_wide_counter.h new file mode 100644 index 0000000..a01dec6 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@atomic_wide_counter.h @@ -0,0 +1,35 @@ +/* Monotonically increasing wide counters (at least 62 bits). + Copyright (C) 2016-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_ATOMIC_WIDE_COUNTER_H +#define _BITS_ATOMIC_WIDE_COUNTER_H + +/* Counter that is monotonically increasing (by less than 2**31 per + increment), with a single writer, and an arbitrary number of + readers. */ +typedef union +{ + __extension__ unsigned long long int __value64; + struct + { + unsigned int __low; + unsigned int __high; + } __value32; +} __atomic_wide_counter; + +#endif /* _BITS_ATOMIC_WIDE_COUNTER_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@atomic_wide_counter.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@atomic_wide_counter.h.blob new file mode 100644 index 0000000..ea89389 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@atomic_wide_counter.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@byteswap.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@byteswap.h new file mode 100644 index 0000000..34533ff --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@byteswap.h @@ -0,0 +1,79 @@ +/* Macros and inline functions to swap the order of bytes in integer values. + Copyright (C) 1997-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H +# error "Never use directly; include instead." +#endif + +#ifndef _BITS_BYTESWAP_H +#define _BITS_BYTESWAP_H 1 + +#include +#include + +/* Swap bytes in 16-bit value. */ +#define __bswap_constant_16(x) \ + ((__uint16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))) + +static __inline __uint16_t +__bswap_16 (__uint16_t __bsx) +{ +#if __GNUC_PREREQ (4, 8) + return __builtin_bswap16 (__bsx); +#else + return __bswap_constant_16 (__bsx); +#endif +} + +/* Swap bytes in 32-bit value. */ +#define __bswap_constant_32(x) \ + ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) \ + | (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) + +static __inline __uint32_t +__bswap_32 (__uint32_t __bsx) +{ +#if __GNUC_PREREQ (4, 3) + return __builtin_bswap32 (__bsx); +#else + return __bswap_constant_32 (__bsx); +#endif +} + +/* Swap bytes in 64-bit value. */ +#define __bswap_constant_64(x) \ + ((((x) & 0xff00000000000000ull) >> 56) \ + | (((x) & 0x00ff000000000000ull) >> 40) \ + | (((x) & 0x0000ff0000000000ull) >> 24) \ + | (((x) & 0x000000ff00000000ull) >> 8) \ + | (((x) & 0x00000000ff000000ull) << 8) \ + | (((x) & 0x0000000000ff0000ull) << 24) \ + | (((x) & 0x000000000000ff00ull) << 40) \ + | (((x) & 0x00000000000000ffull) << 56)) + +__extension__ static __inline __uint64_t +__bswap_64 (__uint64_t __bsx) +{ +#if __GNUC_PREREQ (4, 3) + return __builtin_bswap64 (__bsx); +#else + return __bswap_constant_64 (__bsx); +#endif +} + +#endif /* _BITS_BYTESWAP_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@byteswap.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@byteswap.h.blob new file mode 100644 index 0000000..e3f5de9 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@byteswap.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@cpu-set.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@cpu-set.h new file mode 100644 index 0000000..ddb79ce --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@cpu-set.h @@ -0,0 +1,124 @@ +/* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993 + scheduling interface. + Copyright (C) 1996-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_CPU_SET_H +#define _BITS_CPU_SET_H 1 + +#ifndef _SCHED_H +# error "Never include directly; use instead." +#endif + +/* Size definition for CPU sets. */ +#define __CPU_SETSIZE 1024 +#define __NCPUBITS (8 * sizeof (__cpu_mask)) + +/* Type for array elements in 'cpu_set_t'. */ +typedef __CPU_MASK_TYPE __cpu_mask; + +/* Basic access functions. */ +#define __CPUELT(cpu) ((cpu) / __NCPUBITS) +#define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS)) + +/* Data structure to describe CPU mask. */ +typedef struct +{ + __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS]; +} cpu_set_t; + +/* Access functions for CPU masks. */ +#if __GNUC_PREREQ (2, 91) +# define __CPU_ZERO_S(setsize, cpusetp) \ + do __builtin_memset (cpusetp, '\0', setsize); while (0) +#else +# define __CPU_ZERO_S(setsize, cpusetp) \ + do { \ + size_t __i; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + __cpu_mask *__bits = (cpusetp)->__bits; \ + for (__i = 0; __i < __imax; ++__i) \ + __bits[__i] = 0; \ + } while (0) +#endif +#define __CPU_SET_S(cpu, setsize, cpusetp) \ + (__extension__ \ + ({ size_t __cpu = (cpu); \ + __cpu / 8 < (setsize) \ + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + |= __CPUMASK (__cpu)) \ + : 0; })) +#define __CPU_CLR_S(cpu, setsize, cpusetp) \ + (__extension__ \ + ({ size_t __cpu = (cpu); \ + __cpu / 8 < (setsize) \ + ? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + &= ~__CPUMASK (__cpu)) \ + : 0; })) +#define __CPU_ISSET_S(cpu, setsize, cpusetp) \ + (__extension__ \ + ({ size_t __cpu = (cpu); \ + __cpu / 8 < (setsize) \ + ? ((((const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \ + & __CPUMASK (__cpu))) != 0 \ + : 0; })) + +#define __CPU_COUNT_S(setsize, cpusetp) \ + __sched_cpucount (setsize, cpusetp) + +#if __GNUC_PREREQ (2, 91) +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ + (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0) +#else +# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ + (__extension__ \ + ({ const __cpu_mask *__arr1 = (cpusetp1)->__bits; \ + const __cpu_mask *__arr2 = (cpusetp2)->__bits; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + size_t __i; \ + for (__i = 0; __i < __imax; ++__i) \ + if (__arr1[__i] != __arr2[__i]) \ + break; \ + __i == __imax; })) +#endif + +#define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \ + (__extension__ \ + ({ cpu_set_t *__dest = (destset); \ + const __cpu_mask *__arr1 = (srcset1)->__bits; \ + const __cpu_mask *__arr2 = (srcset2)->__bits; \ + size_t __imax = (setsize) / sizeof (__cpu_mask); \ + size_t __i; \ + for (__i = 0; __i < __imax; ++__i) \ + ((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \ + __dest; })) + +#define __CPU_ALLOC_SIZE(count) \ + ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask)) +#define __CPU_ALLOC(count) __sched_cpualloc (count) +#define __CPU_FREE(cpuset) __sched_cpufree (cpuset) + +__BEGIN_DECLS + +extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp) + __THROW; +extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur; +extern void __sched_cpufree (cpu_set_t *__set) __THROW; + +__END_DECLS + +#endif /* bits/cpu-set.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@cpu-set.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@cpu-set.h.blob new file mode 100644 index 0000000..efec87d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@cpu-set.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endian.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endian.h new file mode 100644 index 0000000..d60ddfd --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endian.h @@ -0,0 +1,49 @@ +/* Endian macros for string.h functions + Copyright (C) 1992-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_ENDIAN_H +#define _BITS_ENDIAN_H 1 + +/* Definitions for byte order, according to significance of bytes, + from low addresses to high addresses. The value is what you get by + putting '4' in the most significant byte, '3' in the second most + significant byte, '2' in the second least significant byte, and '1' + in the least significant byte, and then writing down one digit for + each byte, starting with the byte at the lowest address at the left, + and proceeding to the byte with the highest address at the right. */ + +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#define __PDP_ENDIAN 3412 + +/* This file defines `__BYTE_ORDER' for the particular machine. */ +#include + +/* Some machines may need to use a different endianness for floating point + values. */ +#ifndef __FLOAT_WORD_ORDER +# define __FLOAT_WORD_ORDER __BYTE_ORDER +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define __LONG_LONG_PAIR(HI, LO) LO, HI +#elif __BYTE_ORDER == __BIG_ENDIAN +# define __LONG_LONG_PAIR(HI, LO) HI, LO +#endif + +#endif /* bits/endian.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endian.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endian.h.blob new file mode 100644 index 0000000..d89b8cf Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endian.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endianness.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endianness.h new file mode 100644 index 0000000..962a9ae --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endianness.h @@ -0,0 +1,11 @@ +#ifndef _BITS_ENDIANNESS_H +#define _BITS_ENDIANNESS_H 1 + +#ifndef _BITS_ENDIAN_H +# error "Never use directly; include instead." +#endif + +/* i386/x86_64 are little-endian. */ +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif /* bits/endianness.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endianness.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endianness.h.blob new file mode 100644 index 0000000..31d02d7 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@endianness.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@errno.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@errno.h new file mode 100644 index 0000000..be4e48e --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@errno.h @@ -0,0 +1,53 @@ +/* Error constants. Linux specific version. + Copyright (C) 1996-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_ERRNO_H +#define _BITS_ERRNO_H 1 + +#if !defined _ERRNO_H +# error "Never include directly; use instead." +#endif + +# include + +/* Older Linux headers do not define these constants. */ +# ifndef ENOTSUP +# define ENOTSUP EOPNOTSUPP +# endif + +# ifndef ECANCELED +# define ECANCELED 125 +# endif + +# ifndef EOWNERDEAD +# define EOWNERDEAD 130 +# endif + +#ifndef ENOTRECOVERABLE +# define ENOTRECOVERABLE 131 +# endif + +# ifndef ERFKILL +# define ERFKILL 132 +# endif + +# ifndef EHWPOISON +# define EHWPOISON 133 +# endif + +#endif /* bits/errno.h. */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@errno.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@errno.h.blob new file mode 100644 index 0000000..358ee25 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@errno.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn-common.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn-common.h new file mode 100644 index 0000000..4c79094 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn-common.h @@ -0,0 +1,329 @@ +/* Macros to control TS 18661-3 glibc features where the same + definitions are appropriate for all platforms. + Copyright (C) 2017-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_FLOATN_COMMON_H +#define _BITS_FLOATN_COMMON_H + +#include +#include + +/* This header should be included at the bottom of each bits/floatn.h. + It defines the following macros for each _FloatN and _FloatNx type, + where the same definitions, or definitions based only on the macros + in bits/floatn.h, are appropriate for all glibc configurations. */ + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for this type, and this + glibc includes corresponding *fN or *fNx interfaces for it. */ +#define __HAVE_FLOAT16 0 +#define __HAVE_FLOAT32 1 +#define __HAVE_FLOAT64 1 +#define __HAVE_FLOAT32X 1 +#define __HAVE_FLOAT128X 0 + +/* Defined to 1 if the corresponding __HAVE_ macro is 1 and the + type is the first with its format in the sequence of (the default + choices for) float, double, long double, _Float16, _Float32, + _Float64, _Float128, _Float32x, _Float64x, _Float128x for this + glibc; that is, if functions present once per floating-point format + rather than once per type are present for this type. + + All configurations supported by glibc have _Float32 the same format + as float, _Float64 and _Float32x the same format as double, the + _Float64x the same format as either long double or _Float128. No + configurations support _Float128x or, as of GCC 7, have compiler + support for a type meeting the requirements for _Float128x. */ +#define __HAVE_DISTINCT_FLOAT16 __HAVE_FLOAT16 +#define __HAVE_DISTINCT_FLOAT32 0 +#define __HAVE_DISTINCT_FLOAT64 0 +#define __HAVE_DISTINCT_FLOAT32X 0 +#define __HAVE_DISTINCT_FLOAT64X 0 +#define __HAVE_DISTINCT_FLOAT128X __HAVE_FLOAT128X + +/* Defined to 1 if the corresponding _FloatN type is not binary compatible + with the corresponding ISO C type in the current compilation unit as + opposed to __HAVE_DISTINCT_FLOATN, which indicates the default types built + in glibc. */ +#define __HAVE_FLOAT128_UNLIKE_LDBL (__HAVE_DISTINCT_FLOAT128 \ + && __LDBL_MANT_DIG__ != 113) + +/* Defined to 1 if any _FloatN or _FloatNx types that are not + ABI-distinct are however distinct types at the C language level (so + for the purposes of __builtin_types_compatible_p and _Generic). */ +#if __GNUC_PREREQ (7, 0) && !defined __cplusplus +# define __HAVE_FLOATN_NOT_TYPEDEF 1 +#else +# define __HAVE_FLOATN_NOT_TYPEDEF 0 +#endif + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _FloatN + or _FloatNx types, if __HAVE_ is 1. The corresponding + literal suffixes exist since GCC 7, for C only. */ +# if __HAVE_FLOAT16 +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +/* No corresponding suffix available for this type. */ +# define __f16(x) ((_Float16) x##f) +# else +# define __f16(x) x##f16 +# endif +# endif + +# if __HAVE_FLOAT32 +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# define __f32(x) x##f +# else +# define __f32(x) x##f32 +# endif +# endif + +# if __HAVE_FLOAT64 +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# ifdef __NO_LONG_DOUBLE_MATH +# define __f64(x) x##l +# else +# define __f64(x) x +# endif +# else +# define __f64(x) x##f64 +# endif +# endif + +# if __HAVE_FLOAT32X +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# define __f32x(x) x +# else +# define __f32x(x) x##f32x +# endif +# endif + +# if __HAVE_FLOAT64X +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# if __HAVE_FLOAT64X_LONG_DOUBLE +# define __f64x(x) x##l +# else +# define __f64x(x) __f128 (x) +# endif +# else +# define __f64x(x) x##f64x +# endif +# endif + +# if __HAVE_FLOAT128X +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# error "_Float128X supported but no constant suffix" +# else +# define __f128x(x) x##f128x +# endif +# endif + +/* Defined to a complex type if __HAVE_ is 1. */ +# if __HAVE_FLOAT16 +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__))); +# define __CFLOAT16 __cfloat16 +# else +# define __CFLOAT16 _Complex _Float16 +# endif +# endif + +# if __HAVE_FLOAT32 +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# define __CFLOAT32 _Complex float +# else +# define __CFLOAT32 _Complex _Float32 +# endif +# endif + +# if __HAVE_FLOAT64 +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# ifdef __NO_LONG_DOUBLE_MATH +# define __CFLOAT64 _Complex long double +# else +# define __CFLOAT64 _Complex double +# endif +# else +# define __CFLOAT64 _Complex _Float64 +# endif +# endif + +# if __HAVE_FLOAT32X +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# define __CFLOAT32X _Complex double +# else +# define __CFLOAT32X _Complex _Float32x +# endif +# endif + +# if __HAVE_FLOAT64X +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# if __HAVE_FLOAT64X_LONG_DOUBLE +# define __CFLOAT64X _Complex long double +# else +# define __CFLOAT64X __CFLOAT128 +# endif +# else +# define __CFLOAT64X _Complex _Float64x +# endif +# endif + +# if __HAVE_FLOAT128X +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# error "_Float128X supported but no complex type" +# else +# define __CFLOAT128X _Complex _Float128x +# endif +# endif + +/* The remaining of this file provides support for older compilers. */ +# if __HAVE_FLOAT16 + +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +typedef float _Float16 __attribute__ ((__mode__ (__HF__))); +# endif + +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf16() ((_Float16) __builtin_huge_val ()) +# define __builtin_inff16() ((_Float16) __builtin_inf ()) +# define __builtin_nanf16(x) ((_Float16) __builtin_nan (x)) +# define __builtin_nansf16(x) ((_Float16) __builtin_nans (x)) +# endif + +# endif + +# if __HAVE_FLOAT32 + +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +typedef float _Float32; +# endif + +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf32() (__builtin_huge_valf ()) +# define __builtin_inff32() (__builtin_inff ()) +# define __builtin_nanf32(x) (__builtin_nanf (x)) +# define __builtin_nansf32(x) (__builtin_nansf (x)) +# endif + +# endif + +# if __HAVE_FLOAT64 + +/* If double, long double and _Float64 all have the same set of + values, TS 18661-3 requires the usual arithmetic conversions on + long double and _Float64 to produce _Float64. For this to be the + case when building with a compiler without a distinct _Float64 + type, _Float64 must be a typedef for long double, not for + double. */ + +# ifdef __NO_LONG_DOUBLE_MATH + +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +typedef long double _Float64; +# endif + +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf64() (__builtin_huge_vall ()) +# define __builtin_inff64() (__builtin_infl ()) +# define __builtin_nanf64(x) (__builtin_nanl (x)) +# define __builtin_nansf64(x) (__builtin_nansl (x)) +# endif + +# else + +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +typedef double _Float64; +# endif + +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf64() (__builtin_huge_val ()) +# define __builtin_inff64() (__builtin_inf ()) +# define __builtin_nanf64(x) (__builtin_nan (x)) +# define __builtin_nansf64(x) (__builtin_nans (x)) +# endif + +# endif + +# endif + +# if __HAVE_FLOAT32X + +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +typedef double _Float32x; +# endif + +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf32x() (__builtin_huge_val ()) +# define __builtin_inff32x() (__builtin_inf ()) +# define __builtin_nanf32x(x) (__builtin_nan (x)) +# define __builtin_nansf32x(x) (__builtin_nans (x)) +# endif + +# endif + +# if __HAVE_FLOAT64X + +# if __HAVE_FLOAT64X_LONG_DOUBLE + +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +typedef long double _Float64x; +# endif + +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf64x() (__builtin_huge_vall ()) +# define __builtin_inff64x() (__builtin_infl ()) +# define __builtin_nanf64x(x) (__builtin_nanl (x)) +# define __builtin_nansf64x(x) (__builtin_nansl (x)) +# endif + +# else + +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +typedef _Float128 _Float64x; +# endif + +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf64x() (__builtin_huge_valf128 ()) +# define __builtin_inff64x() (__builtin_inff128 ()) +# define __builtin_nanf64x(x) (__builtin_nanf128 (x)) +# define __builtin_nansf64x(x) (__builtin_nansf128 (x)) +# endif + +# endif + +# endif + +# if __HAVE_FLOAT128X + +# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) +# error "_Float128x supported but no type" +# endif + +# if !__GNUC_PREREQ (7, 0) +# define __builtin_huge_valf128x() ((_Float128x) __builtin_huge_val ()) +# define __builtin_inff128x() ((_Float128x) __builtin_inf ()) +# define __builtin_nanf128x(x) ((_Float128x) __builtin_nan (x)) +# define __builtin_nansf128x(x) ((_Float128x) __builtin_nans (x)) +# endif + +# endif + +#endif /* !__ASSEMBLER__. */ + +#endif /* _BITS_FLOATN_COMMON_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn-common.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn-common.h.blob new file mode 100644 index 0000000..42be20d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn-common.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn.h new file mode 100644 index 0000000..387a4ae --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn.h @@ -0,0 +1,133 @@ +/* Macros to control TS 18661-3 glibc features on x86. + Copyright (C) 2017-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_FLOATN_H +#define _BITS_FLOATN_H + +#include + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the IEEE 754 binary128 format, and this + glibc includes corresponding *f128 interfaces for it. The required + libgcc support was added some time after the basic compiler + support, for x86_64 and x86. Intel SYCL compiler doesn't support + _Float128: https://github.com/intel/llvm/issues/16903 + */ +#if (defined __x86_64__ \ + ? __GNUC_PREREQ (4, 3) \ + : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) \ + || (__glibc_clang_prereq (3, 9) \ + && (!defined __INTEL_LLVM_COMPILER \ + || !defined SYCL_LANGUAGE_VERSION)) +# define __HAVE_FLOAT128 1 +#else +# define __HAVE_FLOAT128 0 +#endif + +/* Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct + from the default float, double and long double types in this glibc. */ +#if __HAVE_FLOAT128 +# define __HAVE_DISTINCT_FLOAT128 1 +#else +# define __HAVE_DISTINCT_FLOAT128 0 +#endif + +/* Defined to 1 if the current compiler invocation provides a + floating-point type with the right format for _Float64x, and this + glibc includes corresponding *f64x interfaces for it. */ +#define __HAVE_FLOAT64X 1 + +/* Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format + of long double. Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has + the format of _Float128, which must be different from that of long + double. */ +#define __HAVE_FLOAT64X_LONG_DOUBLE 1 + +#ifndef __ASSEMBLER__ + +/* Defined to concatenate the literal suffix to be used with _Float128 + types, if __HAVE_FLOAT128 is 1. */ +# if __HAVE_FLOAT128 +# if !__GNUC_PREREQ (7, 0) \ + || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) \ + || defined __clang__ +/* The literal suffix f128 exists only since GCC 7.0. */ +# define __f128(x) x##q +# else +# define __f128(x) x##f128 +# endif +# endif + +/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */ +# if __HAVE_FLOAT128 +# if !__GNUC_PREREQ (7, 0) \ + || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) \ + || defined __clang__ +/* Add a typedef for older GCC compilers which don't natively support + _Complex _Float128. */ +typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); +# define __CFLOAT128 __cfloat128 +# else +# define __CFLOAT128 _Complex _Float128 +# endif +# endif + +/* The remaining of this file provides support for older compilers. */ +# if __HAVE_FLOAT128 + +/* The type _Float128 exists only since GCC 7.0. */ +# if !__GNUC_PREREQ (7, 0) \ + || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) \ + || __glibc_clang_prereq (3, 9) +typedef __float128 _Float128; +# endif + +/* __builtin_huge_valf128 doesn't exist before GCC 7.0 nor Clang 7.0. */ +# if !__GNUC_PREREQ (7, 0) && !__glibc_clang_prereq (7, 0) +# define __builtin_huge_valf128() ((_Float128) __builtin_huge_val ()) +# endif + +/* Older GCC has only a subset of built-in functions for _Float128 on + x86, and __builtin_infq is not usable in static initializers. + Converting a narrower sNaN to _Float128 produces a quiet NaN, so + attempts to use _Float128 sNaNs will not work properly with older + compilers. */ +# if !__GNUC_PREREQ (7, 0) && !defined __clang__ +# define __builtin_copysignf128 __builtin_copysignq +# define __builtin_fabsf128 __builtin_fabsq +# define __builtin_inff128() ((_Float128) __builtin_inf ()) +# define __builtin_nanf128(x) ((_Float128) __builtin_nan (x)) +# define __builtin_nansf128(x) ((_Float128) __builtin_nans (x)) +# endif + +/* In math/math.h, __MATH_TG will expand signbit to __builtin_signbit*, + e.g.: __builtin_signbitf128, before GCC 6. However, there has never + been a __builtin_signbitf128 in GCC and the type-generic builtin is + only available since GCC 6. signbit is expanded to __builtin_signbit + after Clang 3.3. */ +# if !__GNUC_PREREQ (6, 0) +# define __builtin_signbitf128 __signbitf128 +# endif + +# endif + +#endif /* !__ASSEMBLER__. */ + +#include + +#endif /* _BITS_FLOATN_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn.h.blob new file mode 100644 index 0000000..1c6844b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@floatn.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@libc-header-start.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@libc-header-start.h new file mode 100644 index 0000000..45897cd --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@libc-header-start.h @@ -0,0 +1,110 @@ +/* Handle feature test macros at the start of a header. + Copyright (C) 2016-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This header is internal to glibc and should not be included outside + of glibc headers. Headers including it must define + __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION first. This header + cannot have multiple include guards because ISO C feature test + macros depend on the definition of the macro when an affected + header is included, not when the first system header is + included. */ + +#ifndef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION +# error "Never include directly." +#endif + +#undef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION + +#include + +/* ISO/IEC TR 24731-2:2010 defines the __STDC_WANT_LIB_EXT2__ + macro. */ +#undef __GLIBC_USE_LIB_EXT2 +#if (defined __USE_GNU \ + || (defined __STDC_WANT_LIB_EXT2__ && __STDC_WANT_LIB_EXT2__ > 0)) +# define __GLIBC_USE_LIB_EXT2 1 +#else +# define __GLIBC_USE_LIB_EXT2 0 +#endif + +/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__ + macro. Most but not all symbols enabled by that macro in TS + 18661-1 are enabled unconditionally in C23. In C23, the symbols in + Annex F still require a new feature test macro + __STDC_WANT_IEC_60559_EXT__ instead (C23 does not define + __STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS + 18661-1 are not included in C23 (and thus should depend on + __STDC_WANT_IEC_60559_BFP_EXT__ even when C23 features are + enabled). + + __GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS + 18661-1 not included in C23. + + __GLIBC_USE (IEC_60559_BFP_EXT_C23) controls those features from TS + 18661-1 that are also included in C23 (with no feature test macro + required in C23). + + __GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1 + that are included in C23 but conditional on + __STDC_WANT_IEC_60559_EXT__. (There are currently no features + conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS + 18661-1.) */ +#undef __GLIBC_USE_IEC_60559_BFP_EXT +#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__ +# define __GLIBC_USE_IEC_60559_BFP_EXT 1 +#else +# define __GLIBC_USE_IEC_60559_BFP_EXT 0 +#endif +#undef __GLIBC_USE_IEC_60559_BFP_EXT_C23 +#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC23) +# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 1 +#else +# define __GLIBC_USE_IEC_60559_BFP_EXT_C23 0 +#endif +#undef __GLIBC_USE_IEC_60559_EXT +#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__ +# define __GLIBC_USE_IEC_60559_EXT 1 +#else +# define __GLIBC_USE_IEC_60559_EXT 0 +#endif + +/* ISO/IEC TS 18661-4:2015 defines the + __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction + functions, the symbols from this TS are enabled unconditionally in + C23. */ +#undef __GLIBC_USE_IEC_60559_FUNCS_EXT +#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_FUNCS_EXT__ +# define __GLIBC_USE_IEC_60559_FUNCS_EXT 1 +#else +# define __GLIBC_USE_IEC_60559_FUNCS_EXT 0 +#endif +#undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 +#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC23) +# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 1 +#else +# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C23 0 +#endif + +/* ISO/IEC TS 18661-3:2015 defines the + __STDC_WANT_IEC_60559_TYPES_EXT__ macro. */ +#undef __GLIBC_USE_IEC_60559_TYPES_EXT +#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_TYPES_EXT__ +# define __GLIBC_USE_IEC_60559_TYPES_EXT 1 +#else +# define __GLIBC_USE_IEC_60559_TYPES_EXT 0 +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@libc-header-start.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@libc-header-start.h.blob new file mode 100644 index 0000000..edcf086 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@libc-header-start.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@locale.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@locale.h new file mode 100644 index 0000000..b75b71a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@locale.h @@ -0,0 +1,40 @@ +/* Definition of locale category symbol values. + Copyright (C) 2001-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#if !defined _LOCALE_H && !defined _LANGINFO_H +# error "Never use directly; include instead." +#endif + +#ifndef _BITS_LOCALE_H +#define _BITS_LOCALE_H 1 + +#define __LC_CTYPE 0 +#define __LC_NUMERIC 1 +#define __LC_TIME 2 +#define __LC_COLLATE 3 +#define __LC_MONETARY 4 +#define __LC_MESSAGES 5 +#define __LC_ALL 6 +#define __LC_PAPER 7 +#define __LC_NAME 8 +#define __LC_ADDRESS 9 +#define __LC_TELEPHONE 10 +#define __LC_MEASUREMENT 11 +#define __LC_IDENTIFICATION 12 + +#endif /* bits/locale.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@locale.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@locale.h.blob new file mode 100644 index 0000000..b0ac43e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@locale.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@long-double.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@long-double.h new file mode 100644 index 0000000..5833ecc --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@long-double.h @@ -0,0 +1,21 @@ +/* Properties of long double type. ldbl-96 version. + Copyright (C) 2016-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* long double is distinct from double, so there is nothing to + define here. */ +#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0 diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@long-double.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@long-double.h.blob new file mode 100644 index 0000000..df5e88e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@long-double.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthread_stack_min-dynamic.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthread_stack_min-dynamic.h new file mode 100644 index 0000000..af35640 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthread_stack_min-dynamic.h @@ -0,0 +1,31 @@ +/* Definition of PTHREAD_STACK_MIN, possibly dynamic. + Copyright (C) 2021-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef PTHREAD_STACK_MIN +# if defined __USE_DYNAMIC_STACK_SIZE && __USE_DYNAMIC_STACK_SIZE +# ifndef __ASSEMBLER__ +# define __SC_THREAD_STACK_MIN_VALUE 75 +__BEGIN_DECLS +extern long int __sysconf (int __name) __THROW; +__END_DECLS +# define PTHREAD_STACK_MIN __sysconf (__SC_THREAD_STACK_MIN_VALUE) +# endif +# else +# include +# endif +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthread_stack_min-dynamic.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthread_stack_min-dynamic.h.blob new file mode 100644 index 0000000..17b7e39 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthread_stack_min-dynamic.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes-arch.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes-arch.h new file mode 100644 index 0000000..403ad38 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes-arch.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2002-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_PTHREADTYPES_ARCH_H +#define _BITS_PTHREADTYPES_ARCH_H 1 + +#include + +#ifdef __x86_64__ +# if __WORDSIZE == 64 +# define __SIZEOF_PTHREAD_MUTEX_T 40 +# define __SIZEOF_PTHREAD_ATTR_T 56 +# define __SIZEOF_PTHREAD_RWLOCK_T 56 +# define __SIZEOF_PTHREAD_BARRIER_T 32 +# else +# define __SIZEOF_PTHREAD_MUTEX_T 32 +# define __SIZEOF_PTHREAD_ATTR_T 32 +# define __SIZEOF_PTHREAD_RWLOCK_T 44 +# define __SIZEOF_PTHREAD_BARRIER_T 20 +# endif +#else +# define __SIZEOF_PTHREAD_MUTEX_T 24 +# define __SIZEOF_PTHREAD_ATTR_T 36 +# define __SIZEOF_PTHREAD_RWLOCK_T 32 +# define __SIZEOF_PTHREAD_BARRIER_T 20 +#endif +#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +#define __SIZEOF_PTHREAD_COND_T 48 +#define __SIZEOF_PTHREAD_CONDATTR_T 4 +#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 + +#define __LOCK_ALIGNMENT +#define __ONCE_ALIGNMENT + +#ifndef __x86_64__ +/* Extra attributes for the cleanup functions. */ +# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1))) +#endif + +#endif /* bits/pthreadtypes.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes-arch.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes-arch.h.blob new file mode 100644 index 0000000..e698a76 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes-arch.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes.h new file mode 100644 index 0000000..6f4c5c4 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes.h @@ -0,0 +1,121 @@ +/* Declaration of common pthread types for all architectures. + Copyright (C) 2017-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_PTHREADTYPES_COMMON_H +# define _BITS_PTHREADTYPES_COMMON_H 1 + +/* For internal mutex and condition variable definitions. */ +#include + +/* Thread identifiers. The structure of the attribute type is not + exposed on purpose. */ +typedef unsigned long int pthread_t; + + +/* Data structures for mutex handling. The structure of the attribute + type is not exposed on purpose. */ +typedef union +{ + char __size[__SIZEOF_PTHREAD_MUTEXATTR_T]; + int __align; +} pthread_mutexattr_t; + + +/* Data structure for condition variable handling. The structure of + the attribute type is not exposed on purpose. */ +typedef union +{ + char __size[__SIZEOF_PTHREAD_CONDATTR_T]; + int __align; +} pthread_condattr_t; + + +/* Keys for thread-specific data */ +typedef unsigned int pthread_key_t; + + +/* Once-only execution */ +typedef int __ONCE_ALIGNMENT pthread_once_t; + + +union pthread_attr_t +{ + char __size[__SIZEOF_PTHREAD_ATTR_T]; + long int __align; +}; +#ifndef __have_pthread_attr_t +typedef union pthread_attr_t pthread_attr_t; +# define __have_pthread_attr_t 1 +#endif + + +typedef union +{ + struct __pthread_mutex_s __data; + char __size[__SIZEOF_PTHREAD_MUTEX_T]; + long int __align; +} pthread_mutex_t; + + +typedef union +{ + struct __pthread_cond_s __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +} pthread_cond_t; + + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +/* Data structure for reader-writer lock variable handling. The + structure of the attribute type is deliberately not exposed. */ +typedef union +{ + struct __pthread_rwlock_arch_t __data; + char __size[__SIZEOF_PTHREAD_RWLOCK_T]; + long int __align; +} pthread_rwlock_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T]; + long int __align; +} pthread_rwlockattr_t; +#endif + + +#ifdef __USE_XOPEN2K +/* POSIX spinlock data type. */ +typedef volatile int pthread_spinlock_t; + + +/* POSIX barriers data type. The structure of the type is + deliberately not exposed. */ +typedef union +{ + char __size[__SIZEOF_PTHREAD_BARRIER_T]; + long int __align; +} pthread_barrier_t; + +typedef union +{ + char __size[__SIZEOF_PTHREAD_BARRIERATTR_T]; + int __align; +} pthread_barrierattr_t; +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes.h.blob new file mode 100644 index 0000000..31ca900 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@pthreadtypes.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@sched.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@sched.h new file mode 100644 index 0000000..efbb464 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@sched.h @@ -0,0 +1,161 @@ +/* Definitions of constants and data structure for POSIX 1003.1b-1993 + scheduling interface. + Copyright (C) 1996-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_SCHED_H +#define _BITS_SCHED_H 1 + +#ifndef _SCHED_H +# error "Never include directly; use instead." +#endif + +/* Scheduling algorithms. */ +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 +#ifdef __USE_GNU +# define SCHED_NORMAL 0 +# define SCHED_BATCH 3 +# define SCHED_ISO 4 +# define SCHED_IDLE 5 +# define SCHED_DEADLINE 6 +# define SCHED_EXT 7 + +/* Flags that can be used in policy values. */ +# define SCHED_RESET_ON_FORK 0x40000000 + +/* Flags for the sched_flags field in struct sched_attr. */ +#define SCHED_FLAG_RESET_ON_FORK 0x01 +#define SCHED_FLAG_RECLAIM 0x02 +#define SCHED_FLAG_DL_OVERRUN 0x04 +#define SCHED_FLAG_KEEP_POLICY 0x08 +#define SCHED_FLAG_KEEP_PARAMS 0x10 +#define SCHED_FLAG_UTIL_CLAMP_MIN 0x20 +#define SCHED_FLAG_UTIL_CLAMP_MAX 0x40 + +/* Combinations of sched_flags fields. */ +#define SCHED_FLAG_KEEP_ALL \ + (SCHED_FLAG_KEEP_POLICY | SCHED_FLAG_KEEP_PARAMS) +#define SCHED_FLAG_UTIL_CLAMP \ + (SCHED_FLAG_UTIL_CLAMP_MIN | SCHED_FLAG_UTIL_CLAMP_MAX) + +/* Use "" to work around incorrect macro expansion of the + __has_include argument (GCC PR 80005). */ +# ifdef __has_include +# if __has_include ("linux/sched/types.h") +/* Some older Linux versions defined sched_param in . */ +# define sched_param __glibc_mask_sched_param +# include +# undef sched_param +# endif +# endif +# ifndef SCHED_ATTR_SIZE_VER0 +# include +# define SCHED_ATTR_SIZE_VER0 48 +# define SCHED_ATTR_SIZE_VER1 56 +struct sched_attr +{ + __u32 size; + __u32 sched_policy; + __u64 sched_flags; + __s32 sched_nice; + __u32 sched_priority; + __u64 sched_runtime; + __u64 sched_deadline; + __u64 sched_period; + __u32 sched_util_min; + __u32 sched_util_max; + /* Additional fields may be added at the end. */ +}; +# endif /* !SCHED_ATTR_SIZE_VER0 */ + +/* Cloning flags. */ +# define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */ +# define CLONE_VM 0x00000100 /* Set if VM shared between processes. */ +# define CLONE_FS 0x00000200 /* Set if fs info shared between processes. */ +# define CLONE_FILES 0x00000400 /* Set if open files shared between processes. */ +# define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */ +# define CLONE_PIDFD 0x00001000 /* Set if a pidfd should be placed + in parent. */ +# define CLONE_PTRACE 0x00002000 /* Set if tracing continues on the child. */ +# define CLONE_VFORK 0x00004000 /* Set if the parent wants the child to + wake it up on mm_release. */ +# define CLONE_PARENT 0x00008000 /* Set if we want to have the same + parent as the cloner. */ +# define CLONE_THREAD 0x00010000 /* Set to add to same thread group. */ +# define CLONE_NEWNS 0x00020000 /* Set to create new namespace. */ +# define CLONE_SYSVSEM 0x00040000 /* Set to shared SVID SEM_UNDO semantics. */ +# define CLONE_SETTLS 0x00080000 /* Set TLS info. */ +# define CLONE_PARENT_SETTID 0x00100000 /* Store TID in userlevel buffer + before MM copy. */ +# define CLONE_CHILD_CLEARTID 0x00200000 /* Register exit futex and memory + location to clear. */ +# define CLONE_DETACHED 0x00400000 /* Create clone detached. */ +# define CLONE_UNTRACED 0x00800000 /* Set if the tracing process can't + force CLONE_PTRACE on this clone. */ +# define CLONE_CHILD_SETTID 0x01000000 /* Store TID in userlevel buffer in + the child. */ +# define CLONE_NEWCGROUP 0x02000000 /* New cgroup namespace. */ +# define CLONE_NEWUTS 0x04000000 /* New utsname group. */ +# define CLONE_NEWIPC 0x08000000 /* New ipcs. */ +# define CLONE_NEWUSER 0x10000000 /* New user namespace. */ +# define CLONE_NEWPID 0x20000000 /* New pid namespace. */ +# define CLONE_NEWNET 0x40000000 /* New network namespace. */ +# define CLONE_IO 0x80000000 /* Clone I/O context. */ + +/* cloning flags intersect with CSIGNAL so can be used only with unshare and + clone3 syscalls. */ +#define CLONE_NEWTIME 0x00000080 /* New time namespace */ +#endif + +#include + +__BEGIN_DECLS + +#ifdef __USE_GNU +/* Clone current process. */ +extern int clone (int (*__fn) (void *__arg), void *__child_stack, + int __flags, void *__arg, ...) __THROW; + +/* Unshare the specified resources. */ +extern int unshare (int __flags) __THROW; + +/* Get index of currently used CPU. */ +extern int sched_getcpu (void) __THROW; + +/* Get currently used CPU and NUMA node. */ +extern int getcpu (unsigned int *, unsigned int *) __THROW; + +/* Switch process to namespace of type NSTYPE indicated by FD. */ +extern int setns (int __fd, int __nstype) __THROW; + +/* Apply the scheduling attributes from *ATTR to the process or thread TID. */ +int sched_setattr (pid_t tid, struct sched_attr *attr, unsigned int flags) + __THROW __nonnull ((2)); + +/* Obtain the scheduling attributes of the process or thread TID and + store it in *ATTR. */ +int sched_getattr (pid_t tid, struct sched_attr *attr, unsigned int size, + unsigned int flags) + __THROW __nonnull ((2)); + +#endif + +__END_DECLS + +#endif /* bits/sched.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@sched.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@sched.h.blob new file mode 100644 index 0000000..6f3cac1 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@sched.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@select.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@select.h new file mode 100644 index 0000000..5edc32d --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@select.h @@ -0,0 +1,37 @@ +/* Copyright (C) 1997-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_SELECT_H +# error "Never use directly; include instead." +#endif + + +/* We don't use `memset' because this would require a prototype and + the array isn't too big. */ +#define __FD_ZERO(s) \ + do { \ + unsigned int __i; \ + fd_set *__arr = (s); \ + for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ + __FDS_BITS (__arr)[__i] = 0; \ + } while (0) +#define __FD_SET(d, s) \ + ((void) (__FDS_BITS (s)[__FD_ELT(d)] |= __FD_MASK(d))) +#define __FD_CLR(d, s) \ + ((void) (__FDS_BITS (s)[__FD_ELT(d)] &= ~__FD_MASK(d))) +#define __FD_ISSET(d, s) \ + ((__FDS_BITS (s)[__FD_ELT (d)] & __FD_MASK (d)) != 0) diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@select.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@select.h.blob new file mode 100644 index 0000000..f838ca6 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@select.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@setjmp.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@setjmp.h new file mode 100644 index 0000000..b6455e7 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@setjmp.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2001-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Define the machine-dependent type `jmp_buf'. x86-64 version. */ +#ifndef _BITS_SETJMP_H +#define _BITS_SETJMP_H 1 + +#if !defined _SETJMP_H && !defined _PTHREAD_H +# error "Never include directly; use instead." +#endif + +#include + +#ifndef _ASM + +# if __WORDSIZE == 64 +typedef long int __jmp_buf[8]; +# elif defined __x86_64__ +__extension__ typedef long long int __jmp_buf[8]; +# else +typedef int __jmp_buf[6]; +# endif + +#endif + +#endif /* bits/setjmp.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@setjmp.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@setjmp.h.blob new file mode 100644 index 0000000..c0b4280 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@setjmp.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-intn.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-intn.h new file mode 100644 index 0000000..cbe07df --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-intn.h @@ -0,0 +1,29 @@ +/* Define intN_t types. + Copyright (C) 2017-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_STDINT_INTN_H +#define _BITS_STDINT_INTN_H 1 + +#include + +typedef __int8_t int8_t; +typedef __int16_t int16_t; +typedef __int32_t int32_t; +typedef __int64_t int64_t; + +#endif /* bits/stdint-intn.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-intn.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-intn.h.blob new file mode 100644 index 0000000..2788067 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-intn.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-least.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-least.h new file mode 100644 index 0000000..a2b0737 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-least.h @@ -0,0 +1,36 @@ +/* Define int_leastN_t and uint_leastN types. + Copyright (C) 2024-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_STDINT_LEAST_H +#define _BITS_STDINT_LEAST_H 1 + +#include + +/* Signed. */ +typedef __int_least8_t int_least8_t; +typedef __int_least16_t int_least16_t; +typedef __int_least32_t int_least32_t; +typedef __int_least64_t int_least64_t; + +/* Unsigned. */ +typedef __uint_least8_t uint_least8_t; +typedef __uint_least16_t uint_least16_t; +typedef __uint_least32_t uint_least32_t; +typedef __uint_least64_t uint_least64_t; + +#endif /* bits/stdint-least.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-least.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-least.h.blob new file mode 100644 index 0000000..fe38d00 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-least.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-uintn.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-uintn.h new file mode 100644 index 0000000..7ffc363 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-uintn.h @@ -0,0 +1,29 @@ +/* Define uintN_t types. + Copyright (C) 2017-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_STDINT_UINTN_H +#define _BITS_STDINT_UINTN_H 1 + +#include + +typedef __uint8_t uint8_t; +typedef __uint16_t uint16_t; +typedef __uint32_t uint32_t; +typedef __uint64_t uint64_t; + +#endif /* bits/stdint-uintn.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-uintn.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-uintn.h.blob new file mode 100644 index 0000000..66cba55 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdint-uintn.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdio_lim.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdio_lim.h new file mode 100644 index 0000000..b2a8268 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdio_lim.h @@ -0,0 +1,28 @@ +/* System specific stdio.h definitions. Linux version. + Copyright (C) 2023-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_STDIO_LIM_H +#define _BITS_STDIO_LIM_H 1 + +#ifndef _STDIO_H +# error "Never include directly; use instead." +#endif + +#define FILENAME_MAX 4096 + +#endif /* bits/stdio_lim.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdio_lim.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdio_lim.h.blob new file mode 100644 index 0000000..551191d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdio_lim.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdlib-float.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdlib-float.h new file mode 100644 index 0000000..d752214 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdlib-float.h @@ -0,0 +1,29 @@ +/* Floating-point inline functions for stdlib.h. + Copyright (C) 2012-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _STDLIB_H +# error "Never use directly; include instead." +#endif + +#ifdef __USE_EXTERN_INLINES +__extern_inline double +__NTH (atof (const char *__nptr)) +{ + return strtod (__nptr, (char **) NULL); +} +#endif /* Optimizing and Inlining. */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdlib-float.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdlib-float.h.blob new file mode 100644 index 0000000..8dc4f7e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@stdlib-float.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_mutex.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_mutex.h new file mode 100644 index 0000000..9c19dff --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_mutex.h @@ -0,0 +1,62 @@ +/* x86 internal mutex struct definitions. + Copyright (C) 2019-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _THREAD_MUTEX_INTERNAL_H +#define _THREAD_MUTEX_INTERNAL_H 1 + +struct __pthread_mutex_s +{ + int __lock; + unsigned int __count; + int __owner; +#ifdef __x86_64__ + unsigned int __nusers; +#endif + /* KIND must stay at this position in the structure to maintain + binary compatibility with static initializers. */ + int __kind; +#ifdef __x86_64__ + short __spins; + short __unused; + __pthread_list_t __list; +# define __PTHREAD_MUTEX_HAVE_PREV 1 +#else + unsigned int __nusers; + __extension__ union + { + struct + { + short __data_spins; + short __data_unused; +# define __spins __data.__data_spins + } __data; + __pthread_slist_t __list; + }; +# define __PTHREAD_MUTEX_HAVE_PREV 0 +#endif +}; + +#ifdef __x86_64__ +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, 0, __kind, 0, 0, { NULL, NULL } +#else +# define __PTHREAD_MUTEX_INITIALIZER(__kind) \ + 0, 0, 0, __kind, 0, { { 0, 0 } } +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_mutex.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_mutex.h.blob new file mode 100644 index 0000000..9fecda1 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_mutex.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_rwlock.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_rwlock.h new file mode 100644 index 0000000..7f75784 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_rwlock.h @@ -0,0 +1,58 @@ +/* x86 internal rwlock struct definitions. + Copyright (C) 2019-2026 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _RWLOCK_INTERNAL_H +#define _RWLOCK_INTERNAL_H + +struct __pthread_rwlock_arch_t +{ + unsigned int __readers; + unsigned int __writers; + unsigned int __wrphase_futex; + unsigned int __writers_futex; + unsigned int __pad3; + unsigned int __pad4; +#ifdef __x86_64__ + int __cur_writer; + int __shared; + unsigned long int __pad1; + unsigned long int __pad2; + /* FLAGS must stay at this position in the structure to maintain + binary compatibility. */ + unsigned int __flags; +#else /* __x86_64__ */ + /* FLAGS must stay at this position in the structure to maintain + binary compatibility. */ + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; + int __cur_writer; +#endif +}; + +#ifdef __x86_64__ +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags +#else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_rwlock.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_rwlock.h.blob new file mode 100644 index 0000000..d20a581 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@struct_rwlock.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@thread-shared-types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@thread-shared-types.h new file mode 100644 index 0000000..624d616 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@thread-shared-types.h @@ -0,0 +1,116 @@ +/* Common threading primitives definitions for both POSIX and C11. + Copyright (C) 2017-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _THREAD_SHARED_TYPES_H +#define _THREAD_SHARED_TYPES_H 1 + +/* Arch-specific definitions. Each architecture must define the following + macros to define the expected sizes of pthread data types: + + __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t. + __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t. + __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t. + __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t. + __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t. + __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t. + __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t. + __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t. + __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t. + + The additional macro defines any constraint for the lock alignment + inside the thread structures: + + __LOCK_ALIGNMENT - for internal lock/futex usage. + + Same idea but for the once locking primitive: + + __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. */ + +#include + +#include + + +/* Common definition of pthread_mutex_t. */ + +typedef struct __pthread_internal_list +{ + struct __pthread_internal_list *__prev; + struct __pthread_internal_list *__next; +} __pthread_list_t; + +typedef struct __pthread_internal_slist +{ + struct __pthread_internal_slist *__next; +} __pthread_slist_t; + +/* Arch-specific mutex definitions. A generic implementation is provided + by sysdeps/nptl/bits/struct_mutex.h. If required, an architecture + can override it by defining: + + 1. struct __pthread_mutex_s (used on both pthread_mutex_t and mtx_t + definition). It should contains at least the internal members + defined in the generic version. + + 2. __LOCK_ALIGNMENT for any extra attribute for internal lock used with + atomic operations. + + 3. The macro __PTHREAD_MUTEX_INITIALIZER used for static initialization. + It should initialize the mutex internal flag. */ + +#include + +/* Arch-specific read-write lock definitions. A generic implementation is + provided by struct_rwlock.h. If required, an architecture can override it + by defining: + + 1. struct __pthread_rwlock_arch_t (used on pthread_rwlock_t definition). + It should contain at least the internal members defined in the + generic version. + + 2. The macro __PTHREAD_RWLOCK_INITIALIZER used for static initialization. + It should initialize the rwlock internal type. */ + +#include + + +/* Common definition of pthread_cond_t. */ + +struct __pthread_cond_s +{ + __atomic_wide_counter __wseq; + __atomic_wide_counter __g1_start; + unsigned int __g_size[2] __LOCK_ALIGNMENT; + unsigned int __g1_orig_size; + unsigned int __wrefs; + unsigned int __g_signals[2]; + unsigned int __unused_initialized_1; + unsigned int __unused_initialized_2; +}; + +typedef unsigned int __tss_t; +typedef unsigned long int __thrd_t; + +typedef struct +{ + int __data __ONCE_ALIGNMENT; +} __once_flag; + +#define __ONCE_FLAG_INIT { 0 } + +#endif /* _THREAD_SHARED_TYPES_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@thread-shared-types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@thread-shared-types.h.blob new file mode 100644 index 0000000..3e82c1b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@thread-shared-types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time.h new file mode 100644 index 0000000..e95066a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time.h @@ -0,0 +1,93 @@ +/* System-dependent timing definitions. Linux version. + Copyright (C) 1996-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * Never include this file directly; use instead. + */ + +#ifndef _BITS_TIME_H +#define _BITS_TIME_H 1 + +#include + +/* ISO/IEC 9899:1999 7.23.1: Components of time + The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is + the number per second of the value returned by the `clock' function. */ +/* CAE XSH, Issue 4, Version 2: + The value of CLOCKS_PER_SEC is required to be 1 million on all + XSI-conformant systems. */ +#define CLOCKS_PER_SEC ((__clock_t) 1000000) + +#if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \ + && !defined __USE_XOPEN2K +/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK + presents the real value for clock ticks per second for the system. */ +extern long int __sysconf (int); +# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ +#endif + +#ifdef __USE_POSIX199309 +/* Identifier for system-wide realtime clock. */ +# define CLOCK_REALTIME 0 +/* Monotonic system-wide clock. */ +# define CLOCK_MONOTONIC 1 +/* High-resolution timer from the CPU. */ +# define CLOCK_PROCESS_CPUTIME_ID 2 +/* Thread-specific CPU-time clock. */ +# define CLOCK_THREAD_CPUTIME_ID 3 +/* Monotonic system-wide clock, not adjusted for frequency scaling. */ +# define CLOCK_MONOTONIC_RAW 4 +/* Identifier for system-wide realtime clock, updated only on ticks. */ +# define CLOCK_REALTIME_COARSE 5 +/* Monotonic system-wide clock, updated only on ticks. */ +# define CLOCK_MONOTONIC_COARSE 6 +/* Monotonic system-wide clock that includes time spent in suspension. */ +# define CLOCK_BOOTTIME 7 +/* Like CLOCK_REALTIME but also wakes suspended system. */ +# define CLOCK_REALTIME_ALARM 8 +/* Like CLOCK_BOOTTIME but also wakes suspended system. */ +# define CLOCK_BOOTTIME_ALARM 9 +/* Like CLOCK_REALTIME but in International Atomic Time. */ +# define CLOCK_TAI 11 + +/* Flag to indicate time is absolute. */ +# define TIMER_ABSTIME 1 +#endif + +#ifdef __USE_GNU +# include + +__BEGIN_DECLS + +/* Tune a POSIX clock. */ +extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW __nonnull((2)); + +#ifdef __USE_TIME64_REDIRECTS +# if defined(__REDIRECT_NTH) +extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id, + struct timex *__utx), + __clock_adjtime64) __nonnull((2)); +# else +# define clock_adjtime __clock_adjtime64 +# endif +#endif + +__END_DECLS +#endif /* use GNU */ + +#endif /* bits/time.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time.h.blob new file mode 100644 index 0000000..7475876 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time64.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time64.h new file mode 100644 index 0000000..3fd9941 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time64.h @@ -0,0 +1,36 @@ +/* bits/time64.h -- underlying types for __time64_t. Generic version. + Copyright (C) 2018-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TIME64_H +#define _BITS_TIME64_H 1 + +/* Define __TIME64_T_TYPE so that it is always a 64-bit type. */ + +#if __TIMESIZE == 64 +/* If we already have 64-bit time type then use it. */ +# define __TIME64_T_TYPE __TIME_T_TYPE +#else +/* Define a 64-bit time type alongsize the 32-bit one. */ +# define __TIME64_T_TYPE __SQUAD_TYPE +#endif + +#endif /* bits/time64.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time64.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time64.h.blob new file mode 100644 index 0000000..aa73768 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@time64.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timesize.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timesize.h new file mode 100644 index 0000000..be0dfea --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timesize.h @@ -0,0 +1,27 @@ +/* Bit size of the time_t type at glibc build time, x86-64 and x32 case. + Copyright (C) 2018-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#if defined __x86_64__ && defined __ILP32__ +/* For x32, time is 64-bit even though word size is 32-bit. */ +# define __TIMESIZE 64 +#else +/* For others, time size is word size. */ +# define __TIMESIZE __WORDSIZE +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timesize.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timesize.h.blob new file mode 100644 index 0000000..a5e858d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timesize.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timex.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timex.h new file mode 100644 index 0000000..f32cf2b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timex.h @@ -0,0 +1,141 @@ +/* Copyright (C) 1995-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_TIMEX_H +#define _BITS_TIMEX_H 1 + +#include +#include + +/* These definitions from linux/timex.h as of 3.18. */ + +struct timex +{ +# if defined __USE_TIME64_REDIRECTS || (__TIMESIZE == 64 && __WORDSIZE == 32) + unsigned int modes; /* mode selector */ + int :32; /* pad */ + long long offset; /* time offset (usec) */ + long long freq; /* frequency offset (scaled ppm) */ + long long maxerror; /* maximum error (usec) */ + long long esterror; /* estimated error (usec) */ + int status; /* clock command/status */ + int :32; /* pad */ + long long constant; /* pll time constant */ + long long precision; /* clock precision (usec) (read only) */ + long long tolerance; /* clock frequency tolerance (ppm) (ro) */ + struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ + long long tick; /* (modified) usecs between clock ticks */ + long long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + int :32; /* pad */ + long long stabil; /* pps stability (scaled ppm) (ro) */ + long long jitcnt; /* jitter limit exceeded (ro) */ + long long calcnt; /* calibration intervals (ro) */ + long long errcnt; /* calibration errors (ro) */ + long long stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; +# else + unsigned int modes; /* mode selector */ + __syscall_slong_t offset; /* time offset (usec) */ + __syscall_slong_t freq; /* frequency offset (scaled ppm) */ + __syscall_slong_t maxerror; /* maximum error (usec) */ + __syscall_slong_t esterror; /* estimated error (usec) */ + int status; /* clock command/status */ + __syscall_slong_t constant; /* pll time constant */ + __syscall_slong_t precision; /* clock precision (usec) (ro) */ + __syscall_slong_t tolerance; /* clock frequency tolerance (ppm) (ro) */ + struct timeval time; /* (read only, except for ADJ_SETOFFSET) */ + __syscall_slong_t tick; /* (modified) usecs between clock ticks */ + __syscall_slong_t ppsfreq; /* pps frequency (scaled ppm) (ro) */ + __syscall_slong_t jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + __syscall_slong_t stabil; /* pps stability (scaled ppm) (ro) */ + __syscall_slong_t jitcnt; /* jitter limit exceeded (ro) */ + __syscall_slong_t calcnt; /* calibration intervals (ro) */ + __syscall_slong_t errcnt; /* calibration errors (ro) */ + __syscall_slong_t stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + /* ??? */ + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; int :32; + int :32; int :32; int :32; +# endif +}; + +/* Mode codes (timex.mode) */ +#define ADJ_OFFSET 0x0001 /* time offset */ +#define ADJ_FREQUENCY 0x0002 /* frequency offset */ +#define ADJ_MAXERROR 0x0004 /* maximum time error */ +#define ADJ_ESTERROR 0x0008 /* estimated time error */ +#define ADJ_STATUS 0x0010 /* clock status */ +#define ADJ_TIMECONST 0x0020 /* pll time constant */ +#define ADJ_TAI 0x0080 /* set TAI offset */ +#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */ +#define ADJ_MICRO 0x1000 /* select microsecond resolution */ +#define ADJ_NANO 0x2000 /* select nanosecond resolution */ +#define ADJ_TICK 0x4000 /* tick value */ +#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ +#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */ + +/* xntp 3.4 compatibility names */ +#define MOD_OFFSET ADJ_OFFSET +#define MOD_FREQUENCY ADJ_FREQUENCY +#define MOD_MAXERROR ADJ_MAXERROR +#define MOD_ESTERROR ADJ_ESTERROR +#define MOD_STATUS ADJ_STATUS +#define MOD_TIMECONST ADJ_TIMECONST +#define MOD_CLKB ADJ_TICK +#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */ +#define MOD_TAI ADJ_TAI +#define MOD_MICRO ADJ_MICRO +#define MOD_NANO ADJ_NANO + + +/* Status codes (timex.status) */ +#define STA_PLL 0x0001 /* enable PLL updates (rw) */ +#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ +#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ +#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ + +#define STA_INS 0x0010 /* insert leap (rw) */ +#define STA_DEL 0x0020 /* delete leap (rw) */ +#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ +#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ + +#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ +#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ +#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ +#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ + +#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ +#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */ +#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */ +#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */ + +/* Read-only bits */ +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER \ + | STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK) + +#endif /* bits/timex.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timex.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timex.h.blob new file mode 100644 index 0000000..e8febc5 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@timex.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types.h new file mode 100644 index 0000000..33b582a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types.h @@ -0,0 +1,228 @@ +/* bits/types.h -- definitions of __*_t types underlying *_t types. + Copyright (C) 2002-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * Never include this file directly; use instead. + */ + +#ifndef _BITS_TYPES_H +#define _BITS_TYPES_H 1 + +#include +#include +#include + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short int __u_short; +typedef unsigned int __u_int; +typedef unsigned long int __u_long; + +/* Fixed-size types, underlying types depend on word size and compiler. */ +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +#if __WORDSIZE == 64 +typedef signed long int __int64_t; +typedef unsigned long int __uint64_t; +#else +__extension__ typedef signed long long int __int64_t; +__extension__ typedef unsigned long long int __uint64_t; +#endif + +/* Smallest types with at least a given width. */ +typedef __int8_t __int_least8_t; +typedef __uint8_t __uint_least8_t; +typedef __int16_t __int_least16_t; +typedef __uint16_t __uint_least16_t; +typedef __int32_t __int_least32_t; +typedef __uint32_t __uint_least32_t; +typedef __int64_t __int_least64_t; +typedef __uint64_t __uint_least64_t; + +/* quad_t is also 64 bits. */ +#if __WORDSIZE == 64 +typedef long int __quad_t; +typedef unsigned long int __u_quad_t; +#else +__extension__ typedef long long int __quad_t; +__extension__ typedef unsigned long long int __u_quad_t; +#endif + +/* Largest integral types. */ +#if __WORDSIZE == 64 +typedef long int __intmax_t; +typedef unsigned long int __uintmax_t; +#else +__extension__ typedef long long int __intmax_t; +__extension__ typedef unsigned long long int __uintmax_t; +#endif + + +/* The machine-dependent file defines __*_T_TYPE + macros for each of the OS types we define below. The definitions + of those macros must use the following macros for underlying types. + We define __S_TYPE and __U_TYPE for the signed and unsigned + variants of each of the following integer types on this machine. + + 16 -- "natural" 16-bit type (always short) + 32 -- "natural" 32-bit type (always int) + 64 -- "natural" 64-bit type (long or long long) + LONG32 -- 32-bit type, traditionally long + QUAD -- 64-bit type, traditionally long long + WORD -- natural type of __WORDSIZE bits (int or long) + LONGWORD -- type of __WORDSIZE bits, traditionally long + + We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the + conventional uses of `long' or `long long' type modifiers match the + types we define, even when a less-adorned type would be the same size. + This matters for (somewhat) portably writing printf/scanf formats for + these types, where using the appropriate l or ll format modifiers can + make the typedefs and the formats match up across all GNU platforms. If + we used `long' when it's 64 bits where `long long' is expected, then the + compiler would warn about the formats not matching the argument types, + and the programmer changing them to shut up the compiler would break the + program's portability. + + Here we assume what is presently the case in all the GCC configurations + we support: long long is always 64 bits, long is always word/address size, + and int is always 32 bits. */ + +#define __S16_TYPE short int +#define __U16_TYPE unsigned short int +#define __S32_TYPE int +#define __U32_TYPE unsigned int +#define __SLONGWORD_TYPE long int +#define __ULONGWORD_TYPE unsigned long int +#if __WORDSIZE == 32 +# define __SQUAD_TYPE __int64_t +# define __UQUAD_TYPE __uint64_t +# define __SWORD_TYPE int +# define __UWORD_TYPE unsigned int +# define __SLONG32_TYPE long int +# define __ULONG32_TYPE unsigned long int +# define __S64_TYPE __int64_t +# define __U64_TYPE __uint64_t +/* We want __extension__ before typedef's that use nonstandard base types + such as `long long' in C89 mode. */ +# define __STD_TYPE __extension__ typedef +#elif __WORDSIZE == 64 +# define __SQUAD_TYPE long int +# define __UQUAD_TYPE unsigned long int +# define __SWORD_TYPE long int +# define __UWORD_TYPE unsigned long int +# define __SLONG32_TYPE int +# define __ULONG32_TYPE unsigned int +# define __S64_TYPE long int +# define __U64_TYPE unsigned long int +/* No need to mark the typedef with __extension__. */ +# define __STD_TYPE typedef +#else +# error +#endif +#include /* Defines __*_T_TYPE macros. */ +#include /* Defines __TIME*_T_TYPE macros. */ + + +__STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */ +__STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */ +__STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */ +__STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */ +__STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/ +__STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */ +__STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */ +__STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */ +__STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */ +__STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */ +__STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */ +__STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */ +__STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */ +__STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */ +__STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ +__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ +__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ +__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ +__STD_TYPE __SUSECONDS64_T_TYPE __suseconds64_t; + +__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */ +__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ + +/* Clock ID used in clock and timer functions. */ +__STD_TYPE __CLOCKID_T_TYPE __clockid_t; + +/* Timer ID returned by `timer_create'. */ +__STD_TYPE __TIMER_T_TYPE __timer_t; + +/* Type to represent block size. */ +__STD_TYPE __BLKSIZE_T_TYPE __blksize_t; + +/* Types from the Large File Support interface. */ + +/* Type to count number of disk blocks. */ +__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t; +__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t; + +/* Type to count file system blocks. */ +__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t; +__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t; + +/* Type to count file system nodes. */ +__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t; +__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t; + +/* Type of miscellaneous file system fields. */ +__STD_TYPE __FSWORD_T_TYPE __fsword_t; + +__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */ + +/* Signed long type used in system calls. */ +__STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t; +/* Unsigned long type used in system calls. */ +__STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t; + +/* These few don't really vary by system, they always correspond + to one of the other defined types. */ +typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */ +typedef char *__caddr_t; + +/* Duplicates info from stdint.h but this is used in unistd.h. */ +__STD_TYPE __SWORD_TYPE __intptr_t; + +/* Duplicate info from sys/socket.h. */ +__STD_TYPE __U32_TYPE __socklen_t; + +/* C99: An integer type that can be accessed as an atomic entity, + even in the presence of asynchronous interrupts. + It is not currently necessary for this to be machine-specific. */ +typedef int __sig_atomic_t; + +/* Seconds since the Epoch, visible to user code when time_t is too + narrow only for consistency with the old way of widening too-narrow + types. User code should never use __time64_t. */ +#if __TIMESIZE == 64 && defined __LIBC +# define __time64_t __time_t +#elif __TIMESIZE != 64 +__STD_TYPE __TIME64_T_TYPE __time64_t; +#endif + +#undef __STD_TYPE + +#endif /* bits/types.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types.h.blob new file mode 100644 index 0000000..14ec554 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@FILE.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@FILE.h new file mode 100644 index 0000000..f268263 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@FILE.h @@ -0,0 +1,9 @@ +#ifndef __FILE_defined +#define __FILE_defined 1 + +struct _IO_FILE; + +/* The opaque type of streams. This is the definition used elsewhere. */ +typedef struct _IO_FILE FILE; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@FILE.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@FILE.h.blob new file mode 100644 index 0000000..51b239e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@FILE.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__FILE.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__FILE.h new file mode 100644 index 0000000..06dd79b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__FILE.h @@ -0,0 +1,7 @@ +#ifndef ____FILE_defined +#define ____FILE_defined 1 + +struct _IO_FILE; +typedef struct _IO_FILE __FILE; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__FILE.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__FILE.h.blob new file mode 100644 index 0000000..90b17ff Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__FILE.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos64_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos64_t.h new file mode 100644 index 0000000..06a6891 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos64_t.h @@ -0,0 +1,16 @@ +#ifndef _____fpos64_t_defined +#define _____fpos64_t_defined 1 + +#include +#include + +/* The tag name of this struct is _G_fpos64_t to preserve historic + C++ mangled names for functions taking fpos_t and/or fpos64_t + arguments. That name should not be used in new code. */ +typedef struct _G_fpos64_t +{ + __off64_t __pos; + __mbstate_t __state; +} __fpos64_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos64_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos64_t.h.blob new file mode 100644 index 0000000..1c8c52c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos64_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos_t.h new file mode 100644 index 0000000..bb04576 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos_t.h @@ -0,0 +1,16 @@ +#ifndef _____fpos_t_defined +#define _____fpos_t_defined 1 + +#include +#include + +/* The tag name of this struct is _G_fpos_t to preserve historic + C++ mangled names for functions taking fpos_t arguments. + That name should not be used in new code. */ +typedef struct _G_fpos_t +{ + __off_t __pos; + __mbstate_t __state; +} __fpos_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos_t.h.blob new file mode 100644 index 0000000..b71d749 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__fpos_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__locale_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__locale_t.h new file mode 100644 index 0000000..c59a107 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__locale_t.h @@ -0,0 +1,43 @@ +/* Definition of struct __locale_struct and __locale_t. + Copyright (C) 1997-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_TYPES___LOCALE_T_H +#define _BITS_TYPES___LOCALE_T_H 1 + +/* POSIX.1-2008: the locale_t type, representing a locale context + (implementation-namespace version). This type should be treated + as opaque by applications; some details are exposed for the sake of + efficiency in e.g. ctype functions. */ + +struct __locale_struct +{ + /* Note: LC_ALL is not a valid index into this array. */ + struct __locale_data *__locales[13]; /* 13 = __LC_LAST. */ + + /* To increase the speed of this solution we add some special members. */ + const unsigned short int *__ctype_b; + const int *__ctype_tolower; + const int *__ctype_toupper; + + /* Note: LC_ALL is not a valid index into this array. */ + const char *__names[13]; +}; + +typedef struct __locale_struct *__locale_t; + +#endif /* bits/types/__locale_t.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__locale_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__locale_t.h.blob new file mode 100644 index 0000000..97c0047 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__locale_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__mbstate_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__mbstate_t.h new file mode 100644 index 0000000..1d8a4e2 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__mbstate_t.h @@ -0,0 +1,23 @@ +#ifndef ____mbstate_t_defined +#define ____mbstate_t_defined 1 + +/* Integral type unchanged by default argument promotions that can + hold any value corresponding to members of the extended character + set, as well as at least one value that does not correspond to any + member of the extended character set. */ +#ifndef __WINT_TYPE__ +# define __WINT_TYPE__ unsigned int +#endif + +/* Conversion state information. */ +typedef struct +{ + int __count; + union + { + __WINT_TYPE__ __wch; + char __wchb[4]; + } __value; /* Value so far. */ +} __mbstate_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__mbstate_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__mbstate_t.h.blob new file mode 100644 index 0000000..81d845f Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__mbstate_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__sigset_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__sigset_t.h new file mode 100644 index 0000000..e2f18ac --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__sigset_t.h @@ -0,0 +1,10 @@ +#ifndef ____sigset_t_defined +#define ____sigset_t_defined + +#define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) +typedef struct +{ + unsigned long int __val[_SIGSET_NWORDS]; +} __sigset_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__sigset_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__sigset_t.h.blob new file mode 100644 index 0000000..4247300 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@__sigset_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clock_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clock_t.h new file mode 100644 index 0000000..ce97248 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clock_t.h @@ -0,0 +1,9 @@ +#ifndef __clock_t_defined +#define __clock_t_defined 1 + +#include + +/* Returned by `clock'. */ +typedef __clock_t clock_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clock_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clock_t.h.blob new file mode 100644 index 0000000..210b638 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clock_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clockid_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clockid_t.h new file mode 100644 index 0000000..b17c7da --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clockid_t.h @@ -0,0 +1,9 @@ +#ifndef __clockid_t_defined +#define __clockid_t_defined 1 + +#include + +/* Clock ID used in clock and timer functions. */ +typedef __clockid_t clockid_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clockid_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clockid_t.h.blob new file mode 100644 index 0000000..efab268 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@clockid_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@cookie_io_functions_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@cookie_io_functions_t.h new file mode 100644 index 0000000..c04319a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@cookie_io_functions_t.h @@ -0,0 +1,63 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef __cookie_io_functions_t_defined +#define __cookie_io_functions_t_defined 1 + +#include + +/* Functions to do I/O and file management for a stream. */ + +/* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF. + Return number of bytes read. */ +typedef __ssize_t cookie_read_function_t (void *__cookie, char *__buf, + size_t __nbytes); + +/* Write NBYTES bytes pointed to by BUF to COOKIE. Write all NBYTES bytes + unless there is an error. Return number of bytes written. If + there is an error, return 0 and do not write anything. If the file + has been opened for append (__mode.__append set), then set the file + pointer to the end of the file and then do the write; if not, just + write at the current file pointer. */ +typedef __ssize_t cookie_write_function_t (void *__cookie, const char *__buf, + size_t __nbytes); + +/* Move COOKIE's file position to *POS bytes from the + beginning of the file (if W is SEEK_SET), + the current position (if W is SEEK_CUR), + or the end of the file (if W is SEEK_END). + Set *POS to the new file position. + Returns zero if successful, nonzero if not. */ +typedef int cookie_seek_function_t (void *__cookie, __off64_t *__pos, int __w); + +/* Close COOKIE. */ +typedef int cookie_close_function_t (void *__cookie); + +/* The structure with the cookie function pointers. + The tag name of this struct is _IO_cookie_io_functions_t to + preserve historic C++ mangled names for functions taking + cookie_io_functions_t arguments. That name should not be used in + new code. */ +typedef struct _IO_cookie_io_functions_t +{ + cookie_read_function_t *read; /* Read bytes. */ + cookie_write_function_t *write; /* Write bytes. */ + cookie_seek_function_t *seek; /* Seek/tell file position. */ + cookie_close_function_t *close; /* Close file. */ +} cookie_io_functions_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@cookie_io_functions_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@cookie_io_functions_t.h.blob new file mode 100644 index 0000000..6640757 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@cookie_io_functions_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@error_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@error_t.h new file mode 100644 index 0000000..ed745fa --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@error_t.h @@ -0,0 +1,24 @@ +/* Define error_t. + Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef __error_t_defined +# define __error_t_defined 1 + +typedef int error_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@error_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@error_t.h.blob new file mode 100644 index 0000000..1acb438 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@error_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@locale_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@locale_t.h new file mode 100644 index 0000000..a825f11 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@locale_t.h @@ -0,0 +1,26 @@ +/* Definition of locale_t. + Copyright (C) 2017-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_TYPES_LOCALE_T_H +#define _BITS_TYPES_LOCALE_T_H 1 + +#include + +typedef __locale_t locale_t; + +#endif /* bits/types/locale_t.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@locale_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@locale_t.h.blob new file mode 100644 index 0000000..68744f2 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@locale_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@mbstate_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@mbstate_t.h new file mode 100644 index 0000000..8d1baa5 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@mbstate_t.h @@ -0,0 +1,8 @@ +#ifndef __mbstate_t_defined +#define __mbstate_t_defined 1 + +#include + +typedef __mbstate_t mbstate_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@mbstate_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@mbstate_t.h.blob new file mode 100644 index 0000000..3aae9b7 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@mbstate_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@sigset_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@sigset_t.h new file mode 100644 index 0000000..8b27e91 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@sigset_t.h @@ -0,0 +1,9 @@ +#ifndef __sigset_t_defined +#define __sigset_t_defined 1 + +#include + +/* A set of signals to be blocked, unblocked, or waited for. */ +typedef __sigset_t sigset_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@sigset_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@sigset_t.h.blob new file mode 100644 index 0000000..97d60dd Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@sigset_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_FILE.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_FILE.h new file mode 100644 index 0000000..2a0cafd --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_FILE.h @@ -0,0 +1,131 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef __struct_FILE_defined +#define __struct_FILE_defined 1 + +/* Caution: The contents of this file are not part of the official + stdio.h API. However, much of it is part of the official *binary* + interface, and therefore cannot be changed. */ + +#if defined _IO_USE_OLD_IO_FILE && !defined _LIBC +# error "_IO_USE_OLD_IO_FILE should only be defined when building libc itself" +#endif + +#if defined _IO_lock_t_defined && !defined _LIBC +# error "_IO_lock_t_defined should only be defined when building libc itself" +#endif + +#include +#include + +struct _IO_FILE; +struct _IO_marker; +struct _IO_codecvt; +struct _IO_wide_data; + +/* During the build of glibc itself, _IO_lock_t will already have been + defined by internal headers. */ +#ifndef _IO_lock_t_defined +typedef void _IO_lock_t; +#endif + +/* The tag name of this struct is _IO_FILE to preserve historic + C++ mangled names for functions taking FILE* arguments. + That name should not be used in new code. */ +struct _IO_FILE +{ + int _flags; /* High-order word is _IO_MAGIC; rest is flags. */ + + /* The following pointers correspond to the C++ streambuf protocol. */ + char *_IO_read_ptr; /* Current read pointer */ + char *_IO_read_end; /* End of get area. */ + char *_IO_read_base; /* Start of putback+get area. */ + char *_IO_write_base; /* Start of put area. */ + char *_IO_write_ptr; /* Current put pointer. */ + char *_IO_write_end; /* End of put area. */ + char *_IO_buf_base; /* Start of reserve area. */ + char *_IO_buf_end; /* End of reserve area. */ + + /* The following fields are used to support backing up and undo. */ + char *_IO_save_base; /* Pointer to start of non-current get area. */ + char *_IO_backup_base; /* Pointer to first valid character of backup area */ + char *_IO_save_end; /* Pointer to end of non-current get area. */ + + struct _IO_marker *_markers; + + struct _IO_FILE *_chain; + + int _fileno; + int _flags2:24; + /* Fallback buffer to use when malloc fails to allocate one. */ + char _short_backupbuf[1]; + __off_t _old_offset; /* This used to be _offset but it's too small. */ + + /* 1+column number of pbase(); 0 is unknown. */ + unsigned short _cur_column; + signed char _vtable_offset; + char _shortbuf[1]; + + _IO_lock_t *_lock; +#ifdef _IO_USE_OLD_IO_FILE +}; + +struct _IO_FILE_complete +{ + struct _IO_FILE _file; +#endif + __off64_t _offset; + /* Wide character stream stuff. */ + struct _IO_codecvt *_codecvt; + struct _IO_wide_data *_wide_data; + struct _IO_FILE *_freeres_list; + void *_freeres_buf; + struct _IO_FILE **_prevchain; + int _mode; +#if __WORDSIZE == 64 + int _unused3; +#endif + __uint64_t _total_written; +#if __WORDSIZE == 32 + int _unused3; +#endif + /* Make sure we don't get into trouble again. */ + char _unused2[12 * sizeof (int) - 5 * sizeof (void *)]; +}; + +/* These macros are used by bits/stdio.h and internal headers. */ +#define __getc_unlocked_body(_fp) \ + (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end) \ + ? __uflow (_fp) : *(unsigned char *) (_fp)->_IO_read_ptr++) + +#define __putc_unlocked_body(_ch, _fp) \ + (__glibc_unlikely ((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \ + ? __overflow (_fp, (unsigned char) (_ch)) \ + : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch))) + +#define _IO_EOF_SEEN 0x0010 +#define __feof_unlocked_body(_fp) (((_fp)->_flags & _IO_EOF_SEEN) != 0) + +#define _IO_ERR_SEEN 0x0020 +#define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0) + +#define _IO_USER_LOCK 0x8000 +/* Many more flag bits are defined internally. */ + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_FILE.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_FILE.h.blob new file mode 100644 index 0000000..193b257 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_FILE.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct___jmp_buf_tag.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct___jmp_buf_tag.h new file mode 100644 index 0000000..ecb563f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct___jmp_buf_tag.h @@ -0,0 +1,37 @@ +/* Define struct __jmp_buf_tag. + Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef __jmp_buf_tag_defined +#define __jmp_buf_tag_defined 1 + +#include /* Get `__jmp_buf'. */ +#include + +/* Calling environment, plus possibly a saved signal mask. */ +struct __jmp_buf_tag + { + /* NOTE: The machine-dependent definitions of `__sigsetjmp' + assume that a `jmp_buf' begins with a `__jmp_buf' and that + `__mask_was_saved' follows it. Do not move these members + or add others before it. */ + __jmp_buf __jmpbuf; /* Calling environment. */ + int __mask_was_saved; /* Saved the signal mask? */ + __sigset_t __saved_mask; /* Saved signal mask. */ + }; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct___jmp_buf_tag.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct___jmp_buf_tag.h.blob new file mode 100644 index 0000000..9811856 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct___jmp_buf_tag.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_itimerspec.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_itimerspec.h new file mode 100644 index 0000000..17cc1ac --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_itimerspec.h @@ -0,0 +1,14 @@ +#ifndef __itimerspec_defined +#define __itimerspec_defined 1 + +#include +#include + +/* POSIX.1b structure for timer start values and intervals. */ +struct itimerspec + { + struct timespec it_interval; + struct timespec it_value; + }; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_itimerspec.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_itimerspec.h.blob new file mode 100644 index 0000000..99a8111 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_itimerspec.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_sched_param.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_sched_param.h new file mode 100644 index 0000000..dce2e57 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_sched_param.h @@ -0,0 +1,28 @@ +/* Sched parameter structure. Generic version. + Copyright (C) 1996-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_TYPES_STRUCT_SCHED_PARAM +#define _BITS_TYPES_STRUCT_SCHED_PARAM 1 + +/* Data structure to describe a process' schedulability. */ +struct sched_param +{ + int sched_priority; +}; + +#endif /* bits/types/struct_sched_param.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_sched_param.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_sched_param.h.blob new file mode 100644 index 0000000..3491035 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_sched_param.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timespec.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timespec.h new file mode 100644 index 0000000..1141015 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timespec.h @@ -0,0 +1,33 @@ +/* NB: Include guard matches what uses. */ +#ifndef _STRUCT_TIMESPEC +#define _STRUCT_TIMESPEC 1 + +#include +#include +#include + +/* POSIX.1b structure for a time value. This is like a `struct timeval' but + has nanoseconds instead of microseconds. */ +struct timespec +{ +#ifdef __USE_TIME64_REDIRECTS + __time64_t tv_sec; /* Seconds. */ +#else + __time_t tv_sec; /* Seconds. */ +#endif +#if __WORDSIZE == 64 \ + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \ + || (__TIMESIZE == 32 && !defined __USE_TIME64_REDIRECTS) + __syscall_slong_t tv_nsec; /* Nanoseconds. */ +#else +# if __BYTE_ORDER == __BIG_ENDIAN + int: 32; /* Padding. */ + long int tv_nsec; /* Nanoseconds. */ +# else + long int tv_nsec; /* Nanoseconds. */ + int: 32; /* Padding. */ +# endif +#endif +}; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timespec.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timespec.h.blob new file mode 100644 index 0000000..25d12cd Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timespec.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timeval.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timeval.h new file mode 100644 index 0000000..0c8e88c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timeval.h @@ -0,0 +1,18 @@ +#ifndef __timeval_defined +#define __timeval_defined 1 + +#include + +/* A time value that is accurate to the nearest + microsecond but also has a range of years. */ +struct timeval +{ +#ifdef __USE_TIME64_REDIRECTS + __time64_t tv_sec; /* Seconds. */ + __suseconds64_t tv_usec; /* Microseconds. */ +#else + __time_t tv_sec; /* Seconds. */ + __suseconds_t tv_usec; /* Microseconds. */ +#endif +}; +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timeval.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timeval.h.blob new file mode 100644 index 0000000..af3abab Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_timeval.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_tm.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_tm.h new file mode 100644 index 0000000..b13b631 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_tm.h @@ -0,0 +1,28 @@ +#ifndef __struct_tm_defined +#define __struct_tm_defined 1 + +#include + +/* ISO C `broken-down time' structure. */ +struct tm +{ + int tm_sec; /* Seconds. [0-60] (1 leap second) */ + int tm_min; /* Minutes. [0-59] */ + int tm_hour; /* Hours. [0-23] */ + int tm_mday; /* Day. [1-31] */ + int tm_mon; /* Month. [0-11] */ + int tm_year; /* Year - 1900. */ + int tm_wday; /* Day of week. [0-6] */ + int tm_yday; /* Days in year.[0-365] */ + int tm_isdst; /* DST. [-1/0/1]*/ + +# ifdef __USE_MISC + long int tm_gmtoff; /* Seconds east of UTC. */ + const char *tm_zone; /* Timezone abbreviation. */ +# else + long int __tm_gmtoff; /* Seconds east of UTC. */ + const char *__tm_zone; /* Timezone abbreviation. */ +# endif +}; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_tm.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_tm.h.blob new file mode 100644 index 0000000..a483d22 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@struct_tm.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@time_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@time_t.h new file mode 100644 index 0000000..00cde92 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@time_t.h @@ -0,0 +1,13 @@ +#ifndef __time_t_defined +#define __time_t_defined 1 + +#include + +/* Returned by `time'. */ +#ifdef __USE_TIME64_REDIRECTS +typedef __time64_t time_t; +#else +typedef __time_t time_t; +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@time_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@time_t.h.blob new file mode 100644 index 0000000..611bac6 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@time_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@timer_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@timer_t.h new file mode 100644 index 0000000..d71a413 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@timer_t.h @@ -0,0 +1,9 @@ +#ifndef __timer_t_defined +#define __timer_t_defined 1 + +#include + +/* Timer ID returned by `timer_create'. */ +typedef __timer_t timer_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@timer_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@timer_t.h.blob new file mode 100644 index 0000000..b736d65 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@timer_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@wint_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@wint_t.h new file mode 100644 index 0000000..fbd63db --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@wint_t.h @@ -0,0 +1,23 @@ +#ifndef __wint_t_defined +#define __wint_t_defined 1 + +/* Some versions of stddef.h provide wint_t, even though neither the + C nor C++ standards, nor POSIX, specifies this. We assume that + stddef.h will define the macro _WINT_T if and only if it provides + wint_t, and conversely, that it will avoid providing wint_t if + _WINT_T is already defined. */ +#ifndef _WINT_T +#define _WINT_T 1 + +/* Integral type unchanged by default argument promotions that can + hold any value corresponding to members of the extended character + set, as well as at least one value that does not correspond to any + member of the extended character set. */ +#ifndef __WINT_TYPE__ +# define __WINT_TYPE__ unsigned int +#endif + +typedef __WINT_TYPE__ wint_t; + +#endif /* _WINT_T */ +#endif /* bits/types/wint_t.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@wint_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@wint_t.h.blob new file mode 100644 index 0000000..55f0fc9 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@types@wint_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@typesizes.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@typesizes.h new file mode 100644 index 0000000..18336f8 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@typesizes.h @@ -0,0 +1,106 @@ +/* bits/typesizes.h -- underlying types for *_t. Linux/x86-64 version. + Copyright (C) 2012-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TYPESIZES_H +#define _BITS_TYPESIZES_H 1 + +/* See for the meaning of these macros. This file exists so + that need not vary across different GNU platforms. */ + +/* X32 kernel interface is 64-bit. */ +#if defined __x86_64__ && defined __ILP32__ +# define __SYSCALL_SLONG_TYPE __SQUAD_TYPE +# define __SYSCALL_ULONG_TYPE __UQUAD_TYPE +#else +# define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE +# define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE +#endif + +#define __DEV_T_TYPE __UQUAD_TYPE +#define __UID_T_TYPE __U32_TYPE +#define __GID_T_TYPE __U32_TYPE +#define __INO_T_TYPE __SYSCALL_ULONG_TYPE +#define __INO64_T_TYPE __UQUAD_TYPE +#define __MODE_T_TYPE __U32_TYPE +#ifdef __x86_64__ +# define __NLINK_T_TYPE __SYSCALL_ULONG_TYPE +# define __FSWORD_T_TYPE __SYSCALL_SLONG_TYPE +#else +# define __NLINK_T_TYPE __UWORD_TYPE +# define __FSWORD_T_TYPE __SWORD_TYPE +#endif +#define __OFF_T_TYPE __SYSCALL_SLONG_TYPE +#define __OFF64_T_TYPE __SQUAD_TYPE +#define __PID_T_TYPE __S32_TYPE +#define __RLIM_T_TYPE __SYSCALL_ULONG_TYPE +#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __BLKCNT_T_TYPE __SYSCALL_SLONG_TYPE +#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __FSBLKCNT_T_TYPE __SYSCALL_ULONG_TYPE +#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT_T_TYPE __SYSCALL_ULONG_TYPE +#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __ID_T_TYPE __U32_TYPE +#define __CLOCK_T_TYPE __SYSCALL_SLONG_TYPE +#define __TIME_T_TYPE __SYSCALL_SLONG_TYPE +#define __USECONDS_T_TYPE __U32_TYPE +#define __SUSECONDS_T_TYPE __SYSCALL_SLONG_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE +#define __DADDR_T_TYPE __S32_TYPE +#define __KEY_T_TYPE __S32_TYPE +#define __CLOCKID_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE void * +#define __BLKSIZE_T_TYPE __SYSCALL_SLONG_TYPE +#define __FSID_T_TYPE struct { int __val[2]; } +#define __SSIZE_T_TYPE __SWORD_TYPE +#define __CPU_MASK_TYPE __SYSCALL_ULONG_TYPE + +#ifdef __x86_64__ +/* Tell the libc code that off_t and off64_t are actually the same type + for all ABI purposes, even if possibly expressed as different base types + for C type-checking purposes. */ +# define __OFF_T_MATCHES_OFF64_T 1 + +/* Same for ino_t and ino64_t. */ +# define __INO_T_MATCHES_INO64_T 1 + +/* And for __rlim_t and __rlim64_t. */ +# define __RLIM_T_MATCHES_RLIM64_T 1 + +/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */ +# define __STATFS_MATCHES_STATFS64 1 + +/* And for getitimer, setitimer and rusage */ +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1 +#else +# define __RLIM_T_MATCHES_RLIM64_T 0 + +# define __STATFS_MATCHES_STATFS64 0 + +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0 +#endif + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +#endif /* bits/typesizes.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@typesizes.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@typesizes.h.blob new file mode 100644 index 0000000..987491d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@typesizes.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@uintn-identity.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@uintn-identity.h new file mode 100644 index 0000000..d78bda6 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@uintn-identity.h @@ -0,0 +1,50 @@ +/* Inline functions to return unsigned integer values unchanged. + Copyright (C) 2017-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#if !defined _NETINET_IN_H && !defined _ENDIAN_H +# error "Never use directly; include or instead." +#endif + +#ifndef _BITS_UINTN_IDENTITY_H +#define _BITS_UINTN_IDENTITY_H 1 + +#include + +/* These inline functions are to ensure the appropriate type + conversions and associated diagnostics from macros that convert to + a given endianness. */ + +static __inline __uint16_t +__uint16_identity (__uint16_t __x) +{ + return __x; +} + +static __inline __uint32_t +__uint32_identity (__uint32_t __x) +{ + return __x; +} + +static __inline __uint64_t +__uint64_identity (__uint64_t __x) +{ + return __x; +} + +#endif /* _BITS_UINTN_IDENTITY_H. */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@uintn-identity.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@uintn-identity.h.blob new file mode 100644 index 0000000..cb45919 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@uintn-identity.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitflags.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitflags.h new file mode 100644 index 0000000..3b85542 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitflags.h @@ -0,0 +1,39 @@ +/* Definitions of flag bits for `waitpid' et al. + Copyright (C) 1992-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#if !defined _SYS_WAIT_H && !defined _STDLIB_H +# error "Never include directly; use instead." +#endif + + +/* Bits in the third argument to `waitpid'. */ +#define WNOHANG 1 /* Don't block waiting. */ +#define WUNTRACED 2 /* Report status of stopped children. */ + +/* Bits in the fourth argument to `waitid'. */ +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +# define WSTOPPED 2 /* Report stopped child (same as WUNTRACED). */ +# define WEXITED 4 /* Report dead child. */ +# define WCONTINUED 8 /* Report continued child. */ +# define WNOWAIT 0x01000000 /* Don't reap, just poll status. */ +#endif + +#define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads + in this group */ +#define __WALL 0x40000000 /* Wait for any child. */ +#define __WCLONE 0x80000000 /* Wait for cloned process. */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitflags.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitflags.h.blob new file mode 100644 index 0000000..e536c03 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitflags.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitstatus.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitstatus.h new file mode 100644 index 0000000..8a8dd04 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitstatus.h @@ -0,0 +1,59 @@ +/* Definitions of status bits for `wait' et al. + Copyright (C) 1992-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#if !defined _SYS_WAIT_H && !defined _STDLIB_H +# error "Never include directly; use instead." +#endif + + +/* Everything extant so far uses these same bits. */ + + +/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ +#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) + +/* If WIFSIGNALED(STATUS), the terminating signal. */ +#define __WTERMSIG(status) ((status) & 0x7f) + +/* If WIFSTOPPED(STATUS), the signal that stopped the child. */ +#define __WSTOPSIG(status) __WEXITSTATUS(status) + +/* Nonzero if STATUS indicates normal termination. */ +#define __WIFEXITED(status) (__WTERMSIG(status) == 0) + +/* Nonzero if STATUS indicates termination by a signal. */ +#define __WIFSIGNALED(status) \ + (((signed char) (((status) & 0x7f) + 1) >> 1) > 0) + +/* Nonzero if STATUS indicates the child is stopped. */ +#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f) + +/* Nonzero if STATUS indicates the child continued after a stop. We only + define this if provides the WCONTINUED flag bit. */ +#ifdef WCONTINUED +# define __WIFCONTINUED(status) ((status) == __W_CONTINUED) +#endif + +/* Nonzero if STATUS indicates the child dumped core. */ +#define __WCOREDUMP(status) ((status) & __WCOREFLAG) + +/* Macros for constructing status values. */ +#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) +#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) +#define __W_CONTINUED 0xffff +#define __WCOREFLAG 0x80 diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitstatus.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitstatus.h.blob new file mode 100644 index 0000000..f1ab3f9 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@waitstatus.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wchar.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wchar.h new file mode 100644 index 0000000..f29443b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wchar.h @@ -0,0 +1,49 @@ +/* wchar_t type related definitions. + Copyright (C) 2000-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _BITS_WCHAR_H +#define _BITS_WCHAR_H 1 + +/* The fallback definitions, for when __WCHAR_MAX__ or __WCHAR_MIN__ + are not defined, give the right value and type as long as both int + and wchar_t are 32-bit types. Adding L'\0' to a constant value + ensures that the type is correct; it is necessary to use (L'\0' + + 0) rather than just L'\0' so that the type in C++ is the promoted + version of wchar_t rather than the distinct wchar_t type itself. + Because wchar_t in preprocessor #if expressions is treated as + intmax_t or uintmax_t, the expression (L'\0' - 1) would have the + wrong value for WCHAR_MAX in such expressions and so cannot be used + to define __WCHAR_MAX in the unsigned case. */ + +#ifdef __WCHAR_MAX__ +# define __WCHAR_MAX __WCHAR_MAX__ +#elif L'\0' - 1 > 0 +# define __WCHAR_MAX (0xffffffffu + L'\0') +#else +# define __WCHAR_MAX (0x7fffffff + L'\0') +#endif + +#ifdef __WCHAR_MIN__ +# define __WCHAR_MIN __WCHAR_MIN__ +#elif L'\0' - 1 > 0 +# define __WCHAR_MIN (L'\0' + 0) +#else +# define __WCHAR_MIN (-__WCHAR_MAX - 1) +#endif + +#endif /* bits/wchar.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wchar.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wchar.h.blob new file mode 100644 index 0000000..34045e0 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wchar.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wctype-wchar.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wctype-wchar.h new file mode 100644 index 0000000..31ad171 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wctype-wchar.h @@ -0,0 +1,173 @@ +/* Copyright (C) 1996-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard: 7.25 + * Wide character classification and mapping utilities + */ + +#ifndef _BITS_WCTYPE_WCHAR_H +#define _BITS_WCTYPE_WCHAR_H 1 + +#if !defined _WCTYPE_H && !defined _WCHAR_H +#error "Never include directly; include or instead." +#endif + +#include +#include + +/* The definitions in this header are specified to appear in + in ISO C99, but in in Unix98. _GNU_SOURCE follows C99. */ + +/* Scalar type that can hold values which represent locale-specific + character classifications. */ +typedef unsigned long int wctype_t; + +# ifndef _ISwbit +/* The characteristics are stored always in network byte order (big + endian). We define the bit value interpretations here dependent on the + machine's byte order. */ + +# include +# if __BYTE_ORDER == __BIG_ENDIAN +# define _ISwbit(bit) (1 << (bit)) +# else /* __BYTE_ORDER == __LITTLE_ENDIAN */ +# define _ISwbit(bit) \ + ((bit) < 8 ? (int) ((1UL << (bit)) << 24) \ + : ((bit) < 16 ? (int) ((1UL << (bit)) << 8) \ + : ((bit) < 24 ? (int) ((1UL << (bit)) >> 8) \ + : (int) ((1UL << (bit)) >> 24)))) +# endif + +enum +{ + __ISwupper = 0, /* UPPERCASE. */ + __ISwlower = 1, /* lowercase. */ + __ISwalpha = 2, /* Alphabetic. */ + __ISwdigit = 3, /* Numeric. */ + __ISwxdigit = 4, /* Hexadecimal numeric. */ + __ISwspace = 5, /* Whitespace. */ + __ISwprint = 6, /* Printing. */ + __ISwgraph = 7, /* Graphical. */ + __ISwblank = 8, /* Blank (usually SPC and TAB). */ + __ISwcntrl = 9, /* Control character. */ + __ISwpunct = 10, /* Punctuation. */ + __ISwalnum = 11, /* Alphanumeric. */ + + _ISwupper = _ISwbit (__ISwupper), /* UPPERCASE. */ + _ISwlower = _ISwbit (__ISwlower), /* lowercase. */ + _ISwalpha = _ISwbit (__ISwalpha), /* Alphabetic. */ + _ISwdigit = _ISwbit (__ISwdigit), /* Numeric. */ + _ISwxdigit = _ISwbit (__ISwxdigit), /* Hexadecimal numeric. */ + _ISwspace = _ISwbit (__ISwspace), /* Whitespace. */ + _ISwprint = _ISwbit (__ISwprint), /* Printing. */ + _ISwgraph = _ISwbit (__ISwgraph), /* Graphical. */ + _ISwblank = _ISwbit (__ISwblank), /* Blank (usually SPC and TAB). */ + _ISwcntrl = _ISwbit (__ISwcntrl), /* Control character. */ + _ISwpunct = _ISwbit (__ISwpunct), /* Punctuation. */ + _ISwalnum = _ISwbit (__ISwalnum) /* Alphanumeric. */ +}; +# endif /* Not _ISwbit */ + + +__BEGIN_DECLS + +/* + * Wide-character classification functions: 7.15.2.1. + */ + +/* Test for any wide character for which `iswalpha' or `iswdigit' is + true. */ +extern int iswalnum (wint_t __wc) __THROW; + +/* Test for any wide character for which `iswupper' or 'iswlower' is + true, or any wide character that is one of a locale-specific set of + wide-characters for which none of `iswcntrl', `iswdigit', + `iswpunct', or `iswspace' is true. */ +extern int iswalpha (wint_t __wc) __THROW; + +/* Test for any control wide character. */ +extern int iswcntrl (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a decimal-digit + character. */ +extern int iswdigit (wint_t __wc) __THROW; + +/* Test for any wide character for which `iswprint' is true and + `iswspace' is false. */ +extern int iswgraph (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a lowercase letter + or is one of a locale-specific set of wide characters for which + none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +extern int iswlower (wint_t __wc) __THROW; + +/* Test for any printing wide character. */ +extern int iswprint (wint_t __wc) __THROW; + +/* Test for any printing wide character that is one of a + locale-specific et of wide characters for which neither `iswspace' + nor `iswalnum' is true. */ +extern int iswpunct (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a locale-specific + set of wide characters for which none of `iswalnum', `iswgraph', or + `iswpunct' is true. */ +extern int iswspace (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to an uppercase letter + or is one of a locale-specific set of wide character for which none + of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +extern int iswupper (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a hexadecimal-digit + character equivalent to that performed be the functions described + in the previous subclause. */ +extern int iswxdigit (wint_t __wc) __THROW; + +/* Test for any wide character that corresponds to a standard blank + wide character or a locale-specific set of wide characters for + which `iswalnum' is false. */ +# ifdef __USE_ISOC99 +extern int iswblank (wint_t __wc) __THROW; +# endif + +/* + * Extensible wide-character classification functions: 7.15.2.2. + */ + +/* Construct value that describes a class of wide characters identified + by the string argument PROPERTY. */ +extern wctype_t wctype (const char *__property) __THROW; + +/* Determine whether the wide-character WC has the property described by + DESC. */ +extern int iswctype (wint_t __wc, wctype_t __desc) __THROW; + +/* + * Wide-character case-mapping functions: 7.15.3.1. + */ + +/* Converts an uppercase letter to the corresponding lowercase letter. */ +extern wint_t towlower (wint_t __wc) __THROW; + +/* Converts an lowercase letter to the corresponding uppercase letter. */ +extern wint_t towupper (wint_t __wc) __THROW; + +__END_DECLS + +#endif /* bits/wctype-wchar.h. */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wctype-wchar.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wctype-wchar.h.blob new file mode 100644 index 0000000..7ee25a1 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wctype-wchar.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wordsize.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wordsize.h new file mode 100644 index 0000000..3f40aa7 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wordsize.h @@ -0,0 +1,16 @@ +/* Determine the wordsize from the preprocessor defines. */ + +#if defined __x86_64__ && !defined __ILP32__ +# define __WORDSIZE 64 +#else +# define __WORDSIZE 32 +#define __WORDSIZE32_SIZE_ULONG 0 +#define __WORDSIZE32_PTRDIFF_LONG 0 +#endif + +#define __WORDSIZE_TIME64_COMPAT32 1 + +#ifdef __x86_64__ +/* Both x86-64 and x32 use the 64-bit system call interface. */ +# define __SYSCALL_WORDSIZE 64 +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wordsize.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wordsize.h.blob new file mode 100644 index 0000000..13bbfe6 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@bits@wordsize.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@backward@binders.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@backward@binders.h new file mode 100644 index 0000000..6c6da9c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@backward@binders.h @@ -0,0 +1,184 @@ +// Functor implementations -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file backward/binders.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _BACKWARD_BINDERS_H +#define _BACKWARD_BINDERS_H 1 + +// Suppress deprecated warning for this file. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 20.3.6 binders + /** @defgroup binders Binder Classes + * @ingroup functors + * + * Binders turn functions/functors with two arguments into functors + * with a single argument, storing an argument to be applied later. + * For example, a variable @c B of type @c binder1st is constructed + * from a functor @c f and an argument @c x. Later, B's @c + * operator() is called with a single argument @c y. The return + * value is the value of @c f(x,y). @c B can be @a called with + * various arguments (y1, y2, ...) and will in turn call @c + * f(x,y1), @c f(x,y2), ... + * + * The function @c bind1st is provided to save some typing. It takes the + * function and an argument as parameters, and returns an instance of + * @c binder1st. + * + * The type @c binder2nd and its creator function @c bind2nd do the same + * thing, but the stored argument is passed as the second parameter instead + * of the first, e.g., @c bind2nd(std::minus(),1.3) will create a + * functor whose @c operator() accepts a floating-point number, subtracts + * 1.3 from it, and returns the result. (If @c bind1st had been used, + * the functor would perform 1.3 - x instead. + * + * Creator-wrapper functions like @c bind1st are intended to be used in + * calling algorithms. Their return values will be temporary objects. + * (The goal is to not require you to type names like + * @c std::binder1st> for declaring a variable to hold the + * return value from @c bind1st(std::plus(),5). + * + * These become more useful when combined with the composition functions. + * + * These functions are deprecated in C++11 and can be replaced by + * @c std::bind (or @c std::tr1::bind) which is more powerful and flexible, + * supporting functions with any number of arguments. Uses of @c bind1st + * can be replaced by @c std::bind(f, x, std::placeholders::_1) and + * @c bind2nd by @c std::bind(f, std::placeholders::_1, x). + * @{ + */ + /// One of the @link binders binder functors@endlink. + template + class binder1st + : public unary_function + { + protected: + _Operation op; + typename _Operation::first_argument_type value; + + public: + binder1st(const _Operation& __x, + const typename _Operation::first_argument_type& __y) + : op(__x), value(__y) { } + + typename _Operation::result_type + operator()(const typename _Operation::second_argument_type& __x) const + { return op(value, __x); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 109. Missing binders for non-const sequence elements + typename _Operation::result_type + operator()(typename _Operation::second_argument_type& __x) const + { return op(value, __x); } + } _GLIBCXX11_DEPRECATED_SUGGEST("std::bind"); + + /// One of the @link binders binder functors@endlink. + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::bind") + inline binder1st<_Operation> + bind1st(const _Operation& __fn, const _Tp& __x) + { + typedef typename _Operation::first_argument_type _Arg1_type; + return binder1st<_Operation>(__fn, _Arg1_type(__x)); + } + + /// One of the @link binders binder functors@endlink. + template + class binder2nd + : public unary_function + { + protected: + _Operation op; + typename _Operation::second_argument_type value; + + public: + binder2nd(const _Operation& __x, + const typename _Operation::second_argument_type& __y) + : op(__x), value(__y) { } + + typename _Operation::result_type + operator()(const typename _Operation::first_argument_type& __x) const + { return op(__x, value); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 109. Missing binders for non-const sequence elements + typename _Operation::result_type + operator()(typename _Operation::first_argument_type& __x) const + { return op(__x, value); } + } _GLIBCXX11_DEPRECATED_SUGGEST("std::bind"); + + /// One of the @link binders binder functors@endlink. + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::bind") + inline binder2nd<_Operation> + bind2nd(const _Operation& __fn, const _Tp& __x) + { + typedef typename _Operation::second_argument_type _Arg2_type; + return binder2nd<_Operation>(__fn, _Arg2_type(__x)); + } + /** @} */ + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#pragma GCC diagnostic pop + +#endif /* _BACKWARD_BINDERS_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@backward@binders.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@backward@binders.h.blob new file mode 100644 index 0000000..f2e9288 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@backward@binders.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bit b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bit new file mode 100644 index 0000000..a481781 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bit @@ -0,0 +1,500 @@ +// -*- C++ -*- + +// Copyright (C) 2018-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bit + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_BIT +#define _GLIBCXX_BIT 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus >= 201402L + +#include // for std::integral +#include + +#if _GLIBCXX_HOSTED || __has_include() +# include +#else +# include +/// @cond undocumented +namespace __gnu_cxx +{ + template + struct __int_traits + { + static constexpr int __digits = std::numeric_limits<_Tp>::digits; + static constexpr _Tp __max = std::numeric_limits<_Tp>::max(); + }; +} +/// @endcond +#endif + +#define __glibcxx_want_bit_cast +#define __glibcxx_want_byteswap +#define __glibcxx_want_bitops +#define __glibcxx_want_int_pow2 +#define __glibcxx_want_endian +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup bit_manip Bit manipulation + * @ingroup numerics + * + * Utilities for examining and manipulating individual bits. + * + * @{ + */ + +#ifdef __cpp_lib_bit_cast // C++ >= 20 + + /// Create a value of type `To` from the bits of `from`. + /** + * @tparam _To A trivially-copyable type. + * @param __from A trivially-copyable object of the same size as `_To`. + * @return An object of type `_To`. + * @since C++20 + */ + template + [[nodiscard]] + constexpr _To + bit_cast(const _From& __from) noexcept +#ifdef __cpp_concepts + requires (sizeof(_To) == sizeof(_From)) + && is_trivially_copyable_v<_To> && is_trivially_copyable_v<_From> +#endif + { + return __builtin_bit_cast(_To, __from); + } +#endif // __cpp_lib_bit_cast + +#ifdef __cpp_lib_byteswap // C++ >= 23 + + /// Reverse order of bytes in the object representation of `value`. + /** + * @tparam _Tp An integral type. + * @param __value An object of integer type. + * @return An object of the same type, with the bytes reversed. + * @since C++23 + */ + template + [[nodiscard]] + constexpr _Tp + byteswap(_Tp __value) noexcept + { + if constexpr (sizeof(_Tp) == 1) + return __value; +#if __cpp_if_consteval >= 202106L && __CHAR_BIT__ == 8 + if !consteval + { + if constexpr (sizeof(_Tp) == 2) + return __builtin_bswap16(__value); + if constexpr (sizeof(_Tp) == 4) + return __builtin_bswap32(__value); + if constexpr (sizeof(_Tp) == 8) + return __builtin_bswap64(__value); + if constexpr (sizeof(_Tp) == 16) +#if __has_builtin(__builtin_bswap128) + return __builtin_bswap128(__value); +#else + return (__builtin_bswap64(__value >> 64) + | (static_cast<_Tp>(__builtin_bswap64(__value)) << 64)); +#endif + } +#endif + + // Fallback implementation that handles even __int24 etc. + using _Up = typename __make_unsigned<__remove_cv_t<_Tp>>::__type; + size_t __diff = __CHAR_BIT__ * (sizeof(_Tp) - 1); + _Up __mask1 = static_cast(~0); + _Up __mask2 = __mask1 << __diff; + _Up __val = __value; + for (size_t __i = 0; __i < sizeof(_Tp) / 2; ++__i) + { + _Up __byte1 = __val & __mask1; + _Up __byte2 = __val & __mask2; + __val = (__val ^ __byte1 ^ __byte2 + ^ (__byte1 << __diff) ^ (__byte2 >> __diff)); + __mask1 <<= __CHAR_BIT__; + __mask2 >>= __CHAR_BIT__; + __diff -= 2 * __CHAR_BIT__; + } + return __val; + } +#endif // __cpp_lib_byteswap + + /// @cond undocumented + + template + constexpr _Tp + __rotl(_Tp __x, int __s) noexcept + { + constexpr auto _Nd = __gnu_cxx::__int_traits<_Tp>::__digits; + if _GLIBCXX17_CONSTEXPR ((_Nd & (_Nd - 1)) == 0) + { + // Variant for power of two _Nd which the compiler can + // easily pattern match. + constexpr unsigned __uNd = _Nd; + const unsigned __r = __s; + return (__x << (__r % __uNd)) | (__x >> ((-__r) % __uNd)); + } + const int __r = __s % _Nd; + if (__r == 0) + return __x; + else if (__r > 0) + return (__x << __r) | (__x >> ((_Nd - __r) % _Nd)); + else + return (__x >> -__r) | (__x << ((_Nd + __r) % _Nd)); // rotr(x, -r) + } + + template + constexpr _Tp + __rotr(_Tp __x, int __s) noexcept + { + constexpr auto _Nd = __gnu_cxx::__int_traits<_Tp>::__digits; + if _GLIBCXX17_CONSTEXPR ((_Nd & (_Nd - 1)) == 0) + { + // Variant for power of two _Nd which the compiler can + // easily pattern match. + constexpr unsigned __uNd = _Nd; + const unsigned __r = __s; + return (__x >> (__r % __uNd)) | (__x << ((-__r) % __uNd)); + } + const int __r = __s % _Nd; + if (__r == 0) + return __x; + else if (__r > 0) + return (__x >> __r) | (__x << ((_Nd - __r) % _Nd)); + else + return (__x << -__r) | (__x >> ((_Nd + __r) % _Nd)); // rotl(x, -r) + } + + template + constexpr int + __countl_zero(_Tp __x) noexcept + { + using __gnu_cxx::__int_traits; + constexpr auto _Nd = __int_traits<_Tp>::__digits; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_clzg) + return __builtin_clzg(__x, _Nd); +#else + if (__x == 0) + return _Nd; + + constexpr auto _Nd_ull = __int_traits::__digits; + constexpr auto _Nd_ul = __int_traits::__digits; + constexpr auto _Nd_u = __int_traits::__digits; + + if _GLIBCXX17_CONSTEXPR (_Nd <= _Nd_u) + { + constexpr int __diff = _Nd_u - _Nd; + return __builtin_clz(__x) - __diff; + } + else if _GLIBCXX17_CONSTEXPR (_Nd <= _Nd_ul) + { + constexpr int __diff = _Nd_ul - _Nd; + return __builtin_clzl(__x) - __diff; + } + else if _GLIBCXX17_CONSTEXPR (_Nd <= _Nd_ull) + { + constexpr int __diff = _Nd_ull - _Nd; + return __builtin_clzll(__x) - __diff; + } + else // (_Nd > _Nd_ull) + { + static_assert(_Nd <= (2 * _Nd_ull), + "Maximum supported integer size is 128-bit"); + + unsigned long long __high = __x >> _Nd_ull; + if (__high != 0) + { + constexpr int __diff = (2 * _Nd_ull) - _Nd; + return __builtin_clzll(__high) - __diff; + } + constexpr auto __max_ull = __int_traits::__max; + unsigned long long __low = __x & __max_ull; + return (_Nd - _Nd_ull) + __builtin_clzll(__low); + } +#endif + } + + template + constexpr int + __countl_one(_Tp __x) noexcept + { + return std::__countl_zero<_Tp>((_Tp)~__x); + } + + template + constexpr int + __countr_zero(_Tp __x) noexcept + { + using __gnu_cxx::__int_traits; + constexpr auto _Nd = __int_traits<_Tp>::__digits; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_ctzg) + return __builtin_ctzg(__x, _Nd); +#else + if (__x == 0) + return _Nd; + + constexpr auto _Nd_ull = __int_traits::__digits; + constexpr auto _Nd_ul = __int_traits::__digits; + constexpr auto _Nd_u = __int_traits::__digits; + + if _GLIBCXX17_CONSTEXPR (_Nd <= _Nd_u) + return __builtin_ctz(__x); + else if _GLIBCXX17_CONSTEXPR (_Nd <= _Nd_ul) + return __builtin_ctzl(__x); + else if _GLIBCXX17_CONSTEXPR (_Nd <= _Nd_ull) + return __builtin_ctzll(__x); + else // (_Nd > _Nd_ull) + { + static_assert(_Nd <= (2 * _Nd_ull), + "Maximum supported integer size is 128-bit"); + + constexpr auto __max_ull = __int_traits::__max; + unsigned long long __low = __x & __max_ull; + if (__low != 0) + return __builtin_ctzll(__low); + unsigned long long __high = __x >> _Nd_ull; + return __builtin_ctzll(__high) + _Nd_ull; + } +#endif + } + + template + constexpr int + __countr_one(_Tp __x) noexcept + { + return std::__countr_zero((_Tp)~__x); + } + + template + constexpr int + __popcount(_Tp __x) noexcept + { +#if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_popcountg) + return __builtin_popcountg(__x); +#else + using __gnu_cxx::__int_traits; + constexpr auto _Nd = __int_traits<_Tp>::__digits; + + constexpr auto _Nd_ull = __int_traits::__digits; + constexpr auto _Nd_ul = __int_traits::__digits; + constexpr auto _Nd_u = __int_traits::__digits; + + if _GLIBCXX17_CONSTEXPR (_Nd <= _Nd_u) + return __builtin_popcount(__x); + else if _GLIBCXX17_CONSTEXPR (_Nd <= _Nd_ul) + return __builtin_popcountl(__x); + else if _GLIBCXX17_CONSTEXPR (_Nd <= _Nd_ull) + return __builtin_popcountll(__x); + else // (_Nd > _Nd_ull) + { + static_assert(_Nd <= (2 * _Nd_ull), + "Maximum supported integer size is 128-bit"); + + constexpr auto __max_ull = __int_traits::__max; + unsigned long long __low = __x & __max_ull; + unsigned long long __high = __x >> _Nd_ull; + return __builtin_popcountll(__low) + __builtin_popcountll(__high); + } +#endif + } + + template + constexpr bool + __has_single_bit(_Tp __x) noexcept + { return std::__popcount(__x) == 1; } + + template + constexpr _Tp + __bit_ceil(_Tp __x) noexcept + { + using __gnu_cxx::__int_traits; + constexpr auto _Nd = __int_traits<_Tp>::__digits; + if (__x == 0 || __x == 1) + return 1; + auto __shift_exponent = _Nd - std::__countl_zero((_Tp)(__x - 1u)); + // If the shift exponent equals _Nd then the correct result is not + // representable as a value of _Tp, and so the result is undefined. + // Want that undefined behaviour to be detected in constant expressions, + // by UBSan, and by debug assertions. + if (!std::__is_constant_evaluated()) + { + __glibcxx_assert( __shift_exponent != __int_traits<_Tp>::__digits ); + } + + using __promoted_type = decltype(__x << 1); + if _GLIBCXX17_CONSTEXPR (!is_same<__promoted_type, _Tp>::value) + { + // If __x undergoes integral promotion then shifting by _Nd is + // not undefined. In order to make the shift undefined, so that + // it is diagnosed in constant expressions and by UBsan, we also + // need to "promote" the shift exponent to be too large for the + // promoted type. + const int __extra_exp = sizeof(__promoted_type) / sizeof(_Tp) / 2; + __shift_exponent |= (__shift_exponent & _Nd) << __extra_exp; + } + return (_Tp)1u << __shift_exponent; + } + + template + constexpr _Tp + __bit_floor(_Tp __x) noexcept + { + constexpr auto _Nd = __gnu_cxx::__int_traits<_Tp>::__digits; + if (__x == 0) + return 0; + return (_Tp)1u << (_Nd - std::__countl_zero((_Tp)(__x >> 1))); + } + + template + constexpr int + __bit_width(_Tp __x) noexcept + { + constexpr auto _Nd = __gnu_cxx::__int_traits<_Tp>::__digits; + return _Nd - std::__countl_zero(__x); + } + + /// @endcond + +#ifdef __cpp_lib_bitops // C++ >= 20 + + /// @cond undocumented + template + concept __unsigned_integer = __is_unsigned_integer<_Tp>::value; + /// @endcond + + // [bit.rot], rotating + + /// Rotate `x` to the left by `s` bits. + template<__unsigned_integer _Tp> + [[nodiscard]] constexpr _Tp + rotl(_Tp __x, int __s) noexcept + { return std::__rotl(__x, __s); } + + /// Rotate `x` to the right by `s` bits. + template<__unsigned_integer _Tp> + [[nodiscard]] constexpr _Tp + rotr(_Tp __x, int __s) noexcept + { return std::__rotr(__x, __s); } + + // [bit.count], counting + + /// The number of contiguous zero bits, starting from the highest bit. + template<__unsigned_integer _Tp> + constexpr int + countl_zero(_Tp __x) noexcept + { return std::__countl_zero(__x); } + + /// The number of contiguous one bits, starting from the highest bit. + template<__unsigned_integer _Tp> + constexpr int + countl_one(_Tp __x) noexcept + { return std::__countl_one(__x); } + + /// The number of contiguous zero bits, starting from the lowest bit. + template<__unsigned_integer _Tp> + constexpr int + countr_zero(_Tp __x) noexcept + { return std::__countr_zero(__x); } + + /// The number of contiguous one bits, starting from the lowest bit. + template<__unsigned_integer _Tp> + constexpr int + countr_one(_Tp __x) noexcept + { return std::__countr_one(__x); } + + /// The number of bits set in `x`. + template<__unsigned_integer _Tp> + constexpr int + popcount(_Tp __x) noexcept + { return std::__popcount(__x); } +#endif // __cpp_lib_bitops + +#ifdef __cpp_lib_int_pow2 // C++ >= 20 + // [bit.pow.two], integral powers of 2 + + /// True if `x` is a power of two, false otherwise. + template<__unsigned_integer _Tp> + constexpr bool + has_single_bit(_Tp __x) noexcept + { return std::__has_single_bit(__x); } + + /// The smallest power-of-two not less than `x`. + template<__unsigned_integer _Tp> + constexpr _Tp + bit_ceil(_Tp __x) noexcept + { return std::__bit_ceil(__x); } + + /// The largest power-of-two not greater than `x`. + template<__unsigned_integer _Tp> + constexpr _Tp + bit_floor(_Tp __x) noexcept + { return std::__bit_floor(__x); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3656. Inconsistent bit operations returning a count + /// The smallest integer greater than the base-2 logarithm of `x`. + template<__unsigned_integer _Tp> + constexpr int + bit_width(_Tp __x) noexcept + { return std::__bit_width(__x); } +#endif // defined (__cpp_lib_int_pow2) + +#ifdef __cpp_lib_endian // C++ >= 20 + + /// Byte order constants + /** + * The platform endianness can be checked by comparing `std::endian::native` + * to one of `std::endian::big` or `std::endian::little`. + * + * @since C++20 + */ + enum class endian + { + little = __ORDER_LITTLE_ENDIAN__, + big = __ORDER_BIG_ENDIAN__, + native = __BYTE_ORDER__ + }; +#endif // __cpp_lib_endian + + /// @} + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++14 +#endif // _GLIBCXX_BIT diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bit.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bit.blob new file mode 100644 index 0000000..aab1f0e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bit.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@alloc_traits.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@alloc_traits.h new file mode 100644 index 0000000..581ba4e --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@alloc_traits.h @@ -0,0 +1,1053 @@ +// Allocator traits -*- C++ -*- + +// Copyright (C) 2011-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/alloc_traits.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _ALLOC_TRAITS_H +#define _ALLOC_TRAITS_H 1 + +#include +#include +#if __cplusplus >= 201103L +# include +# include +# if _GLIBCXX_HOSTED +# include +# endif +# if __cpp_exceptions +# include // __make_move_if_noexcept_iterator +# endif +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if __cplusplus >= 201103L + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++14-extensions" // for variable templates +#pragma GCC diagnostic ignored "-Wc++17-extensions" // for if-constexpr + + /// @cond undocumented + struct __allocator_traits_base + { +#if __cpp_concepts + template +#else + template +#endif + struct __rebind : __replace_first_arg<_Tp, _Up> + { + static_assert(is_same< + typename __replace_first_arg<_Tp, typename _Tp::value_type>::type, + _Tp>::value, + "allocator_traits::rebind_alloc must be A"); + }; + + template +#if __cpp_concepts + requires requires { typename _Tp::template rebind<_Up>::other; } + struct __rebind<_Tp, _Up> +#else + struct __rebind<_Tp, _Up, + __void_t::other>> +#endif + { + using type = typename _Tp::template rebind<_Up>::other; + + static_assert(is_same< + typename _Tp::template rebind::other, + _Tp>::value, + "allocator_traits::rebind_alloc must be A"); + }; + + protected: + template + using __pointer = typename _Tp::pointer; + template + using __c_pointer = typename _Tp::const_pointer; + template + using __v_pointer = typename _Tp::void_pointer; + template + using __cv_pointer = typename _Tp::const_void_pointer; + template + using __pocca = typename _Tp::propagate_on_container_copy_assignment; + template + using __pocma = typename _Tp::propagate_on_container_move_assignment; + template + using __pocs = typename _Tp::propagate_on_container_swap; + template + using __equal = __type_identity; + + // __has_allocate_hint is true if a.allocate(n, hint) is well-formed. +#if __cpp_concepts + template + static constexpr bool __has_allocate_hint + = requires (_Alloc& __a, _Sz __n, _Vp __hint) { + __a.allocate(__n, __hint); + }; +#else + template + using __allocate_hint_t + = decltype(std::declval<_Alloc&>() + .allocate(std::declval<_Sz>(), std::declval<_Vp>())); + template + static constexpr bool __has_allocate_hint = false; + template + static constexpr bool + __has_allocate_hint<_Alloc, _Sz, _Vp, + __void_t<__allocate_hint_t<_Alloc, _Sz, _Vp>>> + = true; +#endif + + // __has_construct is true if a.construct(p, args...) is well-formed. + // __can_construct is true if either __has_construct is true, or if + // a placement new-expression for T(args...) is well-formed. We use this + // to constrain allocator_traits::construct, as a libstdc++ extension. +#if __cpp_concepts + template + static constexpr bool __has_construct + = requires (_Alloc& __a, _Tp* __p, _Args&&... __args) { + __a.construct(__p, std::forward<_Args>(__args)...); + }; + template + static constexpr bool __can_construct_at + = requires (_Tp* __p, _Args&&... __args) { +#if __cpp_constexpr_dynamic_alloc + std::construct_at(__p, std::forward<_Args>(__args)...); +#else + ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); +#endif + }; + template + static constexpr bool __can_construct + = __has_construct<_Alloc, _Tp, _Args...> + || __can_construct_at<_Tp, _Args...>; +#else + template + using __construct_t + = decltype(std::declval<_Alloc&>().construct(std::declval<_Tp*>(), + std::declval<_Args>()...)); + template + static constexpr bool __has_construct_impl = false; + template + static constexpr bool + __has_construct_impl<_Alloc, _Tp, + __void_t<__construct_t<_Alloc, _Tp, _Args...>>, + _Args...> + = true; + template + static constexpr bool __has_construct + = __has_construct_impl<_Alloc, _Tp, void, _Args...>; + template + using __new_expr_t + = decltype(::new((void*)0) _Tp(std::declval<_Args>()...)); + template + static constexpr bool __has_new_expr = false; + template + static constexpr bool + __has_new_expr<_Tp, __void_t<__new_expr_t<_Tp, _Args...>>, _Args...> + = true; + template + static constexpr bool __can_construct + = __has_construct<_Alloc, _Tp, _Args...> + || __has_new_expr<_Tp, void, _Args...>; +#endif + + // __has_destroy is true if a.destroy(p) is well-formed. +#if __cpp_concepts + template + static constexpr bool __has_destroy = requires (_Alloc& __a, _Tp* __p) { + __a.destroy(__p); + }; +#else + template + using __destroy_t + = decltype(std::declval<_Alloc&>().destroy(std::declval<_Tp*>())); + template + static constexpr bool __has_destroy = false; + template + static constexpr bool __has_destroy<_Alloc, _Tp, + __void_t<__destroy_t<_Alloc, _Tp>>> + = true; +#endif + + // __has_max_size is true if a.max_size() is well-formed. +#if __cpp_concepts + template + static constexpr bool __has_max_size = requires (const _Alloc& __a) { + __a.max_size(); + }; +#else + template + using __max_size_t = decltype(std::declval().max_size()); + template + static constexpr bool __has_max_size = false; + template + static constexpr bool __has_max_size<_Alloc, + __void_t<__max_size_t<_Alloc>>> + = true; +#endif + + // __has_soccc is true if a.select_on_container_copy_construction() + // is well-formed. +#if __cpp_concepts + template + static constexpr bool __has_soccc = requires (const _Alloc& __a) { + __a.select_on_container_copy_construction(); + }; +#else + template + using __soccc_t + = decltype(std::declval() + .select_on_container_copy_construction()); + template + static constexpr bool __has_soccc = false; + template + static constexpr bool __has_soccc<_Alloc, __void_t<__soccc_t<_Alloc>>> + = true; +#endif + }; + + template + using __alloc_rebind + = typename __allocator_traits_base::template __rebind<_Alloc, _Up>::type; + /// @endcond + + /** + * @brief Uniform interface to all allocator types. + * @headerfile memory + * @ingroup allocators + * @since C++11 + */ + template + struct allocator_traits : __allocator_traits_base + { + /// The allocator type + typedef _Alloc allocator_type; + /// The allocated type + typedef typename _Alloc::value_type value_type; + + /** + * @brief The allocator's pointer type. + * + * @c Alloc::pointer if that type exists, otherwise @c value_type* + */ + using pointer = __detected_or_t; + + private: + // Select _Func<_Alloc> or pointer_traits::rebind<_Tp> + template class _Func, typename _Tp, typename = void> + struct _Ptr + { + using type = typename pointer_traits::template rebind<_Tp>; + }; + + template class _Func, typename _Tp> + struct _Ptr<_Func, _Tp, __void_t<_Func<_Alloc>>> + { + using type = _Func<_Alloc>; + }; + + // Select _A2::difference_type or pointer_traits<_Ptr>::difference_type + template + struct _Diff + { using type = typename pointer_traits<_PtrT>::difference_type; }; + + template + struct _Diff<_A2, _PtrT, __void_t> + { using type = typename _A2::difference_type; }; + + // Select _A2::size_type or make_unsigned<_DiffT>::type + template + struct _Size : make_unsigned<_DiffT> { }; + + template + struct _Size<_A2, _DiffT, __void_t> + { using type = typename _A2::size_type; }; + + public: + /** + * @brief The allocator's const pointer type. + * + * @c Alloc::const_pointer if that type exists, otherwise + * pointer_traits::rebind + */ + using const_pointer = typename _Ptr<__c_pointer, const value_type>::type; + + /** + * @brief The allocator's void pointer type. + * + * @c Alloc::void_pointer if that type exists, otherwise + * pointer_traits::rebind + */ + using void_pointer = typename _Ptr<__v_pointer, void>::type; + + /** + * @brief The allocator's const void pointer type. + * + * @c Alloc::const_void_pointer if that type exists, otherwise + * pointer_traits::rebind + */ + using const_void_pointer = typename _Ptr<__cv_pointer, const void>::type; + + /** + * @brief The allocator's difference type + * + * @c Alloc::difference_type if that type exists, otherwise + * pointer_traits::difference_type + */ + using difference_type = typename _Diff<_Alloc, pointer>::type; + + /** + * @brief The allocator's size type + * + * @c Alloc::size_type if that type exists, otherwise + * make_unsigned::type + */ + using size_type = typename _Size<_Alloc, difference_type>::type; + + /** + * @brief How the allocator is propagated on copy assignment + * + * @c Alloc::propagate_on_container_copy_assignment if that type exists, + * otherwise @c false_type + */ + using propagate_on_container_copy_assignment + = __detected_or_t; + + /** + * @brief How the allocator is propagated on move assignment + * + * @c Alloc::propagate_on_container_move_assignment if that type exists, + * otherwise @c false_type + */ + using propagate_on_container_move_assignment + = __detected_or_t; + + /** + * @brief How the allocator is propagated on swap + * + * @c Alloc::propagate_on_container_swap if that type exists, + * otherwise @c false_type + */ + using propagate_on_container_swap + = __detected_or_t; + + /** + * @brief Whether all instances of the allocator type compare equal. + * + * @c Alloc::is_always_equal if that type exists, + * otherwise @c is_empty::type + */ + using is_always_equal + = typename __detected_or_t, __equal, _Alloc>::type; + + template + using rebind_alloc = __alloc_rebind<_Alloc, _Tp>; + template + using rebind_traits = allocator_traits>; + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * + * Calls @c a.allocate(n) + */ + _GLIBCXX_NODISCARD static _GLIBCXX20_CONSTEXPR pointer + allocate(_Alloc& __a, size_type __n) + { return __a.allocate(__n); } + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * @param __hint Aid to locality. + * @return Memory of suitable size and alignment for @a n objects + * of type @c value_type + * + * Returns a.allocate(n, hint) if that expression is + * well-formed, otherwise returns @c a.allocate(n) + */ + _GLIBCXX_NODISCARD static _GLIBCXX20_CONSTEXPR pointer + allocate(_Alloc& __a, size_type __n, const_void_pointer __hint) + { + if constexpr (__has_allocate_hint<_Alloc, size_type, const_void_pointer>) + return __a.allocate(__n, __hint); + else + return __a.allocate(__n); + } + + /** + * @brief Deallocate memory. + * @param __a An allocator. + * @param __p Pointer to the memory to deallocate. + * @param __n The number of objects space was allocated for. + * + * Calls a.deallocate(p, n) + */ + static _GLIBCXX20_CONSTEXPR void + deallocate(_Alloc& __a, pointer __p, size_type __n) + { __a.deallocate(__p, __n); } + + /** + * @brief Construct an object of type `_Tp` + * @param __a An allocator. + * @param __p Pointer to memory of suitable size and alignment for Tp + * @param __args Constructor arguments. + * + * Calls __a.construct(__p, std::forward(__args)...) + * if that expression is well-formed, otherwise uses placement-new + * to construct an object of type @a _Tp at location @a __p from the + * arguments @a __args... + */ + template +#if __cpp_concepts && __cpp_constexpr_dynamic_alloc + requires __can_construct<_Alloc, _Tp, _Args...> + static constexpr void +#else + static __enable_if_t<__can_construct<_Alloc, _Tp, _Args...>> +#endif + construct(_Alloc& __a, _Tp* __p, _Args&&... __args) + noexcept(_S_nothrow_construct<_Tp, _Args...>()) + { + if constexpr (__has_construct<_Alloc, _Tp, _Args...>) + __a.construct(__p, std::forward<_Args>(__args)...); + else + std::_Construct(__p, std::forward<_Args>(__args)...); + } + + /** + * @brief Destroy an object of type @a _Tp + * @param __a An allocator. + * @param __p Pointer to the object to destroy + * + * Calls @c __a.destroy(__p) if that expression is well-formed, + * otherwise calls @c __p->~_Tp() + */ + template + static _GLIBCXX20_CONSTEXPR void + destroy(_Alloc& __a, _Tp* __p) + noexcept(_S_nothrow_destroy<_Tp>()) + { + if constexpr (__has_destroy<_Alloc, _Tp>) + __a.destroy(__p); + else + std::_Destroy(__p); + } + + /** + * @brief The maximum supported allocation size + * @param __a An allocator. + * @return @c __a.max_size() or @c numeric_limits::max() + * + * Returns @c __a.max_size() if that expression is well-formed, + * otherwise returns @c numeric_limits::max() + */ + static _GLIBCXX20_CONSTEXPR size_type + max_size(const _Alloc& __a) noexcept + { + if constexpr (__has_max_size<_Alloc>) + return __a.max_size(); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2466. allocator_traits::max_size() default behavior is incorrect + return __gnu_cxx::__numeric_traits::__max + / sizeof(value_type); + } + + /** + * @brief Obtain an allocator to use when copying a container. + * @param __rhs An allocator. + * @return @c __rhs.select_on_container_copy_construction() or @a __rhs + * + * Returns @c __rhs.select_on_container_copy_construction() if that + * expression is well-formed, otherwise returns @a __rhs + */ + static _GLIBCXX20_CONSTEXPR _Alloc + select_on_container_copy_construction(const _Alloc& __rhs) + { + if constexpr (__has_soccc<_Alloc>) + return __rhs.select_on_container_copy_construction(); + else + return __rhs; + } + + private: +#if __cpp_constexpr >= 201304 // >= C++14 + template + static constexpr bool + _S_nothrow_construct(_Alloc* __a = nullptr, _Tp* __p = nullptr) + { + if constexpr (__has_construct<_Alloc, _Tp, _Args...>) + return noexcept(__a->construct(__p, std::declval<_Args>()...)); + else + return __is_nothrow_new_constructible<_Tp, _Args...>; + } + + template + static constexpr bool + _S_nothrow_destroy(_Alloc* __a = nullptr, _Tp* __p = nullptr) + { + if constexpr (__has_destroy<_Alloc, _Tp>) + return noexcept(__a->destroy(__p)); + else + return is_nothrow_destructible<_Tp>::value; + } +#else + template + static constexpr + __enable_if_t<__has_construct<_Alloc, _Tp, _Args...>, bool> + _S_nothrow_construct(_Alloc* __a = nullptr, _Tp* __p = nullptr) + { return noexcept(__a->construct(__p, std::declval<_Args>()...)); } + + template + static constexpr + __enable_if_t, bool> + _S_nothrow_construct(_Alloc* = nullptr, _Tp* __p = nullptr) + { return __is_nothrow_new_constructible<_Tp, _Args...>; } + + template + static constexpr + __enable_if_t<__has_destroy<_Alloc, _Tp>, bool> + _S_nothrow_destroy(_Alloc* __a = nullptr, _Tp* __p = nullptr) + { return noexcept(__a->destroy(__p)); } + + template + static constexpr + __enable_if_t, bool> + _S_nothrow_destroy(_Alloc* = nullptr, _Tp* __p = nullptr) + { return is_nothrow_destructible<_Tp>::value; } +#endif + }; +#pragma GCC diagnostic pop + +#if _GLIBCXX_HOSTED + /** + * @brief Partial specialization for `std::allocator` + * @headerfile memory + * @ingroup allocators + * @since C++11 + * @see std::allocator_traits + */ + template + struct allocator_traits> + { + /// The allocator type + using allocator_type = allocator<_Tp>; + + /// The allocated type + using value_type = _Tp; + + /// The allocator's pointer type. + using pointer = _Tp*; + + /// The allocator's const pointer type. + using const_pointer = const _Tp*; + + /// The allocator's void pointer type. + using void_pointer = void*; + + /// The allocator's const void pointer type. + using const_void_pointer = const void*; + + /// The allocator's difference type + using difference_type = std::ptrdiff_t; + + /// The allocator's size type + using size_type = std::size_t; + + /// How the allocator is propagated on copy assignment + using propagate_on_container_copy_assignment = false_type; + + /// How the allocator is propagated on move assignment + using propagate_on_container_move_assignment = true_type; + + /// How the allocator is propagated on swap + using propagate_on_container_swap = false_type; + + /// Whether all instances of the allocator type compare equal. + using is_always_equal = true_type; + + template + using rebind_alloc = allocator<_Up>; + + template + using rebind_traits = allocator_traits>; + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * + * Calls @c a.allocate(n) + */ + [[__nodiscard__,__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR pointer + allocate(allocator_type& __a, size_type __n) + { return __a.allocate(__n); } + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * @param __hint Aid to locality. + * @return Memory of suitable size and alignment for @a n objects + * of type @c value_type + * + * Returns a.allocate(n, hint) + */ + [[__nodiscard__,__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR pointer + allocate(allocator_type& __a, size_type __n, + [[maybe_unused]] const_void_pointer __hint) + { +#if __cplusplus <= 201703L + return __a.allocate(__n, __hint); +#else + return __a.allocate(__n); +#endif + } + + /** + * @brief Deallocate memory. + * @param __a An allocator. + * @param __p Pointer to the memory to deallocate. + * @param __n The number of objects space was allocated for. + * + * Calls a.deallocate(p, n) + */ + [[__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR void + deallocate(allocator_type& __a, pointer __p, size_type __n) + { __a.deallocate(__p, __n); } + + /** + * @brief Construct an object of type `_Up` + * @param __a An allocator. + * @param __p Pointer to memory of suitable size and alignment for + * an object of type `_Up`. + * @param __args Constructor arguments. + * + * Calls `__a.construct(__p, std::forward<_Args>(__args)...)` + * in C++11, C++14 and C++17. Changed in C++20 to call + * `std::construct_at(__p, std::forward<_Args>(__args)...)` instead. + */ + template + [[__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR void + construct(allocator_type& __a __attribute__((__unused__)), + _Up* __p, _Args&&... __args) +#if __cplusplus <= 201703L + noexcept(noexcept(__a.construct(__p, std::forward<_Args>(__args)...))) +#else + noexcept(__is_nothrow_new_constructible<_Up, _Args...>) +#endif + { +#if __cplusplus <= 201703L + __a.construct(__p, std::forward<_Args>(__args)...); +#elif __cpp_constexpr_dynamic_alloc // >= C++20 + std::construct_at(__p, std::forward<_Args>(__args)...); +#else + std::_Construct(__p, std::forward<_Args>(__args)...); +#endif + } + + /** + * @brief Destroy an object of type @a _Up + * @param __a An allocator. + * @param __p Pointer to the object to destroy + * + * Calls @c __a.destroy(__p). + */ + template + [[__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR void + destroy(allocator_type& __a __attribute__((__unused__)), _Up* __p) + noexcept(is_nothrow_destructible<_Up>::value) + { +#if __cplusplus <= 201703L + __a.destroy(__p); +#else + std::destroy_at(__p); +#endif + } + + /** + * @brief The maximum supported allocation size + * @param __a An allocator. + * @return @c __a.max_size() + */ + [[__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR size_type + max_size(const allocator_type& __a __attribute__((__unused__))) noexcept + { +#if __cplusplus <= 201703L + return __a.max_size(); +#else + return size_t(-1) / sizeof(value_type); +#endif + } + + /** + * @brief Obtain an allocator to use when copying a container. + * @param __rhs An allocator. + * @return @c __rhs + */ + [[__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR allocator_type + select_on_container_copy_construction(const allocator_type& __rhs) + { return __rhs; } + }; + + /** + * @brief Explicit specialization for `std::allocator` + * @headerfile memory + * @ingroup allocators + * @since C++11 + * @see std::allocator_traits + */ + template<> + struct allocator_traits> + { + /// The allocator type + using allocator_type = allocator; + + /// The allocated type + using value_type = void; + + /// The allocator's pointer type. + using pointer = void*; + + /// The allocator's const pointer type. + using const_pointer = const void*; + + /// The allocator's void pointer type. + using void_pointer = void*; + + /// The allocator's const void pointer type. + using const_void_pointer = const void*; + + /// The allocator's difference type + using difference_type = std::ptrdiff_t; + + /// The allocator's size type + using size_type = std::size_t; + + /// How the allocator is propagated on copy assignment + using propagate_on_container_copy_assignment = false_type; + + /// How the allocator is propagated on move assignment + using propagate_on_container_move_assignment = true_type; + + /// How the allocator is propagated on swap + using propagate_on_container_swap = false_type; + + /// Whether all instances of the allocator type compare equal. + using is_always_equal = true_type; + + template + using rebind_alloc = allocator<_Up>; + + template + using rebind_traits = allocator_traits>; + + /// allocate is ill-formed for allocator + static void* + allocate(allocator_type&, size_type, const void* = nullptr) = delete; + + /// deallocate is ill-formed for allocator + static void + deallocate(allocator_type&, void*, size_type) = delete; + + /** + * @brief Construct an object of type `_Up` + * @param __a An allocator. + * @param __p Pointer to memory of suitable size and alignment for + * an object of type `_Up`. + * @param __args Constructor arguments. + * + * Calls `__a.construct(__p, std::forward<_Args>(__args)...)` + * in C++11, C++14 and C++17. Changed in C++20 to call + * `std::construct_at(__p, std::forward<_Args>(__args)...)` instead. + */ + template + [[__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR void + construct(allocator_type&, _Up* __p, _Args&&... __args) + noexcept(__is_nothrow_new_constructible<_Up, _Args...>) + { std::_Construct(__p, std::forward<_Args>(__args)...); } + + /** + * @brief Destroy an object of type `_Up` + * @param __a An allocator. + * @param __p Pointer to the object to destroy + * + * Invokes the destructor for `*__p`. + */ + template + [[__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR void + destroy(allocator_type&, _Up* __p) + noexcept(is_nothrow_destructible<_Up>::value) + { std::_Destroy(__p); } + + /// max_size is ill-formed for allocator + static size_type + max_size(const allocator_type&) = delete; + + /** + * @brief Obtain an allocator to use when copying a container. + * @param __rhs An allocator. + * @return `__rhs` + */ + [[__gnu__::__always_inline__]] + static _GLIBCXX20_CONSTEXPR allocator_type + select_on_container_copy_construction(const allocator_type& __rhs) + { return __rhs; } + }; +#endif + + /// @cond undocumented +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr + template + [[__gnu__::__always_inline__]] + _GLIBCXX14_CONSTEXPR inline void + __alloc_on_copy(_Alloc& __one, const _Alloc& __two) + { + using __traits = allocator_traits<_Alloc>; + using __pocca = + typename __traits::propagate_on_container_copy_assignment::type; + if constexpr (__pocca::value) + __one = __two; + } + + template + [[__gnu__::__always_inline__]] + constexpr _Alloc + __alloc_on_copy(const _Alloc& __a) + { + typedef allocator_traits<_Alloc> __traits; + return __traits::select_on_container_copy_construction(__a); + } + + template + [[__gnu__::__always_inline__]] + _GLIBCXX14_CONSTEXPR inline void + __alloc_on_move(_Alloc& __one, _Alloc& __two) + { + using __traits = allocator_traits<_Alloc>; + using __pocma + = typename __traits::propagate_on_container_move_assignment::type; + if constexpr (__pocma::value) + __one = std::move(__two); + } + + template + [[__gnu__::__always_inline__]] + _GLIBCXX14_CONSTEXPR inline void + __alloc_on_swap(_Alloc& __one, _Alloc& __two) + { + using __traits = allocator_traits<_Alloc>; + using __pocs = typename __traits::propagate_on_container_swap::type; + if constexpr (__pocs::value) + { + using std::swap; + swap(__one, __two); + } + } +#pragma GCC diagnostic pop + + template, + typename = void> + struct __is_alloc_insertable_impl + : false_type + { }; + + template + struct __is_alloc_insertable_impl<_Alloc, _Tp, _ValueT, + __void_t::construct( + std::declval<_Alloc&>(), std::declval<_ValueT*>(), + std::declval<_Tp>()))>> + : true_type + { }; + + // true if _Alloc::value_type is CopyInsertable into containers using _Alloc + // (might be wrong if _Alloc::construct exists but is not constrained, + // i.e. actually trying to use it would still be invalid. Use with caution.) + template + struct __is_copy_insertable + : __is_alloc_insertable_impl<_Alloc, + typename _Alloc::value_type const&>::type + { }; + +#if _GLIBCXX_HOSTED + // std::allocator<_Tp> just requires CopyConstructible + template + struct __is_copy_insertable> + : is_copy_constructible<_Tp> + { }; +#endif + + // true if _Alloc::value_type is MoveInsertable into containers using _Alloc + // (might be wrong if _Alloc::construct exists but is not constrained, + // i.e. actually trying to use it would still be invalid. Use with caution.) + template + struct __is_move_insertable + : __is_alloc_insertable_impl<_Alloc, typename _Alloc::value_type>::type + { }; + +#if _GLIBCXX_HOSTED + // std::allocator<_Tp> just requires MoveConstructible + template + struct __is_move_insertable> + : is_move_constructible<_Tp> + { }; +#endif + + // Trait to detect Allocator-like types. + template + struct __is_allocator : false_type { }; + + template + struct __is_allocator<_Alloc, + __void_t().allocate(size_t{}))>> + : true_type { }; + + template + using _RequireAllocator + = typename enable_if<__is_allocator<_Alloc>::value, _Alloc>::type; + + template + using _RequireNotAllocator + = typename enable_if::value, _Alloc>::type; + +#if __cpp_concepts >= 201907L + template + concept __allocator_like = requires (_Alloc& __a) { + typename _Alloc::value_type; + __a.deallocate(__a.allocate(1u), 1u); + }; + + template + concept __not_allocator_like = !__allocator_like<_Alloc>; +#endif + /// @endcond +#endif // C++11 + + /// @cond undocumented + + // To implement Option 3 of DR 431. + template + struct __alloc_swap + { static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } }; + + template + struct __alloc_swap<_Alloc, false> + { + static void + _S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT + { + // Precondition: swappable allocators. + if (__one != __two) + swap(__one, __two); + } + }; + +#if __cplusplus >= 201103L + template, + is_nothrow_move_constructible>::value> + struct __shrink_to_fit_aux + { static bool _S_do_it(_Tp&) noexcept { return false; } }; + + template + struct __shrink_to_fit_aux<_Tp, true> + { + _GLIBCXX20_CONSTEXPR + static bool + _S_do_it(_Tp& __c) noexcept + { +#if __cpp_exceptions + try + { + _Tp(__make_move_if_noexcept_iterator(__c.begin()), + __make_move_if_noexcept_iterator(__c.end()), + __c.get_allocator()).swap(__c); + return true; + } + catch(...) + { return false; } +#else + return false; +#endif + } + }; +#endif + + /** + * Destroy a range of objects using the supplied allocator. For + * non-default allocators we do not optimize away invocation of + * destroy() even if _Tp has a trivial destructor. + */ + + template + _GLIBCXX20_CONSTEXPR + void + _Destroy(_ForwardIterator __first, _ForwardIterator __last, + _Allocator& __alloc) + { + for (; __first != __last; ++__first) +#if __cplusplus < 201103L + __alloc.destroy(std::__addressof(*__first)); +#else + allocator_traits<_Allocator>::destroy(__alloc, + std::__addressof(*__first)); +#endif + } + +#if _GLIBCXX_HOSTED + template + __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR + inline void + _Destroy(_ForwardIterator __first, _ForwardIterator __last, + allocator<_Tp>&) + { + std::_Destroy(__first, __last); + } +#endif + + /// @endcond + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // _ALLOC_TRAITS_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@alloc_traits.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@alloc_traits.h.blob new file mode 100644 index 0000000..3fcad57 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@alloc_traits.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocated_ptr.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocated_ptr.h new file mode 100644 index 0000000..0b2b6fe --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocated_ptr.h @@ -0,0 +1,144 @@ +// Guarded Allocation -*- C++ -*- + +// Copyright (C) 2014-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/allocated_ptr.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _ALLOCATED_PTR_H +#define _ALLOCATED_PTR_H 1 + +#if __cplusplus < 201103L +# include +#else +# include +# include +# include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +/// @cond undocumented + + /// Non-standard RAII type for managing pointers obtained from allocators. + template + struct __allocated_ptr + { + using pointer = typename allocator_traits<_Alloc>::pointer; + using value_type = typename allocator_traits<_Alloc>::value_type; + + /// Take ownership of __ptr + __allocated_ptr(_Alloc& __a, pointer __ptr) noexcept + : _M_alloc(std::__addressof(__a)), _M_ptr(__ptr) + { } + + /// Convert __ptr to allocator's pointer type and take ownership of it + template>> + __allocated_ptr(_Alloc& __a, _Ptr __ptr) + : _M_alloc(std::__addressof(__a)), + _M_ptr(pointer_traits::pointer_to(*__ptr)) + { } + + /// Transfer ownership of the owned pointer + __allocated_ptr(__allocated_ptr&& __gd) noexcept + : _M_alloc(__gd._M_alloc), _M_ptr(__gd._M_ptr) + { __gd._M_ptr = nullptr; } + + /// Deallocate the owned pointer + ~__allocated_ptr() + { + if (_M_ptr != nullptr) + std::allocator_traits<_Alloc>::deallocate(*_M_alloc, _M_ptr, 1); + } + + /// Release ownership of the owned pointer + __allocated_ptr& + operator=(std::nullptr_t) noexcept + { + _M_ptr = nullptr; + return *this; + } + + explicit operator bool() const noexcept { return (bool)_M_ptr; } + + /// Get the address that the owned pointer refers to. + value_type* get() const { return std::__to_address(_M_ptr); } + + pointer release() { return std::__exchange(_M_ptr, nullptr); } + + private: + _Alloc* _M_alloc; + pointer _M_ptr; + }; + + /// Allocate space for a single object using __a. + template + inline __allocated_ptr<_Alloc> + __allocate_guarded(_Alloc& __a) + { + return { __a, std::allocator_traits<_Alloc>::allocate(__a, 1) }; + } + + /// RAII type for constructing/destroying an object with an allocated pointer + template + struct __allocated_obj : __allocated_ptr<_Alloc> + { + using value_type = typename __allocated_ptr<_Alloc>::value_type; + + __allocated_obj(__allocated_obj<_Alloc>&&) = default; + + // Default-initialize a value_type at *__ptr + __allocated_obj(__allocated_ptr<_Alloc>&& __ptr) + : __allocated_ptr<_Alloc>(std::move(__ptr)) + { ::new ((void*)this->get()) value_type; } + + // Call the destructor if an object is owned. + ~__allocated_obj() + { + if (static_cast(*this)) + this->get()->~value_type(); + } + + using __allocated_ptr<_Alloc>::operator=; + + value_type& operator*() const { return *this->get(); } + value_type* operator->() const { return this->get(); } + }; + + /// Construct an object in storage allocated using __a. + template + inline __allocated_obj<_Alloc> + __allocate_guarded_obj(_Alloc& __a) + { + return { std::__allocate_guarded(__a) }; + } + +/// @endcond +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocated_ptr.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocated_ptr.h.blob new file mode 100644 index 0000000..eaf52c9 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocated_ptr.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocator.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocator.h new file mode 100644 index 0000000..37452d1 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocator.h @@ -0,0 +1,303 @@ +// Allocators -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * Copyright (c) 1996-1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/allocator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _ALLOCATOR_H +#define _ALLOCATOR_H 1 + +#include // Define the base class to std::allocator. +#include +#if __cplusplus >= 201103L +#include +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup allocators + * @{ + */ + + // Since C++20 the primary template should be used for allocator, + // but then it would have a non-trivial default ctor and dtor for C++20, + // but trivial for C++98-17, which would be an ABI incompatibility between + // different standard dialects. So C++20 still uses the allocator + // explicit specialization, with the historical ABI properties, but with + // the same members that are present in the primary template. + + /** std::allocator specialization. + * + * @headerfile memory + */ + template<> + class allocator + { + public: + typedef void value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + +#if __cplusplus <= 201703L + // These were removed for C++20, allocator_traits does the right thing. + typedef void* pointer; + typedef const void* const_pointer; + + template + struct rebind + { typedef allocator<_Tp1> other; }; +#endif + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. std::allocator propagate_on_container_move_assignment + using propagate_on_container_move_assignment = true_type; + +#if __cplusplus <= 202302L + using is_always_equal + _GLIBCXX20_DEPRECATED_SUGGEST("std::allocator_traits::is_always_equal") + = true_type; +#endif + +#if __cplusplus >= 202002L + // As noted above, these members are present for C++20 to provide the + // same API as the primary template, but still trivial as in pre-C++20. + allocator() = default; + ~allocator() = default; + + template + __attribute__((__always_inline__)) + constexpr + allocator(const allocator<_Up>&) noexcept { } + + // No allocate member because it's ill-formed by LWG 3307. + // No deallocate member because it would be undefined to call it + // with any pointer which wasn't obtained from allocate. +#endif // C++20 +#endif // C++11 + }; + + /** + * @brief The @a standard allocator, as per C++03 [20.4.1]. + * + * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/memory.html#std.util.memory.allocator + * for further details. + * + * @tparam _Tp Type of allocated object. + * + * @headerfile memory + */ + template + class allocator : public __allocator_base<_Tp> + { + public: + typedef _Tp value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + +#if __cplusplus <= 201703L + // These were removed for C++20. + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + + template + struct rebind + { typedef allocator<_Tp1> other; }; +#endif + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. std::allocator propagate_on_container_move_assignment + using propagate_on_container_move_assignment = true_type; + +#if __cplusplus <= 202302L + using is_always_equal + _GLIBCXX20_DEPRECATED_SUGGEST("std::allocator_traits::is_always_equal") + = true_type; +#endif +#endif + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3035. std::allocator's constructors should be constexpr + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + allocator() _GLIBCXX_NOTHROW { } + + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + allocator(const allocator& __a) _GLIBCXX_NOTHROW + : __allocator_base<_Tp>(__a) { } + +#if __cplusplus >= 201103L + // Avoid implicit deprecation. + allocator& operator=(const allocator&) = default; +#endif + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + allocator(const allocator<_Tp1>&) _GLIBCXX_NOTHROW { } + + __attribute__((__always_inline__)) +#if __cpp_constexpr_dynamic_alloc + constexpr +#endif + ~allocator() _GLIBCXX_NOTHROW { } + +#if __cplusplus > 201703L + [[nodiscard,__gnu__::__always_inline__]] + constexpr _Tp* + allocate(size_t __n) + { + if (std::__is_constant_evaluated()) + { + if (__builtin_mul_overflow(__n, sizeof(_Tp), &__n)) + std::__throw_bad_array_new_length(); + return static_cast<_Tp*>(::operator new(__n)); + } + + return __allocator_base<_Tp>::allocate(__n, 0); + } + + [[__gnu__::__always_inline__]] + constexpr void + deallocate(_Tp* __p, size_t __n) + { + if (std::__is_constant_evaluated()) + { + ::operator delete(__p); + return; + } + __allocator_base<_Tp>::deallocate(__p, __n); + } +#endif // C++20 + + friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR + bool + operator==(const allocator&, const allocator&) _GLIBCXX_NOTHROW + { return true; } + +#if __cpp_impl_three_way_comparison < 201907L + friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR + bool + operator!=(const allocator&, const allocator&) _GLIBCXX_NOTHROW + { return false; } +#endif + + // Inherit everything else. + }; + + /** Equality comparison for std::allocator objects + * + * @return true, for all std::allocator objects. + * @relates std::allocator + */ + template + __attribute__((__always_inline__)) + inline _GLIBCXX20_CONSTEXPR bool + operator==(const allocator<_T1>&, const allocator<_T2>&) + _GLIBCXX_NOTHROW + { return true; } + +#if __cpp_impl_three_way_comparison < 201907L + template + __attribute__((__always_inline__)) + inline _GLIBCXX20_CONSTEXPR bool + operator!=(const allocator<_T1>&, const allocator<_T2>&) + _GLIBCXX_NOTHROW + { return false; } +#endif + + /// @cond undocumented + + // Invalid allocator partial specializations. + // allocator_traits::rebind_alloc can be used to form a valid allocator type. + template + class allocator + { + public: + typedef _Tp value_type; + allocator() { } + template allocator(const allocator<_Up>&) { } + }; + + template + class allocator + { + public: + typedef _Tp value_type; + allocator() { } + template allocator(const allocator<_Up>&) { } + }; + + template + class allocator + { + public: + typedef _Tp value_type; + allocator() { } + template allocator(const allocator<_Up>&) { } + }; + /// @endcond + + /// @} group allocator + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class allocator; + extern template class allocator; +#endif + + // Undefine. +#undef __allocator_base + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocator.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocator.h.blob new file mode 100644 index 0000000..d6e49e6 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@allocator.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.h new file mode 100644 index 0000000..ecb3b56 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.h @@ -0,0 +1,533 @@ +// Iostreams base classes -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/basic_ios.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ios} + */ + +#ifndef _BASIC_IOS_H +#define _BASIC_IOS_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + inline const _Facet& + __check_facet(const _Facet* __f) + { + if (!__f) + __throw_bad_cast(); + return *__f; + } + + /** + * @brief Template class basic_ios, virtual base class for all + * stream classes. + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * + * Most of the member functions called dispatched on stream objects + * (e.g., @c std::cout.foo(bar);) are consolidated in this class. + */ + template + class basic_ios : public ios_base + { +#if __cplusplus >= 202002L + static_assert(is_same_v<_CharT, typename _Traits::char_type>); +#endif + + public: + ///@{ + /** + * These are standard types. They permit a standardized way of + * referring to names of (or names dependent on) the template + * parameters, which are specific to the implementation. + */ + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + ///@} + + ///@{ + /** + * These are non-standard types. + */ + typedef ctype<_CharT> __ctype_type; + typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > + __num_put_type; + typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > + __num_get_type; + ///@} + + // Data members: + protected: + basic_ostream<_CharT, _Traits>* _M_tie; + mutable char_type _M_fill; + mutable bool _M_fill_init; + basic_streambuf<_CharT, _Traits>* _M_streambuf; + + // Cached use_facet, which is based on the current locale info. + const __ctype_type* _M_ctype; + // For ostream. + const __num_put_type* _M_num_put; + // For istream. + const __num_get_type* _M_num_get; + + public: + ///@{ + /** + * @brief The quick-and-easy status check. + * + * This allows you to write constructs such as + * if (!a_stream) ... and while (a_stream) ... + */ +#if __cplusplus >= 201103L + _GLIBCXX_NODISCARD + explicit operator bool() const + { return !this->fail(); } +#else + operator void*() const + { return this->fail() ? 0 : const_cast(this); } +#endif + + _GLIBCXX_NODISCARD + bool + operator!() const + { return this->fail(); } + ///@} + + /** + * @brief Returns the error state of the stream buffer. + * @return A bit pattern (well, isn't everything?) + * + * See std::ios_base::iostate for the possible bit values. Most + * users will call one of the interpreting wrappers, e.g., good(). + */ + _GLIBCXX_NODISCARD + iostate + rdstate() const + { return _M_streambuf_state; } + + /** + * @brief [Re]sets the error state. + * @param __state The new state flag(s) to set. + * + * See std::ios_base::iostate for the possible bit values. Most + * users will not need to pass an argument. + */ + void + clear(iostate __state = goodbit); + + /** + * @brief Sets additional flags in the error state. + * @param __state The additional state flag(s) to set. + * + * See std::ios_base::iostate for the possible bit values. + */ + void + setstate(iostate __state) + { this->clear(this->rdstate() | __state); } + + // Flips the internal state on for the proper state bits, then + // rethrows the propagated exception if bit also set in + // exceptions(). Must only be called within a catch handler. + void + _M_setstate(iostate __state) + { + // 27.6.1.2.1 Common requirements. + // Turn this on without causing an ios::failure to be thrown. + _M_streambuf_state |= __state; + if (this->exceptions() & __state) + { __throw_exception_again; } + } + + /** + * @brief Fast error checking. + * @return True if no error flags are set. + * + * A wrapper around rdstate. + */ + _GLIBCXX_NODISCARD + bool + good() const + { return this->rdstate() == 0; } + + /** + * @brief Fast error checking. + * @return True if the eofbit is set. + * + * Note that other iostate flags may also be set. + */ + _GLIBCXX_NODISCARD + bool + eof() const + { return (this->rdstate() & eofbit) != 0; } + + /** + * @brief Fast error checking. + * @return True if either the badbit or the failbit is set. + * + * Checking the badbit in fail() is historical practice. + * Note that other iostate flags may also be set. + */ + _GLIBCXX_NODISCARD + bool + fail() const + { return (this->rdstate() & (badbit | failbit)) != 0; } + + /** + * @brief Fast error checking. + * @return True if the badbit is set. + * + * Note that other iostate flags may also be set. + */ + _GLIBCXX_NODISCARD + bool + bad() const + { return (this->rdstate() & badbit) != 0; } + + /** + * @brief Throwing exceptions on errors. + * @return The current exceptions mask. + * + * This changes nothing in the stream. See the one-argument version + * of exceptions(iostate) for the meaning of the return value. + */ + _GLIBCXX_NODISCARD + iostate + exceptions() const + { return _M_exception; } + + /** + * @brief Throwing exceptions on errors. + * @param __except The new exceptions mask. + * + * By default, error flags are set silently. You can set an + * exceptions mask for each stream; if a bit in the mask becomes set + * in the error flags, then an exception of type + * std::ios_base::failure is thrown. + * + * If the error flag is already set when the exceptions mask is + * added, the exception is immediately thrown. Try running the + * following under GCC 3.1 or later: + * @code + * #include + * #include + * #include + * + * int main() + * { + * std::set_terminate (__gnu_cxx::__verbose_terminate_handler); + * + * std::ifstream f ("/etc/motd"); + * + * std::cerr << "Setting badbit\n"; + * f.setstate (std::ios_base::badbit); + * + * std::cerr << "Setting exception mask\n"; + * f.exceptions (std::ios_base::badbit); + * } + * @endcode + */ + void + exceptions(iostate __except) + { + _M_exception = __except; + this->clear(_M_streambuf_state); + } + + // Constructor/destructor: + /** + * @brief Constructor performs initialization. + * + * The parameter is passed by derived streams. + */ + explicit + basic_ios(basic_streambuf<_CharT, _Traits>* __sb) + : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0), + _M_ctype(0), _M_num_put(0), _M_num_get(0) + { this->init(__sb); } + + /** + * @brief Empty. + * + * The destructor does nothing. More specifically, it does not + * destroy the streambuf held by rdbuf(). + */ + virtual + ~basic_ios() { } + + // Members: + /** + * @brief Fetches the current @e tied stream. + * @return A pointer to the tied stream, or NULL if the stream is + * not tied. + * + * A stream may be @e tied (or synchronized) to a second output + * stream. When this stream performs any I/O, the tied stream is + * first flushed. For example, @c std::cin is tied to @c std::cout. + */ + _GLIBCXX_NODISCARD + basic_ostream<_CharT, _Traits>* + tie() const + { return _M_tie; } + + /** + * @brief Ties this stream to an output stream. + * @param __tiestr The output stream. + * @return The previously tied output stream, or NULL if the stream + * was not tied. + * + * This sets up a new tie; see tie() for more. + */ + basic_ostream<_CharT, _Traits>* + tie(basic_ostream<_CharT, _Traits>* __tiestr) + { + basic_ostream<_CharT, _Traits>* __old = _M_tie; + _M_tie = __tiestr; + return __old; + } + + /** + * @brief Accessing the underlying buffer. + * @return The current stream buffer. + * + * This does not change the state of the stream. + */ + _GLIBCXX_NODISCARD + basic_streambuf<_CharT, _Traits>* + rdbuf() const + { return _M_streambuf; } + + /** + * @brief Changing the underlying buffer. + * @param __sb The new stream buffer. + * @return The previous stream buffer. + * + * Associates a new buffer with the current stream, and clears the + * error state. + * + * Due to historical accidents which the LWG refuses to correct, the + * I/O library suffers from a design error: this function is hidden + * in derived classes by overrides of the zero-argument @c rdbuf(), + * which is non-virtual for hysterical raisins. As a result, you + * must use explicit qualifications to access this function via any + * derived class. For example: + * + * @code + * std::fstream foo; // or some other derived type + * std::streambuf* p = .....; + * + * foo.ios::rdbuf(p); // ios == basic_ios + * @endcode + */ + basic_streambuf<_CharT, _Traits>* + rdbuf(basic_streambuf<_CharT, _Traits>* __sb); + + /** + * @brief Copies fields of __rhs into this. + * @param __rhs The source values for the copies. + * @return Reference to this object. + * + * All fields of __rhs are copied into this object except that rdbuf() + * and rdstate() remain unchanged. All values in the pword and iword + * arrays are copied. Before copying, each callback is invoked with + * erase_event. After copying, each (new) callback is invoked with + * copyfmt_event. The final step is to copy exceptions(). + */ + basic_ios& + copyfmt(const basic_ios& __rhs); + + /** + * @brief Retrieves the @a empty character. + * @return The current fill character. + * + * It defaults to a space (' ') in the current locale. + */ + _GLIBCXX_NODISCARD + char_type + fill() const + { + if (__builtin_expect(!_M_fill_init, false)) + return this->widen(' '); + return _M_fill; + } + + /** + * @brief Sets a new @a empty character. + * @param __ch The new character. + * @return The previous fill character. + * + * The fill character is used to fill out space when P+ characters + * have been requested (e.g., via setw), Q characters are actually + * used, and Q >(getloc()).narrow(c,dfault) + * @endcode + * + * Additional l10n notes are at + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html + */ + char + narrow(char_type __c, char __dfault) const + { return __check_facet(_M_ctype).narrow(__c, __dfault); } + + /** + * @brief Widens characters. + * @param __c The character to widen. + * @return The widened character. + * + * Maps a character of @c char to a character of @c char_type. + * + * Returns the result of + * @code + * std::use_facet >(getloc()).widen(c) + * @endcode + * + * Additional l10n notes are at + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html + */ + char_type + widen(char __c) const + { return __check_facet(_M_ctype).widen(__c); } + + protected: + // 27.4.5.1 basic_ios constructors + /** + * @brief Empty. + * + * The default constructor does nothing and is not normally + * accessible to users. + */ + basic_ios() + : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false), + _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0) + { } + + /** + * @brief All setup is performed here. + * + * This is called from the public constructor. It is not virtual and + * cannot be redefined. + */ + void + init(basic_streambuf<_CharT, _Traits>* __sb); + +#if __cplusplus >= 201103L + basic_ios(const basic_ios&) = delete; + basic_ios& operator=(const basic_ios&) = delete; + + void + move(basic_ios& __rhs) + { + ios_base::_M_move(__rhs); + _M_cache_locale(_M_ios_locale); + this->tie(__rhs.tie(nullptr)); + _M_fill = __rhs._M_fill; + _M_fill_init = __rhs._M_fill_init; + _M_streambuf = nullptr; + } + + void + move(basic_ios&& __rhs) + { this->move(__rhs); } + + void + swap(basic_ios& __rhs) noexcept + { + ios_base::_M_swap(__rhs); + _M_cache_locale(_M_ios_locale); + __rhs._M_cache_locale(__rhs._M_ios_locale); + std::swap(_M_tie, __rhs._M_tie); + std::swap(_M_fill, __rhs._M_fill); + std::swap(_M_fill_init, __rhs._M_fill_init); + } + + void + set_rdbuf(basic_streambuf<_CharT, _Traits>* __sb) + { _M_streambuf = __sb; } +#endif + + void + _M_cache_locale(const locale& __loc); + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#include + +#endif /* _BASIC_IOS_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.h.blob new file mode 100644 index 0000000..75e5855 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.tcc new file mode 100644 index 0000000..6173fc7 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.tcc @@ -0,0 +1,190 @@ +// basic_ios member functions -*- C++ -*- + +// Copyright (C) 1999-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/basic_ios.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ios} + */ + +#ifndef _BASIC_IOS_TCC +#define _BASIC_IOS_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + void + basic_ios<_CharT, _Traits>::clear(iostate __state) + { + if (this->rdbuf()) + _M_streambuf_state = __state; + else + _M_streambuf_state = __state | badbit; + if (this->exceptions() & this->rdstate()) + __throw_ios_failure(__N("basic_ios::clear")); + } + + template + basic_streambuf<_CharT, _Traits>* + basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb) + { + basic_streambuf<_CharT, _Traits>* __old = _M_streambuf; + _M_streambuf = __sb; + this->clear(); + return __old; + } + + template + basic_ios<_CharT, _Traits>& + basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 292. effects of a.copyfmt (a) + if (this != std::__addressof(__rhs)) + { + // Per 27.1.1, do not call imbue, yet must trash all caches + // associated with imbue() + + // Alloc any new word array first, so if it fails we have "rollback". + _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ? + _M_local_word : new _Words[__rhs._M_word_size]; + + // Bump refs before doing callbacks, for safety. + _Callback_list* __cb = __rhs._M_callbacks; + if (__cb) + __cb->_M_add_reference(); + _M_call_callbacks(erase_event); + if (_M_word != _M_local_word) + { + delete [] _M_word; + _M_word = 0; + } + _M_dispose_callbacks(); + + // NB: Don't want any added during above. + _M_callbacks = __cb; + for (int __i = 0; __i < __rhs._M_word_size; ++__i) + __words[__i] = __rhs._M_word[__i]; + _M_word = __words; + _M_word_size = __rhs._M_word_size; + + this->flags(__rhs.flags()); + this->width(__rhs.width()); + this->precision(__rhs.precision()); + this->tie(__rhs.tie()); + this->fill(__rhs.fill()); + _M_ios_locale = __rhs.getloc(); + _M_cache_locale(_M_ios_locale); + + _M_call_callbacks(copyfmt_event); + + // The next is required to be the last assignment. + this->exceptions(__rhs.exceptions()); + } + return *this; + } + + // Locales: + template + locale + basic_ios<_CharT, _Traits>::imbue(const locale& __loc) + { + locale __old(this->getloc()); + ios_base::imbue(__loc); + _M_cache_locale(__loc); + if (this->rdbuf() != 0) + this->rdbuf()->pubimbue(__loc); + return __old; + } + + template + void + basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb) + { + // NB: This may be called more than once on the same object. + ios_base::_M_init(); + + // Cache locale data and specific facets used by iostreams. + _M_cache_locale(_M_ios_locale); + + // NB: The 27.4.4.1 Postconditions Table specifies requirements + // after basic_ios::init() has been called. As part of this, + // fill() must return widen(' ') any time after init() has been + // called, which needs an imbued ctype facet of char_type to + // return without throwing an exception. Unfortunately, + // ctype is not necessarily a required facet, so + // streams with char_type != [char, wchar_t] will not have it by + // default. If the ctype facet is available now, + // _M_fill is set here, but otherwise no fill character will be + // cached and a call to fill() will check for the facet again later + // (and will throw if the facet is still not present). This way + // unformatted input and output with non-required basic_ios + // instantiations is possible even without imbuing the expected + // ctype facet. + if (_M_ctype) + { + _M_fill = _M_ctype->widen(' '); + _M_fill_init = true; + } + else + _M_fill_init = false; + + _M_tie = 0; + _M_exception = goodbit; + _M_streambuf = __sb; + _M_streambuf_state = __sb ? goodbit : badbit; + } + + template + void + basic_ios<_CharT, _Traits>::_M_cache_locale(const locale& __loc) + { + _M_ctype = std::__try_use_facet<__ctype_type>(__loc); + _M_num_put = std::__try_use_facet<__num_put_type>(__loc); + _M_num_get = std::__try_use_facet<__num_get_type>(__loc); + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class basic_ios; + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class basic_ios; +#endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.tcc.blob new file mode 100644 index 0000000..de7c269 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_ios.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.h new file mode 100644 index 0000000..c90bd09 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.h @@ -0,0 +1,5041 @@ +// Components for manipulating sequences of characters -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/basic_string.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{string} + */ + +// +// ISO C++ 14882: 21 Strings library +// + +#ifndef _BASIC_STRING_H +#define _BASIC_STRING_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +#if __cplusplus >= 201103L +#include +#endif + +#include + +#ifdef __glibcxx_string_view // >= C++17 +# include +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 +# include // ranges::copy +# include // ranges::subrange +#endif + +#if __cplusplus > 202302L +# include +#endif + + +#if ! _GLIBCXX_USE_CXX11_ABI +# include "cow_string.h" +#else + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @class basic_string basic_string.h + * @brief Managing sequences of characters and character-like objects. + * + * @ingroup strings + * @ingroup sequences + * @headerfile string + * @since C++98 + * + * @tparam _CharT Type of character + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. + * + * Meets the requirements of a container, a + * reversible container, and a + * sequence. Of the + * optional sequence requirements, only + * @c push_back, @c at, and @c %array access are supported. + */ + template + class basic_string + { +#if __cplusplus >= 202002L + static_assert(is_trivially_copyable_v<_CharT> + && is_trivially_default_constructible_v<_CharT> + && is_standard_layout_v<_CharT>); + static_assert(is_same_v<_CharT, typename _Traits::char_type>); + static_assert(is_same_v<_CharT, typename _Alloc::value_type>); + using _Char_alloc_type = _Alloc; +#else + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_CharT>::other _Char_alloc_type; +#endif + + typedef __gnu_cxx::__alloc_traits<_Char_alloc_type> _Alloc_traits; + + // Types: + public: + typedef _Traits traits_type; + typedef typename _Traits::char_type value_type; + typedef _Char_alloc_type allocator_type; + typedef typename _Alloc_traits::size_type size_type; + typedef typename _Alloc_traits::difference_type difference_type; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + typedef typename _Alloc_traits::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef __gnu_cxx::__normal_iterator iterator; + typedef __gnu_cxx::__normal_iterator + const_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + + /// Value returned by various member functions when they fail. + static const size_type npos = static_cast(-1); + + protected: + // type used for positions in insert, erase etc. +#if __cplusplus < 201103L + typedef iterator __const_iterator; +#else + typedef const_iterator __const_iterator; +#endif + + private: + static _GLIBCXX20_CONSTEXPR pointer + _S_allocate(_Char_alloc_type& __a, size_type __n) + { + pointer __p = _Alloc_traits::allocate(__a, __n); +#if __glibcxx_constexpr_string >= 201907L + // std::char_traits begins the lifetime of characters, + // but custom traits might not, so do it here. + if constexpr (!is_same_v<_Traits, char_traits<_CharT>>) + if (std::__is_constant_evaluated()) + // Begin the lifetime of characters in allocated storage. + for (size_type __i = 0; __i < __n; ++__i) + std::construct_at(__builtin_addressof(__p[__i])); +#endif + return __p; + } + +#ifdef __glibcxx_string_view // >= C++17 + // A helper type for avoiding boiler-plate. + typedef basic_string_view<_CharT, _Traits> __sv_type; + + template + using _If_sv = enable_if_t< + __and_, + __not_>, + __not_>>::value, + _Res>; + + // Allows an implicit conversion to __sv_type. + _GLIBCXX20_CONSTEXPR + static __sv_type + _S_to_string_view(__sv_type __svt) noexcept + { return __svt; } + + // Wraps a string_view by explicit conversion and thus + // allows to add an internal constructor that does not + // participate in overload resolution when a string_view + // is provided. + struct __sv_wrapper + { + _GLIBCXX20_CONSTEXPR explicit + __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { } + + __sv_type _M_sv; + }; + + /** + * @brief Only internally used: Construct string from a string view + * wrapper. + * @param __svw string view wrapper. + * @param __a Allocator to use. + */ + _GLIBCXX20_CONSTEXPR + explicit + basic_string(__sv_wrapper __svw, const _Alloc& __a) + : basic_string(__svw._M_sv.data(), __svw._M_sv.size(), __a) { } +#endif + + // Use empty-base optimization: http://www.cantrip.org/emptyopt.html + struct _Alloc_hider : allocator_type // TODO check __is_final + { +#if __cplusplus < 201103L + _Alloc_hider(pointer __dat, const _Alloc& __a = _Alloc()) + : allocator_type(__a), _M_p(__dat) { } +#else + _GLIBCXX20_CONSTEXPR + _Alloc_hider(pointer __dat, const _Alloc& __a) + : allocator_type(__a), _M_p(__dat) { } + + _GLIBCXX20_CONSTEXPR + _Alloc_hider(pointer __dat, _Alloc&& __a = _Alloc()) + : allocator_type(std::move(__a)), _M_p(__dat) { } +#endif + + pointer _M_p; // The actual data. + }; + + _Alloc_hider _M_dataplus; + size_type _M_string_length; + + enum { _S_local_capacity = 15 / sizeof(_CharT) }; + + union + { + _CharT _M_local_buf[_S_local_capacity + 1]; + size_type _M_allocated_capacity; + }; + + _GLIBCXX20_CONSTEXPR + void + _M_data(pointer __p) + { _M_dataplus._M_p = __p; } + + _GLIBCXX20_CONSTEXPR + void + _M_length(size_type __length) + { _M_string_length = __length; } + + _GLIBCXX20_CONSTEXPR + pointer + _M_data() const + { return _M_dataplus._M_p; } + + _GLIBCXX20_CONSTEXPR + pointer + _M_local_data() + { +#if __cplusplus >= 201103L + return std::pointer_traits::pointer_to(*_M_local_buf); +#else + return pointer(_M_local_buf); +#endif + } + + _GLIBCXX20_CONSTEXPR + const_pointer + _M_local_data() const + { +#if __cplusplus >= 201103L + return std::pointer_traits::pointer_to(*_M_local_buf); +#else + return const_pointer(_M_local_buf); +#endif + } + + _GLIBCXX20_CONSTEXPR + void + _M_capacity(size_type __capacity) + { _M_allocated_capacity = __capacity; } + + _GLIBCXX20_CONSTEXPR + void + _M_set_length(size_type __n) + { + _M_length(__n); + traits_type::assign(_M_data()[__n], _CharT()); + } + + _GLIBCXX20_CONSTEXPR + bool + _M_is_local() const + { + if (_M_data() == _M_local_data()) + { + if (_M_string_length > _S_local_capacity) + __builtin_unreachable(); + return true; + } + return false; + } + + // Create & Destroy + _GLIBCXX20_CONSTEXPR + pointer + _M_create(size_type&, size_type); + + _GLIBCXX20_CONSTEXPR + void + _M_dispose() + { + if (!_M_is_local()) + _M_destroy(_M_allocated_capacity); + } + + _GLIBCXX20_CONSTEXPR + void + _M_destroy(size_type __size) throw() + { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); } + +#if __cplusplus < 201103L || defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS + // _M_construct_aux is used to implement the 21.3.1 para 15 which + // requires special behaviour if _InIterator is an integral type + template + void + _M_construct_aux(_InIterator __beg, _InIterator __end, + std::__false_type) + { + typedef typename iterator_traits<_InIterator>::iterator_category _Tag; + _M_construct(__beg, __end, _Tag()); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type) + { _M_construct_aux_2(static_cast(__beg), __end); } + + void + _M_construct_aux_2(size_type __req, _CharT __c) + { _M_construct(__req, __c); } +#endif + + // For Input Iterators, used in istreambuf_iterators, etc. + template + _GLIBCXX20_CONSTEXPR + void + _M_construct(_InIterator __beg, _InIterator __end, + std::input_iterator_tag); + + // For forward_iterators up to random_access_iterators, used for + // string::iterator, _CharT*, etc. + template + _GLIBCXX20_CONSTEXPR + void + _M_construct(_FwdIterator __beg, _FwdIterator __end, + std::forward_iterator_tag); + + _GLIBCXX20_CONSTEXPR + void + _M_construct(size_type __req, _CharT __c); + + // Construct using block of memory of known size. + // If _Terminated is true assume that source is already 0 terminated. + template + _GLIBCXX20_CONSTEXPR + void + _M_construct(const _CharT *__c, size_type __n); + + _GLIBCXX20_CONSTEXPR + allocator_type& + _M_get_allocator() + { return _M_dataplus; } + + _GLIBCXX20_CONSTEXPR + const allocator_type& + _M_get_allocator() const + { return _M_dataplus; } + + // Ensure that _M_local_buf is the active member of the union. + __attribute__((__always_inline__)) + _GLIBCXX14_CONSTEXPR + void + _M_init_local_buf() _GLIBCXX_NOEXCEPT + { +#if __glibcxx_is_constant_evaluated + if (std::is_constant_evaluated()) + for (size_type __i = 0; __i <= _S_local_capacity; ++__i) + _M_local_buf[__i] = _CharT(); +#endif + } + + __attribute__((__always_inline__)) + _GLIBCXX14_CONSTEXPR + pointer + _M_use_local_data() _GLIBCXX_NOEXCEPT + { +#if __cpp_lib_is_constant_evaluated + _M_init_local_buf(); +#endif + return _M_local_data(); + } + + private: + +#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST + // The explicit instantiations in misc-inst.cc require this due to + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063 + template::__value + && !__are_same<_Tp, const _CharT*>::__value + && !__are_same<_Tp, iterator>::__value + && !__are_same<_Tp, const_iterator>::__value> + struct __enable_if_not_native_iterator + { typedef basic_string& __type; }; + template + struct __enable_if_not_native_iterator<_Tp, false> { }; +#endif + + _GLIBCXX20_CONSTEXPR + size_type + _M_check(size_type __pos, const char* __s) const + { + if (__pos > this->size()) + __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > " + "this->size() (which is %zu)"), + __s, __pos, this->size()); + return __pos; + } + + _GLIBCXX20_CONSTEXPR + void + _M_check_length(size_type __n1, size_type __n2, const char* __s) const + { + if (this->max_size() - (this->size() - __n1) < __n2) + __throw_length_error(__N(__s)); + } + + + // NB: _M_limit doesn't check for a bad __pos value. + _GLIBCXX20_CONSTEXPR + size_type + _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT + { + const bool __testoff = __off < this->size() - __pos; + return __testoff ? __off : this->size() - __pos; + } + + // True if _Rep and source do not overlap. + bool + _M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT + { + return (less()(__s, _M_data()) + || less()(_M_data() + this->size(), __s)); + } + + // When __n = 1 way faster than the general multichar + // traits_type::copy/move/assign. + _GLIBCXX20_CONSTEXPR + static void + _S_copy(_CharT* __d, const _CharT* __s, size_type __n) + { + if (__n == 1) + traits_type::assign(*__d, *__s); + else + traits_type::copy(__d, __s, __n); + } + + _GLIBCXX20_CONSTEXPR + static void + _S_move(_CharT* __d, const _CharT* __s, size_type __n) + { + if (__n == 1) + traits_type::assign(*__d, *__s); + else + traits_type::move(__d, __s, __n); + } + + _GLIBCXX20_CONSTEXPR + static void + _S_assign(_CharT* __d, size_type __n, _CharT __c) + { + if (__n == 1) + traits_type::assign(*__d, __c); + else + traits_type::assign(__d, __n, __c); + } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + // _S_copy_chars is a separate template to permit specialization + // to optimize for the common case of pointers as iterators. + template + _GLIBCXX20_CONSTEXPR + static void + _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) + { +#if __cplusplus >= 201103L + using _IterBase = decltype(std::__niter_base(__k1)); + if constexpr (__or_, + is_same<_IterBase, const _CharT*>>::value) + _S_copy(__p, std::__niter_base(__k1), __k2 - __k1); +#if __cpp_lib_concepts + else if constexpr (requires { + requires contiguous_iterator<_Iterator>; + { std::to_address(__k1) } + -> convertible_to; + }) + { + const auto __d = __k2 - __k1; + (void) (__k1 + __d); // See P3349R1 + _S_copy(__p, std::to_address(__k1), static_cast(__d)); + } +#endif + else +#endif + for (; __k1 != __k2; ++__k1, (void)++__p) + traits_type::assign(*__p, static_cast<_CharT>(*__k1)); + } +#pragma GCC diagnostic pop + +#if __cplusplus < 201103L || defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS + static void + _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) + { _S_copy_chars(__p, __k1.base(), __k2.base()); } + + static void + _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) + { _S_copy_chars(__p, __k1.base(), __k2.base()); } + + static void + _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) + { _S_copy(__p, __k1, __k2 - __k1); } + + static void + _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) + { _S_copy(__p, __k1, __k2 - __k1); } +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 + // pre: __n == ranges::distance(__rg). __p+[0,__n) is a valid range. + template + static constexpr void + _S_copy_range(pointer __p, _Rg&& __rg, size_type __n) + { + if constexpr (requires { + requires ranges::contiguous_range<_Rg>; + { ranges::data(std::forward<_Rg>(__rg)) } + -> convertible_to; + }) + _S_copy(__p, ranges::data(std::forward<_Rg>(__rg)), __n); + else + { + auto __first = ranges::begin(__rg); + const auto __last = ranges::end(__rg); + for (; __first != __last; ++__first) + traits_type::assign(*__p++, static_cast<_CharT>(*__first)); + } + } +#endif + + _GLIBCXX20_CONSTEXPR + static int + _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT + { + const difference_type __d = difference_type(__n1 - __n2); + + if (__d > __gnu_cxx::__numeric_traits::__max) + return __gnu_cxx::__numeric_traits::__max; + else if (__d < __gnu_cxx::__numeric_traits::__min) + return __gnu_cxx::__numeric_traits::__min; + else + return int(__d); + } + + _GLIBCXX20_CONSTEXPR + void + _M_assign(const basic_string&); + + _GLIBCXX20_CONSTEXPR + void + _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, + size_type __len2); + + _GLIBCXX20_CONSTEXPR + void + _M_erase(size_type __pos, size_type __n); + + public: + // Construct/copy/destroy: + // NB: We overload ctors in some cases instead of using default + // arguments, per 17.4.4.4 para. 2 item 2. + + /** + * @brief Default constructor creates an empty string. + */ + _GLIBCXX20_CONSTEXPR + basic_string() + _GLIBCXX_NOEXCEPT_IF(is_nothrow_default_constructible<_Alloc>::value) +#if __cpp_concepts && __glibcxx_type_trait_variable_templates + requires is_default_constructible_v<_Alloc> +#endif + : _M_dataplus(_M_local_data()) + { + _M_init_local_buf(); + _M_set_length(0); + } + + /** + * @brief Construct an empty string using allocator @a a. + */ + _GLIBCXX20_CONSTEXPR + explicit + basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT + : _M_dataplus(_M_local_data(), __a) + { + _M_init_local_buf(); + _M_set_length(0); + } + + /** + * @brief Construct string with copy of value of @a __str. + * @param __str Source string. + */ + _GLIBCXX20_CONSTEXPR + basic_string(const basic_string& __str) + : _M_dataplus(_M_local_data(), + _Alloc_traits::_S_select_on_copy(__str._M_get_allocator())) + { + _M_construct(__str._M_data(), __str.length()); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2583. no way to supply an allocator for basic_string(str, pos) + /** + * @brief Construct string as copy of a substring. + * @param __str Source string. + * @param __pos Index of first character to copy from. + * @param __a Allocator to use. + */ + _GLIBCXX20_CONSTEXPR + basic_string(const basic_string& __str, size_type __pos, + const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { + const _CharT* __start = __str._M_data() + + __str._M_check(__pos, "basic_string::basic_string"); + _M_construct(__start, __start + __str._M_limit(__pos, npos), + std::forward_iterator_tag()); + } + + /** + * @brief Construct string as copy of a substring. + * @param __str Source string. + * @param __pos Index of first character to copy from. + * @param __n Number of characters to copy. + */ + _GLIBCXX20_CONSTEXPR + basic_string(const basic_string& __str, size_type __pos, + size_type __n) + : _M_dataplus(_M_local_data()) + { + const _CharT* __start = __str._M_data() + + __str._M_check(__pos, "basic_string::basic_string"); + _M_construct(__start, __start + __str._M_limit(__pos, __n), + std::forward_iterator_tag()); + } + + /** + * @brief Construct string as copy of a substring. + * @param __str Source string. + * @param __pos Index of first character to copy from. + * @param __n Number of characters to copy. + * @param __a Allocator to use. + */ + _GLIBCXX20_CONSTEXPR + basic_string(const basic_string& __str, size_type __pos, + size_type __n, const _Alloc& __a) + : _M_dataplus(_M_local_data(), __a) + { + const _CharT* __start + = __str._M_data() + __str._M_check(__pos, "string::string"); + _M_construct(__start, __start + __str._M_limit(__pos, __n), + std::forward_iterator_tag()); + } + + /** + * @brief Construct string initialized by a character %array. + * @param __s Source character %array. + * @param __n Number of characters to copy. + * @param __a Allocator to use (default is default allocator). + * + * NB: @a __s must have at least @a __n characters, '\\0' + * has no special meaning. + */ + _GLIBCXX20_CONSTEXPR + basic_string(const _CharT* __s, size_type __n, + const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { + // NB: Not required, but considered best practice. + if (__s == 0 && __n > 0) + std::__throw_logic_error(__N("basic_string: " + "construction from null is not valid")); + _M_construct(__s, __s + __n, std::forward_iterator_tag()); + } + + /** + * @brief Construct string as copy of a C string. + * @param __s Source C string. + * @param __a Allocator to use (default is default allocator). + */ +#if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3076. basic_string CTAD ambiguity + template> +#endif + _GLIBCXX20_CONSTEXPR + basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { + // NB: Not required, but considered best practice. + if (__s == 0) + std::__throw_logic_error(__N("basic_string: " + "construction from null is not valid")); + const _CharT* __end = __s + traits_type::length(__s); + _M_construct(__s, __end, forward_iterator_tag()); + } + + /** + * @brief Construct string as multiple characters. + * @param __n Number of characters. + * @param __c Character to use. + * @param __a Allocator to use (default is default allocator). + */ +#if __cpp_deduction_guides && ! defined _GLIBCXX_DEFINING_STRING_INSTANTIATIONS + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3076. basic_string CTAD ambiguity + template> +#endif + _GLIBCXX20_CONSTEXPR + basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { _M_construct(__n, __c); } + +#if __cplusplus >= 201103L + /** + * @brief Move construct string. + * @param __str Source string. + * + * The newly-created string contains the exact contents of @a __str. + * @a __str is a valid, but unspecified string. + */ + _GLIBCXX20_CONSTEXPR + basic_string(basic_string&& __str) noexcept + : _M_dataplus(_M_local_data(), std::move(__str._M_get_allocator())) + { + if (__str._M_is_local()) + { + _M_init_local_buf(); + traits_type::copy(_M_local_buf, __str._M_local_buf, + __str.length() + 1); + } + else + { + _M_data(__str._M_data()); + _M_capacity(__str._M_allocated_capacity); + } + + // Must use _M_length() here not _M_set_length() because + // basic_stringbuf relies on writing into unallocated capacity so + // we mess up the contents if we put a '\0' in the string. + _M_length(__str.length()); + __str._M_data(__str._M_use_local_data()); + __str._M_set_length(0); + } + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Construct a string from a range. + * @since C++23 + */ + template<__detail::__container_compatible_range<_CharT> _Rg> + constexpr + basic_string(from_range_t, _Rg&& __rg, const _Alloc& __a = _Alloc()) + : basic_string(__a) + { + if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) + { + const auto __n = static_cast(ranges::distance(__rg)); + reserve(__n); + _S_copy_range(_M_data(), std::forward<_Rg>(__rg), __n); + _M_set_length(__n); + } + else + { + auto __first = ranges::begin(__rg); + const auto __last = ranges::end(__rg); + for (; __first != __last; ++__first) + push_back(*__first); + } + } +#endif + + /** + * @brief Construct string from an initializer %list. + * @param __l std::initializer_list of characters. + * @param __a Allocator to use (default is default allocator). + */ + _GLIBCXX20_CONSTEXPR + basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { _M_construct(__l.begin(), __l.end(), std::forward_iterator_tag()); } + + _GLIBCXX20_CONSTEXPR + basic_string(const basic_string& __str, const _Alloc& __a) + : _M_dataplus(_M_local_data(), __a) + { _M_construct(__str.begin(), __str.end(), std::forward_iterator_tag()); } + + _GLIBCXX20_CONSTEXPR + basic_string(basic_string&& __str, const _Alloc& __a) + noexcept(_Alloc_traits::_S_always_equal()) + : _M_dataplus(_M_local_data(), __a) + { + if (__str._M_is_local()) + { + _M_init_local_buf(); + traits_type::copy(_M_local_buf, __str._M_local_buf, + __str.length() + 1); + _M_length(__str.length()); + __str._M_set_length(0); + } + else if (_Alloc_traits::_S_always_equal() + || __str.get_allocator() == __a) + { + _M_data(__str._M_data()); + _M_length(__str.length()); + _M_capacity(__str._M_allocated_capacity); + __str._M_data(__str._M_use_local_data()); + __str._M_set_length(0); + } + else + _M_construct(__str.begin(), __str.end(), std::forward_iterator_tag()); + } +#endif // C++11 + +#if __cplusplus >= 202100L + basic_string(nullptr_t) = delete; + basic_string& operator=(nullptr_t) = delete; +#endif // C++23 + + /** + * @brief Construct string as copy of a range. + * @param __beg Start of range. + * @param __end End of range. + * @param __a Allocator to use (default is default allocator). + */ +#if __cplusplus >= 201103L + template> +#else + template +#endif + _GLIBCXX20_CONSTEXPR + basic_string(_InputIterator __beg, _InputIterator __end, + const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a), _M_string_length(0) + { +#if __cplusplus >= 201103L + _M_construct(__beg, __end, std::__iterator_category(__beg)); +#else + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_construct_aux(__beg, __end, _Integral()); +#endif + } + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Construct string from a substring of a string_view. + * @param __t Source object convertible to string view. + * @param __pos The index of the first character to copy from __t. + * @param __n The number of characters to copy from __t. + * @param __a Allocator to use. + */ + template>> + _GLIBCXX20_CONSTEXPR + basic_string(const _Tp& __t, size_type __pos, size_type __n, + const _Alloc& __a = _Alloc()) + : basic_string(_S_to_string_view(__t).substr(__pos, __n), __a) { } + + /** + * @brief Construct string from a string_view. + * @param __t Source object convertible to string view. + * @param __a Allocator to use (default is default allocator). + */ + template> + _GLIBCXX20_CONSTEXPR + explicit + basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) + : basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { } +#endif // C++17 + + /** + * @brief Destroy the string instance. + */ + _GLIBCXX20_CONSTEXPR + ~basic_string() + { _M_dispose(); } + + /** + * @brief Assign the value of @a str to this string. + * @param __str Source string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + operator=(const basic_string& __str) + { + return this->assign(__str); + } + + /** + * @brief Copy contents of @a s into this string. + * @param __s Source null-terminated string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + operator=(const _CharT* __s) + { return this->assign(__s); } + + /** + * @brief Set value to string of length 1. + * @param __c Source character. + * + * Assigning to a character makes this string length 1 and + * (*this)[0] == @a c. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + operator=(_CharT __c) + { + this->assign(1, __c); + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Move assign the value of @a str to this string. + * @param __str Source string. + * + * The contents of @a str are moved into this string (without copying). + * @a str is a valid, but unspecified string. + */ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2063. Contradictory requirements for string move assignment + _GLIBCXX20_CONSTEXPR + basic_string& + operator=(basic_string&& __str) + noexcept(_Alloc_traits::_S_nothrow_move()) + { + const bool __equal_allocs = _Alloc_traits::_S_always_equal() + || _M_get_allocator() == __str._M_get_allocator(); + if (!_M_is_local() && _Alloc_traits::_S_propagate_on_move_assign() + && !__equal_allocs) + { + // Destroy existing storage before replacing allocator. + _M_destroy(_M_allocated_capacity); + _M_data(_M_local_data()); + _M_set_length(0); + } + // Replace allocator if POCMA is true. + std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator()); + + if (__str._M_is_local()) + { + // We've always got room for a short string, just copy it + // (unless this is a self-move, because that would violate the + // char_traits::copy precondition that the ranges don't overlap). + if (__builtin_expect(std::__addressof(__str) != this, true)) + { + if (__str.size()) + this->_S_copy(_M_data(), __str._M_data(), __str.size()); + _M_set_length(__str.size()); + } + } + else if (_Alloc_traits::_S_propagate_on_move_assign() || __equal_allocs) + { + // Just move the allocated pointer, our allocator can free it. + pointer __data = nullptr; + size_type __capacity; + if (!_M_is_local()) + { + if (__equal_allocs) + { + // __str can reuse our existing storage. + __data = _M_data(); + __capacity = _M_allocated_capacity; + } + else // __str can't use it, so free it. + _M_destroy(_M_allocated_capacity); + } + + _M_data(__str._M_data()); + _M_length(__str.length()); + _M_capacity(__str._M_allocated_capacity); + if (__data) + { + __str._M_data(__data); + __str._M_capacity(__capacity); + } + else + __str._M_data(__str._M_use_local_data()); + } + else // Need to do a deep copy + _M_assign(__str); + __str.clear(); + return *this; + } + + /** + * @brief Set value to string constructed from initializer %list. + * @param __l std::initializer_list. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + operator=(initializer_list<_CharT> __l) + { + this->assign(__l.begin(), __l.size()); + return *this; + } +#endif // C++11 + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Set value to string constructed from a string_view. + * @param __svt An object convertible to string_view. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + operator=(const _Tp& __svt) + { return this->assign(__svt); } + + /** + * @brief Convert to a string_view. + * @return A string_view. + */ + _GLIBCXX20_CONSTEXPR + operator __sv_type() const noexcept + { return __sv_type(data(), size()); } +#endif // C++17 + + // Iterators: + /** + * Returns a read/write iterator that points to the first character in + * the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_M_data()); } + + /** + * Returns a read-only (constant) iterator that points to the first + * character in the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_M_data()); } + + /** + * Returns a read/write iterator that points one past the last + * character in the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_M_data() + this->size()); } + + /** + * Returns a read-only (constant) iterator that points one past the + * last character in the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_M_data() + this->size()); } + + /** + * Returns a read/write reverse iterator that points to the last + * character in the %string. Iteration is done in reverse element + * order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(this->end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last character in the %string. Iteration is done in + * reverse element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(this->end()); } + + /** + * Returns a read/write reverse iterator that points to one before the + * first character in the %string. Iteration is done in reverse + * element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(this->begin()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first character in the %string. Iteration + * is done in reverse element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(this->begin()); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the first + * character in the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_iterator + cbegin() const noexcept + { return const_iterator(this->_M_data()); } + + /** + * Returns a read-only (constant) iterator that points one past the + * last character in the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_iterator + cend() const noexcept + { return const_iterator(this->_M_data() + this->size()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last character in the %string. Iteration is done in + * reverse element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(this->end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first character in the %string. Iteration + * is done in reverse element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(this->begin()); } +#endif + + public: + // Capacity: + /// Returns the number of characters in the string, not including any + /// null-termination. + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + size() const _GLIBCXX_NOEXCEPT + { + size_type __sz = _M_string_length; + if (__sz > max_size ()) + __builtin_unreachable (); + return __sz; + } + + /// Returns the number of characters in the string, not including any + /// null-termination. + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + length() const _GLIBCXX_NOEXCEPT + { return size(); } + + /// Returns the size() of the largest possible %string. + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + max_size() const _GLIBCXX_NOEXCEPT + { + const size_t __diffmax + = __gnu_cxx::__numeric_traits::__max / sizeof(_CharT); + const size_t __allocmax = _Alloc_traits::max_size(_M_get_allocator()); + return (std::min)(__diffmax, __allocmax) - 1; + } + + /** + * @brief Resizes the %string to the specified number of characters. + * @param __n Number of characters the %string should contain. + * @param __c Character to fill any new elements. + * + * This function will %resize the %string to the specified + * number of characters. If the number is smaller than the + * %string's current size the %string is truncated, otherwise + * the %string is extended and new elements are %set to @a __c. + */ + _GLIBCXX20_CONSTEXPR + void + resize(size_type __n, _CharT __c); + + /** + * @brief Resizes the %string to the specified number of characters. + * @param __n Number of characters the %string should contain. + * + * This function will resize the %string to the specified length. If + * the new size is smaller than the %string's current size the %string + * is truncated, otherwise the %string is extended and new characters + * are default-constructed. For basic types such as char, this means + * setting them to 0. + */ + _GLIBCXX20_CONSTEXPR + void + resize(size_type __n) + { this->resize(__n, _CharT()); } + +#if __cplusplus >= 201103L +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + /// A non-binding request to reduce capacity() to size(). + _GLIBCXX20_CONSTEXPR + void + shrink_to_fit() noexcept + { reserve(); } +#pragma GCC diagnostic pop +#endif + +#ifdef __glibcxx_string_resize_and_overwrite // C++ >= 23 + /** Resize the string and call a function to fill it. + * + * @param __n The maximum size requested. + * @param __op A callable object that writes characters to the string. + * + * This is a low-level function that is easy to misuse, be careful. + * + * Calling `str.resize_and_overwrite(n, op)` will reserve at least `n` + * characters in `str`, evaluate `n2 = std::move(op)(str.data(), n)`, + * and finally set the string length to `n2` (adding a null terminator + * at the end). The function object `op` is allowed to write to the + * extra capacity added by the initial reserve operation, which is not + * allowed if you just call `str.reserve(n)` yourself. + * + * This can be used to efficiently fill a `string` buffer without the + * overhead of zero-initializing characters that will be overwritten + * anyway. + * + * The callable `op` must not access the string directly (only through + * the pointer passed as its first argument), must not write more than + * `n` characters to the string, must return a value no greater than `n`, + * and must ensure that all characters up to the returned length are + * valid after it returns (i.e. there must be no uninitialized values + * left in the string after the call, because accessing them would + * have undefined behaviour). If `op` exits by throwing an exception + * the behaviour is undefined. + * + * @since C++23 + */ + template + constexpr void + resize_and_overwrite(size_type __n, _Operation __op); +#endif + +#if __cplusplus >= 201103L + /// Non-standard version of resize_and_overwrite for C++11 and above. + template + _GLIBCXX20_CONSTEXPR void + __resize_and_overwrite(size_type __n, _Operation __op); +#endif + + /** + * Returns the total number of characters that the %string can hold + * before needing to allocate more memory. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + capacity() const _GLIBCXX_NOEXCEPT + { + size_t __sz = _M_is_local() ? size_type(_S_local_capacity) + : _M_allocated_capacity; + if (__sz < _S_local_capacity || __sz > max_size ()) + __builtin_unreachable (); + return __sz; + } + + /** + * @brief Attempt to preallocate enough memory for specified number of + * characters. + * @param __res_arg Number of characters required. + * @throw std::length_error If @a __res_arg exceeds @c max_size(). + * + * This function attempts to reserve enough memory for the + * %string to hold the specified number of characters. If the + * number requested is more than max_size(), length_error is + * thrown. + * + * The advantage of this function is that if optimal code is a + * necessity and the user can determine the string length that will be + * required, the user can reserve the memory in %advance, and thus + * prevent a possible reallocation of memory and copying of %string + * data. + */ + _GLIBCXX20_CONSTEXPR + void + reserve(size_type __res_arg); + + /** + * Equivalent to shrink_to_fit(). + */ +#if __cplusplus > 201703L + [[deprecated("use shrink_to_fit() instead")]] +#endif + _GLIBCXX20_CONSTEXPR + void + reserve(); + + /** + * Erases the string, making it empty. + */ + _GLIBCXX20_CONSTEXPR + void + clear() _GLIBCXX_NOEXCEPT + { _M_set_length(0); } + + /** + * Returns true if the %string is empty. Equivalent to + * *this == "". + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + bool + empty() const _GLIBCXX_NOEXCEPT + { return _M_string_length == 0; } + + // Element access: + /** + * @brief Subscript access to the data contained in the %string. + * @param __pos The index of the character to access. + * @return Read-only (constant) reference to the character. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT + { + __glibcxx_assert(__pos <= size()); + return _M_data()[__pos]; + } + + /** + * @brief Subscript access to the data contained in the %string. + * @param __pos The index of the character to access. + * @return Read/write reference to the character. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + operator[](size_type __pos) + { + // Allow pos == size() both in C++98 mode, as v3 extension, + // and in C++11 mode. + __glibcxx_assert(__pos <= size()); + // In pedantic mode be strict in C++98 mode. + _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < size()); + return _M_data()[__pos]; + } + + /** + * @brief Provides access to the data contained in the %string. + * @param __n The index of the character to access. + * @return Read-only (const) reference to the character. + * @throw std::out_of_range If @a n is an invalid index. + * + * This function provides for safer data access. The parameter is + * first checked that it is in the range of the string. The function + * throws out_of_range if the check fails. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + at(size_type __n) const + { + if (__n >= this->size()) + __throw_out_of_range_fmt(__N("basic_string::at: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + return _M_data()[__n]; + } + + /** + * @brief Provides access to the data contained in the %string. + * @param __n The index of the character to access. + * @return Read/write reference to the character. + * @throw std::out_of_range If @a n is an invalid index. + * + * This function provides for safer data access. The parameter is + * first checked that it is in the range of the string. The function + * throws out_of_range if the check fails. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + at(size_type __n) + { + if (__n >= size()) + __throw_out_of_range_fmt(__N("basic_string::at: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + return _M_data()[__n]; + } + +#if __cplusplus >= 201103L + /** + * Returns a read/write reference to the data at the first + * element of the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + front() noexcept + { + __glibcxx_assert(!empty()); + return operator[](0); + } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + front() const noexcept + { + __glibcxx_assert(!empty()); + return operator[](0); + } + + /** + * Returns a read/write reference to the data at the last + * element of the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + back() noexcept + { + __glibcxx_assert(!empty()); + return operator[](this->size() - 1); + } + + /** + * Returns a read-only (constant) reference to the data at the + * last element of the %string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + back() const noexcept + { + __glibcxx_assert(!empty()); + return operator[](this->size() - 1); + } +#endif + + // Modifiers: + /** + * @brief Append a string to this string. + * @param __str The string to append. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + operator+=(const basic_string& __str) + { return this->append(__str); } + + /** + * @brief Append a C string. + * @param __s The C string to append. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + operator+=(const _CharT* __s) + { return this->append(__s); } + + /** + * @brief Append a character. + * @param __c The character to append. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + operator+=(_CharT __c) + { + this->push_back(__c); + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Append an initializer_list of characters. + * @param __l The initializer_list of characters to be appended. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + operator+=(initializer_list<_CharT> __l) + { return this->append(__l.begin(), __l.size()); } +#endif // C++11 + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Append a string_view. + * @param __svt An object convertible to string_view to be appended. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + operator+=(const _Tp& __svt) + { return this->append(__svt); } +#endif // C++17 + + /** + * @brief Append a string to this string. + * @param __str The string to append. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + append(const basic_string& __str) + { return this->append(__str._M_data(), __str.size()); } + + /** + * @brief Append a substring. + * @param __str The string to append. + * @param __pos Index of the first character of str to append. + * @param __n The number of characters to append. + * @return Reference to this string. + * @throw std::out_of_range if @a __pos is not a valid index. + * + * This function appends @a __n characters from @a __str + * starting at @a __pos to this string. If @a __n is is larger + * than the number of available characters in @a __str, the + * remainder of @a __str is appended. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + append(const basic_string& __str, size_type __pos, size_type __n = npos) + { return this->append(__str._M_data() + + __str._M_check(__pos, "basic_string::append"), + __str._M_limit(__pos, __n)); } + + /** + * @brief Append a C substring. + * @param __s The C string to append. + * @param __n The number of characters to append. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + append(const _CharT* __s, size_type __n) + { + __glibcxx_requires_string_len(__s, __n); + _M_check_length(size_type(0), __n, "basic_string::append"); + return _M_append(__s, __n); + } + + /** + * @brief Append a C string. + * @param __s The C string to append. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + append(const _CharT* __s) + { + __glibcxx_requires_string(__s); + const size_type __n = traits_type::length(__s); + _M_check_length(size_type(0), __n, "basic_string::append"); + return _M_append(__s, __n); + } + + /** + * @brief Append multiple characters. + * @param __n The number of characters to append. + * @param __c The character to use. + * @return Reference to this string. + * + * Appends __n copies of __c to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + append(size_type __n, _CharT __c) + { return _M_replace_aux(this->size(), size_type(0), __n, __c); } + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Append a range to the string. + * @param __rg A range of values that are convertible to `value_type`. + * @since C++23 + * + * The range `__rg` is allowed to overlap with `*this`. + */ + template<__detail::__container_compatible_range<_CharT> _Rg> + constexpr basic_string& + append_range(_Rg&& __rg) + { + // N.B. __rg may overlap with *this, so we must copy from __rg before + // existing elements or iterators referring to *this are invalidated. + // e.g. in s.append_range(views::concat(s, str)), rg overlaps s. + if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) + { + const auto __len = size_type(ranges::distance(__rg)); + + // Don't care if this addition wraps around, we check it below: + const size_type __newlen = size() + __len; + + if ((capacity() - size()) >= __len) + _S_copy_range(_M_data() + size(), std::forward<_Rg>(__rg), + __len); + else + { + _M_check_length(0, __len, "basic_string::append_range"); + basic_string __s(_M_get_allocator()); + __s.reserve(__newlen); + _S_copy_range(__s._M_data() + size(), std::forward<_Rg>(__rg), + __len); + _S_copy(__s._M_data(), _M_data(), size()); + if (!_M_is_local()) + _M_destroy(_M_allocated_capacity); + _M_data(__s._M_data()); + _M_capacity(__s._M_allocated_capacity); + __s._M_data(__s._M_local_data()); + __s._M_length(0); + } + _M_set_length(__newlen); // adds null-terminator + } + else + { + basic_string __s(from_range, std::forward<_Rg>(__rg), + _M_get_allocator()); + append(__s); + } + return *this; + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Append an initializer_list of characters. + * @param __l The initializer_list of characters to append. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + append(initializer_list<_CharT> __l) + { return this->append(__l.begin(), __l.size()); } +#endif // C++11 + + /** + * @brief Append a range of characters. + * @param __first Iterator referencing the first character to append. + * @param __last Iterator marking the end of the range. + * @return Reference to this string. + * + * Appends characters in the range [__first,__last) to this string. + */ +#if __cplusplus >= 201103L + template> + _GLIBCXX20_CONSTEXPR +#else + template +#endif + basic_string& + append(_InputIterator __first, _InputIterator __last) + { return this->replace(end(), end(), __first, __last); } + +#ifdef __glibcxx_string_view + /** + * @brief Append a string_view. + * @param __svt An object convertible to string_view to be appended. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + append(const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->append(__sv.data(), __sv.size()); + } + + /** + * @brief Append a range of characters from a string_view. + * @param __svt An object convertible to string_view to be appended from. + * @param __pos The position in the string_view to append from. + * @param __n The number of characters to append from the string_view. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + append(const _Tp& __svt, size_type __pos, size_type __n = npos) + { + __sv_type __sv = __svt; + return _M_append(__sv.data() + + std::__sv_check(__sv.size(), __pos, "basic_string::append"), + std::__sv_limit(__sv.size(), __pos, __n)); + } +#endif // C++17 + + /** + * @brief Append a single character. + * @param __c Character to append. + */ + _GLIBCXX20_CONSTEXPR + void + push_back(_CharT __c) + { + const size_type __size = this->size(); + if (__size + 1 > this->capacity()) + this->_M_mutate(__size, size_type(0), 0, size_type(1)); + traits_type::assign(this->_M_data()[__size], __c); + this->_M_set_length(__size + 1); + } + + /** + * @brief Set value to contents of another string. + * @param __str Source string to use. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + assign(const basic_string& __str) + { +#if __cplusplus >= 201103L + if (_Alloc_traits::_S_propagate_on_copy_assign()) + { + if (!_Alloc_traits::_S_always_equal() && !_M_is_local() + && _M_get_allocator() != __str._M_get_allocator()) + { + // Propagating allocator cannot free existing storage so must + // deallocate it before replacing current allocator. + if (__str.size() <= _S_local_capacity) + { + _M_destroy(_M_allocated_capacity); + _M_data(_M_use_local_data()); + _M_set_length(0); + } + else + { + const auto __len = __str.size(); + auto __alloc = __str._M_get_allocator(); + // If this allocation throws there are no effects: + auto __ptr = _S_allocate(__alloc, __len + 1); + _M_destroy(_M_allocated_capacity); + _M_data(__ptr); + _M_capacity(__len); + _M_set_length(__len); + } + } + std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator()); + } +#endif + this->_M_assign(__str); + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Set value to contents of another string. + * @param __str Source string to use. + * @return Reference to this string. + * + * This function sets this string to the exact contents of @a __str. + * @a __str is a valid, but unspecified string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + assign(basic_string&& __str) + noexcept(_Alloc_traits::_S_nothrow_move()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2063. Contradictory requirements for string move assignment + return *this = std::move(__str); + } +#endif // C++11 + + /** + * @brief Set value to a substring of a string. + * @param __str The string to use. + * @param __pos Index of the first character of str. + * @param __n Number of characters to use. + * @return Reference to this string. + * @throw std::out_of_range if @a pos is not a valid index. + * + * This function sets this string to the substring of @a __str + * consisting of @a __n characters at @a __pos. If @a __n is + * is larger than the number of available characters in @a + * __str, the remainder of @a __str is used. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + assign(const basic_string& __str, size_type __pos, size_type __n = npos) + { return _M_replace(size_type(0), this->size(), __str._M_data() + + __str._M_check(__pos, "basic_string::assign"), + __str._M_limit(__pos, __n)); } + + /** + * @brief Set value to a C substring. + * @param __s The C string to use. + * @param __n Number of characters to use. + * @return Reference to this string. + * + * This function sets the value of this string to the first @a __n + * characters of @a __s. If @a __n is is larger than the number of + * available characters in @a __s, the remainder of @a __s is used. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + assign(const _CharT* __s, size_type __n) + { + __glibcxx_requires_string_len(__s, __n); + return _M_replace(size_type(0), this->size(), __s, __n); + } + + /** + * @brief Set value to contents of a C string. + * @param __s The C string to use. + * @return Reference to this string. + * + * This function sets the value of this string to the value of @a __s. + * The data is copied, so there is no dependence on @a __s once the + * function returns. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + assign(const _CharT* __s) + { + __glibcxx_requires_string(__s); + return _M_replace(size_type(0), this->size(), __s, + traits_type::length(__s)); + } + + /** + * @brief Set value to multiple characters. + * @param __n Length of the resulting string. + * @param __c The character to use. + * @return Reference to this string. + * + * This function sets the value of this string to @a __n copies of + * character @a __c. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + assign(size_type __n, _CharT __c) + { return _M_replace_aux(size_type(0), this->size(), __n, __c); } + + /** + * @brief Set value to a range of characters. + * @param __first Iterator referencing the first character to append. + * @param __last Iterator marking the end of the range. + * @return Reference to this string. + * + * Sets value of string to characters in the range [__first,__last). + */ +#if __cplusplus >= 201103L +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + template> + _GLIBCXX20_CONSTEXPR + basic_string& + assign(_InputIterator __first, _InputIterator __last) + { + using _IterTraits = iterator_traits<_InputIterator>; + if constexpr (is_pointer::value + && is_same::value) + { + __glibcxx_requires_valid_range(__first, __last); + return _M_replace(size_type(0), size(), + std::__niter_base(__first), __last - __first); + } +#if __cplusplus >= 202002L + else if constexpr (contiguous_iterator<_InputIterator> + && is_same_v, + _CharT>) + { + __glibcxx_requires_valid_range(__first, __last); + return _M_replace(size_type(0), size(), + std::to_address(__first), __last - __first); + } +#endif + else + return *this = basic_string(__first, __last, get_allocator()); + } +#pragma GCC diagnostic pop +#else + template + basic_string& + assign(_InputIterator __first, _InputIterator __last) + { return this->replace(begin(), end(), __first, __last); } +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Assign a range to the string. + * @param __rg A range of values that are convertible to `value_type`. + * @since C++23 + * + * The range `__rg` is allowed to overlap with `*this`. + */ + template<__detail::__container_compatible_range<_CharT> _Rg> + constexpr basic_string& + assign_range(_Rg&& __rg) + { + basic_string __s(from_range, std::forward<_Rg>(__rg), + _M_get_allocator()); + assign(std::move(__s)); + return *this; + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Set value to an initializer_list of characters. + * @param __l The initializer_list of characters to assign. + * @return Reference to this string. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + assign(initializer_list<_CharT> __l) + { + // The initializer_list array cannot alias the characters in *this + // so we don't need to use replace to that case. + const size_type __n = __l.size(); + if (__n > capacity()) + *this = basic_string(__l.begin(), __l.end(), get_allocator()); + else + { + if (__n) + _S_copy(_M_data(), __l.begin(), __n); + _M_set_length(__n); + } + return *this; + } +#endif // C++11 + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Set value from a string_view. + * @param __svt The source object convertible to string_view. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + assign(const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->assign(__sv.data(), __sv.size()); + } + + /** + * @brief Set value from a range of characters in a string_view. + * @param __svt The source object convertible to string_view. + * @param __pos The position in the string_view to assign from. + * @param __n The number of characters to assign. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + assign(const _Tp& __svt, size_type __pos, size_type __n = npos) + { + __sv_type __sv = __svt; + return _M_replace(size_type(0), this->size(), + __sv.data() + + std::__sv_check(__sv.size(), __pos, "basic_string::assign"), + std::__sv_limit(__sv.size(), __pos, __n)); + } +#endif // C++17 + +#if __cplusplus >= 201103L + /** + * @brief Insert multiple characters. + * @param __p Const_iterator referencing location in string to + * insert at. + * @param __n Number of characters to insert + * @param __c The character to insert. + * @return Iterator referencing the first inserted char. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts @a __n copies of character @a __c starting at the + * position referenced by iterator @a __p. If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __p, size_type __n, _CharT __c) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); + const size_type __pos = __p - begin(); + this->replace(__p, __p, __n, __c); + return iterator(this->_M_data() + __pos); + } +#else + /** + * @brief Insert multiple characters. + * @param __p Iterator referencing location in string to insert at. + * @param __n Number of characters to insert + * @param __c The character to insert. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts @a __n copies of character @a __c starting at the + * position referenced by iterator @a __p. If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + void + insert(iterator __p, size_type __n, _CharT __c) + { this->replace(__p, __p, __n, __c); } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Insert a range of characters. + * @param __p Const_iterator referencing location in string to + * insert at. + * @param __beg Start of range. + * @param __end End of range. + * @return Iterator referencing the first inserted char. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts characters in range [beg,end). If adding characters + * causes the length to exceed max_size(), length_error is + * thrown. The value of the string doesn't change if an error + * is thrown. + */ + template> + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __p, _InputIterator __beg, _InputIterator __end) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); + const size_type __pos = __p - begin(); + this->replace(__p, __p, __beg, __end); + return iterator(this->_M_data() + __pos); + } +#else + /** + * @brief Insert a range of characters. + * @param __p Iterator referencing location in string to insert at. + * @param __beg Start of range. + * @param __end End of range. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts characters in range [__beg,__end). If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + template + void + insert(iterator __p, _InputIterator __beg, _InputIterator __end) + { this->replace(__p, __p, __beg, __end); } +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Insert a range into the string. + * @param __rg A range of values that are convertible to `value_type`. + * @since C++23 + * + * The range `__rg` is allowed to overlap with `*this`. + */ + template<__detail::__container_compatible_range<_CharT> _Rg> + constexpr iterator + insert_range(const_iterator __p, _Rg&& __rg) + { + auto __pos = __p - cbegin(); + + if constexpr (ranges::forward_range<_Rg>) + if (ranges::empty(__rg)) + return begin() + __pos; + + + if (__p == cend()) + append_range(std::forward<_Rg>(__rg)); + else + { + basic_string __s(from_range, std::forward<_Rg>(__rg), + _M_get_allocator()); + insert(__pos, __s); + } + return begin() + __pos; + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Insert an initializer_list of characters. + * @param __p Iterator referencing location in string to insert at. + * @param __l The initializer_list of characters to insert. + * @throw std::length_error If new length exceeds @c max_size(). + */ + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __p, initializer_list<_CharT> __l) + { return this->insert(__p, __l.begin(), __l.end()); } + +#ifdef _GLIBCXX_DEFINING_STRING_INSTANTIATIONS + // See PR libstdc++/83328 + void + insert(iterator __p, initializer_list<_CharT> __l) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); + this->insert(__p - begin(), __l.begin(), __l.size()); + } +#endif +#endif // C++11 + + /** + * @brief Insert value of a string. + * @param __pos1 Position in string to insert at. + * @param __str The string to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts value of @a __str starting at @a __pos1. If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + insert(size_type __pos1, const basic_string& __str) + { return this->replace(__pos1, size_type(0), + __str._M_data(), __str.size()); } + + /** + * @brief Insert a substring. + * @param __pos1 Position in string to insert at. + * @param __str The string to insert. + * @param __pos2 Start of characters in str to insert. + * @param __n Number of characters to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a pos1 > size() or + * @a __pos2 > @a str.size(). + * + * Starting at @a pos1, insert @a __n character of @a __str + * beginning with @a __pos2. If adding characters causes the + * length to exceed max_size(), length_error is thrown. If @a + * __pos1 is beyond the end of this string or @a __pos2 is + * beyond the end of @a __str, out_of_range is thrown. The + * value of the string doesn't change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + insert(size_type __pos1, const basic_string& __str, + size_type __pos2, size_type __n = npos) + { return this->replace(__pos1, size_type(0), __str._M_data() + + __str._M_check(__pos2, "basic_string::insert"), + __str._M_limit(__pos2, __n)); } + + /** + * @brief Insert a C substring. + * @param __pos Position in string to insert at. + * @param __s The C string to insert. + * @param __n The number of characters to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a __pos is beyond the end of this + * string. + * + * Inserts the first @a __n characters of @a __s starting at @a + * __pos. If adding characters causes the length to exceed + * max_size(), length_error is thrown. If @a __pos is beyond + * end(), out_of_range is thrown. The value of the string + * doesn't change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + insert(size_type __pos, const _CharT* __s, size_type __n) + { return this->replace(__pos, size_type(0), __s, __n); } + + /** + * @brief Insert a C string. + * @param __pos Position in string to insert at. + * @param __s The C string to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a pos is beyond the end of this + * string. + * + * Inserts the first @a n characters of @a __s starting at @a __pos. If + * adding characters causes the length to exceed max_size(), + * length_error is thrown. If @a __pos is beyond end(), out_of_range is + * thrown. The value of the string doesn't change if an error is + * thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + insert(size_type __pos, const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->replace(__pos, size_type(0), __s, + traits_type::length(__s)); + } + + /** + * @brief Insert multiple characters. + * @param __pos Index in string to insert at. + * @param __n Number of characters to insert + * @param __c The character to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a __pos is beyond the end of this + * string. + * + * Inserts @a __n copies of character @a __c starting at index + * @a __pos. If adding characters causes the length to exceed + * max_size(), length_error is thrown. If @a __pos > length(), + * out_of_range is thrown. The value of the string doesn't + * change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + insert(size_type __pos, size_type __n, _CharT __c) + { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), + size_type(0), __n, __c); } + + /** + * @brief Insert one character. + * @param __p Iterator referencing position in string to insert at. + * @param __c The character to insert. + * @return Iterator referencing newly inserted char. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts character @a __c at position referenced by @a __p. + * If adding character causes the length to exceed max_size(), + * length_error is thrown. If @a __p is beyond end of string, + * out_of_range is thrown. The value of the string doesn't + * change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + iterator + insert(__const_iterator __p, _CharT __c) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); + const size_type __pos = __p - begin(); + _M_replace_aux(__pos, size_type(0), size_type(1), __c); + return iterator(_M_data() + __pos); + } + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Insert a string_view. + * @param __pos Position in string to insert at. + * @param __svt The object convertible to string_view to insert. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + insert(size_type __pos, const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->insert(__pos, __sv.data(), __sv.size()); + } + + /** + * @brief Insert a string_view. + * @param __pos1 Position in string to insert at. + * @param __svt The object convertible to string_view to insert from. + * @param __pos2 Start of characters in str to insert. + * @param __n The number of characters to insert. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + insert(size_type __pos1, const _Tp& __svt, + size_type __pos2, size_type __n = npos) + { + __sv_type __sv = __svt; + return this->replace(__pos1, size_type(0), + __sv.data() + + std::__sv_check(__sv.size(), __pos2, "basic_string::insert"), + std::__sv_limit(__sv.size(), __pos2, __n)); + } +#endif // C++17 + + /** + * @brief Remove characters. + * @param __pos Index of first character to remove (default 0). + * @param __n Number of characters to remove (default remainder). + * @return Reference to this string. + * @throw std::out_of_range If @a pos is beyond the end of this + * string. + * + * Removes @a __n characters from this string starting at @a + * __pos. The length of the string is reduced by @a __n. If + * there are < @a __n characters to remove, the remainder of + * the string is truncated. If @a __p is beyond end of string, + * out_of_range is thrown. The value of the string doesn't + * change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + erase(size_type __pos = 0, size_type __n = npos) + { + _M_check(__pos, "basic_string::erase"); + if (__n == npos) + this->_M_set_length(__pos); + else if (__n != 0) + this->_M_erase(__pos, _M_limit(__pos, __n)); + return *this; + } + + /** + * @brief Remove one character. + * @param __position Iterator referencing the character to remove. + * @return iterator referencing same location after removal. + * + * Removes the character at @a __position from this string. The value + * of the string doesn't change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + iterator + erase(__const_iterator __position) + { + _GLIBCXX_DEBUG_PEDASSERT(__position >= begin() + && __position < end()); + const size_type __pos = __position - begin(); + this->_M_erase(__pos, size_type(1)); + return iterator(_M_data() + __pos); + } + + /** + * @brief Remove a range of characters. + * @param __first Iterator referencing the first character to remove. + * @param __last Iterator referencing the end of the range. + * @return Iterator referencing location of first after removal. + * + * Removes the characters in the range [first,last) from this string. + * The value of the string doesn't change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + iterator + erase(__const_iterator __first, __const_iterator __last) + { + _GLIBCXX_DEBUG_PEDASSERT(__first >= begin() && __first <= __last + && __last <= end()); + const size_type __pos = __first - begin(); + if (__last == end()) + this->_M_set_length(__pos); + else + this->_M_erase(__pos, __last - __first); + return iterator(this->_M_data() + __pos); + } + +#if __cplusplus >= 201103L + /** + * @brief Remove the last character. + * + * The string must be non-empty. + */ + _GLIBCXX20_CONSTEXPR + void + pop_back() noexcept + { + __glibcxx_assert(!empty()); + _M_erase(size() - 1, 1); + } +#endif // C++11 + + /** + * @brief Replace characters with value from another string. + * @param __pos Index of first character to replace. + * @param __n Number of characters to be replaced. + * @param __str String to insert. + * @return Reference to this string. + * @throw std::out_of_range If @a pos is beyond the end of this + * string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos,__pos+__n) from + * this string. In place, the value of @a __str is inserted. + * If @a __pos is beyond end of string, out_of_range is thrown. + * If the length of the result exceeds max_size(), length_error + * is thrown. The value of the string doesn't change if an + * error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + replace(size_type __pos, size_type __n, const basic_string& __str) + { return this->replace(__pos, __n, __str._M_data(), __str.size()); } + + /** + * @brief Replace characters with value from another string. + * @param __pos1 Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __str String to insert. + * @param __pos2 Index of first character of str to use. + * @param __n2 Number of characters from str to use. + * @return Reference to this string. + * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 > + * __str.size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos1,__pos1 + n) from this + * string. In place, the value of @a __str is inserted. If @a __pos is + * beyond end of string, out_of_range is thrown. If the length of the + * result exceeds max_size(), length_error is thrown. The value of the + * string doesn't change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + replace(size_type __pos1, size_type __n1, const basic_string& __str, + size_type __pos2, size_type __n2 = npos) + { return this->replace(__pos1, __n1, __str._M_data() + + __str._M_check(__pos2, "basic_string::replace"), + __str._M_limit(__pos2, __n2)); } + + /** + * @brief Replace characters with value of a C substring. + * @param __pos Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __s C string to insert. + * @param __n2 Number of characters from @a s to use. + * @return Reference to this string. + * @throw std::out_of_range If @a pos1 > size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos,__pos + __n1) + * from this string. In place, the first @a __n2 characters of + * @a __s are inserted, or all of @a __s if @a __n2 is too large. If + * @a __pos is beyond end of string, out_of_range is thrown. If + * the length of result exceeds max_size(), length_error is + * thrown. The value of the string doesn't change if an error + * is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + replace(size_type __pos, size_type __n1, const _CharT* __s, + size_type __n2) + { + __glibcxx_requires_string_len(__s, __n2); + return _M_replace(_M_check(__pos, "basic_string::replace"), + _M_limit(__pos, __n1), __s, __n2); + } + + /** + * @brief Replace characters with value of a C string. + * @param __pos Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __s C string to insert. + * @return Reference to this string. + * @throw std::out_of_range If @a pos > size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos,__pos + __n1) + * from this string. In place, the characters of @a __s are + * inserted. If @a __pos is beyond end of string, out_of_range + * is thrown. If the length of result exceeds max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + replace(size_type __pos, size_type __n1, const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->replace(__pos, __n1, __s, traits_type::length(__s)); + } + + /** + * @brief Replace characters with multiple characters. + * @param __pos Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __n2 Number of characters to insert. + * @param __c Character to insert. + * @return Reference to this string. + * @throw std::out_of_range If @a __pos > size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [pos,pos + n1) from this + * string. In place, @a __n2 copies of @a __c are inserted. + * If @a __pos is beyond end of string, out_of_range is thrown. + * If the length of result exceeds max_size(), length_error is + * thrown. The value of the string doesn't change if an error + * is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) + { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), + _M_limit(__pos, __n1), __n2, __c); } + + /** + * @brief Replace range of characters with string. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __str String value to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * the value of @a __str is inserted. If the length of result + * exceeds max_size(), length_error is thrown. The value of + * the string doesn't change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const basic_string& __str) + { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } + + /** + * @brief Replace range of characters with C substring. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __s C string value to insert. + * @param __n Number of characters from s to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * the first @a __n characters of @a __s are inserted. If the + * length of result exceeds max_size(), length_error is thrown. + * The value of the string doesn't change if an error is + * thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const _CharT* __s, size_type __n) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + return this->replace(__i1 - begin(), __i2 - __i1, __s, __n); + } + + /** + * @brief Replace range of characters with C string. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __s C string value to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * the characters of @a __s are inserted. If the length of + * result exceeds max_size(), length_error is thrown. The + * value of the string doesn't change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->replace(__i1, __i2, __s, traits_type::length(__s)); + } + + /** + * @brief Replace range of characters with multiple characters + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __n Number of characters to insert. + * @param __c Character to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * @a __n copies of @a __c are inserted. If the length of + * result exceeds max_size(), length_error is thrown. The + * value of the string doesn't change if an error is thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, size_type __n, + _CharT __c) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + return _M_replace_aux(__i1 - begin(), __i2 - __i1, __n, __c); + } + + /** + * @brief Replace range of characters with range. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __k1 Iterator referencing start of range to insert. + * @param __k2 Iterator referencing end of range to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * characters in the range [__k1,__k2) are inserted. If the + * length of result exceeds max_size(), length_error is thrown. + * The value of the string doesn't change if an error is + * thrown. + */ +#if __cplusplus >= 201103L + template> + _GLIBCXX20_CONSTEXPR + basic_string& + replace(const_iterator __i1, const_iterator __i2, + _InputIterator __k1, _InputIterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, + std::__false_type()); + } +#else + template +#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST + typename __enable_if_not_native_iterator<_InputIterator>::__type +#else + basic_string& +#endif + replace(iterator __i1, iterator __i2, + _InputIterator __k1, _InputIterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); + } +#endif + + // Specializations for the common case of pointer and iterator: + // useful to avoid the overhead of temporary buffering in _M_replace. + _GLIBCXX20_CONSTEXPR + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + _CharT* __k1, _CharT* __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - begin(), __i2 - __i1, + __k1, __k2 - __k1); + } + + _GLIBCXX20_CONSTEXPR + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const _CharT* __k1, const _CharT* __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - begin(), __i2 - __i1, + __k1, __k2 - __k1); + } + + _GLIBCXX20_CONSTEXPR + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + iterator __k1, iterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - begin(), __i2 - __i1, + __k1.base(), __k2 - __k1); + } + + _GLIBCXX20_CONSTEXPR + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const_iterator __k1, const_iterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - begin(), __i2 - __i1, + __k1.base(), __k2 - __k1); + } + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Replace part of the string with a range. + * @param __rg A range of values that are convertible to `value_type`. + * @since C++23 + * + * The range `__rg` is allowed to overlap with `*this`. + */ + template<__detail::__container_compatible_range<_CharT> _Rg> + constexpr basic_string& + replace_with_range(const_iterator __i1, const_iterator __i2, _Rg&& __rg) + { + if (__i1 == cend()) + append_range(std::forward<_Rg>(__rg)); + else + { + basic_string __s(from_range, std::forward<_Rg>(__rg), + _M_get_allocator()); + replace(__i1, __i2, __s); + } + return *this; + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Replace range of characters with initializer_list. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __l The initializer_list of characters to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * characters in the range [__k1,__k2) are inserted. If the + * length of result exceeds max_size(), length_error is thrown. + * The value of the string doesn't change if an error is + * thrown. + */ + _GLIBCXX20_CONSTEXPR + basic_string& replace(const_iterator __i1, const_iterator __i2, + initializer_list<_CharT> __l) + { return this->replace(__i1, __i2, __l.begin(), __l.size()); } +#endif // C++11 + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Replace range of characters with string_view. + * @param __pos The position to replace at. + * @param __n The number of characters to replace. + * @param __svt The object convertible to string_view to insert. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + replace(size_type __pos, size_type __n, const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->replace(__pos, __n, __sv.data(), __sv.size()); + } + + /** + * @brief Replace range of characters with string_view. + * @param __pos1 The position to replace at. + * @param __n1 The number of characters to replace. + * @param __svt The object convertible to string_view to insert from. + * @param __pos2 The position in the string_view to insert from. + * @param __n2 The number of characters to insert. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + replace(size_type __pos1, size_type __n1, const _Tp& __svt, + size_type __pos2, size_type __n2 = npos) + { + __sv_type __sv = __svt; + return this->replace(__pos1, __n1, + __sv.data() + + std::__sv_check(__sv.size(), __pos2, "basic_string::replace"), + std::__sv_limit(__sv.size(), __pos2, __n2)); + } + + /** + * @brief Replace range of characters with string_view. + * @param __i1 An iterator referencing the start position + to replace at. + * @param __i2 An iterator referencing the end position + for the replace. + * @param __svt The object convertible to string_view to insert from. + * @return Reference to this string. + */ + template + _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, basic_string&> + replace(const_iterator __i1, const_iterator __i2, const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->replace(__i1 - begin(), __i2 - __i1, __sv); + } +#endif // C++17 + + private: + template + _GLIBCXX20_CONSTEXPR + basic_string& + _M_replace_dispatch(const_iterator __i1, const_iterator __i2, + _Integer __n, _Integer __val, __true_type) + { return _M_replace_aux(__i1 - begin(), __i2 - __i1, __n, __val); } + + template + _GLIBCXX20_CONSTEXPR + basic_string& + _M_replace_dispatch(const_iterator __i1, const_iterator __i2, + _InputIterator __k1, _InputIterator __k2, + __false_type); + + _GLIBCXX20_CONSTEXPR + basic_string& + _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, + _CharT __c); + + __attribute__((__noinline__, __noclone__, __cold__)) void + _M_replace_cold(pointer __p, size_type __len1, const _CharT* __s, + const size_type __len2, const size_type __how_much); + + _GLIBCXX20_CONSTEXPR + basic_string& + _M_replace(size_type __pos, size_type __len1, const _CharT* __s, + const size_type __len2); + + _GLIBCXX20_CONSTEXPR + basic_string& + _M_append(const _CharT* __s, size_type __n); + + public: + + /** + * @brief Copy substring into C string. + * @param __s C string to copy value into. + * @param __n Number of characters to copy. + * @param __pos Index of first character to copy. + * @return Number of characters actually copied + * @throw std::out_of_range If __pos > size(). + * + * Copies up to @a __n characters starting at @a __pos into the + * C string @a __s. If @a __pos is %greater than size(), + * out_of_range is thrown. + */ + _GLIBCXX20_CONSTEXPR + size_type + copy(_CharT* __s, size_type __n, size_type __pos = 0) const; + + /** + * @brief Swap contents with another string. + * @param __s String to swap with. + * + * Exchanges the contents of this string with that of @a __s in constant + * time. + */ + _GLIBCXX20_CONSTEXPR + void + swap(basic_string& __s) _GLIBCXX_NOEXCEPT; + + // String operations: + /** + * @brief Return const pointer to null-terminated contents. + * + * This is a handle to internal data. Do not modify or dire things may + * happen. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const _CharT* + c_str() const _GLIBCXX_NOEXCEPT + { return _M_data(); } + + /** + * @brief Return const pointer to contents. + * + * This is a pointer to internal data. It is undefined to modify + * the contents through the returned pointer. To get a pointer that + * allows modifying the contents use @c &str[0] instead, + * (or in C++17 the non-const @c str.data() overload). + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const _CharT* + data() const _GLIBCXX_NOEXCEPT + { return _M_data(); } + +#if __cplusplus >= 201703L + /** + * @brief Return non-const pointer to contents. + * + * This is a pointer to the character sequence held by the string. + * Modifying the characters in the sequence is allowed. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _CharT* + data() noexcept + { return _M_data(); } +#endif + + /** + * @brief Return copy of allocator used to construct this string. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return _M_get_allocator(); } + + /** + * @brief Find position of a C substring. + * @param __s C string to locate. + * @param __pos Index of character to search from. + * @param __n Number of characters from @a s to search for. + * @return Index of start of first occurrence. + * + * Starting from @a __pos, searches forward for the first @a + * __n characters in @a __s within this string. If found, + * returns the index where it begins. If not found, returns + * npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a string. + * @param __str String to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of start of first occurrence. + * + * Starting from @a __pos, searches forward for value of @a __str within + * this string. If found, returns the index where it begins. If not + * found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return this->find(__str.data(), __pos, __str.size()); } + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Find position of a string_view. + * @param __svt The object convertible to string_view to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of start of first occurrence. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, size_type> + find(const _Tp& __svt, size_type __pos = 0) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find position of a C string. + * @param __s C string to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of start of first occurrence. + * + * Starting from @a __pos, searches forward for the value of @a + * __s within this string. If found, returns the index where + * it begins. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for @a __c within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a string. + * @param __str String to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of start of last occurrence. + * + * Starting from @a __pos, searches backward for value of @a + * __str within this string. If found, returns the index where + * it begins. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + rfind(const basic_string& __str, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { return this->rfind(__str.data(), __pos, __str.size()); } + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Find last position of a string_view. + * @param __svt The object convertible to string_view to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of start of last occurrence. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, size_type> + rfind(const _Tp& __svt, size_type __pos = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->rfind(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find last position of a C substring. + * @param __s C string to locate. + * @param __pos Index of character to search back from. + * @param __n Number of characters from s to search for. + * @return Index of start of last occurrence. + * + * Starting from @a __pos, searches backward for the first @a + * __n characters in @a __s within this string. If found, + * returns the index where it begins. If not found, returns + * npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + rfind(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a C string. + * @param __s C string to locate. + * @param __pos Index of character to start search at (default end). + * @return Index of start of last occurrence. + * + * Starting from @a __pos, searches backward for the value of + * @a __s within this string. If found, returns the index + * where it begins. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + rfind(const _CharT* __s, size_type __pos = npos) const + { + __glibcxx_requires_string(__s); + return this->rfind(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find last position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for @a __c within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a character of string. + * @param __str String containing characters to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for one of the + * characters of @a __str within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_first_of(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return this->find_first_of(__str.data(), __pos, __str.size()); } + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Find position of a character of a string_view. + * @param __svt An object convertible to string_view containing + * characters to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, size_type> + find_first_of(const _Tp& __svt, size_type __pos = 0) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_first_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find position of a character of C substring. + * @param __s String containing characters to locate. + * @param __pos Index of character to search from. + * @param __n Number of characters from s to search for. + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for one of the + * first @a __n characters of @a __s within this string. If + * found, returns the index where it was found. If not found, + * returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_first_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a character of C string. + * @param __s String containing characters to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for one of the + * characters of @a __s within this string. If found, returns + * the index where it was found. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_first_of(const _CharT* __s, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_first_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for the character + * @a __c within this string. If found, returns the index + * where it was found. If not found, returns npos. + * + * Note: equivalent to find(__c, __pos). + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT + { return this->find(__c, __pos); } + + /** + * @brief Find last position of a character of string. + * @param __str String containing characters to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for one of the + * characters of @a __str within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_last_of(const basic_string& __str, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { return this->find_last_of(__str.data(), __pos, __str.size()); } + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Find last position of a character of string. + * @param __svt An object convertible to string_view containing + * characters to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, size_type> + find_last_of(const _Tp& __svt, size_type __pos = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_last_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find last position of a character of C substring. + * @param __s C string containing characters to locate. + * @param __pos Index of character to search back from. + * @param __n Number of characters from s to search for. + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for one of the + * first @a __n characters of @a __s within this string. If + * found, returns the index where it was found. If not found, + * returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_last_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a character of C string. + * @param __s C string containing characters to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for one of the + * characters of @a __s within this string. If found, returns + * the index where it was found. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_last_of(const _CharT* __s, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_last_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find last position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for @a __c within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + * + * Note: equivalent to rfind(__c, __pos). + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT + { return this->rfind(__c, __pos); } + + /** + * @brief Find position of a character not in string. + * @param __str String containing characters to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character not contained + * in @a __str within this string. If found, returns the index where it + * was found. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_first_not_of(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return this->find_first_not_of(__str.data(), __pos, __str.size()); } + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Find position of a character not in a string_view. + * @param __svt A object convertible to string_view containing + * characters to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, size_type> + find_first_not_of(const _Tp& __svt, size_type __pos = 0) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_first_not_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find position of a character not in C substring. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search from. + * @param __n Number of characters from __s to consider. + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character not + * contained in the first @a __n characters of @a __s within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_first_not_of(const _CharT* __s, size_type __pos, + size_type __n) const _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a character not in C string. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character not + * contained in @a __s within this string. If found, returns + * the index where it was found. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_first_not_of(const _CharT* __s, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_first_not_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find position of a different character. + * @param __c Character to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character + * other than @a __c within this string. If found, returns the + * index where it was found. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_first_not_of(_CharT __c, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a character not in string. + * @param __str String containing characters to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character + * not contained in @a __str within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_last_not_of(const basic_string& __str, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { return this->find_last_not_of(__str.data(), __pos, __str.size()); } + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Find last position of a character not in a string_view. + * @param __svt An object convertible to string_view containing + * characters to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, size_type> + find_last_not_of(const _Tp& __svt, size_type __pos = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_last_not_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find last position of a character not in C substring. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search back from. + * @param __n Number of characters from s to consider. + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character not + * contained in the first @a __n characters of @a __s within this string. + * If found, returns the index where it was found. If not found, + * returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_last_not_of(const _CharT* __s, size_type __pos, + size_type __n) const _GLIBCXX_NOEXCEPT; + /** + * @brief Find last position of a character not in C string. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character + * not contained in @a __s within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_last_not_of(const _CharT* __s, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_last_not_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find last position of a different character. + * @param __c Character to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character other than + * @a __c within this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + find_last_not_of(_CharT __c, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Get a substring. + * @param __pos Index of first character (default 0). + * @param __n Number of characters in substring (default remainder). + * @return The new string. + * @throw std::out_of_range If __pos > size(). + * + * Construct and return a new string using the @a __n + * characters starting at @a __pos. If the string is too + * short, use the remainder of the characters. If @a __pos is + * beyond the end of the string, out_of_range is thrown. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + basic_string + substr(size_type __pos = 0, size_type __n = npos) const + { return basic_string(*this, + _M_check(__pos, "basic_string::substr"), __n); } + + /** + * @brief Compare to a string. + * @param __str String to compare against. + * @return Integer < 0, 0, or > 0. + * + * Returns an integer < 0 if this string is ordered before @a + * __str, 0 if their values are equivalent, or > 0 if this + * string is ordered after @a __str. Determines the effective + * length rlen of the strings to compare as the smallest of + * size() and str.size(). The function then compares the two + * strings by calling traits::compare(data(), str.data(),rlen). + * If the result of the comparison is nonzero returns it, + * otherwise the shorter one is ordered first. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + int + compare(const basic_string& __str) const + { + const size_type __size = this->size(); + const size_type __osize = __str.size(); + const size_type __len = std::min(__size, __osize); + + int __r = traits_type::compare(_M_data(), __str.data(), __len); + if (!__r) + __r = _S_compare(__size, __osize); + return __r; + } + +#ifdef __glibcxx_string_view // >= C++17 + /** + * @brief Compare to a string_view. + * @param __svt An object convertible to string_view to compare against. + * @return Integer < 0, 0, or > 0. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, int> + compare(const _Tp& __svt) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + const size_type __size = this->size(); + const size_type __osize = __sv.size(); + const size_type __len = std::min(__size, __osize); + + int __r = traits_type::compare(_M_data(), __sv.data(), __len); + if (!__r) + __r = _S_compare(__size, __osize); + return __r; + } + + /** + * @brief Compare to a string_view. + * @param __pos A position in the string to start comparing from. + * @param __n The number of characters to compare. + * @param __svt An object convertible to string_view to compare + * against. + * @return Integer < 0, 0, or > 0. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, int> + compare(size_type __pos, size_type __n, const _Tp& __svt) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return __sv_type(*this).substr(__pos, __n).compare(__sv); + } + + /** + * @brief Compare to a string_view. + * @param __pos1 A position in the string to start comparing from. + * @param __n1 The number of characters to compare. + * @param __svt An object convertible to string_view to compare + * against. + * @param __pos2 A position in the string_view to start comparing from. + * @param __n2 The number of characters to compare. + * @return Integer < 0, 0, or > 0. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _If_sv<_Tp, int> + compare(size_type __pos1, size_type __n1, const _Tp& __svt, + size_type __pos2, size_type __n2 = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return __sv_type(*this) + .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); + } +#endif // C++17 + + /** + * @brief Compare substring to a string. + * @param __pos Index of first character of substring. + * @param __n Number of characters in substring. + * @param __str String to compare against. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n characters + * starting at @a __pos. Returns an integer < 0 if the + * substring is ordered before @a __str, 0 if their values are + * equivalent, or > 0 if the substring is ordered after @a + * __str. Determines the effective length rlen of the strings + * to compare as the smallest of the length of the substring + * and @a __str.size(). The function then compares the two + * strings by calling + * traits::compare(substring.data(),str.data(),rlen). If the + * result of the comparison is nonzero returns it, otherwise + * the shorter one is ordered first. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + int + compare(size_type __pos, size_type __n, const basic_string& __str) const + { + _M_check(__pos, "basic_string::compare"); + __n = _M_limit(__pos, __n); + const size_type __osize = __str.size(); + const size_type __len = std::min(__n, __osize); + int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len); + if (!__r) + __r = _S_compare(__n, __osize); + return __r; + } + + /** + * @brief Compare substring to a substring. + * @param __pos1 Index of first character of substring. + * @param __n1 Number of characters in substring. + * @param __str String to compare against. + * @param __pos2 Index of first character of substring of str. + * @param __n2 Number of characters in substring of str. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n1 + * characters starting at @a __pos1. Form the substring of @a + * __str from the @a __n2 characters starting at @a __pos2. + * Returns an integer < 0 if this substring is ordered before + * the substring of @a __str, 0 if their values are equivalent, + * or > 0 if this substring is ordered after the substring of + * @a __str. Determines the effective length rlen of the + * strings to compare as the smallest of the lengths of the + * substrings. The function then compares the two strings by + * calling + * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). + * If the result of the comparison is nonzero returns it, + * otherwise the shorter one is ordered first. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + int + compare(size_type __pos1, size_type __n1, const basic_string& __str, + size_type __pos2, size_type __n2 = npos) const + { + _M_check(__pos1, "basic_string::compare"); + __str._M_check(__pos2, "basic_string::compare"); + __n1 = _M_limit(__pos1, __n1); + __n2 = __str._M_limit(__pos2, __n2); + const size_type __len = std::min(__n1, __n2); + int __r = traits_type::compare(_M_data() + __pos1, + __str.data() + __pos2, __len); + if (!__r) + __r = _S_compare(__n1, __n2); + return __r; + } + + /** + * @brief Compare to a C string. + * @param __s C string to compare against. + * @return Integer < 0, 0, or > 0. + * + * Returns an integer < 0 if this string is ordered before @a __s, 0 if + * their values are equivalent, or > 0 if this string is ordered after + * @a __s. Determines the effective length rlen of the strings to + * compare as the smallest of size() and the length of a string + * constructed from @a __s. The function then compares the two strings + * by calling traits::compare(data(),s,rlen). If the result of the + * comparison is nonzero returns it, otherwise the shorter one is + * ordered first. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + int + compare(const _CharT* __s) const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + const size_type __size = this->size(); + const size_type __osize = traits_type::length(__s); + const size_type __len = std::min(__size, __osize); + int __r = traits_type::compare(_M_data(), __s, __len); + if (!__r) + __r = _S_compare(__size, __osize); + return __r; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 5 String::compare specification questionable + /** + * @brief Compare substring to a C string. + * @param __pos Index of first character of substring. + * @param __n1 Number of characters in substring. + * @param __s C string to compare against. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n1 + * characters starting at @a pos. Returns an integer < 0 if + * the substring is ordered before @a __s, 0 if their values + * are equivalent, or > 0 if the substring is ordered after @a + * __s. Determines the effective length rlen of the strings to + * compare as the smallest of the length of the substring and + * the length of a string constructed from @a __s. The + * function then compares the two string by calling + * traits::compare(substring.data(),__s,rlen). If the result of + * the comparison is nonzero returns it, otherwise the shorter + * one is ordered first. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + int + compare(size_type __pos, size_type __n1, const _CharT* __s) const + { + __glibcxx_requires_string(__s); + _M_check(__pos, "basic_string::compare"); + __n1 = _M_limit(__pos, __n1); + const size_type __osize = traits_type::length(__s); + const size_type __len = std::min(__n1, __osize); + int __r = traits_type::compare(_M_data() + __pos, __s, __len); + if (!__r) + __r = _S_compare(__n1, __osize); + return __r; + } + + /** + * @brief Compare substring against a character %array. + * @param __pos Index of first character of substring. + * @param __n1 Number of characters in substring. + * @param __s character %array to compare against. + * @param __n2 Number of characters of s. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n1 + * characters starting at @a __pos. Form a string from the + * first @a __n2 characters of @a __s. Returns an integer < 0 + * if this substring is ordered before the string from @a __s, + * 0 if their values are equivalent, or > 0 if this substring + * is ordered after the string from @a __s. Determines the + * effective length rlen of the strings to compare as the + * smallest of the length of the substring and @a __n2. The + * function then compares the two strings by calling + * traits::compare(substring.data(),s,rlen). If the result of + * the comparison is nonzero returns it, otherwise the shorter + * one is ordered first. + * + * NB: s must have at least n2 characters, '\\0' has + * no special meaning. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + int + compare(size_type __pos, size_type __n1, const _CharT* __s, + size_type __n2) const + { + __glibcxx_requires_string_len(__s, __n2); + _M_check(__pos, "basic_string::compare"); + __n1 = _M_limit(__pos, __n1); + const size_type __len = std::min(__n1, __n2); + int __r = traits_type::compare(_M_data() + __pos, __s, __len); + if (!__r) + __r = _S_compare(__n1, __n2); + return __r; + } + +#if __cplusplus >= 202002L + [[nodiscard]] + constexpr bool + starts_with(basic_string_view<_CharT, _Traits> __x) const noexcept + { return __sv_type(this->data(), this->size()).starts_with(__x); } + + [[nodiscard]] + constexpr bool + starts_with(_CharT __x) const noexcept + { return __sv_type(this->data(), this->size()).starts_with(__x); } + + [[nodiscard, __gnu__::__nonnull__]] + constexpr bool + starts_with(const _CharT* __x) const noexcept + { return __sv_type(this->data(), this->size()).starts_with(__x); } + + [[nodiscard]] + constexpr bool + ends_with(basic_string_view<_CharT, _Traits> __x) const noexcept + { return __sv_type(this->data(), this->size()).ends_with(__x); } + + [[nodiscard]] + constexpr bool + ends_with(_CharT __x) const noexcept + { return __sv_type(this->data(), this->size()).ends_with(__x); } + + [[nodiscard, __gnu__::__nonnull__]] + constexpr bool + ends_with(const _CharT* __x) const noexcept + { return __sv_type(this->data(), this->size()).ends_with(__x); } +#endif // C++20 + +#if __cplusplus > 202002L + [[nodiscard]] + constexpr bool + contains(basic_string_view<_CharT, _Traits> __x) const noexcept + { return __sv_type(this->data(), this->size()).contains(__x); } + + [[nodiscard]] + constexpr bool + contains(_CharT __x) const noexcept + { return __sv_type(this->data(), this->size()).contains(__x); } + + [[nodiscard, __gnu__::__nonnull__]] + constexpr bool + contains(const _CharT* __x) const noexcept + { return __sv_type(this->data(), this->size()).contains(__x); } +#endif // C++23 + + // Allow basic_stringbuf::__xfer_bufptrs to call _M_length: + template friend class basic_stringbuf; + }; +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // _GLIBCXX_USE_CXX11_ABI + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if __cpp_deduction_guides >= 201606 +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template::value_type, + typename _Allocator = allocator<_CharT>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireAllocator<_Allocator>> + basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator()) + -> basic_string<_CharT, char_traits<_CharT>, _Allocator>; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3075. basic_string needs deduction guides from basic_string_view + template, + typename = _RequireAllocator<_Allocator>> + basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& = _Allocator()) + -> basic_string<_CharT, _Traits, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + basic_string(basic_string_view<_CharT, _Traits>, + typename basic_string<_CharT, _Traits, _Allocator>::size_type, + typename basic_string<_CharT, _Traits, _Allocator>::size_type, + const _Allocator& = _Allocator()) + -> basic_string<_CharT, _Traits, _Allocator>; + +#if __glibcxx_containers_ranges // C++ >= 23 + template>> + basic_string(from_range_t, _Rg&&, _Allocator = _Allocator()) + -> basic_string, + char_traits>, + _Allocator>; +#endif +_GLIBCXX_END_NAMESPACE_CXX11 +#endif + + template + _GLIBCXX20_CONSTEXPR + inline _Str + __str_concat(typename _Str::value_type const* __lhs, + typename _Str::size_type __lhs_len, + typename _Str::value_type const* __rhs, + typename _Str::size_type __rhs_len, + typename _Str::allocator_type const& __a) + { + typedef typename _Str::allocator_type allocator_type; + typedef __gnu_cxx::__alloc_traits _Alloc_traits; + _Str __str(_Alloc_traits::_S_select_on_copy(__a)); + __str.reserve(__lhs_len + __rhs_len); + __str.append(__lhs, __lhs_len); + __str.append(__rhs, __rhs_len); + return __str; + } + + // operator+ + /** + * @brief Concatenate two strings. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with value of @a __lhs followed by @a __rhs. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { + typedef basic_string<_CharT, _Traits, _Alloc> _Str; + return std::__str_concat<_Str>(__lhs.c_str(), __lhs.size(), + __rhs.c_str(), __rhs.size(), + __lhs.get_allocator()); + } + + /** + * @brief Concatenate C string and string. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with value of @a __lhs followed by @a __rhs. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT,_Traits,_Alloc> + operator+(const _CharT* __lhs, + const basic_string<_CharT,_Traits,_Alloc>& __rhs) + { + __glibcxx_requires_string(__lhs); + typedef basic_string<_CharT, _Traits, _Alloc> _Str; + return std::__str_concat<_Str>(__lhs, _Traits::length(__lhs), + __rhs.c_str(), __rhs.size(), + __rhs.get_allocator()); + } + + /** + * @brief Concatenate character and string. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with @a __lhs followed by @a __rhs. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT,_Traits,_Alloc> + operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) + { + typedef basic_string<_CharT, _Traits, _Alloc> _Str; + return std::__str_concat<_Str>(__builtin_addressof(__lhs), 1, + __rhs.c_str(), __rhs.size(), + __rhs.get_allocator()); + } + + /** + * @brief Concatenate string and C string. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with @a __lhs followed by @a __rhs. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { + __glibcxx_requires_string(__rhs); + typedef basic_string<_CharT, _Traits, _Alloc> _Str; + return std::__str_concat<_Str>(__lhs.c_str(), __lhs.size(), + __rhs, _Traits::length(__rhs), + __lhs.get_allocator()); + } + /** + * @brief Concatenate string and character. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with @a __lhs followed by @a __rhs. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) + { + typedef basic_string<_CharT, _Traits, _Alloc> _Str; + return std::__str_concat<_Str>(__lhs.c_str(), __lhs.size(), + __builtin_addressof(__rhs), 1, + __lhs.get_allocator()); + } + +#if __cplusplus >= 201103L + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return std::move(__lhs.append(__rhs)); } + + template + _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + basic_string<_CharT, _Traits, _Alloc>&& __rhs) + { return std::move(__rhs.insert(0, __lhs)); } + + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, + basic_string<_CharT, _Traits, _Alloc>&& __rhs) + { +#if _GLIBCXX_USE_CXX11_ABI + using _Alloc_traits = allocator_traits<_Alloc>; + bool __use_rhs = false; + if _GLIBCXX17_CONSTEXPR (typename _Alloc_traits::is_always_equal{}) + __use_rhs = true; + else if (__lhs.get_allocator() == __rhs.get_allocator()) + __use_rhs = true; + if (__use_rhs) +#endif + { + const auto __size = __lhs.size() + __rhs.size(); + if (__size > __lhs.capacity() && __size <= __rhs.capacity()) + return std::move(__rhs.insert(0, __lhs)); + } + return std::move(__lhs.append(__rhs)); + } + + template + _GLIBCXX_NODISCARD _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(const _CharT* __lhs, + basic_string<_CharT, _Traits, _Alloc>&& __rhs) + { return std::move(__rhs.insert(0, __lhs)); } + + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(_CharT __lhs, + basic_string<_CharT, _Traits, _Alloc>&& __rhs) + { return std::move(__rhs.insert(0, 1, __lhs)); } + + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, + const _CharT* __rhs) + { return std::move(__lhs.append(__rhs)); } + + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline basic_string<_CharT, _Traits, _Alloc> + operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, + _CharT __rhs) + { return std::move(__lhs.append(1, __rhs)); } +#endif + +#if __glibcxx_string_view >= 202403L + // const string & + string_view + template + [[nodiscard]] + constexpr basic_string<_CharT, _Traits, _Alloc> + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + type_identity_t> __rhs) + { + using _Str = basic_string<_CharT, _Traits, _Alloc>; + return std::__str_concat<_Str>(__lhs.data(), __lhs.size(), + __rhs.data(), __rhs.size(), + __lhs.get_allocator()); + } + + // string && + string_view + template + [[nodiscard]] + constexpr basic_string<_CharT, _Traits, _Alloc> + operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, + type_identity_t> __rhs) + { + return std::move(__lhs.append(__rhs)); + } + + // string_view + const string & + template + [[nodiscard]] + constexpr basic_string<_CharT, _Traits, _Alloc> + operator+(type_identity_t> __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { + using _Str = basic_string<_CharT, _Traits, _Alloc>; + return std::__str_concat<_Str>(__lhs.data(), __lhs.size(), + __rhs.data(), __rhs.size(), + __rhs.get_allocator()); + } + + // string_view + string && + template + [[nodiscard]] + constexpr basic_string<_CharT, _Traits, _Alloc> + operator+(type_identity_t> __lhs, + basic_string<_CharT, _Traits, _Alloc>&& __rhs) + { + return std::move(__rhs.insert(0, __lhs)); + } +#endif + + // operator == + /** + * @brief Test equivalence of two strings. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline bool + operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { + return __lhs.size() == __rhs.size() + && !_Traits::compare(__lhs.data(), __rhs.data(), __lhs.size()); + } + + /** + * @brief Test equivalence of string and C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline bool + operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { + return __lhs.size() == _Traits::length(__rhs) + && !_Traits::compare(__lhs.data(), __rhs, __lhs.size()); + } + +#if __cpp_lib_three_way_comparison + /** + * @brief Three-way comparison of a string and a C string. + * @param __lhs A string. + * @param __rhs A null-terminated string. + * @return A value indicating whether `__lhs` is less than, equal to, + * greater than, or incomparable with `__rhs`. + */ + template + [[nodiscard]] + constexpr auto + operator<=>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) noexcept + -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0)) + { return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); } + + /** + * @brief Three-way comparison of a string and a C string. + * @param __lhs A string. + * @param __rhs A null-terminated string. + * @return A value indicating whether `__lhs` is less than, equal to, + * greater than, or incomparable with `__rhs`. + */ + template + [[nodiscard]] + constexpr auto + operator<=>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) noexcept + -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0)) + { return __detail::__char_traits_cmp_cat<_Traits>(__lhs.compare(__rhs)); } +#else + /** + * @brief Test equivalence of C string and string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __rhs.compare(@a __lhs) == 0. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator==(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs == __lhs; } + + // operator != + /** + * @brief Test difference of two strings. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return !(__lhs == __rhs); } + + /** + * @brief Test difference of C string and string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __rhs.compare(@a __lhs) != 0. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator!=(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return !(__rhs == __lhs); } + + /** + * @brief Test difference of string and C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return !(__lhs == __rhs); } + + // operator < + /** + * @brief Test if string precedes string. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs precedes @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.compare(__rhs) < 0; } + + /** + * @brief Test if string precedes C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs precedes @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return __lhs.compare(__rhs) < 0; } + + /** + * @brief Test if C string precedes string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __lhs precedes @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator<(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs.compare(__lhs) > 0; } + + // operator > + /** + * @brief Test if string follows string. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs follows @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.compare(__rhs) > 0; } + + /** + * @brief Test if string follows C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs follows @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return __lhs.compare(__rhs) > 0; } + + /** + * @brief Test if C string follows string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __lhs follows @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator>(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs.compare(__lhs) < 0; } + + // operator <= + /** + * @brief Test if string doesn't follow string. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.compare(__rhs) <= 0; } + + /** + * @brief Test if string doesn't follow C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return __lhs.compare(__rhs) <= 0; } + + /** + * @brief Test if C string doesn't follow string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator<=(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs.compare(__lhs) >= 0; } + + // operator >= + /** + * @brief Test if string doesn't precede string. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.compare(__rhs) >= 0; } + + /** + * @brief Test if string doesn't precede C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return __lhs.compare(__rhs) >= 0; } + + /** + * @brief Test if C string doesn't precede string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. + */ + template + _GLIBCXX_NODISCARD + inline bool + operator>=(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs.compare(__lhs) <= 0; } +#endif // three-way comparison + + /** + * @brief Swap contents of two strings. + * @param __lhs First string. + * @param __rhs Second string. + * + * Exchanges the contents of @a __lhs and @a __rhs in constant time. + */ + template + _GLIBCXX20_CONSTEXPR + inline void + swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, + basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) + { __lhs.swap(__rhs); } + + + /** + * @brief Read stream into a string. + * @param __is Input stream. + * @param __str Buffer to store into. + * @return Reference to the input stream. + * + * Stores characters from @a __is into @a __str until whitespace is + * found, the end of the stream is encountered, or str.max_size() + * is reached. If is.width() is non-zero, that is the limit on the + * number of characters stored into @a __str. Any previous + * contents of @a __str are erased. + */ + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT, _Traits, _Alloc>& __str); + + template<> + basic_istream& + operator>>(basic_istream& __is, basic_string& __str); + + /** + * @brief Write string to a stream. + * @param __os Output stream. + * @param __str String to write out. + * @return Reference to the output stream. + * + * Output characters of @a __str into os following the same rules as for + * writing a C string. + */ + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, + const basic_string<_CharT, _Traits, _Alloc>& __str) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 586. string inserter not a formatted function + return __ostream_insert(__os, __str.data(), __str.size()); + } + + /** + * @brief Read a line from stream into a string. + * @param __is Input stream. + * @param __str Buffer to store into. + * @param __delim Character marking end of line. + * @return Reference to the input stream. + * + * Stores characters from @a __is into @a __str until @a __delim is + * found, the end of the stream is encountered, or str.max_size() + * is reached. Any previous contents of @a __str are erased. If + * @a __delim is encountered, it is extracted but not stored into + * @a __str. + */ + template + basic_istream<_CharT, _Traits>& + getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim); + + /** + * @brief Read a line from stream into a string. + * @param __is Input stream. + * @param __str Buffer to store into. + * @return Reference to the input stream. + * + * Stores characters from is into @a __str until '\n' is + * found, the end of the stream is encountered, or str.max_size() + * is reached. Any previous contents of @a __str are erased. If + * end of line is encountered, it is extracted but not stored into + * @a __str. + */ + template + inline basic_istream<_CharT, _Traits>& + getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT, _Traits, _Alloc>& __str) + { return std::getline(__is, __str, __is.widen('\n')); } + +#if __cplusplus >= 201103L + /// Read a line from an rvalue stream into a string. + template + inline basic_istream<_CharT, _Traits>& + getline(basic_istream<_CharT, _Traits>&& __is, + basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim) + { return std::getline(__is, __str, __delim); } + + /// Read a line from an rvalue stream into a string. + template + inline basic_istream<_CharT, _Traits>& + getline(basic_istream<_CharT, _Traits>&& __is, + basic_string<_CharT, _Traits, _Alloc>& __str) + { return std::getline(__is, __str); } +#endif + + template<> + basic_istream& + getline(basic_istream& __in, basic_string& __str, + char __delim); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + basic_istream& + getline(basic_istream& __in, basic_string& __str, + wchar_t __delim); +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if __cplusplus >= 201103L + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + // 21.4 Numeric Conversions [string.conversions]. + inline int + stoi(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtol, "stoi", __str.c_str(), + __idx, __base); } + + inline long + stol(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(), + __idx, __base); } + + inline unsigned long + stoul(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(), + __idx, __base); } + +#if _GLIBCXX_USE_C99_STDLIB + inline long long + stoll(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(), + __idx, __base); } + + inline unsigned long long + stoull(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), + __idx, __base); } +#elif __LONG_WIDTH__ == __LONG_LONG_WIDTH__ + inline long long + stoll(const string& __str, size_t* __idx = 0, int __base = 10) + { return std::stol(__str, __idx, __base); } + + inline unsigned long long + stoull(const string& __str, size_t* __idx = 0, int __base = 10) + { return std::stoul(__str, __idx, __base); } +#endif + + inline double + stod(const string& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } + +#if _GLIBCXX_HAVE_STRTOF + // NB: strtof vs strtod. + inline float + stof(const string& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } +#else + inline float + stof(const string& __str, size_t* __idx = 0) + { + double __d = std::stod(__str, __idx); + if (__builtin_isfinite(__d) && __d != 0.0) + { + double __abs_d = __builtin_fabs(__d); + if (__abs_d < __FLT_MIN__ || __abs_d > __FLT_MAX__) + { + errno = ERANGE; + std::__throw_out_of_range("stof"); + } + } + return __d; + } +#endif + +#if _GLIBCXX_HAVE_STRTOLD && ! _GLIBCXX_HAVE_BROKEN_STRTOLD + inline long double + stold(const string& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } +#elif __DBL_MANT_DIG__ == __LDBL_MANT_DIG__ + inline long double + stold(const string& __str, size_t* __idx = 0) + { return std::stod(__str, __idx); } +#endif + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 1261. Insufficent overloads for to_string / to_wstring + + _GLIBCXX_NODISCARD + inline string + to_string(int __val) +#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32 + noexcept // any 32-bit value fits in the SSO buffer +#endif + { + const bool __neg = __val < 0; + const unsigned __uval = __neg ? (unsigned)~__val + 1u : __val; + const auto __len = __detail::__to_chars_len(__uval); + string __str; + __str.__resize_and_overwrite(__neg + __len, [=](char* __p, size_t __n) { + __p[0] = '-'; + __detail::__to_chars_10_impl(__p + (int)__neg, __len, __uval); + return __n; + }); + return __str; + } + + _GLIBCXX_NODISCARD + inline string + to_string(unsigned __val) +#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_INT__) <= 32 + noexcept // any 32-bit value fits in the SSO buffer +#endif + { + const auto __len = __detail::__to_chars_len(__val); + string __str; + __str.__resize_and_overwrite(__len, [__val](char* __p, size_t __n) { + __detail::__to_chars_10_impl(__p, __n, __val); + return __n; + }); + return __str; + } + + _GLIBCXX_NODISCARD + inline string + to_string(long __val) +#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32 + noexcept // any 32-bit value fits in the SSO buffer +#endif + { + const bool __neg = __val < 0; + const unsigned long __uval = __neg ? (unsigned long)~__val + 1ul : __val; + const auto __len = __detail::__to_chars_len(__uval); + string __str; + __str.__resize_and_overwrite(__neg + __len, [=](char* __p, size_t __n) { + __p[0] = '-'; + __detail::__to_chars_10_impl(__p + (int)__neg, __len, __uval); + return __n; + }); + return __str; + } + + _GLIBCXX_NODISCARD + inline string + to_string(unsigned long __val) +#if _GLIBCXX_USE_CXX11_ABI && (__CHAR_BIT__ * __SIZEOF_LONG__) <= 32 + noexcept // any 32-bit value fits in the SSO buffer +#endif + { + const auto __len = __detail::__to_chars_len(__val); + string __str; + __str.__resize_and_overwrite(__len, [__val](char* __p, size_t __n) { + __detail::__to_chars_10_impl(__p, __n, __val); + return __n; + }); + return __str; + } + + _GLIBCXX_NODISCARD + inline string + to_string(long long __val) + { + const bool __neg = __val < 0; + const unsigned long long __uval + = __neg ? (unsigned long long)~__val + 1ull : __val; + const auto __len = __detail::__to_chars_len(__uval); + string __str; + __str.__resize_and_overwrite(__neg + __len, [=](char* __p, size_t __n) { + __p[0] = '-'; + __detail::__to_chars_10_impl(__p + (int)__neg, __len, __uval); + return __n; + }); + return __str; + } + + _GLIBCXX_NODISCARD + inline string + to_string(unsigned long long __val) + { + const auto __len = __detail::__to_chars_len(__val); + string __str; + __str.__resize_and_overwrite(__len, [__val](char* __p, size_t __n) { + __detail::__to_chars_10_impl(__p, __n, __val); + return __n; + }); + return __str; + } + +#if __glibcxx_to_string >= 202306L // C++ >= 26 + + [[nodiscard]] + inline string + to_string(float __val) + { + string __str; + size_t __len = 15; + do { + __str.resize_and_overwrite(__len, + [__val, &__len] (char* __p, size_t __n) { + auto [__end, __err] = std::to_chars(__p, __p + __n, __val); + if (__err == errc{}) [[likely]] + return __end - __p; + __len *= 2; + return __p - __p;; + }); + } while (__str.empty()); + return __str; + } + + [[nodiscard]] + inline string + to_string(double __val) + { + string __str; + size_t __len = 15; + do { + __str.resize_and_overwrite(__len, + [__val, &__len] (char* __p, size_t __n) { + auto [__end, __err] = std::to_chars(__p, __p + __n, __val); + if (__err == errc{}) [[likely]] + return __end - __p; + __len *= 2; + return __p - __p;; + }); + } while (__str.empty()); + return __str; + } + + [[nodiscard]] + inline string + to_string(long double __val) + { + string __str; + size_t __len = 15; + do { + __str.resize_and_overwrite(__len, + [__val, &__len] (char* __p, size_t __n) { + auto [__end, __err] = std::to_chars(__p, __p + __n, __val); + if (__err == errc{}) [[likely]] + return __end - __p; + __len *= 2; + return __p - __p;; + }); + } while (__str.empty()); + return __str; + } +#elif _GLIBCXX_USE_C99_STDIO +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsuggest-attribute=format" + // NB: (v)snprintf vs sprintf. + + _GLIBCXX_NODISCARD + inline string + to_string(float __val) + { + const int __n = + __gnu_cxx::__numeric_traits::__max_exponent10 + 20; + return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, + "%f", __val); + } + + _GLIBCXX_NODISCARD + inline string + to_string(double __val) + { + const int __n = + __gnu_cxx::__numeric_traits::__max_exponent10 + 20; + return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, + "%f", __val); + } + + _GLIBCXX_NODISCARD + inline string + to_string(long double __val) + { + const int __n = + __gnu_cxx::__numeric_traits::__max_exponent10 + 20; + return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, + "%Lf", __val); + } +#pragma GCC diagnostic pop +#endif // _GLIBCXX_USE_C99_STDIO + +#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR + inline int + stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstol, "stoi", __str.c_str(), + __idx, __base); } + + inline long + stol(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(), + __idx, __base); } + + inline unsigned long + stoul(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(), + __idx, __base); } + + inline long long + stoll(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(), + __idx, __base); } + + inline unsigned long long + stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(), + __idx, __base); } + + // NB: wcstof vs wcstod. + inline float + stof(const wstring& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); } + + inline double + stod(const wstring& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); } + + inline long double + stold(const wstring& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } +#endif + +#ifdef _GLIBCXX_USE_WCHAR_T +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + _GLIBCXX20_CONSTEXPR + inline void + __to_wstring_numeric(const char* __s, int __len, wchar_t* __wout) + { + // This condition is true if exec-charset and wide-exec-charset share the + // same values for the ASCII subset or the EBCDIC invariant character set. + if constexpr (wchar_t('0') == L'0' && wchar_t('-') == L'-' + && wchar_t('.') == L'.' && wchar_t('e') == L'e') + { + for (int __i = 0; __i < __len; ++__i) + __wout[__i] = (wchar_t) __s[__i]; + } + else + { + wchar_t __wc[256]; + for (int __i = '0'; __i <= '9'; ++__i) + __wc[__i] = L'0' + __i; + __wc['.'] = L'.'; + __wc['+'] = L'+'; + __wc['-'] = L'-'; + __wc['a'] = L'a'; + __wc['b'] = L'b'; + __wc['c'] = L'c'; + __wc['d'] = L'd'; + __wc['e'] = L'e'; + __wc['f'] = L'f'; + __wc['i'] = L'i'; // for "inf" + __wc['n'] = L'n'; // for "nan" and "inf" + __wc['p'] = L'p'; // for hexfloats "0x1p1" + __wc['x'] = L'x'; + __wc['A'] = L'A'; + __wc['B'] = L'B'; + __wc['C'] = L'C'; + __wc['D'] = L'D'; + __wc['E'] = L'E'; + __wc['F'] = L'F'; + __wc['I'] = L'I'; + __wc['N'] = L'N'; + __wc['P'] = L'P'; + __wc['X'] = L'X'; + + for (int __i = 0; __i < __len; ++__i) + __wout[__i] = __wc[(int)__s[__i]]; + } + } + +#if __glibcxx_constexpr_string >= 201907L + constexpr +#endif + inline wstring +#ifdef __glibcxx_string_view // >= C++17 + __to_wstring_numeric(string_view __s) +#else + __to_wstring_numeric(const string& __s) +#endif + { + if constexpr (wchar_t('0') == L'0' && wchar_t('-') == L'-' + && wchar_t('.') == L'.' && wchar_t('e') == L'e') + return wstring(__s.data(), __s.data() + __s.size()); + else + { + wstring __ws; + auto __f = __s.data(); + __ws.__resize_and_overwrite(__s.size(), + [__f] (wchar_t* __to, int __n) { + std::__to_wstring_numeric(__f, __n, __to); + return __n; + }); + return __ws; + } + } +#pragma GCC diagnostic pop + + _GLIBCXX_NODISCARD + inline wstring + to_wstring(int __val) + { return std::__to_wstring_numeric(std::to_string(__val)); } + + _GLIBCXX_NODISCARD + inline wstring + to_wstring(unsigned __val) + { return std::__to_wstring_numeric(std::to_string(__val)); } + + _GLIBCXX_NODISCARD + inline wstring + to_wstring(long __val) + { return std::__to_wstring_numeric(std::to_string(__val)); } + + _GLIBCXX_NODISCARD + inline wstring + to_wstring(unsigned long __val) + { return std::__to_wstring_numeric(std::to_string(__val)); } + + _GLIBCXX_NODISCARD + inline wstring + to_wstring(long long __val) + { return std::__to_wstring_numeric(std::to_string(__val)); } + + _GLIBCXX_NODISCARD + inline wstring + to_wstring(unsigned long long __val) + { return std::__to_wstring_numeric(std::to_string(__val)); } + +#if __glibcxx_to_string || _GLIBCXX_USE_C99_STDIO + _GLIBCXX_NODISCARD + inline wstring + to_wstring(float __val) + { return std::__to_wstring_numeric(std::to_string(__val)); } + + _GLIBCXX_NODISCARD + inline wstring + to_wstring(double __val) + { return std::__to_wstring_numeric(std::to_string(__val)); } + + _GLIBCXX_NODISCARD + inline wstring + to_wstring(long double __val) + { return std::__to_wstring_numeric(std::to_string(__val)); } +#endif +#endif // _GLIBCXX_USE_WCHAR_T + +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* C++11 */ + +#if __cplusplus >= 201103L + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3705. Hashability shouldn't depend on basic_string's allocator + + template, _Alloc>> + struct __str_hash_base + : public __hash_base + { + [[__nodiscard__]] + size_t + operator()(const _StrT& __s) const noexcept + { return _Hash_impl::hash(__s.data(), __s.length() * sizeof(_CharT)); } + }; + +#ifndef _GLIBCXX_COMPATIBILITY_CXX0X + /// std::hash specialization for string. + template + struct hash, _Alloc>> + : public __str_hash_base + { }; + + /// std::hash specialization for wstring. + template + struct hash, _Alloc>> + : public __str_hash_base + { }; + + template + struct __is_fast_hash, + _Alloc>>> + : std::false_type + { }; +#endif /* _GLIBCXX_COMPATIBILITY_CXX0X */ + +#ifdef _GLIBCXX_USE_CHAR8_T + /// std::hash specialization for u8string. + template + struct hash, _Alloc>> + : public __str_hash_base + { }; +#endif + + /// std::hash specialization for u16string. + template + struct hash, _Alloc>> + : public __str_hash_base + { }; + + /// std::hash specialization for u32string. + template + struct hash, _Alloc>> + : public __str_hash_base + { }; + +#if ! _GLIBCXX_INLINE_VERSION + // PR libstdc++/105907 - __is_fast_hash affects unordered container ABI. + template<> struct __is_fast_hash> : std::false_type { }; + template<> struct __is_fast_hash> : std::false_type { }; + template<> struct __is_fast_hash> : std::false_type { }; + template<> struct __is_fast_hash> : std::false_type { }; +#ifdef _GLIBCXX_USE_CHAR8_T + template<> struct __is_fast_hash> : std::false_type { }; +#endif +#else + // For versioned namespace, assume every std::hash> is slow. + template + struct __is_fast_hash>> + : std::false_type + { }; +#endif + +#ifdef __glibcxx_string_udls // C++ >= 14 + inline namespace literals + { + inline namespace string_literals + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wliteral-suffix" + +#if __glibcxx_constexpr_string >= 201907L +# define _GLIBCXX_STRING_CONSTEXPR constexpr +#else +# define _GLIBCXX_STRING_CONSTEXPR +#endif + + _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR + inline basic_string + operator""s(const char* __str, size_t __len) + { return basic_string{__str, __len}; } + + _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR + inline basic_string + operator""s(const wchar_t* __str, size_t __len) + { return basic_string{__str, __len}; } + +#ifdef _GLIBCXX_USE_CHAR8_T + _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR + inline basic_string + operator""s(const char8_t* __str, size_t __len) + { return basic_string{__str, __len}; } +#endif + + _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR + inline basic_string + operator""s(const char16_t* __str, size_t __len) + { return basic_string{__str, __len}; } + + _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_STRING_CONSTEXPR + inline basic_string + operator""s(const char32_t* __str, size_t __len) + { return basic_string{__str, __len}; } + +#undef _GLIBCXX_STRING_CONSTEXPR +#pragma GCC diagnostic pop + } // inline namespace string_literals + } // inline namespace literals +#endif // __glibcxx_string_udls + +#ifdef __glibcxx_variant // >= C++17 + namespace __detail::__variant + { + template struct _Never_valueless_alt; // see + + // Provide the strong exception-safety guarantee when emplacing a + // basic_string into a variant, but only if moving the string cannot throw. + template + struct _Never_valueless_alt> + : __and_< + is_nothrow_move_constructible>, + is_nothrow_move_assignable> + >::type + { }; + } // namespace __detail::__variant +#endif // C++17 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 + +#endif /* _BASIC_STRING_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.h.blob new file mode 100644 index 0000000..a8baae4 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.tcc new file mode 100644 index 0000000..bca55bc --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.tcc @@ -0,0 +1,1066 @@ +// Components for manipulating sequences of characters -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/basic_string.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{string} + */ + +// +// ISO C++ 14882: 21 Strings library +// + +// Written by Jason Merrill based upon the specification by Takanori Adachi +// in ANSI X3J16/94-0013R2. Rewritten by Nathan Myers to ISO-14882. +// Non-reference-counted implementation written by Paolo Carlini and +// updated by Jonathan Wakely for ISO-14882-2011. + +#ifndef _BASIC_STRING_TCC +#define _BASIC_STRING_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if _GLIBCXX_USE_CXX11_ABI + + template + const typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>::npos; + + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + swap(basic_string& __s) _GLIBCXX_NOEXCEPT + { + if (this == std::__addressof(__s)) + return; + + _Alloc_traits::_S_on_swap(_M_get_allocator(), __s._M_get_allocator()); + + if (_M_is_local()) + if (__s._M_is_local()) + { + if (length() && __s.length()) + { + _CharT __tmp_data[_S_local_capacity + 1]; + traits_type::copy(__tmp_data, __s._M_local_buf, + __s.length() + 1); + traits_type::copy(__s._M_local_buf, _M_local_buf, + length() + 1); + traits_type::copy(_M_local_buf, __tmp_data, + __s.length() + 1); + } + else if (__s.length()) + { + _M_init_local_buf(); + traits_type::copy(_M_local_buf, __s._M_local_buf, + __s.length() + 1); + _M_length(__s.length()); + __s._M_set_length(0); + return; + } + else if (length()) + { + __s._M_init_local_buf(); + traits_type::copy(__s._M_local_buf, _M_local_buf, + length() + 1); + __s._M_length(length()); + _M_set_length(0); + return; + } + } + else + { + const size_type __tmp_capacity = __s._M_allocated_capacity; + __s._M_init_local_buf(); + traits_type::copy(__s._M_local_buf, _M_local_buf, + length() + 1); + _M_data(__s._M_data()); + __s._M_data(__s._M_local_buf); + _M_capacity(__tmp_capacity); + } + else + { + const size_type __tmp_capacity = _M_allocated_capacity; + if (__s._M_is_local()) + { + _M_init_local_buf(); + traits_type::copy(_M_local_buf, __s._M_local_buf, + __s.length() + 1); + __s._M_data(_M_data()); + _M_data(_M_local_buf); + } + else + { + pointer __tmp_ptr = _M_data(); + _M_data(__s._M_data()); + __s._M_data(__tmp_ptr); + _M_capacity(__s._M_allocated_capacity); + } + __s._M_capacity(__tmp_capacity); + } + + const size_type __tmp_length = length(); + _M_length(__s.length()); + __s._M_length(__tmp_length); + } + + template + _GLIBCXX20_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::pointer + basic_string<_CharT, _Traits, _Alloc>:: + _M_create(size_type& __capacity, size_type __old_capacity) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 83. String::npos vs. string::max_size() + if (__capacity > max_size()) + std::__throw_length_error(__N("basic_string::_M_create")); + + // The below implements an exponential growth policy, necessary to + // meet amortized linear time requirements of the library: see + // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html. + if (__capacity > __old_capacity && __capacity < 2 * __old_capacity) + { + __capacity = 2 * __old_capacity; + // Never allocate a string bigger than max_size. + if (__capacity > max_size()) + __capacity = max_size(); + } + + // NB: Need an array of char_type[__capacity], plus a terminating + // null char_type() element. + return _S_allocate(_M_get_allocator(), __capacity + 1); + } + + // NB: This is the special case for Input Iterators, used in + // istreambuf_iterators, etc. + // Input Iterators have a cost structure very different from + // pointers, calling for a different coding style. + template + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + _M_construct(_InIterator __beg, _InIterator __end, + std::input_iterator_tag) + { + size_type __len = 0; + size_type __capacity = size_type(_S_local_capacity); + + _M_init_local_buf(); + + while (__beg != __end && __len < __capacity) + { + _M_local_buf[__len++] = *__beg; + ++__beg; + } + + struct _Guard + { + _GLIBCXX20_CONSTEXPR + explicit _Guard(basic_string* __s) : _M_guarded(__s) { } + + _GLIBCXX20_CONSTEXPR + ~_Guard() { if (_M_guarded) _M_guarded->_M_dispose(); } + + basic_string* _M_guarded; + } __guard(this); + + while (__beg != __end) + { + if (__len == __capacity) + { + // Allocate more space. + __capacity = __len + 1; + pointer __another = _M_create(__capacity, __len); + this->_S_copy(__another, _M_data(), __len); + _M_dispose(); + _M_data(__another); + _M_capacity(__capacity); + } + traits_type::assign(_M_data()[__len++], + static_cast<_CharT>(*__beg)); + ++__beg; + } + + __guard._M_guarded = 0; + + _M_set_length(__len); + } + + template + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + _M_construct(_InIterator __beg, _InIterator __end, + std::forward_iterator_tag) + { + size_type __dnew = static_cast(std::distance(__beg, __end)); + + if (__dnew > size_type(_S_local_capacity)) + { + _M_data(_M_create(__dnew, size_type(0))); + _M_capacity(__dnew); + } + else + _M_init_local_buf(); + + // Check for out_of_range and length_error exceptions. + struct _Guard + { + _GLIBCXX20_CONSTEXPR + explicit _Guard(basic_string* __s) : _M_guarded(__s) { } + + _GLIBCXX20_CONSTEXPR + ~_Guard() { if (_M_guarded) _M_guarded->_M_dispose(); } + + basic_string* _M_guarded; + } __guard(this); + + this->_S_copy_chars(_M_data(), __beg, __end); + + __guard._M_guarded = 0; + + _M_set_length(__dnew); + } + + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + _M_construct(size_type __n, _CharT __c) + { + if (__n > size_type(_S_local_capacity)) + { + _M_data(_M_create(__n, size_type(0))); + _M_capacity(__n); + } + else + _M_init_local_buf(); + + if (__n) + this->_S_assign(_M_data(), __n, __c); + + _M_set_length(__n); + } + + // Length of string constructed is easier to propagate inter-procedurally + // than difference between iterators. + template + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + _M_construct(const _CharT* __str, size_type __n) + { + if (__n > size_type(_S_local_capacity)) + { + _M_data(_M_create(__n, size_type(0))); + _M_capacity(__n); + } + else + _M_init_local_buf(); + + if (__n || _Terminated) + this->_S_copy(_M_data(), __str, __n + _Terminated); + + _M_length(__n); + if (!_Terminated) + traits_type::assign(_M_data()[__n], _CharT()); + } + + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + _M_assign(const basic_string& __str) + { + if (this != std::__addressof(__str)) + { + const size_type __rsize = __str.length(); + const size_type __capacity = capacity(); + + if (__rsize > __capacity) + { + size_type __new_capacity = __rsize; + pointer __tmp = _M_create(__new_capacity, __capacity); + _M_dispose(); + _M_data(__tmp); + _M_capacity(__new_capacity); + } + + if (__rsize) + this->_S_copy(_M_data(), __str._M_data(), __rsize); + + _M_set_length(__rsize); + } + } + + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + reserve(size_type __res) + { + const size_type __capacity = capacity(); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2968. Inconsistencies between basic_string reserve and + // vector/unordered_map/unordered_set reserve functions + // P0966 reserve should not shrink + if (__res <= __capacity) + return; + + pointer __tmp = _M_create(__res, __capacity); + this->_S_copy(__tmp, _M_data(), length() + 1); + _M_dispose(); + _M_data(__tmp); + _M_capacity(__res); + } + + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, + size_type __len2) + { + const size_type __how_much = length() - __pos - __len1; + + size_type __new_capacity = length() + __len2 - __len1; + pointer __r = _M_create(__new_capacity, capacity()); + + if (__pos) + this->_S_copy(__r, _M_data(), __pos); + if (__s && __len2) + this->_S_copy(__r + __pos, __s, __len2); + if (__how_much) + this->_S_copy(__r + __pos + __len2, + _M_data() + __pos + __len1, __how_much); + + _M_dispose(); + _M_data(__r); + _M_capacity(__new_capacity); + } + + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + _M_erase(size_type __pos, size_type __n) + { + const size_type __how_much = length() - __pos - __n; + + if (__how_much && __n) + this->_S_move(_M_data() + __pos, _M_data() + __pos + __n, __how_much); + + _M_set_length(length() - __n); + } + + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + reserve() + { + if (_M_is_local()) + return; + + const size_type __length = length(); + const size_type __capacity = _M_allocated_capacity; + + if (__length <= size_type(_S_local_capacity)) + { + _M_init_local_buf(); + this->_S_copy(_M_local_buf, _M_data(), __length + 1); + _M_destroy(__capacity); + _M_data(_M_local_data()); + } +#if __cpp_exceptions + else if (__length < __capacity) + try + { + pointer __tmp = _S_allocate(_M_get_allocator(), __length + 1); + this->_S_copy(__tmp, _M_data(), __length + 1); + _M_dispose(); + _M_data(__tmp); + _M_capacity(__length); + } + catch (const __cxxabiv1::__forced_unwind&) + { throw; } + catch (...) + { /* swallow the exception */ } +#endif + } + + template + _GLIBCXX20_CONSTEXPR + void + basic_string<_CharT, _Traits, _Alloc>:: + resize(size_type __n, _CharT __c) + { + const size_type __size = this->size(); + if (__size < __n) + this->append(__n - __size, __c); + else if (__n < __size) + this->_M_set_length(__n); + } + + template + _GLIBCXX20_CONSTEXPR + basic_string<_CharT, _Traits, _Alloc>& + basic_string<_CharT, _Traits, _Alloc>:: + _M_append(const _CharT* __s, size_type __n) + { + const size_type __len = __n + this->size(); + + if (__len <= this->capacity()) + { + if (__n) + this->_S_copy(this->_M_data() + this->size(), __s, __n); + } + else + this->_M_mutate(this->size(), size_type(0), __s, __n); + + this->_M_set_length(__len); + return *this; + } + + template + template + _GLIBCXX20_CONSTEXPR + basic_string<_CharT, _Traits, _Alloc>& + basic_string<_CharT, _Traits, _Alloc>:: + _M_replace_dispatch(const_iterator __i1, const_iterator __i2, + _InputIterator __k1, _InputIterator __k2, + std::__false_type) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2788. unintentionally require a default constructible allocator + const basic_string __s(__k1, __k2, this->get_allocator()); + const size_type __n1 = __i2 - __i1; + return _M_replace(__i1 - begin(), __n1, __s._M_data(), + __s.size()); + } + + template + _GLIBCXX20_CONSTEXPR + basic_string<_CharT, _Traits, _Alloc>& + basic_string<_CharT, _Traits, _Alloc>:: + _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, + _CharT __c) + { + _M_check_length(__n1, __n2, "basic_string::_M_replace_aux"); + + const size_type __old_size = this->size(); + const size_type __new_size = __old_size + __n2 - __n1; + + if (__new_size <= this->capacity()) + { + pointer __p = this->_M_data() + __pos1; + + const size_type __how_much = __old_size - __pos1 - __n1; + if (__how_much && __n1 != __n2) + this->_S_move(__p + __n2, __p + __n1, __how_much); + } + else + this->_M_mutate(__pos1, __n1, 0, __n2); + + if (__n2) + this->_S_assign(this->_M_data() + __pos1, __n2, __c); + + this->_M_set_length(__new_size); + return *this; + } + + template + __attribute__((__noinline__, __noclone__, __cold__)) void + basic_string<_CharT, _Traits, _Alloc>:: + _M_replace_cold(pointer __p, size_type __len1, const _CharT* __s, + const size_type __len2, const size_type __how_much) + { + // Work in-place. + if (__len2 && __len2 <= __len1) + this->_S_move(__p, __s, __len2); + if (__how_much && __len1 != __len2) + this->_S_move(__p + __len2, __p + __len1, __how_much); + if (__len2 > __len1) + { + if (__s + __len2 <= __p + __len1) + this->_S_move(__p, __s, __len2); + else if (__s >= __p + __len1) + { + // Hint to middle end that __p and __s overlap + // (PR 98465). + const size_type __poff = (__s - __p) + (__len2 - __len1); + this->_S_copy(__p, __p + __poff, __len2); + } + else + { + const size_type __nleft = (__p + __len1) - __s; + this->_S_move(__p, __s, __nleft); + this->_S_copy(__p + __nleft, __p + __len2, __len2 - __nleft); + } + } + } + + template + _GLIBCXX20_CONSTEXPR + basic_string<_CharT, _Traits, _Alloc>& + basic_string<_CharT, _Traits, _Alloc>:: + _M_replace(size_type __pos, size_type __len1, const _CharT* __s, + const size_type __len2) + { + _M_check_length(__len1, __len2, "basic_string::_M_replace"); + + const size_type __old_size = this->size(); + const size_type __new_size = __old_size + __len2 - __len1; + + if (__new_size <= this->capacity()) + { + pointer __p = this->_M_data() + __pos; + + const size_type __how_much = __old_size - __pos - __len1; +#if __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + { + auto __newp = _S_allocate(_M_get_allocator(), __new_size); + _S_copy(__newp, this->_M_data(), __pos); + _S_copy(__newp + __pos, __s, __len2); + _S_copy(__newp + __pos + __len2, __p + __len1, __how_much); + _S_copy(this->_M_data(), __newp, __new_size); + this->_M_get_allocator().deallocate(__newp, __new_size); + } + else +#endif + if (__builtin_expect(_M_disjunct(__s), true)) + { + if (__how_much && __len1 != __len2) + this->_S_move(__p + __len2, __p + __len1, __how_much); + if (__len2) + this->_S_copy(__p, __s, __len2); + } + else + _M_replace_cold(__p, __len1, __s, __len2, __how_much); + } + else + this->_M_mutate(__pos, __len1, __s, __len2); + + this->_M_set_length(__new_size); + return *this; + } + + template + _GLIBCXX20_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + copy(_CharT* __s, size_type __n, size_type __pos) const + { + _M_check(__pos, "basic_string::copy"); + __n = _M_limit(__pos, __n); + __glibcxx_requires_string_len(__s, __n); + if (__n) + _S_copy(__s, _M_data() + __pos, __n); + // 21.3.5.7 par 3: do not append null. (good.) + return __n; + } + +#ifdef __glibcxx_string_resize_and_overwrite // C++ >= 23 + template + template + [[__gnu__::__always_inline__]] + constexpr void + basic_string<_CharT, _Traits, _Alloc>:: + __resize_and_overwrite(const size_type __n, _Operation __op) + { resize_and_overwrite<_Operation&>(__n, __op); } +#endif + +#if __cplusplus >= 201103L + template + template + _GLIBCXX20_CONSTEXPR void + basic_string<_CharT, _Traits, _Alloc>:: +#ifdef __glibcxx_string_resize_and_overwrite // C++ >= 23 + resize_and_overwrite(const size_type __n, _Operation __op) +#else + __resize_and_overwrite(const size_type __n, _Operation __op) +#endif + { + reserve(__n); + _CharT* const __p = _M_data(); +#if __cpp_lib_is_constant_evaluated + if (std::__is_constant_evaluated() && __n > size()) + traits_type::assign(__p + size(), __n - size(), _CharT()); +#endif + struct _Terminator { + _GLIBCXX20_CONSTEXPR ~_Terminator() { _M_this->_M_set_length(_M_r); } + basic_string* _M_this; + size_type _M_r; + }; + _Terminator __term{this, 0}; + auto __r = std::move(__op)(__p + 0, __n + 0); +#ifdef __cpp_lib_concepts + static_assert(ranges::__detail::__is_integer_like); +#else + static_assert(__gnu_cxx::__is_integer_nonstrict::__value, + "resize_and_overwrite operation must return an integer"); +#endif + _GLIBCXX_DEBUG_ASSERT(__r >= 0 && size_type(__r) <= __n); + __term._M_r = size_type(__r); + if (__term._M_r > __n) + __builtin_unreachable(); + } +#endif // C++11 + +#endif // _GLIBCXX_USE_CXX11_ABI + +#if __glibcxx_constexpr_string >= 201907L +# define _GLIBCXX_STRING_CONSTEXPR constexpr +#else +# define _GLIBCXX_STRING_CONSTEXPR +#endif + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + find(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string_len(__s, __n); + const size_type __size = this->size(); + + if (__n == 0) + return __pos <= __size ? __pos : npos; + if (__pos >= __size) + return npos; + + const _CharT __elem0 = __s[0]; + const _CharT* const __data = data(); + const _CharT* __first = __data + __pos; + const _CharT* const __last = __data + __size; + size_type __len = __size - __pos; + + while (__len >= __n) + { + // Find the first occurrence of __elem0: + __first = traits_type::find(__first, __len - __n + 1, __elem0); + if (!__first) + return npos; + // Compare the full strings from the first occurrence of __elem0. + // We already know that __first[0] == __s[0] but compare them again + // anyway because __s is probably aligned, which helps memcmp. + if (traits_type::compare(__first, __s, __n) == 0) + return __first - __data; + __len = __last - ++__first; + } + return npos; + } + + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + find(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT + { + size_type __ret = npos; + const size_type __size = this->size(); + if (__pos < __size) + { + const _CharT* __data = _M_data(); + const size_type __n = __size - __pos; + const _CharT* __p = traits_type::find(__data + __pos, __n, __c); + if (__p) + __ret = __p - __data; + } + return __ret; + } + + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + rfind(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string_len(__s, __n); + const size_type __size = this->size(); + if (__n <= __size) + { + __pos = std::min(size_type(__size - __n), __pos); + const _CharT* __data = _M_data(); + do + { + if (traits_type::compare(__data + __pos, __s, __n) == 0) + return __pos; + } + while (__pos-- > 0); + } + return npos; + } + + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + rfind(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT + { + size_type __size = this->size(); + if (__size) + { + if (--__size > __pos) + __size = __pos; + for (++__size; __size-- > 0; ) + if (traits_type::eq(_M_data()[__size], __c)) + return __size; + } + return npos; + } + + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + find_first_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string_len(__s, __n); + for (; __n && __pos < this->size(); ++__pos) + { + const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]); + if (__p) + return __pos; + } + return npos; + } + + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + find_last_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string_len(__s, __n); + size_type __size = this->size(); + if (__size && __n) + { + if (--__size > __pos) + __size = __pos; + do + { + if (traits_type::find(__s, __n, _M_data()[__size])) + return __size; + } + while (__size-- != 0); + } + return npos; + } + + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string_len(__s, __n); + for (; __pos < this->size(); ++__pos) + if (!traits_type::find(__s, __n, _M_data()[__pos])) + return __pos; + return npos; + } + + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + find_first_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT + { + for (; __pos < this->size(); ++__pos) + if (!traits_type::eq(_M_data()[__pos], __c)) + return __pos; + return npos; + } + + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string_len(__s, __n); + size_type __size = this->size(); + if (__size) + { + if (--__size > __pos) + __size = __pos; + do + { + if (!traits_type::find(__s, __n, _M_data()[__size])) + return __size; + } + while (__size--); + } + return npos; + } + + template + _GLIBCXX_STRING_CONSTEXPR + typename basic_string<_CharT, _Traits, _Alloc>::size_type + basic_string<_CharT, _Traits, _Alloc>:: + find_last_not_of(_CharT __c, size_type __pos) const _GLIBCXX_NOEXCEPT + { + size_type __size = this->size(); + if (__size) + { + if (--__size > __pos) + __size = __pos; + do + { + if (!traits_type::eq(_M_data()[__size], __c)) + return __size; + } + while (__size--); + } + return npos; + } + +#undef _GLIBCXX_STRING_CONSTEXPR + + // 21.3.7.9 basic_string::getline and operators + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __in, + basic_string<_CharT, _Traits, _Alloc>& __str) + { + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef typename __istream_type::ios_base __ios_base; + typedef typename __istream_type::int_type __int_type; + typedef typename __string_type::size_type __size_type; + typedef ctype<_CharT> __ctype_type; + typedef typename __ctype_type::ctype_base __ctype_base; + + __size_type __extracted = 0; + typename __ios_base::iostate __err = __ios_base::goodbit; + typename __istream_type::sentry __cerb(__in, false); + if (__cerb) + { + __try + { + // Avoid reallocation for common case. + __str.erase(); + _CharT __buf[128]; + __size_type __len = 0; + const streamsize __w = __in.width(); + const __size_type __n = __w > 0 ? static_cast<__size_type>(__w) + : __str.max_size(); + const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); + const __int_type __eof = _Traits::eof(); + __int_type __c = __in.rdbuf()->sgetc(); + + while (__extracted < __n + && !_Traits::eq_int_type(__c, __eof) + && !__ct.is(__ctype_base::space, + _Traits::to_char_type(__c))) + { + if (__len == sizeof(__buf) / sizeof(_CharT)) + { + __str.append(__buf, sizeof(__buf) / sizeof(_CharT)); + __len = 0; + } + __buf[__len++] = _Traits::to_char_type(__c); + ++__extracted; + __c = __in.rdbuf()->snextc(); + } + __str.append(__buf, __len); + + if (__extracted < __n && _Traits::eq_int_type(__c, __eof)) + __err |= __ios_base::eofbit; + __in.width(0); + } + __catch(__cxxabiv1::__forced_unwind&) + { + __in._M_setstate(__ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 91. Description of operator>> and getline() for string<> + // might cause endless loop + __in._M_setstate(__ios_base::badbit); + } + } + // 211. operator>>(istream&, string&) doesn't set failbit + if (!__extracted) + __err |= __ios_base::failbit; + if (__err) + __in.setstate(__err); + return __in; + } + + template + basic_istream<_CharT, _Traits>& + getline(basic_istream<_CharT, _Traits>& __in, + basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim) + { + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef typename __istream_type::ios_base __ios_base; + typedef typename __istream_type::int_type __int_type; + typedef typename __string_type::size_type __size_type; + + __size_type __extracted = 0; + const __size_type __n = __str.max_size(); + typename __ios_base::iostate __err = __ios_base::goodbit; + typename __istream_type::sentry __cerb(__in, true); + if (__cerb) + { + __try + { + __str.erase(); + const __int_type __idelim = _Traits::to_int_type(__delim); + const __int_type __eof = _Traits::eof(); + __int_type __c = __in.rdbuf()->sgetc(); + + while (__extracted < __n + && !_Traits::eq_int_type(__c, __eof) + && !_Traits::eq_int_type(__c, __idelim)) + { + __str += _Traits::to_char_type(__c); + ++__extracted; + __c = __in.rdbuf()->snextc(); + } + + if (_Traits::eq_int_type(__c, __eof)) + __err |= __ios_base::eofbit; + else if (_Traits::eq_int_type(__c, __idelim)) + { + ++__extracted; + __in.rdbuf()->sbumpc(); + } + else + __err |= __ios_base::failbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + __in._M_setstate(__ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 91. Description of operator>> and getline() for string<> + // might cause endless loop + __in._M_setstate(__ios_base::badbit); + } + } + if (!__extracted) + __err |= __ios_base::failbit; + if (__err) + __in.setstate(__err); + return __in; + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + // The explicit instantiation definitions in src/c++11/string-inst.cc and + // src/c++17/string-inst.cc only instantiate the members required for C++17 + // and earlier standards (so not C++20's starts_with and ends_with). + // Suppress the explicit instantiation declarations for C++20, so C++20 + // code will implicitly instantiate std::string and std::wstring as needed. +# if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0 + extern template class basic_string; +# elif ! _GLIBCXX_USE_CXX11_ABI + // Still need to prevent implicit instantiation of the COW empty rep, + // to ensure the definition in libstdc++.so is unique (PR 86138). + extern template basic_string::size_type + basic_string::_Rep::_S_empty_rep_storage[]; +# elif _GLIBCXX_EXTERN_TEMPLATE > 0 + // Export _M_replace_cold even for C++20. + extern template void + basic_string::_M_replace_cold(char *, size_type, const char*, + const size_type, const size_type); +# endif + + extern template + basic_istream& + operator>>(basic_istream&, string&); + extern template + basic_ostream& + operator<<(basic_ostream&, const string&); + extern template + basic_istream& + getline(basic_istream&, string&, char); + extern template + basic_istream& + getline(basic_istream&, string&); + +#ifdef _GLIBCXX_USE_WCHAR_T +# if __cplusplus <= 201703L && _GLIBCXX_EXTERN_TEMPLATE > 0 + extern template class basic_string; +# elif ! _GLIBCXX_USE_CXX11_ABI + extern template basic_string::size_type + basic_string::_Rep::_S_empty_rep_storage[]; +# elif _GLIBCXX_EXTERN_TEMPLATE > 0 + // Export _M_replace_cold even for C++20. + extern template void + basic_string::_M_replace_cold(wchar_t*, size_type, const wchar_t*, + const size_type, const size_type); +# endif + + extern template + basic_istream& + operator>>(basic_istream&, wstring&); + extern template + basic_ostream& + operator<<(basic_ostream&, const wstring&); + extern template + basic_istream& + getline(basic_istream&, wstring&, wchar_t); + extern template + basic_istream& + getline(basic_istream&, wstring&); +#endif // _GLIBCXX_USE_WCHAR_T +#endif // _GLIBCXX_EXTERN_TEMPLATE + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.tcc.blob new file mode 100644 index 0000000..6d5380f Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@basic_string.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@char_traits.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@char_traits.h new file mode 100644 index 0000000..67e18e8 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@char_traits.h @@ -0,0 +1,1016 @@ +// Character Traits for use by standard string and iostream -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/char_traits.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{string} + */ + +// +// ISO C++ 14882: 21 Strings library +// + +#ifndef _CHAR_TRAITS_H +#define _CHAR_TRAITS_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#if _GLIBCXX_HOSTED +# include // For streampos +#endif // HOSTED + +#ifdef _GLIBCXX_USE_WCHAR_T +# include // For WEOF, wmemmove, wmemset, etc. +#endif // USE_WCHAR_T + +#if __cplusplus >= 201103L +# include +#if !defined __UINT_LEAST16_TYPE__ || !defined __UINT_LEAST32_TYPE__ +# include +#endif +#endif +#if __cplusplus >= 202002L +# include +# include +#endif + +#ifndef _GLIBCXX_ALWAYS_INLINE +# define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#pragma GCC diagnostic ignored "-Wstringop-overread" +#pragma GCC diagnostic ignored "-Warray-bounds" + + /** + * @brief Mapping from character type to associated types. + * + * @note This is an implementation class for the generic version + * of char_traits. It defines int_type, off_type, pos_type, and + * state_type. By default these are unsigned long, streamoff, + * streampos, and mbstate_t. Users who need a different set of + * types, but who don't need to change the definitions of any function + * defined in char_traits, can specialize __gnu_cxx::_Char_types + * while leaving __gnu_cxx::char_traits alone. */ + template + struct _Char_types + { + typedef unsigned long int_type; +#if _GLIBCXX_HOSTED + typedef std::streampos pos_type; + typedef std::streamoff off_type; + typedef std::mbstate_t state_type; +#endif // HOSTED + }; + + + /** + * @brief Base class used to implement std::char_traits. + * + * @note For any given actual character type, this definition is + * probably wrong. (Most of the member functions are likely to be + * right, but the int_type and state_type typedefs, and the eof() + * member function, are likely to be wrong.) The reason this class + * exists is so users can specialize it. Classes in namespace std + * may not be specialized for fundamental types, but classes in + * namespace __gnu_cxx may be. + * + * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types + * for advice on how to make use of this class for @a unusual character + * types. Also, check out include/ext/pod_char_traits.h. + */ + template + struct char_traits + { + typedef _CharT char_type; + typedef typename _Char_types<_CharT>::int_type int_type; +#if _GLIBCXX_HOSTED + typedef typename _Char_types<_CharT>::pos_type pos_type; + typedef typename _Char_types<_CharT>::off_type off_type; + typedef typename _Char_types<_CharT>::state_type state_type; +#endif // HOSTED +#if __cpp_lib_three_way_comparison + using comparison_category = std::strong_ordering; +#endif + + static _GLIBCXX14_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) + { +#if __cpp_constexpr_dynamic_alloc + if (std::__is_constant_evaluated()) + std::construct_at(__builtin_addressof(__c1), __c2); + else +#endif + __c1 = __c2; + } + + static _GLIBCXX_CONSTEXPR bool + eq(const char_type& __c1, const char_type& __c2) + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR bool + lt(const char_type& __c1, const char_type& __c2) + { return __c1 < __c2; } + + static _GLIBCXX14_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, std::size_t __n); + + static _GLIBCXX14_CONSTEXPR std::size_t + length(const char_type* __s); + + static _GLIBCXX14_CONSTEXPR const char_type* + find(const char_type* __s, std::size_t __n, const char_type& __a); + + static _GLIBCXX20_CONSTEXPR char_type* + move(char_type* __s1, const char_type* __s2, std::size_t __n); + + static _GLIBCXX20_CONSTEXPR char_type* + copy(char_type* __s1, const char_type* __s2, std::size_t __n); + + static _GLIBCXX20_CONSTEXPR char_type* + assign(char_type* __s, std::size_t __n, char_type __a); + + static _GLIBCXX_CONSTEXPR char_type + to_char_type(const int_type& __c) + { return static_cast(__c); } + + static _GLIBCXX_CONSTEXPR int_type + to_int_type(const char_type& __c) + { return static_cast(__c); } + + static _GLIBCXX_CONSTEXPR bool + eq_int_type(const int_type& __c1, const int_type& __c2) + { return __c1 == __c2; } + +#ifdef _GLIBCXX_STDIO_EOF + static _GLIBCXX_CONSTEXPR int_type + eof() + { return static_cast(_GLIBCXX_STDIO_EOF); } + + static _GLIBCXX_CONSTEXPR int_type + not_eof(const int_type& __c) + { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); } +#endif // defined(_GLIBCXX_STDIO_EOF) + }; + + template + _GLIBCXX14_CONSTEXPR int + char_traits<_CharT>:: + compare(const char_type* __s1, const char_type* __s2, std::size_t __n) + { + for (std::size_t __i = 0; __i < __n; ++__i) + if (lt(__s1[__i], __s2[__i])) + return -1; + else if (lt(__s2[__i], __s1[__i])) + return 1; + return 0; + } + + template + _GLIBCXX14_CONSTEXPR std::size_t + char_traits<_CharT>:: + length(const char_type* __p) + { + std::size_t __i = 0; + while (!eq(__p[__i], char_type())) + ++__i; + return __i; + } + + template + _GLIBCXX14_CONSTEXPR const typename char_traits<_CharT>::char_type* + char_traits<_CharT>:: + find(const char_type* __s, std::size_t __n, const char_type& __a) + { + for (std::size_t __i = 0; __i < __n; ++__i) + if (eq(__s[__i], __a)) + return __s + __i; + return 0; + } + + template + _GLIBCXX20_CONSTEXPR + typename char_traits<_CharT>::char_type* + char_traits<_CharT>:: + move(char_type* __s1, const char_type* __s2, std::size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + { + // Use __builtin_constant_p to avoid comparing unrelated pointers. + if (__builtin_constant_p(__s2 < __s1) + && __s1 > __s2 && __s1 < (__s2 + __n)) + { + do + { + --__n; + assign(__s1[__n], __s2[__n]); + } + while (__n > 0); + } + else + copy(__s1, __s2, __n); + return __s1; + } +#endif + __builtin_memmove(__s1, __s2, __n * sizeof(char_type)); + return __s1; + } + + template + _GLIBCXX20_CONSTEXPR + typename char_traits<_CharT>::char_type* + char_traits<_CharT>:: + copy(char_type* __s1, const char_type* __s2, std::size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + { + for (std::size_t __i = 0; __i < __n; ++__i) + std::construct_at(__s1 + __i, __s2[__i]); + return __s1; + } +#endif + __builtin_memcpy(__s1, __s2, __n * sizeof(char_type)); + return __s1; + } + + template + _GLIBCXX20_CONSTEXPR + typename char_traits<_CharT>::char_type* + char_traits<_CharT>:: + assign(char_type* __s, std::size_t __n, char_type __a) + { +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + { + for (std::size_t __i = 0; __i < __n; ++__i) + std::construct_at(__s + __i, __a); + return __s; + } +#endif + + if _GLIBCXX17_CONSTEXPR (sizeof(_CharT) == 1 && __is_trivial(_CharT)) + { + if (__n) + { + unsigned char __c; + __builtin_memcpy(&__c, __builtin_addressof(__a), 1); + __builtin_memset(__s, __c, __n); + } + } + else + { + for (std::size_t __i = 0; __i < __n; ++__i) + __s[__i] = __a; + } + return __s; + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 21.1 + /** + * @brief Basis for explicit traits specializations. + * + * @note For any given actual character type, this definition is + * probably wrong. Since this is just a thin wrapper around + * __gnu_cxx::char_traits, it is possible to achieve a more + * appropriate definition by specializing __gnu_cxx::char_traits. + * + * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types + * for advice on how to make use of this class for @a unusual character + * types. Also, check out include/ext/pod_char_traits.h. + */ + template + struct char_traits : public __gnu_cxx::char_traits<_CharT> + { }; + + + /// 21.1.3.1 char_traits specializations + template<> + struct char_traits + { + typedef char char_type; + typedef int int_type; +#if _GLIBCXX_HOSTED + typedef streampos pos_type; + typedef streamoff off_type; + typedef mbstate_t state_type; +#endif // HOSTED +#if __cpp_lib_three_way_comparison + using comparison_category = strong_ordering; +#endif + + static _GLIBCXX17_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { +#if __cpp_constexpr_dynamic_alloc + if (std::__is_constant_evaluated()) + std::construct_at(__builtin_addressof(__c1), __c2); + else +#endif + __c1 = __c2; + } + + static _GLIBCXX_CONSTEXPR bool + eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR bool + lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { + // LWG 467. + return (static_cast(__c1) + < static_cast(__c2)); + } + + static _GLIBCXX17_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return 0; +#if __cplusplus >= 201703L + if (std::__is_constant_evaluated()) + { + for (size_t __i = 0; __i < __n; ++__i) + if (lt(__s1[__i], __s2[__i])) + return -1; + else if (lt(__s2[__i], __s1[__i])) + return 1; + return 0; + } +#endif + return __builtin_memcmp(__s1, __s2, __n); + } + + static _GLIBCXX17_CONSTEXPR size_t + length(const char_type* __s) + { +#if __cplusplus >= 201703L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::length(__s); +#endif + return __builtin_strlen(__s); + } + + static _GLIBCXX17_CONSTEXPR const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + if (__n == 0) + return 0; +#if __cplusplus >= 201703L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::find(__s, __n, __a); +#endif + return static_cast(__builtin_memchr(__s, __a, __n)); + } + + static _GLIBCXX20_CONSTEXPR char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::move(__s1, __s2, __n); +#endif + return static_cast(__builtin_memmove(__s1, __s2, __n)); + } + + static _GLIBCXX20_CONSTEXPR char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::copy(__s1, __s2, __n); +#endif + return static_cast(__builtin_memcpy(__s1, __s2, __n)); + } + + static _GLIBCXX20_CONSTEXPR char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + if (__n == 0) + return __s; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::assign(__s, __n, __a); +#endif + return static_cast(__builtin_memset(__s, __a, __n)); + } + + static _GLIBCXX_CONSTEXPR char_type + to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT + { return static_cast(__c); } + + // To keep both the byte 0xff and the eof symbol 0xffffffff + // from ending up as 0xffffffff. + static _GLIBCXX_CONSTEXPR int_type + to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT + { return static_cast(static_cast(__c)); } + + static _GLIBCXX_CONSTEXPR bool + eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + +#ifdef _GLIBCXX_STDIO_EOF + static _GLIBCXX_CONSTEXPR int_type + eof() _GLIBCXX_NOEXCEPT + { return static_cast(_GLIBCXX_STDIO_EOF); } + + static _GLIBCXX_CONSTEXPR int_type + not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT + { return (__c == eof()) ? 0 : __c; } +#endif // defined(_GLIBCXX_STDIO_EOF) + }; + + +#ifdef _GLIBCXX_USE_WCHAR_T + /// 21.1.3.2 char_traits specializations + template<> + struct char_traits + { + typedef wchar_t char_type; + typedef wint_t int_type; +#if _GLIBCXX_HOSTED + typedef streamoff off_type; + typedef wstreampos pos_type; + typedef mbstate_t state_type; +#endif // HOSTED +#if __cpp_lib_three_way_comparison + using comparison_category = strong_ordering; +#endif + + static _GLIBCXX17_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { +#if __cpp_constexpr_dynamic_alloc + if (std::__is_constant_evaluated()) + std::construct_at(__builtin_addressof(__c1), __c2); + else +#endif + __c1 = __c2; + } + + static _GLIBCXX_CONSTEXPR bool + eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR bool + lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 < __c2; } + + static _GLIBCXX17_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return 0; +#if __cplusplus >= 201703L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::compare(__s1, __s2, __n); +#endif + return wmemcmp(__s1, __s2, __n); + } + + static _GLIBCXX17_CONSTEXPR size_t + length(const char_type* __s) + { +#if __cplusplus >= 201703L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::length(__s); +#endif + return wcslen(__s); + } + + static _GLIBCXX17_CONSTEXPR const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + if (__n == 0) + return 0; +#if __cplusplus >= 201703L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::find(__s, __n, __a); +#endif + return wmemchr(__s, __a, __n); + } + + static _GLIBCXX20_CONSTEXPR char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::move(__s1, __s2, __n); +#endif + return wmemmove(__s1, __s2, __n); + } + + static _GLIBCXX20_CONSTEXPR char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::copy(__s1, __s2, __n); +#endif + return wmemcpy(__s1, __s2, __n); + } + + static _GLIBCXX20_CONSTEXPR char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + if (__n == 0) + return __s; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::assign(__s, __n, __a); +#endif + return wmemset(__s, __a, __n); + } + + static _GLIBCXX_CONSTEXPR char_type + to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT + { return char_type(__c); } + + static _GLIBCXX_CONSTEXPR int_type + to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT + { return int_type(__c); } + + static _GLIBCXX_CONSTEXPR bool + eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + +#if _GLIBCXX_HOSTED + static _GLIBCXX_CONSTEXPR int_type + eof() _GLIBCXX_NOEXCEPT + { return static_cast(WEOF); } + + static _GLIBCXX_CONSTEXPR int_type + not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT + { return eq_int_type(__c, eof()) ? 0 : __c; } +#endif // HOSTED + }; +#else // _GLIBCXX_USE_WCHAR_T + template<> + struct char_traits : public __gnu_cxx::char_traits + { }; +#endif //_GLIBCXX_USE_WCHAR_T + +#ifdef _GLIBCXX_USE_CHAR8_T + template<> + struct char_traits + { + typedef char8_t char_type; + typedef unsigned int int_type; +#if _GLIBCXX_HOSTED + typedef u8streampos pos_type; + typedef streamoff off_type; + typedef mbstate_t state_type; +#endif // HOSTED +#if __cpp_lib_three_way_comparison + using comparison_category = strong_ordering; +#endif + + static _GLIBCXX17_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { +#if __cpp_constexpr_dynamic_alloc + if (std::__is_constant_evaluated()) + std::construct_at(__builtin_addressof(__c1), __c2); + else +#endif + __c1 = __c2; + } + + static _GLIBCXX_CONSTEXPR bool + eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR bool + lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 < __c2; } + + static _GLIBCXX17_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return 0; +#if __cplusplus >= 201703L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::compare(__s1, __s2, __n); +#endif + return __builtin_memcmp(__s1, __s2, __n); + } + + static _GLIBCXX17_CONSTEXPR size_t + length(const char_type* __s) + { +#if __cplusplus >= 201703L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::length(__s); +#endif + return __builtin_strlen((const char*)__s); + } + + static _GLIBCXX17_CONSTEXPR const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + if (__n == 0) + return 0; +#if __cplusplus >= 201703L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::find(__s, __n, __a); +#endif + return static_cast(__builtin_memchr(__s, __a, __n)); + } + + static _GLIBCXX20_CONSTEXPR char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::move(__s1, __s2, __n); +#endif + return static_cast(__builtin_memmove(__s1, __s2, __n)); + } + + static _GLIBCXX20_CONSTEXPR char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::copy(__s1, __s2, __n); +#endif + return static_cast(__builtin_memcpy(__s1, __s2, __n)); + } + + static _GLIBCXX20_CONSTEXPR char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + if (__n == 0) + return __s; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::assign(__s, __n, __a); +#endif + return static_cast(__builtin_memset(__s, __a, __n)); + } + + static _GLIBCXX_CONSTEXPR char_type + to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT + { return char_type(__c); } + + static _GLIBCXX_CONSTEXPR int_type + to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT + { return int_type(__c); } + + static _GLIBCXX_CONSTEXPR bool + eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + +#if _GLIBCXX_HOSTED + static _GLIBCXX_CONSTEXPR int_type + eof() _GLIBCXX_NOEXCEPT + { return static_cast(-1); } + + static _GLIBCXX_CONSTEXPR int_type + not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT + { return eq_int_type(__c, eof()) ? 0 : __c; } +#endif // HOSTED + }; +#endif //_GLIBCXX_USE_CHAR8_T + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if __cplusplus >= 201103L + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template<> + struct char_traits + { + typedef char16_t char_type; +#ifdef __UINT_LEAST16_TYPE__ + typedef __UINT_LEAST16_TYPE__ int_type; +#else + typedef uint_least16_t int_type; +#endif +#if _GLIBCXX_HOSTED + typedef streamoff off_type; + typedef u16streampos pos_type; + typedef mbstate_t state_type; +#endif // HOSTED +#if __cpp_lib_three_way_comparison + using comparison_category = strong_ordering; +#endif + + static _GLIBCXX17_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) noexcept + { +#if __cpp_constexpr_dynamic_alloc + if (std::__is_constant_evaluated()) + std::construct_at(__builtin_addressof(__c1), __c2); + else +#endif + __c1 = __c2; + } + + static constexpr bool + eq(const char_type& __c1, const char_type& __c2) noexcept + { return __c1 == __c2; } + + static constexpr bool + lt(const char_type& __c1, const char_type& __c2) noexcept + { return __c1 < __c2; } + + static _GLIBCXX17_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + for (size_t __i = 0; __i < __n; ++__i) + if (lt(__s1[__i], __s2[__i])) + return -1; + else if (lt(__s2[__i], __s1[__i])) + return 1; + return 0; + } + + static _GLIBCXX17_CONSTEXPR size_t + length(const char_type* __s) + { + size_t __i = 0; + while (!eq(__s[__i], char_type())) + ++__i; + return __i; + } + + static _GLIBCXX17_CONSTEXPR const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + for (size_t __i = 0; __i < __n; ++__i) + if (eq(__s[__i], __a)) + return __s + __i; + return 0; + } + + static _GLIBCXX20_CONSTEXPR char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::move(__s1, __s2, __n); +#endif + return (static_cast + (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); + } + + static _GLIBCXX20_CONSTEXPR char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::copy(__s1, __s2, __n); +#endif + return (static_cast + (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); + } + + static _GLIBCXX20_CONSTEXPR char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + for (size_t __i = 0; __i < __n; ++__i) + assign(__s[__i], __a); + return __s; + } + + static constexpr char_type + to_char_type(const int_type& __c) noexcept + { return char_type(__c); } + + static constexpr bool + eq_int_type(const int_type& __c1, const int_type& __c2) noexcept + { return __c1 == __c2; } + +#if _GLIBCXX_HOSTED + static constexpr int_type + to_int_type(const char_type& __c) noexcept + { return __c == eof() ? int_type(0xfffd) : int_type(__c); } + + static constexpr int_type + eof() noexcept + { return static_cast(-1); } + + static constexpr int_type + not_eof(const int_type& __c) noexcept + { return eq_int_type(__c, eof()) ? 0 : __c; } +#else // !HOSTED + static constexpr int_type + to_int_type(const char_type& __c) noexcept + { return int_type(__c); } +#endif // !HOSTED + }; + + template<> + struct char_traits + { + typedef char32_t char_type; +#ifdef __UINT_LEAST32_TYPE__ + typedef __UINT_LEAST32_TYPE__ int_type; +#else + typedef uint_least32_t int_type; +#endif +#if _GLIBCXX_HOSTED + typedef streamoff off_type; + typedef u32streampos pos_type; + typedef mbstate_t state_type; +#endif // HOSTED +#if __cpp_lib_three_way_comparison + using comparison_category = strong_ordering; +#endif + + static _GLIBCXX17_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) noexcept + { +#if __cpp_constexpr_dynamic_alloc + if (std::__is_constant_evaluated()) + std::construct_at(__builtin_addressof(__c1), __c2); + else +#endif + __c1 = __c2; + } + + static constexpr bool + eq(const char_type& __c1, const char_type& __c2) noexcept + { return __c1 == __c2; } + + static constexpr bool + lt(const char_type& __c1, const char_type& __c2) noexcept + { return __c1 < __c2; } + + static _GLIBCXX17_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + for (size_t __i = 0; __i < __n; ++__i) + if (lt(__s1[__i], __s2[__i])) + return -1; + else if (lt(__s2[__i], __s1[__i])) + return 1; + return 0; + } + + static _GLIBCXX17_CONSTEXPR size_t + length(const char_type* __s) + { + size_t __i = 0; + while (!eq(__s[__i], char_type())) + ++__i; + return __i; + } + + static _GLIBCXX17_CONSTEXPR const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + for (size_t __i = 0; __i < __n; ++__i) + if (eq(__s[__i], __a)) + return __s + __i; + return 0; + } + + static _GLIBCXX20_CONSTEXPR char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::move(__s1, __s2, __n); +#endif + return (static_cast + (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); + } + + static _GLIBCXX20_CONSTEXPR char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; +#if __cplusplus >= 202002L + if (std::__is_constant_evaluated()) + return __gnu_cxx::char_traits::copy(__s1, __s2, __n); +#endif + return (static_cast + (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); + } + + static _GLIBCXX20_CONSTEXPR char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + for (size_t __i = 0; __i < __n; ++__i) + assign(__s[__i], __a); + return __s; + } + + static constexpr char_type + to_char_type(const int_type& __c) noexcept + { return char_type(__c); } + + static constexpr int_type + to_int_type(const char_type& __c) noexcept + { return int_type(__c); } + + static constexpr bool + eq_int_type(const int_type& __c1, const int_type& __c2) noexcept + { return __c1 == __c2; } + +#if _GLIBCXX_HOSTED + static constexpr int_type + eof() noexcept + { return static_cast(-1); } + + static constexpr int_type + not_eof(const int_type& __c) noexcept + { return eq_int_type(__c, eof()) ? 0 : __c; } +#endif // HOSTED + }; + +#if __cpp_lib_three_way_comparison + namespace __detail + { + template + constexpr auto + __char_traits_cmp_cat(int __cmp) noexcept + { + if constexpr (requires { typename _ChTraits::comparison_category; }) + { + using _Cat = typename _ChTraits::comparison_category; + static_assert( !is_void_v> ); + return static_cast<_Cat>(__cmp <=> 0); + } + else + return static_cast(__cmp <=> 0); + } + } // namespace __detail +#endif // C++20 + +#pragma GCC diagnostic pop + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // C++11 + +#endif // _CHAR_TRAITS_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@char_traits.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@char_traits.h.blob new file mode 100644 index 0000000..a6059b3 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@char_traits.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@charconv.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@charconv.h new file mode 100644 index 0000000..6cb12f1 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@charconv.h @@ -0,0 +1,118 @@ +// Numeric conversions (to_string, to_chars) -*- C++ -*- + +// Copyright (C) 2017-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/charconv.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{charconv} + */ + +#ifndef _GLIBCXX_CHARCONV_H +#define _GLIBCXX_CHARCONV_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus >= 201103L + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +namespace __detail +{ +#if __cpp_variable_templates + // This accepts 128-bit integers even in strict mode. + template + constexpr bool __integer_to_chars_is_unsigned + = ! __gnu_cxx::__int_traits<_Tp>::__is_signed; +#endif + + // Generic implementation for arbitrary bases. + template + _GLIBCXX14_CONSTEXPR unsigned + __to_chars_len(_Tp __value, int __base = 10) noexcept + { +#if __cpp_variable_templates + static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation bug"); +#endif + + unsigned __n = 1; + const unsigned __b2 = __base * __base; + const unsigned __b3 = __b2 * __base; + const unsigned long __b4 = __b3 * __base; + for (;;) + { + if (__value < (unsigned)__base) return __n; + if (__value < __b2) return __n + 1; + if (__value < __b3) return __n + 2; + if (__value < __b4) return __n + 3; + __value /= __b4; + __n += 4; + } + } + + // Write an unsigned integer value to the range [first,first+len). + // The caller is required to provide a buffer of exactly the right size + // (which can be determined by the __to_chars_len function). + template + _GLIBCXX23_CONSTEXPR void + __to_chars_10_impl(char* __first, unsigned __len, _Tp __val) noexcept + { +#if __cpp_variable_templates + static_assert(__integer_to_chars_is_unsigned<_Tp>, "implementation bug"); +#endif + + constexpr char __digits[201] = + "0001020304050607080910111213141516171819" + "2021222324252627282930313233343536373839" + "4041424344454647484950515253545556575859" + "6061626364656667686970717273747576777879" + "8081828384858687888990919293949596979899"; + unsigned __pos = __len - 1; + while (__val >= 100) + { + auto const __num = (__val % 100) * 2; + __val /= 100; + __first[__pos] = __digits[__num + 1]; + __first[__pos - 1] = __digits[__num]; + __pos -= 2; + } + if (__val >= 10) + { + auto const __num = __val * 2; + __first[1] = __digits[__num + 1]; + __first[0] = __digits[__num]; + } + else + __first[0] = '0' + __val; + } + +} // namespace __detail +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++11 +#endif // _GLIBCXX_CHARCONV_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@charconv.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@charconv.h.blob new file mode 100644 index 0000000..4dd6f0b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@charconv.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@chrono.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@chrono.h new file mode 100644 index 0000000..8de8e75 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@chrono.h @@ -0,0 +1,1523 @@ +// chrono::duration and chrono::time_point -*- C++ -*- + +// Copyright (C) 2008-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/chrono.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{chrono} + */ + +#ifndef _GLIBCXX_CHRONO_H +#define _GLIBCXX_CHRONO_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus >= 201103L + +#include +#include +#include +#if _GLIBCXX_HOSTED +# include +#endif +#include // for literals support. +#if __cplusplus >= 202002L +# include +# include +#endif + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if __cplusplus >= 201703L && _GLIBCXX_HOSTED + namespace filesystem { struct __file_clock; }; +#endif + + namespace chrono + { + /// @addtogroup chrono + /// @{ + + /// `chrono::duration` represents a distance between two points in time + template> + class duration; + + /// `chrono::time_point` represents a point in time as measured by a clock + template + class time_point; + /// @} + } + + /// @addtogroup chrono + /// @{ + + // 20.11.4.3 specialization of common_type (for duration, sfinae-friendly) + + /// @cond undocumented + + template + struct __duration_common_type + { }; + + template + struct __duration_common_type<_CT, _Period1, _Period2, + __void_t> + { + private: + using __gcd_num = __static_gcd<_Period1::num, _Period2::num>; + using __gcd_den = __static_gcd<_Period1::den, _Period2::den>; + using __cr = typename _CT::type; + using __r = ratio<__gcd_num::value, + (_Period1::den / __gcd_den::value) * _Period2::den>; + + public: + using type = chrono::duration<__cr, typename __r::type>; + }; + + /// @endcond + + /// @{ + /// @relates chrono::duration + + /// Specialization of common_type for chrono::duration types. + template + struct common_type, + chrono::duration<_Rep2, _Period2>> + : __duration_common_type, + typename _Period1::type, + typename _Period2::type> + { }; + + /// Specialization of common_type for two identical chrono::duration types. + template + struct common_type, + chrono::duration<_Rep, _Period>> + { + using type = chrono::duration::type, + typename _Period::type>; + }; + + /// Specialization of common_type for one chrono::duration type. + template + struct common_type> + { + using type = chrono::duration::type, + typename _Period::type>; + }; + /// @} + + // 20.11.4.3 specialization of common_type (for time_point, sfinae-friendly) + + /// @cond undocumented + + template + struct __timepoint_common_type + { }; + + template + struct __timepoint_common_type<_CT, _Clock, __void_t> + { + using type = chrono::time_point<_Clock, typename _CT::type>; + }; + + /// @endcond + + /// @{ + /// @relates chrono::time_point + + /// Specialization of common_type for chrono::time_point types. + template + struct common_type, + chrono::time_point<_Clock, _Duration2>> + : __timepoint_common_type, _Clock> + { }; + + /// Specialization of common_type for two identical chrono::time_point types. + template + struct common_type, + chrono::time_point<_Clock, _Duration>> + { using type = chrono::time_point<_Clock, _Duration>; }; + + /// Specialization of common_type for one chrono::time_point type. + template + struct common_type> + { using type = chrono::time_point<_Clock, _Duration>; }; + /// @} + + /// @} group chrono + + namespace chrono + { + /// @addtogroup chrono + /// @{ + + /// @cond undocumented + + // Primary template for duration_cast impl. + template + struct __duration_cast_impl + { + template + static constexpr _ToDur + __cast(const duration<_Rep, _Period>& __d) + { + typedef typename _ToDur::rep __to_rep; + return _ToDur(static_cast<__to_rep>(static_cast<_CR>(__d.count()) + * static_cast<_CR>(_CF::num) + / static_cast<_CR>(_CF::den))); + } + }; + + template + struct __duration_cast_impl<_ToDur, _CF, _CR, true, true> + { + template + static constexpr _ToDur + __cast(const duration<_Rep, _Period>& __d) + { + typedef typename _ToDur::rep __to_rep; + return _ToDur(static_cast<__to_rep>(__d.count())); + } + }; + + template + struct __duration_cast_impl<_ToDur, _CF, _CR, true, false> + { + template + static constexpr _ToDur + __cast(const duration<_Rep, _Period>& __d) + { + typedef typename _ToDur::rep __to_rep; + return _ToDur(static_cast<__to_rep>( + static_cast<_CR>(__d.count()) / static_cast<_CR>(_CF::den))); + } + }; + + template + struct __duration_cast_impl<_ToDur, _CF, _CR, false, true> + { + template + static constexpr _ToDur + __cast(const duration<_Rep, _Period>& __d) + { + typedef typename _ToDur::rep __to_rep; + return _ToDur(static_cast<__to_rep>( + static_cast<_CR>(__d.count()) * static_cast<_CR>(_CF::num))); + } + }; + + template + struct __is_duration + : std::false_type + { }; + + template + struct __is_duration> + : std::true_type + { }; + + template + using __enable_if_is_duration + = typename enable_if<__is_duration<_Tp>::value, _Tp>::type; + + template + using __disable_if_is_duration + = typename enable_if::value, _Tp>::type; + +#if __cplusplus >= 201703L + template + inline constexpr bool __is_duration_v = false; + template + inline constexpr bool __is_duration_v> = true; + template + inline constexpr bool __is_time_point_v = false; + template + inline constexpr bool __is_time_point_v> = true; +#endif + + /// @endcond + + /** Convert a `duration` to type `ToDur`. + * + * If the duration cannot be represented accurately in the result type, + * returns the result of integer truncation (i.e., rounded towards zero). + * + * @tparam _ToDur The result type must be a `duration`. + * @param __d A duration. + * @return The value of `__d` converted to type `_ToDur`. + * @since C++11 + */ + template + _GLIBCXX_NODISCARD + constexpr __enable_if_is_duration<_ToDur> + duration_cast(const duration<_Rep, _Period>& __d) + { +#if __cpp_inline_variables && __cpp_if_constexpr + if constexpr (is_same_v<_ToDur, duration<_Rep, _Period>>) + return __d; + else + { +#endif + using __to_period = typename _ToDur::period; + using __to_rep = typename _ToDur::rep; + using __cf = ratio_divide<_Period, __to_period>; + using __cr = typename common_type<__to_rep, _Rep, intmax_t>::type; + using __dc = __duration_cast_impl<_ToDur, __cf, __cr, + __cf::num == 1, __cf::den == 1>; + return __dc::__cast(__d); +#if __cpp_inline_variables && __cpp_if_constexpr + } +#endif + } + + /** Trait indicating whether to treat a type as a floating-point type. + * + * The chrono library uses this trait to tell whether a `duration` can + * represent fractional values of the given precision, or only integral + * values. + * + * You should specialize this trait for your own numeric types that are + * used with `duration` and can represent non-integral values. + * + * @since C++11 + */ + template + struct treat_as_floating_point + : is_floating_point<_Rep> + { }; + +#if __cplusplus > 201402L + template + inline constexpr bool treat_as_floating_point_v = + treat_as_floating_point<_Rep>::value; + + template<> + inline constexpr bool treat_as_floating_point_v = false; + template<> + inline constexpr bool treat_as_floating_point_v = false; + template<> + inline constexpr bool treat_as_floating_point_v = false; + template<> + inline constexpr bool treat_as_floating_point_v = true; + template<> + inline constexpr bool treat_as_floating_point_v = true; + template<> + inline constexpr bool treat_as_floating_point_v = true; +#endif // C++17 + +#if __cplusplus > 201703L +#if __cpp_lib_concepts + template + inline constexpr bool is_clock_v = false; + + template + requires requires { + typename _Tp::rep; + typename _Tp::period; + typename _Tp::duration; + typename _Tp::time_point::clock; + typename _Tp::time_point::duration; + { &_Tp::is_steady } -> same_as; + { _Tp::now() } -> same_as; + requires same_as>; + requires same_as; + } + inline constexpr bool is_clock_v<_Tp> = true; +#else + template + inline constexpr bool is_clock_v = false; + + template + inline constexpr bool + is_clock_v<_Tp, void_t> + = __and_v>, + is_same, + is_same, + is_same>; +#endif + + template + struct is_clock + : bool_constant> + { }; +#endif // C++20 + +#if __cplusplus >= 201703L // C++ >= 17 + /** Convert a `duration` to type `ToDur` and round down. + * + * If the duration cannot be represented exactly in the result type, + * returns the closest value that is less than the argument. + * + * @tparam _ToDur The result type must be a `duration`. + * @param __d A duration. + * @return The value of `__d` converted to type `_ToDur`. + * @since C++17 + */ + template + [[nodiscard]] constexpr __enable_if_is_duration<_ToDur> + floor(const duration<_Rep, _Period>& __d) + { + auto __to = chrono::duration_cast<_ToDur>(__d); + if (__to > __d) + return __to - _ToDur{1}; + return __to; + } + + /** Convert a `duration` to type `ToDur` and round up. + * + * If the duration cannot be represented exactly in the result type, + * returns the closest value that is greater than the argument. + * + * @tparam _ToDur The result type must be a `duration`. + * @param __d A duration. + * @return The value of `__d` converted to type `_ToDur`. + * @since C++17 + */ + template + [[nodiscard]] constexpr __enable_if_is_duration<_ToDur> + ceil(const duration<_Rep, _Period>& __d) + { + auto __to = chrono::duration_cast<_ToDur>(__d); + if (__to < __d) + return __to + _ToDur{1}; + return __to; + } + + /** Convert a `duration` to type `ToDur` and round to the closest value. + * + * If the duration cannot be represented exactly in the result type, + * returns the closest value, rounding ties to even. + * + * @tparam _ToDur The result type must be a `duration` with a + * non-floating-point `rep` type. + * @param __d A duration. + * @return The value of `__d` converted to type `_ToDur`. + * @since C++17 + */ + template + [[nodiscard]] constexpr + enable_if_t< + __and_<__is_duration<_ToDur>, + __not_>>::value, + _ToDur> + round(const duration<_Rep, _Period>& __d) + { + _ToDur __t0 = chrono::floor<_ToDur>(__d); + _ToDur __t1 = __t0 + _ToDur{1}; + auto __diff0 = __d - __t0; + auto __diff1 = __t1 - __d; + if (__diff0 == __diff1) + { + if (__t0.count() & 1) + return __t1; + return __t0; + } + else if (__diff0 < __diff1) + return __t0; + return __t1; + } + + /** The absolute (non-negative) value of a duration. + * + * @param __d A duration with a signed `rep` type. + * @return A duration of the same type as the argument, with value |d|. + * @since C++17 + */ + template + [[nodiscard]] constexpr + enable_if_t::is_signed, duration<_Rep, _Period>> + abs(duration<_Rep, _Period> __d) + { + if (__d >= __d.zero()) + return __d; + return -__d; + } + + // Make chrono::ceil also usable as chrono::__detail::ceil. + namespace __detail { using chrono::ceil; } + +#else // ! __glibcxx_chrono + + // We want to use ceil even when compiling for earlier standards versions. + // C++11 only allows a single statement in a constexpr function, so we + // need to move the comparison into a separate function, __ceil_impl. + namespace __detail + { + template + constexpr _Tp + __ceil_impl(const _Tp& __t, const _Up& __u) + { + return (__t < __u) ? (__t + _Tp{1}) : __t; + } + + // C++11-friendly version of std::chrono::ceil for internal use. + template + constexpr _ToDur + ceil(const duration<_Rep, _Period>& __d) + { + return __detail::__ceil_impl(chrono::duration_cast<_ToDur>(__d), __d); + } + } +#endif // __glibcxx_chrono + + /// duration_values + template + struct duration_values + { + static constexpr _Rep + zero() noexcept + { return _Rep(0); } + + static constexpr _Rep + max() noexcept + { return numeric_limits<_Rep>::max(); } + + static constexpr _Rep + min() noexcept + { return numeric_limits<_Rep>::lowest(); } + }; + + template + class duration + { + static_assert(!__is_duration<_Rep>::value, + "rep cannot be a std::chrono::duration"); + static_assert(__is_ratio<_Period>::value, + "period must be a specialization of std::ratio"); + static_assert(_Period::num > 0, "period must be positive"); + + template + using __is_float = treat_as_floating_point<_Rep2>; + + static constexpr intmax_t + _S_gcd(intmax_t __m, intmax_t __n) noexcept + { + // Duration only allows positive periods so we don't need to + // handle negative values here (unlike __static_gcd and std::gcd). +#if __cplusplus >= 201402L + do + { + intmax_t __rem = __m % __n; + __m = __n; + __n = __rem; + } + while (__n != 0); + return __m; +#else + // C++11 doesn't allow loops in constexpr functions, but this + // recursive version can be more expensive to evaluate. + return (__n == 0) ? __m : _S_gcd(__n, __m % __n); +#endif + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2094. overflow shouldn't participate in overload resolution + // 3090. What is [2094] intended to mean? + // This only produces a valid type if no overflow occurs. + template + using __divide = ratio<(_R1::num / __gcd1) * (_R2::den / __gcd2), + (_R1::den / __gcd2) * (_R2::num / __gcd1)>; + + // _Period2 is an exact multiple of _Period + template + using __is_harmonic + = __bool_constant<__divide<_Period2, _Period>::den == 1>; + + public: + + using rep = _Rep; + using period = typename _Period::type; + + // 20.11.5.1 construction / copy / destroy + constexpr duration() = default; + + duration(const duration&) = default; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3050. Conversion specification problem in chrono::duration + template, + __or_<__is_float, __not_<__is_float<_Rep2>>>>> + constexpr explicit duration(const _Rep2& __rep) + : __r(static_cast(__rep)) { } + + template, + __or_<__is_float, + __and_<__is_harmonic<_Period2>, + __not_<__is_float<_Rep2>>>>>> + constexpr duration(const duration<_Rep2, _Period2>& __d) + : __r(duration_cast(__d).count()) { } + + ~duration() = default; + duration& operator=(const duration&) = default; + + // 20.11.5.2 observer + constexpr rep + count() const + { return __r; } + + // 20.11.5.3 arithmetic + + constexpr duration::type, period> + operator+() const + { return duration::type, period>(__r); } + + constexpr duration::type, period> + operator-() const + { return duration::type, period>(-__r); } + + _GLIBCXX17_CONSTEXPR duration& + operator++() + { + ++__r; + return *this; + } + + _GLIBCXX17_CONSTEXPR duration + operator++(int) + { return duration(__r++); } + + _GLIBCXX17_CONSTEXPR duration& + operator--() + { + --__r; + return *this; + } + + _GLIBCXX17_CONSTEXPR duration + operator--(int) + { return duration(__r--); } + + _GLIBCXX17_CONSTEXPR duration& + operator+=(const duration& __d) + { + __r += __d.count(); + return *this; + } + + _GLIBCXX17_CONSTEXPR duration& + operator-=(const duration& __d) + { + __r -= __d.count(); + return *this; + } + + _GLIBCXX17_CONSTEXPR duration& + operator*=(const rep& __rhs) + { + __r *= __rhs; + return *this; + } + + _GLIBCXX17_CONSTEXPR duration& + operator/=(const rep& __rhs) + { + __r /= __rhs; + return *this; + } + + // DR 934. + template + _GLIBCXX17_CONSTEXPR + __enable_if_t::value, duration&> + operator%=(const rep& __rhs) + { + __r %= __rhs; + return *this; + } + + template + _GLIBCXX17_CONSTEXPR + __enable_if_t::value, duration&> + operator%=(const duration& __d) + { + __r %= __d.count(); + return *this; + } + + // 20.11.5.4 special values + static constexpr duration + zero() noexcept + { return duration(duration_values::zero()); } + + static constexpr duration + min() noexcept + { return duration(duration_values::min()); } + + static constexpr duration + max() noexcept + { return duration(duration_values::max()); } + + private: + rep __r; + }; + + /// @{ + /// @relates std::chrono::duration + + /// The sum of two durations. + template + constexpr typename common_type, + duration<_Rep2, _Period2>>::type + operator+(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { + typedef duration<_Rep1, _Period1> __dur1; + typedef duration<_Rep2, _Period2> __dur2; + typedef typename common_type<__dur1,__dur2>::type __cd; + return __cd(__cd(__lhs).count() + __cd(__rhs).count()); + } + + /// The difference between two durations. + template + constexpr typename common_type, + duration<_Rep2, _Period2>>::type + operator-(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { + typedef duration<_Rep1, _Period1> __dur1; + typedef duration<_Rep2, _Period2> __dur2; + typedef typename common_type<__dur1,__dur2>::type __cd; + return __cd(__cd(__lhs).count() - __cd(__rhs).count()); + } + + /// @} + + /// @cond undocumented + + // SFINAE helper to obtain common_type<_Rep1, _Rep2> only if _Rep2 + // is implicitly convertible to it. + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3050. Conversion specification problem in chrono::duration constructor + template::type> + using __common_rep_t = typename + enable_if::value, _CRep>::type; + + /// @endcond + + /** @{ + * Arithmetic operators for chrono::duration + * @relates std::chrono::duration + */ + + template + constexpr duration<__common_rep_t<_Rep1, _Rep2>, _Period> + operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) + { + typedef duration::type, _Period> + __cd; + return __cd(__cd(__d).count() * __s); + } + + template + constexpr duration<__common_rep_t<_Rep2, _Rep1>, _Period> + operator*(const _Rep1& __s, const duration<_Rep2, _Period>& __d) + { return __d * __s; } + + template + constexpr + duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period> + operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) + { + typedef duration::type, _Period> + __cd; + return __cd(__cd(__d).count() / __s); + } + + template + constexpr typename common_type<_Rep1, _Rep2>::type + operator/(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { + typedef duration<_Rep1, _Period1> __dur1; + typedef duration<_Rep2, _Period2> __dur2; + typedef typename common_type<__dur1,__dur2>::type __cd; + return __cd(__lhs).count() / __cd(__rhs).count(); + } + + // DR 934. + template + constexpr + duration<__common_rep_t<_Rep1, __disable_if_is_duration<_Rep2>>, _Period> + operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) + { + typedef duration::type, _Period> + __cd; + return __cd(__cd(__d).count() % __s); + } + + template + constexpr typename common_type, + duration<_Rep2, _Period2>>::type + operator%(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { + typedef duration<_Rep1, _Period1> __dur1; + typedef duration<_Rep2, _Period2> __dur2; + typedef typename common_type<__dur1,__dur2>::type __cd; + return __cd(__cd(__lhs).count() % __cd(__rhs).count()); + } + /// @} + + // comparisons + + /** @{ + * Comparisons for chrono::duration + * @relates std::chrono::duration + */ + + template + constexpr bool + operator==(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { + typedef duration<_Rep1, _Period1> __dur1; + typedef duration<_Rep2, _Period2> __dur2; + typedef typename common_type<__dur1,__dur2>::type __ct; + return __ct(__lhs).count() == __ct(__rhs).count(); + } + + template + constexpr bool + operator<(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { + typedef duration<_Rep1, _Period1> __dur1; + typedef duration<_Rep2, _Period2> __dur2; + typedef typename common_type<__dur1,__dur2>::type __ct; + return __ct(__lhs).count() < __ct(__rhs).count(); + } + +#if __cpp_lib_three_way_comparison + template + requires three_way_comparable> + constexpr auto + operator<=>(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { + using __ct = common_type_t, + duration<_Rep2, _Period2>>; + return __ct(__lhs).count() <=> __ct(__rhs).count(); + } +#else + template + constexpr bool + operator!=(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { return !(__lhs == __rhs); } +#endif + + template + constexpr bool + operator<=(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { return !(__rhs < __lhs); } + + template + constexpr bool + operator>(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { return __rhs < __lhs; } + + template + constexpr bool + operator>=(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { return !(__lhs < __rhs); } + + /// @} + + /// @cond undocumented +#ifdef _GLIBCXX_USE_C99_STDINT +# define _GLIBCXX_CHRONO_INT64_T int64_t +#elif defined __INT64_TYPE__ +# define _GLIBCXX_CHRONO_INT64_T __INT64_TYPE__ +#else + static_assert(std::numeric_limits::digits >= 64, + "Representation type for nanoseconds must have at least 64 bits"); +# define _GLIBCXX_CHRONO_INT64_T long long +#endif + /// @endcond + + /// nanoseconds + using nanoseconds = duration<_GLIBCXX_CHRONO_INT64_T, nano>; + + /// microseconds + using microseconds = duration<_GLIBCXX_CHRONO_INT64_T, micro>; + + /// milliseconds + using milliseconds = duration<_GLIBCXX_CHRONO_INT64_T, milli>; + + /// seconds + using seconds = duration<_GLIBCXX_CHRONO_INT64_T>; + + /// minutes + using minutes = duration<_GLIBCXX_CHRONO_INT64_T, ratio< 60>>; + + /// hours + using hours = duration<_GLIBCXX_CHRONO_INT64_T, ratio<3600>>; + +#if __cplusplus > 201703L + /// days + using days = duration<_GLIBCXX_CHRONO_INT64_T, ratio<86400>>; + + /// weeks + using weeks = duration<_GLIBCXX_CHRONO_INT64_T, ratio<604800>>; + + /// years + using years = duration<_GLIBCXX_CHRONO_INT64_T, ratio<31556952>>; + + /// months + using months = duration<_GLIBCXX_CHRONO_INT64_T, ratio<2629746>>; +#endif // C++20 + +#undef _GLIBCXX_CHRONO_INT64_T + + template + class time_point + { + static_assert(__is_duration<_Dur>::value, + "duration must be a specialization of std::chrono::duration"); + + public: + typedef _Clock clock; + typedef _Dur duration; + typedef typename duration::rep rep; + typedef typename duration::period period; + + constexpr time_point() : __d(duration::zero()) + { } + + constexpr explicit time_point(const duration& __dur) + : __d(__dur) + { } + + // conversions + template>> + constexpr time_point(const time_point& __t) + : __d(__t.time_since_epoch()) + { } + + // observer + constexpr duration + time_since_epoch() const + { return __d; } + +#if __cplusplus > 201703L + constexpr time_point& + operator++() + { + ++__d; + return *this; + } + + constexpr time_point + operator++(int) + { return time_point{__d++}; } + + constexpr time_point& + operator--() + { + --__d; + return *this; + } + + constexpr time_point + operator--(int) + { return time_point{__d--}; } +#endif + + // arithmetic + _GLIBCXX17_CONSTEXPR time_point& + operator+=(const duration& __dur) + { + __d += __dur; + return *this; + } + + _GLIBCXX17_CONSTEXPR time_point& + operator-=(const duration& __dur) + { + __d -= __dur; + return *this; + } + + // special values + static constexpr time_point + min() noexcept + { return time_point(duration::min()); } + + static constexpr time_point + max() noexcept + { return time_point(duration::max()); } + + private: + duration __d; + }; + + /** Convert a `time_point` to use `duration` type `ToDur`. + * + * The result is the same time point as measured by the same clock, but + * using the specified `duration` to represent the time. + * If the time point cannot be represented accurately in the result type, + * returns the result of integer truncation (i.e., rounded towards zero). + * + * @tparam _ToDur The `duration` type to use for the result. + * @param __t A time point. + * @return The value of `__t` converted to use type `_ToDur`. + * @since C++11 + */ + template + _GLIBCXX_NODISCARD constexpr + __enable_if_t<__is_duration<_ToDur>::value, time_point<_Clock, _ToDur>> + time_point_cast(const time_point<_Clock, _Dur>& __t) + { + typedef time_point<_Clock, _ToDur> __time_point; + return __time_point(duration_cast<_ToDur>(__t.time_since_epoch())); + } + +#if __cplusplus > 201402L + /** Convert a `time_point` to type `ToDur` and round down. + * + * The result is the same time point as measured by the same clock, but + * using the specified `duration` to represent the time. + * If the time point cannot be represented exactly in the result type, + * returns the closest value that is less than the argument. + * + * @tparam _ToDur The `duration` type to use for the result. + * @param __t A time point. + * @return The value of `__d` converted to type `_ToDur`. + * @since C++17 + */ + template + [[nodiscard]] constexpr + enable_if_t<__is_duration_v<_ToDur>, time_point<_Clock, _ToDur>> + floor(const time_point<_Clock, _Dur>& __tp) + { + return time_point<_Clock, _ToDur>{ + chrono::floor<_ToDur>(__tp.time_since_epoch())}; + } + + /** Convert a `time_point` to type `ToDur` and round up. + * + * The result is the same time point as measured by the same clock, but + * using the specified `duration` to represent the time. + * If the time point cannot be represented exactly in the result type, + * returns the closest value that is greater than the argument. + * + * @tparam _ToDur The `duration` type to use for the result. + * @param __t A time point. + * @return The value of `__d` converted to type `_ToDur`. + * @since C++17 + */ + template + [[nodiscard]] constexpr + enable_if_t<__is_duration_v<_ToDur>, time_point<_Clock, _ToDur>> + ceil(const time_point<_Clock, _Dur>& __tp) + { + return time_point<_Clock, _ToDur>{ + chrono::ceil<_ToDur>(__tp.time_since_epoch())}; + } + + /** Convert a `time_point` to type `ToDur` and round to the closest value. + * + * The result is the same time point as measured by the same clock, but + * using the specified `duration` to represent the time. + * If the time point cannot be represented exactly in the result type, + * returns the closest value, rounding ties to even. + * + * @tparam _ToDur The `duration` type to use for the result, + * which must have a non-floating-point `rep` type. + * @param __t A time point. + * @return The value of `__d` converted to type `_ToDur`. + * @since C++17 + */ + template + [[nodiscard]] constexpr + enable_if_t<__is_duration_v<_ToDur> + && !treat_as_floating_point_v, + time_point<_Clock, _ToDur>> + round(const time_point<_Clock, _Dur>& __tp) + { + return time_point<_Clock, _ToDur>{ + chrono::round<_ToDur>(__tp.time_since_epoch())}; + } +#endif // C++17 + + /// @{ + /// @relates time_point + + /// Adjust a time point forwards by the given duration. + template + constexpr time_point<_Clock, + typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> + operator+(const time_point<_Clock, _Dur1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { + typedef duration<_Rep2, _Period2> __dur2; + typedef typename common_type<_Dur1,__dur2>::type __ct; + typedef time_point<_Clock, __ct> __time_point; + return __time_point(__lhs.time_since_epoch() + __rhs); + } + + /// Adjust a time point forwards by the given duration. + template + constexpr time_point<_Clock, + typename common_type, _Dur2>::type> + operator+(const duration<_Rep1, _Period1>& __lhs, + const time_point<_Clock, _Dur2>& __rhs) + { + typedef duration<_Rep1, _Period1> __dur1; + typedef typename common_type<__dur1,_Dur2>::type __ct; + typedef time_point<_Clock, __ct> __time_point; + return __time_point(__rhs.time_since_epoch() + __lhs); + } + + /// Adjust a time point backwards by the given duration. + template + constexpr time_point<_Clock, + typename common_type<_Dur1, duration<_Rep2, _Period2>>::type> + operator-(const time_point<_Clock, _Dur1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) + { + typedef duration<_Rep2, _Period2> __dur2; + typedef typename common_type<_Dur1,__dur2>::type __ct; + typedef time_point<_Clock, __ct> __time_point; + return __time_point(__lhs.time_since_epoch() -__rhs); + } + + /// The difference between two time points (as a duration) + template + constexpr typename common_type<_Dur1, _Dur2>::type + operator-(const time_point<_Clock, _Dur1>& __lhs, + const time_point<_Clock, _Dur2>& __rhs) + { return __lhs.time_since_epoch() - __rhs.time_since_epoch(); } + /// @} + + /** @{ + * Comparisons for time_point + * @relates chrono::time_point + */ + + template + constexpr bool + operator==(const time_point<_Clock, _Dur1>& __lhs, + const time_point<_Clock, _Dur2>& __rhs) + { return __lhs.time_since_epoch() == __rhs.time_since_epoch(); } + +#if __cpp_lib_three_way_comparison + template _Dur2> + constexpr auto + operator<=>(const time_point<_Clock, _Dur1>& __lhs, + const time_point<_Clock, _Dur2>& __rhs) + { return __lhs.time_since_epoch() <=> __rhs.time_since_epoch(); } +#else + template + constexpr bool + operator!=(const time_point<_Clock, _Dur1>& __lhs, + const time_point<_Clock, _Dur2>& __rhs) + { return !(__lhs == __rhs); } +#endif + + template + constexpr bool + operator<(const time_point<_Clock, _Dur1>& __lhs, + const time_point<_Clock, _Dur2>& __rhs) + { return __lhs.time_since_epoch() < __rhs.time_since_epoch(); } + + template + constexpr bool + operator<=(const time_point<_Clock, _Dur1>& __lhs, + const time_point<_Clock, _Dur2>& __rhs) + { return !(__rhs < __lhs); } + + template + constexpr bool + operator>(const time_point<_Clock, _Dur1>& __lhs, + const time_point<_Clock, _Dur2>& __rhs) + { return __rhs < __lhs; } + + template + constexpr bool + operator>=(const time_point<_Clock, _Dur1>& __lhs, + const time_point<_Clock, _Dur2>& __rhs) + { return !(__lhs < __rhs); } + + /// @} + /// @} group chrono + +#if _GLIBCXX_HOSTED + // Clocks. + + // Why nanosecond resolution as the default? + // Why have std::system_clock always count in the highest + // resolution (ie nanoseconds), even if on some OSes the low 3 + // or 9 decimal digits will be always zero? This allows later + // implementations to change the system_clock::now() + // implementation any time to provide better resolution without + // changing function signature or units. + + // To support the (forward) evolution of the library's defined + // clocks, wrap inside inline namespace so that the current + // defintions of system_clock, steady_clock, and + // high_resolution_clock types are uniquely mangled. This way, new + // code can use the latests clocks, while the library can contain + // compatibility definitions for previous versions. At some + // point, when these clocks settle down, the inlined namespaces + // can be removed. XXX GLIBCXX_ABI Deprecated +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) + + /** + * @brief System clock. + * + * Time returned represents wall time from the system-wide clock. + * @ingroup chrono + */ + struct system_clock + { + typedef chrono::nanoseconds duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point time_point; + + static_assert(system_clock::duration::min() + < system_clock::duration::zero(), + "a clock's minimum duration cannot be less than its epoch"); + + static constexpr bool is_steady = false; + + static time_point + now() noexcept; + + // Map to C API + [[__gnu__::__always_inline__]] + static std::time_t + to_time_t(const time_point& __t) noexcept + { + return std::time_t(duration_cast + (__t.time_since_epoch()).count()); + } + + [[__gnu__::__always_inline__]] + static time_point + from_time_t(std::time_t __t) noexcept + { + typedef chrono::time_point __from; + return time_point_cast + (__from(chrono::seconds(__t))); + } + }; + + + /** + * @brief Monotonic clock + * + * Time returned has the property of only increasing at a uniform rate. + * @ingroup chrono + */ + struct steady_clock + { + typedef chrono::nanoseconds duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point time_point; + + static constexpr bool is_steady = true; + + static time_point + now() noexcept; + }; + + + /** + * @brief Highest-resolution clock + * + * This is the clock "with the shortest tick period." Alias to + * std::system_clock until higher-than-nanosecond definitions + * become feasible. + * @ingroup chrono + */ + using high_resolution_clock = system_clock; + +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) + +#if __cplusplus >= 202002L + /// @addtogroup chrono + /// @{ + template + using sys_time = time_point; + using sys_seconds = sys_time; + using sys_days = sys_time; + + using file_clock = ::std::filesystem::__file_clock; + + template + using file_time = time_point; + + template<> struct is_clock : true_type { }; + template<> struct is_clock : true_type { }; + template<> struct is_clock : true_type { }; + + template<> inline constexpr bool is_clock_v = true; + template<> inline constexpr bool is_clock_v = true; + template<> inline constexpr bool is_clock_v = true; + /// @} +#endif // C++20 +#elif __cplusplus >= 202002L + // Define a fake clock like chrono::local_t so that sys_time etc. + // can be used for freestanding. + struct __sys_t; + template + using sys_time = time_point<__sys_t, _Duration>; + using sys_seconds = sys_time; + using sys_days = sys_time; +#endif // _GLIBCXX_HOSTED + } // namespace chrono + +#ifdef __glibcxx_chrono_udls // C++ >= 14 + inline namespace literals + { + /** ISO C++ 2014 namespace for suffixes for duration literals. + * + * These suffixes can be used to create `chrono::duration` values with + * tick periods of hours, minutes, seconds, milliseconds, microseconds + * or nanoseconds. For example, `std::chrono::seconds(5)` can be written + * as `5s` after making the suffix visible in the current scope. + * The suffixes can be made visible by a using-directive or + * using-declaration such as: + * - `using namespace std::chrono_literals;` + * - `using namespace std::literals;` + * - `using namespace std::chrono;` + * - `using namespace std;` + * - `using std::chrono_literals::operator""s;` + * + * The result of these suffixes on an integer literal is one of the + * standard typedefs such as `std::chrono::hours`. + * The result on a floating-point literal is a duration type with the + * specified tick period and an unspecified floating-point representation, + * for example `1.5e2ms` might be equivalent to + * `chrono::duration(1.5e2)`. + * + * @since C+14 + * @ingroup chrono + */ + inline namespace chrono_literals + { + /// @addtogroup chrono + /// @{ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wliteral-suffix" + /// @cond undocumented + template + constexpr _Dur __check_overflow() + { + using _Val = __parse_int::_Parse_int<_Digits...>; + constexpr typename _Dur::rep __repval = _Val::value; + static_assert(__repval >= 0 && __repval == _Val::value, + "literal value cannot be represented by duration type"); + return _Dur(__repval); + } + /// @endcond + + /// Literal suffix for durations representing non-integer hours + constexpr chrono::duration> + operator""h(long double __hours) + { return chrono::duration>{__hours}; } + + /// Literal suffix for durations of type `std::chrono::hours` + template + constexpr chrono::hours + operator""h() + { return __check_overflow(); } + + /// Literal suffix for durations representing non-integer minutes + constexpr chrono::duration> + operator""min(long double __mins) + { return chrono::duration>{__mins}; } + + /// Literal suffix for durations of type `std::chrono::minutes` + template + constexpr chrono::minutes + operator""min() + { return __check_overflow(); } + + /// Literal suffix for durations representing non-integer seconds + constexpr chrono::duration + operator""s(long double __secs) + { return chrono::duration{__secs}; } + + /// Literal suffix for durations of type `std::chrono::seconds` + template + constexpr chrono::seconds + operator""s() + { return __check_overflow(); } + + /// Literal suffix for durations representing non-integer milliseconds + constexpr chrono::duration + operator""ms(long double __msecs) + { return chrono::duration{__msecs}; } + + /// Literal suffix for durations of type `std::chrono::milliseconds` + template + constexpr chrono::milliseconds + operator""ms() + { return __check_overflow(); } + + /// Literal suffix for durations representing non-integer microseconds + constexpr chrono::duration + operator""us(long double __usecs) + { return chrono::duration{__usecs}; } + + /// Literal suffix for durations of type `std::chrono::microseconds` + template + constexpr chrono::microseconds + operator""us() + { return __check_overflow(); } + + /// Literal suffix for durations representing non-integer nanoseconds + constexpr chrono::duration + operator""ns(long double __nsecs) + { return chrono::duration{__nsecs}; } + + /// Literal suffix for durations of type `std::chrono::nanoseconds` + template + constexpr chrono::nanoseconds + operator""ns() + { return __check_overflow(); } + +#pragma GCC diagnostic pop + /// @} + } // inline namespace chrono_literals + } // inline namespace literals + + namespace chrono + { + using namespace literals::chrono_literals; + } // namespace chrono +#endif // __glibcxx_chrono_udls + +#if __cplusplus >= 201703L && _GLIBCXX_HOSTED + namespace filesystem + { + struct __file_clock + { + using duration = chrono::nanoseconds; + using rep = duration::rep; + using period = duration::period; + using time_point = chrono::time_point<__file_clock>; + static constexpr bool is_steady = false; + + static time_point + now() noexcept + { return _S_from_sys(chrono::system_clock::now()); } + +#if __cplusplus > 201703L + template + static + chrono::file_time> + from_sys(const chrono::sys_time<_Dur>& __t) noexcept + { return _S_from_sys(__t); } + + // For internal use only + template + static + chrono::sys_time> + to_sys(const chrono::file_time<_Dur>& __t) noexcept + { return _S_to_sys(__t); } +#endif // C++20 + + private: + using __sys_clock = chrono::system_clock; + + // This clock's (unspecified) epoch is 2174-01-01 00:00:00 UTC. + // A signed 64-bit duration with nanosecond resolution gives roughly + // +/- 292 years, which covers the 1901-2446 date range for ext4. + static constexpr chrono::seconds _S_epoch_diff{6437664000}; + + protected: + // For internal use only + template + static + chrono::time_point<__file_clock, common_type_t<_Dur, chrono::seconds>> + _S_from_sys(const chrono::time_point<__sys_clock, _Dur>& __t) noexcept + { + using _CDur = common_type_t<_Dur, chrono::seconds>; + using __file_time = chrono::time_point<__file_clock, _CDur>; + return __file_time{__t.time_since_epoch()} - _S_epoch_diff; + } + + // For internal use only + template + static + chrono::time_point<__sys_clock, common_type_t<_Dur, chrono::seconds>> + _S_to_sys(const chrono::time_point<__file_clock, _Dur>& __t) noexcept + { + using _CDur = common_type_t<_Dur, chrono::seconds>; + using __sys_time = chrono::time_point<__sys_clock, _CDur>; + return __sys_time{__t.time_since_epoch()} + _S_epoch_diff; + } + }; + } // namespace filesystem +#endif // C++17 && HOSTED + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 + +#endif //_GLIBCXX_CHRONO_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@chrono.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@chrono.h.blob new file mode 100644 index 0000000..e707e5a Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@chrono.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@codecvt.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@codecvt.h new file mode 100644 index 0000000..1dcc70f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@codecvt.h @@ -0,0 +1,849 @@ +// Locale support (codecvt) -*- C++ -*- + +// Copyright (C) 2000-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/codecvt.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.2.1.5 Template class codecvt +// + +// Written by Benjamin Kosnik + +#ifndef _CODECVT_H +#define _CODECVT_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include // locale::facet + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// Empty base class for codecvt facet [22.2.1.5]. + class codecvt_base + { + public: + enum result + { + ok, + partial, + error, + noconv + }; + }; + + /** + * @brief Common base for codecvt functions. + * + * This template class provides implementations of the public functions + * that forward to the protected virtual functions. + * + * This template also provides abstract stubs for the protected virtual + * functions. + */ + template + class __codecvt_abstract_base + : public locale::facet, public codecvt_base + { + public: + // Types: + typedef codecvt_base::result result; + typedef _InternT intern_type; + typedef _ExternT extern_type; + typedef _StateT state_type; + + // 22.2.1.5.1 codecvt members + /** + * @brief Convert from internal to external character set. + * + * Converts input string of intern_type to output string of + * extern_type. This is analogous to wcsrtombs. It does this by + * calling codecvt::do_out. + * + * The source and destination character sets are determined by the + * facet's locale, internal and external types. + * + * The characters in [from,from_end) are converted and written to + * [to,to_end). from_next and to_next are set to point to the + * character following the last successfully converted character, + * respectively. If the result needed no conversion, from_next and + * to_next are not affected. + * + * The @a state argument should be initialized if the input is at the + * beginning and carried from a previous call if continuing + * conversion. There are no guarantees about how @a state is used. + * + * The result returned is a member of codecvt_base::result. If + * all the input is converted, returns codecvt_base::ok. If no + * conversion is necessary, returns codecvt_base::noconv. If + * the input ends early or there is insufficient space in the + * output, returns codecvt_base::partial. Otherwise the + * conversion failed and codecvt_base::error is returned. + * + * @param __state Persistent conversion state data. + * @param __from Start of input. + * @param __from_end End of input. + * @param __from_next Returns start of unconverted data. + * @param __to Start of output buffer. + * @param __to_end End of output buffer. + * @param __to_next Returns start of unused output area. + * @return codecvt_base::result. + */ + result + out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const + { + return this->do_out(__state, __from, __from_end, __from_next, + __to, __to_end, __to_next); + } + + /** + * @brief Reset conversion state. + * + * Writes characters to output that would restore @a state to initial + * conditions. The idea is that if a partial conversion occurs, then + * the converting the characters written by this function would leave + * the state in initial conditions, rather than partial conversion + * state. It does this by calling codecvt::do_unshift(). + * + * For example, if 4 external characters always converted to 1 internal + * character, and input to in() had 6 external characters with state + * saved, this function would write two characters to the output and + * set the state to initialized conditions. + * + * The source and destination character sets are determined by the + * facet's locale, internal and external types. + * + * The result returned is a member of codecvt_base::result. If the + * state could be reset and data written, returns codecvt_base::ok. If + * no conversion is necessary, returns codecvt_base::noconv. If the + * output has insufficient space, returns codecvt_base::partial. + * Otherwise the reset failed and codecvt_base::error is returned. + * + * @param __state Persistent conversion state data. + * @param __to Start of output buffer. + * @param __to_end End of output buffer. + * @param __to_next Returns start of unused output area. + * @return codecvt_base::result. + */ + result + unshift(state_type& __state, extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const + { return this->do_unshift(__state, __to,__to_end,__to_next); } + + /** + * @brief Convert from external to internal character set. + * + * Converts input string of extern_type to output string of + * intern_type. This is analogous to mbsrtowcs. It does this by + * calling codecvt::do_in. + * + * The source and destination character sets are determined by the + * facet's locale, internal and external types. + * + * The characters in [from,from_end) are converted and written to + * [to,to_end). from_next and to_next are set to point to the + * character following the last successfully converted character, + * respectively. If the result needed no conversion, from_next and + * to_next are not affected. + * + * The @a state argument should be initialized if the input is at the + * beginning and carried from a previous call if continuing + * conversion. There are no guarantees about how @a state is used. + * + * The result returned is a member of codecvt_base::result. If + * all the input is converted, returns codecvt_base::ok. If no + * conversion is necessary, returns codecvt_base::noconv. If + * the input ends early or there is insufficient space in the + * output, returns codecvt_base::partial. Otherwise the + * conversion failed and codecvt_base::error is returned. + * + * @param __state Persistent conversion state data. + * @param __from Start of input. + * @param __from_end End of input. + * @param __from_next Returns start of unconverted data. + * @param __to Start of output buffer. + * @param __to_end End of output buffer. + * @param __to_next Returns start of unused output area. + * @return codecvt_base::result. + */ + result + in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const + { + return this->do_in(__state, __from, __from_end, __from_next, + __to, __to_end, __to_next); + } + + int + encoding() const throw() + { return this->do_encoding(); } + + bool + always_noconv() const throw() + { return this->do_always_noconv(); } + + int + length(state_type& __state, const extern_type* __from, + const extern_type* __end, size_t __max) const + { return this->do_length(__state, __from, __end, __max); } + + int + max_length() const throw() + { return this->do_max_length(); } + + protected: + explicit + __codecvt_abstract_base(size_t __refs = 0) : locale::facet(__refs) { } + + virtual + ~__codecvt_abstract_base() { } + + /** + * @brief Convert from internal to external character set. + * + * Converts input string of intern_type to output string of + * extern_type. This function is a hook for derived classes to change + * the value returned. @see out for more information. + */ + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const = 0; + + virtual result + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const = 0; + + virtual result + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const = 0; + + virtual int + do_encoding() const throw() = 0; + + virtual bool + do_always_noconv() const throw() = 0; + + virtual int + do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const = 0; + + virtual int + do_max_length() const throw() = 0; + }; + + /** + * @brief Primary class template codecvt. + * @ingroup locales + * + * NB: Generic, mostly useless implementation. + * + */ + template + class codecvt + : public __codecvt_abstract_base<_InternT, _ExternT, _StateT> + { + public: + // Types: + typedef codecvt_base::result result; + typedef _InternT intern_type; + typedef _ExternT extern_type; + typedef _StateT state_type; + + protected: + __c_locale _M_c_locale_codecvt; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base<_InternT, _ExternT, _StateT> (__refs), + _M_c_locale_codecvt(0) + { } + + explicit + codecvt(__c_locale __cloc, size_t __refs = 0); + + protected: + virtual + ~codecvt() { } + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual int + do_encoding() const throw(); + + virtual bool + do_always_noconv() const throw(); + + virtual int + do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + + template + locale::id codecvt<_InternT, _ExternT, _StateT>::id; + + /// class codecvt specialization. + template<> + class codecvt + : public __codecvt_abstract_base + { + friend class messages; + + public: + // Types: + typedef char intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + protected: + __c_locale _M_c_locale_codecvt; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0); + + explicit + codecvt(__c_locale __cloc, size_t __refs = 0); + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual int + do_encoding() const throw(); + + virtual bool + do_always_noconv() const throw(); + + virtual int + do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + +#ifdef _GLIBCXX_USE_WCHAR_T + /** @brief Class codecvt specialization. + * + * Converts between narrow and wide characters in the native character set + */ + template<> + class codecvt + : public __codecvt_abstract_base + { + friend class messages; + + public: + // Types: + typedef wchar_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + protected: + __c_locale _M_c_locale_codecvt; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0); + + explicit + codecvt(__c_locale __cloc, size_t __refs = 0); + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, + const extern_type* __from, const extern_type* __from_end, + const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual + int do_encoding() const throw(); + + virtual + bool do_always_noconv() const throw(); + + virtual + int do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; +#endif //_GLIBCXX_USE_WCHAR_T + +#if __cplusplus >= 201103L + /** @brief Class codecvt specialization. + * + * Converts between UTF-16 and UTF-8. + */ + template<> + class codecvt + : public __codecvt_abstract_base + { + public: + // Types: + typedef char16_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base(__refs) { } + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, + const extern_type* __from, const extern_type* __from_end, + const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual + int do_encoding() const throw(); + + virtual + bool do_always_noconv() const throw(); + + virtual + int do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + + /** @brief Class codecvt specialization. + * + * Converts between UTF-32 and UTF-8. + */ + template<> + class codecvt + : public __codecvt_abstract_base + { + public: + // Types: + typedef char32_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base(__refs) { } + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, + const extern_type* __from, const extern_type* __from_end, + const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual + int do_encoding() const throw(); + + virtual + bool do_always_noconv() const throw(); + + virtual + int do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + +#ifdef _GLIBCXX_USE_CHAR8_T + /** @brief Class codecvt specialization. + * + * Converts between UTF-16 and UTF-8. + */ + template<> + class codecvt + : public __codecvt_abstract_base + { + public: + // Types: + typedef char16_t intern_type; + typedef char8_t extern_type; + typedef mbstate_t state_type; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base(__refs) { } + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, + const extern_type* __from, const extern_type* __from_end, + const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual + int do_encoding() const throw(); + + virtual + bool do_always_noconv() const throw(); + + virtual + int do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + + /** @brief Class codecvt specialization. + * + * Converts between UTF-32 and UTF-8. + */ + template<> + class codecvt + : public __codecvt_abstract_base + { + public: + // Types: + typedef char32_t intern_type; + typedef char8_t extern_type; + typedef mbstate_t state_type; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base(__refs) { } + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, + const extern_type* __from, const extern_type* __from_end, + const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual + int do_encoding() const throw(); + + virtual + bool do_always_noconv() const throw(); + + virtual + int do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; +#endif // _GLIBCXX_USE_CHAR8_T + +#endif // C++11 + + /// class codecvt_byname [22.2.1.6]. + template + class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> + { + public: + explicit + codecvt_byname(const char* __s, size_t __refs = 0) + : codecvt<_InternT, _ExternT, _StateT>(__refs) + { + if (__builtin_strcmp(__s, "C") != 0 + && __builtin_strcmp(__s, "POSIX") != 0) + { + this->_S_destroy_c_locale(this->_M_c_locale_codecvt); + this->_S_create_c_locale(this->_M_c_locale_codecvt, __s); + } + } + +#if __cplusplus >= 201103L + explicit + codecvt_byname(const string& __s, size_t __refs = 0) + : codecvt_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~codecvt_byname() { } + }; + +#if __cplusplus >= 201103L + template<> + class codecvt_byname + : public codecvt + { + public: + explicit + codecvt_byname(const char*, size_t __refs = 0) + : codecvt(__refs) { } + + explicit + codecvt_byname(const string& __s, size_t __refs = 0) + : codecvt_byname(__s.c_str(), __refs) { } + + protected: + virtual + ~codecvt_byname() { } + }; + + template<> + class codecvt_byname + : public codecvt + { + public: + explicit + codecvt_byname(const char*, size_t __refs = 0) + : codecvt(__refs) { } + + explicit + codecvt_byname(const string& __s, size_t __refs = 0) + : codecvt_byname(__s.c_str(), __refs) { } + + protected: + virtual + ~codecvt_byname() { } + }; + +#if defined(_GLIBCXX_USE_CHAR8_T) + template<> + class codecvt_byname + : public codecvt + { + public: + explicit + codecvt_byname(const char*, size_t __refs = 0) + : codecvt(__refs) { } + + explicit + codecvt_byname(const string& __s, size_t __refs = 0) + : codecvt_byname(__s.c_str(), __refs) { } + + protected: + virtual + ~codecvt_byname() { } + }; + + template<> + class codecvt_byname + : public codecvt + { + public: + explicit + codecvt_byname(const char*, size_t __refs = 0) + : codecvt(__refs) { } + + explicit + codecvt_byname(const string& __s, size_t __refs = 0) + : codecvt_byname(__s.c_str(), __refs) { } + + protected: + virtual + ~codecvt_byname() { } + }; +#endif + +#endif // C++11 + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class codecvt_byname; + + extern template + const codecvt& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class codecvt_byname; + + extern template + const codecvt& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); +#endif + +#if __cplusplus >= 201103L + extern template class codecvt_byname; + extern template class codecvt_byname; + +#if defined(_GLIBCXX_USE_CHAR8_T) + extern template class codecvt_byname; + extern template class codecvt_byname; +#endif + +#endif + +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif // _CODECVT_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@codecvt.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@codecvt.h.blob new file mode 100644 index 0000000..fc6e27c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@codecvt.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@concept_check.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@concept_check.h new file mode 100644 index 0000000..3e68067 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@concept_check.h @@ -0,0 +1,87 @@ +// Concept-checking control -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/concept_check.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ + +#ifndef _CONCEPT_CHECK_H +#define _CONCEPT_CHECK_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wvariadic-macros" + +// All places in libstdc++-v3 where these are used, or /might/ be used, or +// don't need to be used, or perhaps /should/ be used, are commented with +// "concept requirements" (and maybe some more text). So grep like crazy +// if you're looking for additional places to use these. + +// Concept-checking code is off by default unless users turn it on via +// configure options or editing c++config.h. +// It is not supported for freestanding implementations. + +#if !defined(_GLIBCXX_CONCEPT_CHECKS) + +#define __glibcxx_function_requires(...) +#define __glibcxx_class_requires(_a,_b) +#define __glibcxx_class_requires2(_a,_b,_c) +#define __glibcxx_class_requires3(_a,_b,_c,_d) +#define __glibcxx_class_requires4(_a,_b,_c,_d,_e) + +#else // the checks are on + +#include + +// Note that the obvious and elegant approach of +// +//#define glibcxx_function_requires(C) debug::function_requires< debug::C >() +// +// won't work due to concept templates with more than one parameter, e.g., +// BinaryPredicateConcept. The preprocessor tries to split things up on +// the commas in the template argument list. We can't use an inner pair of +// parenthesis to hide the commas, because "debug::(Temp)" isn't +// a valid instantiation pattern. Thus, we steal a feature from C99. + +#define __glibcxx_function_requires(...) \ + __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >(); +#define __glibcxx_class_requires(_a,_C) \ + _GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C); +#define __glibcxx_class_requires2(_a,_b,_C) \ + _GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C); +#define __glibcxx_class_requires3(_a,_b,_c,_C) \ + _GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C); +#define __glibcxx_class_requires4(_a,_b,_c,_d,_C) \ + _GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C); + +#endif // enable/disable + +#pragma GCC diagnostic pop +#endif // _GLIBCXX_CONCEPT_CHECK diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@concept_check.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@concept_check.h.blob new file mode 100644 index 0000000..759906e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@concept_check.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cpp_type_traits.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cpp_type_traits.h new file mode 100644 index 0000000..0e1c441 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cpp_type_traits.h @@ -0,0 +1,714 @@ +// The -*- C++ -*- type traits classes for internal use in libstdc++ + +// Copyright (C) 2000-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/cpp_type_traits.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ext/type_traits.h} + */ + +// Written by Gabriel Dos Reis + +#ifndef _CPP_TYPE_TRAITS_H +#define _CPP_TYPE_TRAITS_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include +#if __glibcxx_type_trait_variable_templates +# include // is_same_v, is_integral_v +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + +// +// This file provides some compile-time information about various types. +// These representations were designed, on purpose, to be constant-expressions +// and not types as found in . In particular, they +// can be used in control structures and the optimizer hopefully will do +// the obvious thing. +// +// Why integral expressions, and not functions nor types? +// Firstly, these compile-time entities are used as template-arguments +// so function return values won't work: We need compile-time entities. +// We're left with types and constant integral expressions. +// Secondly, from the point of view of ease of use, type-based compile-time +// information is -not- *that* convenient. One has to write lots of +// overloaded functions and to hope that the compiler will select the right +// one. As a net effect, the overall structure isn't very clear at first +// glance. +// Thirdly, partial ordering and overload resolution (of function templates) +// is highly costly in terms of compiler-resource. It is a Good Thing to +// keep these resource consumption as least as possible. +// +// See valarray_array.h for a case use. +// +// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06. +// +// Update 2005: types are also provided and has been +// removed. +// + +extern "C++" { + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + struct __true_type { }; + struct __false_type { }; + + template + struct __truth_type + { typedef __false_type __type; }; + + template<> + struct __truth_type + { typedef __true_type __type; }; + + // N.B. The conversions to bool are needed due to the issue + // explained in c++/19404. + template + struct __traitor + { + enum { __value = bool(_Sp::__value) || bool(_Tp::__value) }; + typedef typename __truth_type<__value>::__type __type; + }; + + // Compare for equality of types. + template + struct __are_same + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + template + struct __are_same<_Tp, _Tp> + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + // + // Integer types + // + template + struct __is_integer + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + // Explicit specializations for the standard integer types. + // Up to four target-specific __int types are supported as well. + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + +# ifdef __WCHAR_TYPE__ + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; +# endif + +#ifdef _GLIBCXX_USE_CHAR8_T + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + +#if __cplusplus >= 201103L + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + +#define __INT_N(TYPE) \ + __extension__ \ + template<> \ + struct __is_integer \ + { \ + enum { __value = 1 }; \ + typedef __true_type __type; \ + }; \ + __extension__ \ + template<> \ + struct __is_integer \ + { \ + enum { __value = 1 }; \ + typedef __true_type __type; \ + }; + +#ifdef __GLIBCXX_TYPE_INT_N_0 +__INT_N(__GLIBCXX_TYPE_INT_N_0) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_1 +__INT_N(__GLIBCXX_TYPE_INT_N_1) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_2 +__INT_N(__GLIBCXX_TYPE_INT_N_2) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_3 +__INT_N(__GLIBCXX_TYPE_INT_N_3) +#endif + +#undef __INT_N + + // + // Floating point types + // + template + struct __is_floating + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + // three specializations (float, double and 'long double') + template<> + struct __is_floating + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_floating + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_floating + { + enum { __value = 1 }; + typedef __true_type __type; + }; + +#ifdef __STDCPP_FLOAT16_T__ + template<> + struct __is_floating<_Float16> + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + +#ifdef __STDCPP_FLOAT32_T__ + template<> + struct __is_floating<_Float32> + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + +#ifdef __STDCPP_FLOAT64_T__ + template<> + struct __is_floating<_Float64> + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + +#ifdef __STDCPP_FLOAT128_T__ + template<> + struct __is_floating<_Float128> + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + +#ifdef __STDCPP_BFLOAT16_T__ + template<> + struct __is_floating<__gnu_cxx::__bfloat16_t> + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + + // + // An arithmetic type is an integer type or a floating point type + // + template + struct __is_arithmetic + : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > + { }; + + // + // For use in std::copy and std::find overloads for streambuf iterators. + // + template + struct __is_char + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + template<> + struct __is_char + { + enum { __value = 1 }; + typedef __true_type __type; + }; + +#ifdef __WCHAR_TYPE__ + template<> + struct __is_char + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + + template + struct __is_byte + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + template<> + struct __is_byte + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_byte + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_byte + { + enum { __value = 1 }; + typedef __true_type __type; + }; + +#ifdef __glibcxx_byte // C++ >= 17 + enum class byte : unsigned char; + + template<> + struct __is_byte + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif // C++17 + +#ifdef _GLIBCXX_USE_CHAR8_T + template<> + struct __is_byte + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + + // A type that is safe for use with memcpy, memmove, memcmp etc. + template + struct __is_nonvolatile_trivially_copyable + { + enum { __value = __is_trivially_copyable(_Tp) }; + }; + + // Cannot use memcpy/memmove/memcmp on volatile types even if they are + // trivially copyable, so ensure __memcpyable + // and similar will be false. + template + struct __is_nonvolatile_trivially_copyable + { + enum { __value = 0 }; + }; + + // Whether two iterator types can be used with memcpy/memmove. + template + struct __memcpyable + { + enum { __value = 0 }; + }; + + // Allow memcpy when source and destination are pointers to the same type. + template + struct __memcpyable<_Tp*, _Tp*> + : __is_nonvolatile_trivially_copyable<_Tp> + { }; + + // Source pointer can be const. + template + struct __memcpyable<_Tp*, const _Tp*> + : __is_nonvolatile_trivially_copyable<_Tp> + { }; + + template struct __memcpyable_integer; + + // For heterogeneous types, allow memcpy between equal-sized integers. + // N.B. we cannot do the same for equal-sized enums, they're not assignable. + // We cannot do it for pointers, because derived-to-base can adjust offset. + template + struct __memcpyable<_Tp*, _Up*> + { + enum { + __value = __memcpyable_integer<_Tp>::__width != 0 + && ((int)__memcpyable_integer<_Tp>::__width + == (int)__memcpyable_integer<_Up>::__width) + }; + }; + + // Specialization for const U* because __is_integer is never true. + template + struct __memcpyable<_Tp*, const _Up*> + : __memcpyable<_Tp*, _Up*> + { }; + + template + struct __memcpyable_integer + { + enum { + __width = __is_integer<_Tp>::__value ? (sizeof(_Tp) * __CHAR_BIT__) : 0 + }; + }; + + // Cannot memcpy volatile memory. + template + struct __memcpyable_integer + { enum { __width = 0 }; }; + + // Assigning an integer to bool needs to convert all non-zero values to true + // so it is not a memcpyable integer. + // __memcpyable is still true though. + template<> + struct __memcpyable_integer + { enum { __width = 0 }; }; + + // Specializations for __intNN types with padding bits. +#if defined __GLIBCXX_TYPE_INT_N_0 && __GLIBCXX_BITSIZE_INT_N_0 % __CHAR_BIT__ + __extension__ + template<> + struct __memcpyable_integer<__GLIBCXX_TYPE_INT_N_0> + { enum { __width = __GLIBCXX_BITSIZE_INT_N_0 }; }; + __extension__ + template<> + struct __memcpyable_integer + { enum { __width = __GLIBCXX_BITSIZE_INT_N_0 }; }; +#endif +#if defined __GLIBCXX_TYPE_INT_N_1 && __GLIBCXX_BITSIZE_INT_N_1 % __CHAR_BIT__ + __extension__ + template<> + struct __memcpyable_integer<__GLIBCXX_TYPE_INT_N_1> + { enum { __width = __GLIBCXX_BITSIZE_INT_N_1 }; }; + __extension__ + template<> + struct __memcpyable_integer + { enum { __width = __GLIBCXX_BITSIZE_INT_N_1 }; }; +#endif +#if defined __GLIBCXX_TYPE_INT_N_2 && __GLIBCXX_BITSIZE_INT_N_2 % __CHAR_BIT__ + __extension__ + template<> + struct __memcpyable_integer<__GLIBCXX_TYPE_INT_N_2> + { enum { __width = __GLIBCXX_BITSIZE_INT_N_2 }; }; + __extension__ + template<> + struct __memcpyable_integer + { enum { __width = __GLIBCXX_BITSIZE_INT_N_2 }; }; +#endif +#if defined __GLIBCXX_TYPE_INT_N_3 && __GLIBCXX_BITSIZE_INT_N_3 % __CHAR_BIT__ + __extension__ + template<> + struct __memcpyable_integer<__GLIBCXX_TYPE_INT_N_3> + { enum { __width = __GLIBCXX_BITSIZE_INT_N_3 }; }; + __extension__ + template<> + struct __memcpyable_integer + { enum { __width = __GLIBCXX_BITSIZE_INT_N_3 }; }; +#endif + +#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__ + // In strict modes __is_integer<__int128> is false, + // but we want to allow memcpy between signed/unsigned __int128. + __extension__ + template<> + struct __memcpyable_integer<__int128> { enum { __width = 128 }; }; + __extension__ + template<> + struct __memcpyable_integer { enum { __width = 128 }; }; +#endif + +#if _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 && _GLIBCXX_LDOUBLE_IS_IEEE_BINARY64 + template<> + struct __memcpyable { enum { __value = true }; }; + template<> + struct __memcpyable { enum { __value = true }; }; +#endif + +#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + template<> + struct __memcpyable<_Float32*, float*> { enum { __value = true }; }; + template<> + struct __memcpyable { enum { __value = true }; }; +#endif + +#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) + template<> + struct __memcpyable<_Float64*, double*> { enum { __value = true }; }; + template<> + struct __memcpyable { enum { __value = true }; }; +#endif + +#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) + template<> + struct __memcpyable<_Float128*, long double*> { enum { __value = true }; }; + template<> + struct __memcpyable { enum { __value = true }; }; +#endif + + // Whether two iterator types can be used with memcmp. + // This trait only says it's well-formed to use memcmp, not that it + // gives the right answer for a given algorithm. So for example, std::equal + // needs to add additional checks that the types are integers or pointers, + // because other trivially copyable types can overload operator==. + template + struct __memcmpable + { + enum { __value = 0 }; + }; + + // OK to use memcmp with pointers to trivially copyable types. + template + struct __memcmpable<_Tp*, _Tp*> + : __is_nonvolatile_trivially_copyable<_Tp> + { }; + + template + struct __memcmpable + : __is_nonvolatile_trivially_copyable<_Tp> + { }; + + template + struct __memcmpable<_Tp*, const _Tp*> + : __is_nonvolatile_trivially_copyable<_Tp> + { }; + + // Whether memcmp can be used to determine ordering for a type + // e.g. in std::lexicographical_compare or three-way comparisons. + // True for unsigned integer-like types where comparing each byte in turn + // as an unsigned char yields the right result. This is true for all + // unsigned integers on big endian targets, but only unsigned narrow + // character types (and std::byte) on little endian targets. + template::__value +#else + __is_byte<_Tp>::__value +#endif + > + struct __is_memcmp_ordered + { + static const bool __value = _Tp(-1) > _Tp(1); // is unsigned + }; + + template + struct __is_memcmp_ordered<_Tp, false> + { + static const bool __value = false; + }; + + // Whether two types can be compared using memcmp. + template + struct __is_memcmp_ordered_with + { + static const bool __value = __is_memcmp_ordered<_Tp>::__value + && __is_memcmp_ordered<_Up>::__value; + }; + + template + struct __is_memcmp_ordered_with<_Tp, _Up, false> + { + static const bool __value = false; + }; + +#if __cplusplus >= 201703L +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + // std::byte is not an integer, but it can be compared using memcmp. + template<> + struct __is_memcmp_ordered + { static constexpr bool __value = true; }; +#endif + + // std::byte can only be compared to itself, not to other types. + template<> + struct __is_memcmp_ordered_with + { static constexpr bool __value = true; }; + + template + struct __is_memcmp_ordered_with<_Tp, std::byte, _SameSize> + { static constexpr bool __value = false; }; + + template + struct __is_memcmp_ordered_with + { static constexpr bool __value = false; }; +#endif + +#if __glibcxx_type_trait_variable_templates + template + constexpr bool __can_use_memchr_for_find + // Can only use memchr to search for narrow characters and std::byte. + = __is_byte<_ValT>::__value + // And only if the value to find is an integer (or is also std::byte). + && (is_same_v<_Tp, _ValT> || is_integral_v<_Tp>); +#endif + + // + // Move iterator type + // + template + struct __is_move_iterator + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + // Fallback implementation of the function in bits/stl_iterator.h used to + // remove the move_iterator wrapper. + template + _GLIBCXX20_CONSTEXPR + inline _Iterator + __miter_base(_Iterator __it) + { return __it; } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +} // extern "C++" + +#pragma GCC diagnostic pop + +#endif //_CPP_TYPE_TRAITS_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cpp_type_traits.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cpp_type_traits.h.blob new file mode 100644 index 0000000..3eb7ced Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cpp_type_traits.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_forced.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_forced.h new file mode 100644 index 0000000..01236df --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_forced.h @@ -0,0 +1,62 @@ +// cxxabi.h subset for cancellation -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/cxxabi_forced.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{cxxabi.h} + */ + +#ifndef _CXXABI_FORCED_H +#define _CXXABI_FORCED_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#pragma GCC visibility push(default) + +#ifdef __cplusplus +namespace __cxxabiv1 +{ + /** + * @brief Thrown as part of forced unwinding. + * @ingroup exceptions + * + * A magic placeholder class that can be caught by reference to + * recognize forced unwinding. + */ + class __forced_unwind + { + virtual ~__forced_unwind() throw(); + + // Prevent catch by value. + virtual void __pure_dummy() = 0; + }; +} +#endif // __cplusplus + +#pragma GCC visibility pop + +#endif // __CXXABI_FORCED_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_forced.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_forced.h.blob new file mode 100644 index 0000000..a7a70af Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_forced.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_init_exception.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_init_exception.h new file mode 100644 index 0000000..962620c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_init_exception.h @@ -0,0 +1,83 @@ +// ABI Support -*- C++ -*- + +// Copyright (C) 2016-2025 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/cxxabi_init_exception.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ + +#ifndef _CXXABI_INIT_EXCEPTION_H +#define _CXXABI_INIT_EXCEPTION_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#pragma GCC visibility push(default) + +#include +#include + +#ifndef _GLIBCXX_CDTOR_CALLABI +#define _GLIBCXX_CDTOR_CALLABI +#define _GLIBCXX_HAVE_CDTOR_CALLABI 0 +#else +#define _GLIBCXX_HAVE_CDTOR_CALLABI 1 +#endif + +#ifdef __cplusplus + +namespace std +{ + class type_info; +} + +namespace __cxxabiv1 +{ + struct __cxa_refcounted_exception; + + extern "C" + { + // Allocate memory for the primary exception plus the thrown object. + void* + __cxa_allocate_exception(size_t) _GLIBCXX_NOTHROW; + + void + __cxa_free_exception(void*) _GLIBCXX_NOTHROW; + + // Initialize exception (this is a GNU extension) + __cxa_refcounted_exception* + __cxa_init_primary_exception(void *__object, std::type_info *__tinfo, + void (_GLIBCXX_CDTOR_CALLABI *__dest) (void *)) + _GLIBCXX_NOTHROW; + + } +} // namespace __cxxabiv1 + +#endif + +#pragma GCC visibility pop + +#endif // _CXXABI_INIT_EXCEPTION_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_init_exception.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_init_exception.h.blob new file mode 100644 index 0000000..7127e21 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@cxxabi_init_exception.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception.h new file mode 100644 index 0000000..f8bca91 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception.h @@ -0,0 +1,85 @@ +// Exception Handling support header for -*- C++ -*- + +// Copyright (C) 2016-2025 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/exception.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ + +#ifndef __EXCEPTION_H +#define __EXCEPTION_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +extern "C++" { + +namespace std _GLIBCXX_VISIBILITY(default) +{ + /** + * @defgroup exceptions Exceptions + * @ingroup diagnostics + * @since C++98 + * + * Classes and functions for reporting errors via exceptions. + * @{ + */ + + /** + * @brief Base class for all library exceptions. + * + * This is the base class for all exceptions thrown by the standard + * library, and by certain language expressions. You are free to derive + * your own %exception classes, or use a different hierarchy, or to + * throw non-class data (e.g., fundamental types). + */ + class exception + { + public: + exception() _GLIBCXX_NOTHROW { } + virtual ~exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW; +#if __cplusplus >= 201103L + exception(const exception&) = default; + exception& operator=(const exception&) = default; + exception(exception&&) = default; + exception& operator=(exception&&) = default; +#endif + + /** Returns a C-style character string describing the general cause + * of the current error. */ + virtual const char* + what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW; + }; + + /// @} + +} // namespace std + +} + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception.h.blob new file mode 100644 index 0000000..4cace51 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_defines.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_defines.h new file mode 100644 index 0000000..59544c0 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_defines.h @@ -0,0 +1,45 @@ +// -fno-exceptions Support -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/exception_defines.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{exception} + */ + +#ifndef _EXCEPTION_DEFINES_H +#define _EXCEPTION_DEFINES_H 1 + +#if ! __cpp_exceptions +// Iff -fno-exceptions, transform error handling code to work without it. +# define __try if (true) +# define __catch(X) if (false) +# define __throw_exception_again +#else +// Else proceed normally. +# define __try try +# define __catch(X) catch(X) +# define __throw_exception_again throw +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_defines.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_defines.h.blob new file mode 100644 index 0000000..71ee64f Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_defines.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_ptr.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_ptr.h new file mode 100644 index 0000000..a7e5e52 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_ptr.h @@ -0,0 +1,294 @@ +// Exception Handling support header (exception_ptr class) for -*- C++ -*- + +// Copyright (C) 2008-2025 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/exception_ptr.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{exception} + */ + +#ifndef _EXCEPTION_PTR_H +#define _EXCEPTION_PTR_H + +#include +#include +#include +#include +#include + +#if __cplusplus >= 201103L +# include +#endif + +#ifdef _GLIBCXX_EH_PTR_RELOPS_COMPAT +# define _GLIBCXX_EH_PTR_USED __attribute__((__used__)) +#else +# define _GLIBCXX_EH_PTR_USED +#endif + +extern "C++" { + +namespace std _GLIBCXX_VISIBILITY(default) +{ + class type_info; + + /** + * @addtogroup exceptions + * @{ + */ + + namespace __exception_ptr + { + class exception_ptr; + } + + using __exception_ptr::exception_ptr; + + /** Obtain an exception_ptr to the currently handled exception. + * + * If there is none, or the currently handled exception is foreign, + * return the null value. + * + * @since C++11 + */ + exception_ptr current_exception() _GLIBCXX_USE_NOEXCEPT; + + template + exception_ptr make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT; + + /// Throw the object pointed to by the exception_ptr. + void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__)); + + namespace __exception_ptr + { + using std::rethrow_exception; // So that ADL finds it. + + /** + * @brief An opaque pointer to an arbitrary exception. + * + * The actual name of this type is unspecified, so the alias + * `std::exception_ptr` should be used to refer to it. + * + * @headerfile exception + * @since C++11 (but usable in C++98 as a GCC extension) + * @ingroup exceptions + */ + class exception_ptr + { + void* _M_exception_object; + + explicit exception_ptr(void* __e) _GLIBCXX_USE_NOEXCEPT; + + void _M_addref() _GLIBCXX_USE_NOEXCEPT; + void _M_release() _GLIBCXX_USE_NOEXCEPT; + + void *_M_get() const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__)); + + friend exception_ptr std::current_exception() _GLIBCXX_USE_NOEXCEPT; + friend void std::rethrow_exception(exception_ptr); + template + friend exception_ptr std::make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT; + + public: + exception_ptr() _GLIBCXX_USE_NOEXCEPT; + + exception_ptr(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; + +#if __cplusplus >= 201103L + exception_ptr(nullptr_t) noexcept + : _M_exception_object(nullptr) + { } + + exception_ptr(exception_ptr&& __o) noexcept + : _M_exception_object(__o._M_exception_object) + { __o._M_exception_object = nullptr; } +#endif + +#if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT) + typedef void (exception_ptr::*__safe_bool)(); + + // For construction from nullptr or 0. + exception_ptr(__safe_bool) _GLIBCXX_USE_NOEXCEPT; +#endif + + exception_ptr& + operator=(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; + +#if __cplusplus >= 201103L + exception_ptr& + operator=(exception_ptr&& __o) noexcept + { + exception_ptr(static_cast(__o)).swap(*this); + return *this; + } +#endif + + ~exception_ptr() _GLIBCXX_USE_NOEXCEPT; + + void + swap(exception_ptr&) _GLIBCXX_USE_NOEXCEPT; + +#ifdef _GLIBCXX_EH_PTR_COMPAT + // Retained for compatibility with CXXABI_1.3. + void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT; + bool operator!() const _GLIBCXX_USE_NOEXCEPT + __attribute__ ((__pure__)); + operator __safe_bool() const _GLIBCXX_USE_NOEXCEPT; +#endif + +#if __cplusplus >= 201103L + explicit operator bool() const noexcept + { return _M_exception_object; } +#endif + +#if __cpp_impl_three_way_comparison >= 201907L \ + && ! defined _GLIBCXX_EH_PTR_RELOPS_COMPAT + friend bool + operator==(const exception_ptr&, const exception_ptr&) noexcept = default; +#else + friend _GLIBCXX_EH_PTR_USED bool + operator==(const exception_ptr& __x, const exception_ptr& __y) + _GLIBCXX_USE_NOEXCEPT + { return __x._M_exception_object == __y._M_exception_object; } + + friend _GLIBCXX_EH_PTR_USED bool + operator!=(const exception_ptr& __x, const exception_ptr& __y) + _GLIBCXX_USE_NOEXCEPT + { return __x._M_exception_object != __y._M_exception_object; } +#endif + + const class std::type_info* + __cxa_exception_type() const _GLIBCXX_USE_NOEXCEPT + __attribute__ ((__pure__)); + }; + + _GLIBCXX_EH_PTR_USED + inline + exception_ptr::exception_ptr() _GLIBCXX_USE_NOEXCEPT + : _M_exception_object(0) + { } + + _GLIBCXX_EH_PTR_USED + inline + exception_ptr::exception_ptr(const exception_ptr& __other) + _GLIBCXX_USE_NOEXCEPT + : _M_exception_object(__other._M_exception_object) + { + if (_M_exception_object) + _M_addref(); + } + + _GLIBCXX_EH_PTR_USED + inline + exception_ptr::~exception_ptr() _GLIBCXX_USE_NOEXCEPT + { + if (_M_exception_object) + _M_release(); + } + + _GLIBCXX_EH_PTR_USED + inline exception_ptr& + exception_ptr::operator=(const exception_ptr& __other) _GLIBCXX_USE_NOEXCEPT + { + exception_ptr(__other).swap(*this); + return *this; + } + + _GLIBCXX_EH_PTR_USED + inline void + exception_ptr::swap(exception_ptr &__other) _GLIBCXX_USE_NOEXCEPT + { + void *__tmp = _M_exception_object; + _M_exception_object = __other._M_exception_object; + __other._M_exception_object = __tmp; + } + + /// @relates exception_ptr + inline void + swap(exception_ptr& __lhs, exception_ptr& __rhs) + { __lhs.swap(__rhs); } + + /// @cond undocumented + template + _GLIBCXX_CDTOR_CALLABI + inline void + __dest_thunk(void* __x) + { static_cast<_Ex*>(__x)->~_Ex(); } + /// @endcond + + } // namespace __exception_ptr + + using __exception_ptr::swap; // So that std::swap(exp1, exp2) finds it. + + /// Obtain an exception_ptr pointing to a copy of the supplied object. +#if (__cplusplus >= 201103L && __cpp_rtti) || __cpp_exceptions + template + exception_ptr + make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT + { +#if __cplusplus >= 201103L && __cpp_rtti + using _Ex2 = typename decay<_Ex>::type; + void* __e = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ex)); + (void) __cxxabiv1::__cxa_init_primary_exception( + __e, const_cast(&typeid(_Ex)), + __exception_ptr::__dest_thunk<_Ex2>); + __try + { + ::new (__e) _Ex2(__ex); + return exception_ptr(__e); + } + __catch(...) + { + __cxxabiv1::__cxa_free_exception(__e); + return current_exception(); + } +#else + try + { + throw __ex; + } + catch(...) + { + return current_exception(); + } +#endif + } +#else // no RTTI and no exceptions + // This is always_inline so the linker will never use this useless definition + // instead of a working one compiled with RTTI and/or exceptions enabled. + template + __attribute__ ((__always_inline__)) + inline exception_ptr + make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT + { return exception_ptr(); } +#endif + +#undef _GLIBCXX_EH_PTR_USED + + /// @} group exceptions +} // namespace std + +} // extern "C++" + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_ptr.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_ptr.h.blob new file mode 100644 index 0000000..ed501ac Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@exception_ptr.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_dir.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_dir.h new file mode 100644 index 0000000..d37c949 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_dir.h @@ -0,0 +1,656 @@ +// Filesystem directory utilities -*- C++ -*- + +// Copyright (C) 2014-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/fs_dir.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{filesystem} + */ + +#ifndef _GLIBCXX_FS_DIR_H +#define _GLIBCXX_FS_DIR_H 1 + +#if __cplusplus >= 201703L +# include +# include +# include +# include + +#if __cplusplus >= 202002L +# include // std::strong_ordering +# include // std::default_sentinel_t +# include // enable_view, enable_borrowed_range +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +namespace filesystem +{ + /** @addtogroup filesystem + * @{ + */ + + /// Information about a file's type and permissions. + /** + * @headerfile filesystem + * @since C++17 + */ + class file_status + { + public: + // constructors and destructor + file_status() noexcept : file_status(file_type::none) {} + + explicit + file_status(file_type __ft, perms __prms = perms::unknown) noexcept + : _M_type(__ft), _M_perms(__prms) { } + + file_status(const file_status&) noexcept = default; + file_status(file_status&&) noexcept = default; + ~file_status() = default; + + file_status& operator=(const file_status&) noexcept = default; + file_status& operator=(file_status&&) noexcept = default; + + // observers + file_type type() const noexcept { return _M_type; } + perms permissions() const noexcept { return _M_perms; } + + // modifiers + void type(file_type __ft) noexcept { _M_type = __ft; } + void permissions(perms __prms) noexcept { _M_perms = __prms; } + +#if __cpp_lib_three_way_comparison + friend bool + operator==(const file_status&, const file_status&) noexcept = default; +#endif + + private: + file_type _M_type; + perms _M_perms; + }; + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + struct _Dir; + class directory_iterator; + class recursive_directory_iterator; + + /// The value type used by directory iterators + /** + * @headerfile filesystem + * @since C++17 + */ + class directory_entry + { + public: + // constructors and destructor + directory_entry() noexcept = default; + directory_entry(const directory_entry&) = default; + directory_entry(directory_entry&&) noexcept = default; + + explicit + directory_entry(const filesystem::path& __p) + : _M_path(__p) + { refresh(); } + + directory_entry(const filesystem::path& __p, error_code& __ec) + : _M_path(__p) + { + refresh(__ec); + if (__ec) + _M_path.clear(); + } + + ~directory_entry() = default; + + // modifiers + directory_entry& operator=(const directory_entry&) = default; + directory_entry& operator=(directory_entry&&) noexcept = default; + + void + assign(const filesystem::path& __p) + { + _M_path = __p; + refresh(); + } + + void + assign(const filesystem::path& __p, error_code& __ec) + { + _M_path = __p; + refresh(__ec); + } + + void + replace_filename(const filesystem::path& __p) + { + _M_path.replace_filename(__p); + refresh(); + } + + void + replace_filename(const filesystem::path& __p, error_code& __ec) + { + _M_path.replace_filename(__p); + refresh(__ec); + } + + void + refresh() + { _M_type = symlink_status().type(); } + + void + refresh(error_code& __ec) noexcept + { _M_type = symlink_status(__ec).type(); } + + // observers + const filesystem::path& path() const noexcept { return _M_path; } + operator const filesystem::path& () const noexcept { return _M_path; } + + bool + exists() const + { return filesystem::exists(file_status{_M_file_type()}); } + + bool + exists(error_code& __ec) const noexcept + { return filesystem::exists(file_status{_M_file_type(__ec)}); } + + bool + is_block_file() const + { return _M_file_type() == file_type::block; } + + bool + is_block_file(error_code& __ec) const noexcept + { return _M_file_type(__ec) == file_type::block; } + + bool + is_character_file() const + { return _M_file_type() == file_type::character; } + + bool + is_character_file(error_code& __ec) const noexcept + { return _M_file_type(__ec) == file_type::character; } + + bool + is_directory() const + { return _M_file_type() == file_type::directory; } + + bool + is_directory(error_code& __ec) const noexcept + { return _M_file_type(__ec) == file_type::directory; } + + bool + is_fifo() const + { return _M_file_type() == file_type::fifo; } + + bool + is_fifo(error_code& __ec) const noexcept + { return _M_file_type(__ec) == file_type::fifo; } + + bool + is_other() const + { return filesystem::is_other(file_status{_M_file_type()}); } + + bool + is_other(error_code& __ec) const noexcept + { return filesystem::is_other(file_status{_M_file_type(__ec)}); } + + bool + is_regular_file() const + { return _M_file_type() == file_type::regular; } + + bool + is_regular_file(error_code& __ec) const noexcept + { return _M_file_type(__ec) == file_type::regular; } + + bool + is_socket() const + { return _M_file_type() == file_type::socket; } + + bool + is_socket(error_code& __ec) const noexcept + { return _M_file_type(__ec) == file_type::socket; } + + bool + is_symlink() const + { + if (_M_type != file_type::none) + return _M_type == file_type::symlink; + return symlink_status().type() == file_type::symlink; + } + + bool + is_symlink(error_code& __ec) const noexcept + { + if (_M_type != file_type::none) + return _M_type == file_type::symlink; + return symlink_status(__ec).type() == file_type::symlink; + } + + uintmax_t + file_size() const + { return filesystem::file_size(_M_path); } + + uintmax_t + file_size(error_code& __ec) const noexcept + { return filesystem::file_size(_M_path, __ec); } + + uintmax_t + hard_link_count() const + { return filesystem::hard_link_count(_M_path); } + + uintmax_t + hard_link_count(error_code& __ec) const noexcept + { return filesystem::hard_link_count(_M_path, __ec); } + + file_time_type + last_write_time() const + { return filesystem::last_write_time(_M_path); } + + + file_time_type + last_write_time(error_code& __ec) const noexcept + { return filesystem::last_write_time(_M_path, __ec); } + + file_status + status() const + { return filesystem::status(_M_path); } + + file_status + status(error_code& __ec) const noexcept + { return filesystem::status(_M_path, __ec); } + + file_status + symlink_status() const + { return filesystem::symlink_status(_M_path); } + + file_status + symlink_status(error_code& __ec) const noexcept + { return filesystem::symlink_status(_M_path, __ec); } + + bool + operator==(const directory_entry& __rhs) const noexcept + { return _M_path == __rhs._M_path; } + +#if __cpp_lib_three_way_comparison + strong_ordering + operator<=>(const directory_entry& __rhs) const noexcept + { return _M_path <=> __rhs._M_path; } +#else + bool + operator!=(const directory_entry& __rhs) const noexcept + { return _M_path != __rhs._M_path; } + + bool + operator< (const directory_entry& __rhs) const noexcept + { return _M_path < __rhs._M_path; } + + bool + operator<=(const directory_entry& __rhs) const noexcept + { return _M_path <= __rhs._M_path; } + + bool + operator> (const directory_entry& __rhs) const noexcept + { return _M_path > __rhs._M_path; } + + bool + operator>=(const directory_entry& __rhs) const noexcept + { return _M_path >= __rhs._M_path; } +#endif + + private: + friend struct _Dir; + friend class directory_iterator; + friend class recursive_directory_iterator; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3171. LWG 2989 breaks directory_entry stream insertion + template + friend basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, + const directory_entry& __d) + { return __os << __d.path(); } + + directory_entry(const filesystem::path& __p, file_type __t) + : _M_path(__p), _M_type(__t) + { } + + // Equivalent to status().type() but uses cached value, if any. + file_type + _M_file_type() const + { + if (_M_type != file_type::none && _M_type != file_type::symlink) + return _M_type; + return status().type(); + } + + // Equivalent to status(__ec).type() but uses cached value, if any. + file_type + _M_file_type(error_code& __ec) const noexcept + { + if (_M_type != file_type::none && _M_type != file_type::symlink) + { + __ec.clear(); + return _M_type; + } + return status(__ec).type(); + } + + filesystem::path _M_path; + file_type _M_type = file_type::none; + }; + + /// @cond undocumented + + /// Proxy returned by post-increment on directory iterators. + /** + * @headerfile filesystem + * @since C++17 + */ + struct __directory_iterator_proxy + { + const directory_entry& operator*() const& noexcept { return _M_entry; } + + directory_entry operator*() && noexcept { return std::move(_M_entry); } + + private: + friend class directory_iterator; + friend class recursive_directory_iterator; + + explicit + __directory_iterator_proxy(const directory_entry& __e) : _M_entry(__e) { } + + directory_entry _M_entry; + }; + /// @endcond + + /// Iterator type for traversing the entries in a single directory. + /** + * @headerfile filesystem + * @since C++17 + */ + class directory_iterator + { + public: + typedef directory_entry value_type; + typedef ptrdiff_t difference_type; + typedef const directory_entry* pointer; + typedef const directory_entry& reference; + typedef input_iterator_tag iterator_category; + + directory_iterator() = default; + + explicit + directory_iterator(const path& __p) + : directory_iterator(__p, directory_options::none, nullptr) { } + + directory_iterator(const path& __p, directory_options __options) + : directory_iterator(__p, __options, nullptr) { } + + directory_iterator(const path& __p, error_code& __ec) + : directory_iterator(__p, directory_options::none, __ec) { } + + directory_iterator(const path& __p, directory_options __options, + error_code& __ec) + : directory_iterator(__p, __options, &__ec) { } + + directory_iterator(const directory_iterator& __rhs) = default; + + directory_iterator(directory_iterator&& __rhs) noexcept = default; + + ~directory_iterator() = default; + + directory_iterator& + operator=(const directory_iterator& __rhs) = default; + + directory_iterator& + operator=(directory_iterator&& __rhs) noexcept = default; + + const directory_entry& operator*() const noexcept; + const directory_entry* operator->() const noexcept { return &**this; } + directory_iterator& operator++(); + directory_iterator& increment(error_code& __ec); + + __directory_iterator_proxy operator++(int) + { + __directory_iterator_proxy __pr{**this}; + ++*this; + return __pr; + } + + friend bool + operator==(const directory_iterator& __lhs, + const directory_iterator& __rhs) noexcept + { + return !__rhs._M_dir.owner_before(__lhs._M_dir) + && !__lhs._M_dir.owner_before(__rhs._M_dir); + } + +#if __cplusplus >= 202002L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3719. Directory iterators should be usable with default sentinel + bool operator==(default_sentinel_t) const noexcept + { return !_M_dir; } +#endif + +#if __cpp_impl_three_way_comparison < 201907L + friend bool + operator!=(const directory_iterator& __lhs, + const directory_iterator& __rhs) noexcept + { return !(__lhs == __rhs); } +#endif + + private: + directory_iterator(const path&, directory_options, error_code*); + + friend class recursive_directory_iterator; + + std::__shared_ptr<_Dir> _M_dir; + }; + + /** @relates std::filesystem::directory_iterator + * @headerfile filesystem + * @since C++17 + * @{ + */ + + /** @brief Enable range-based `for` using directory_iterator. + * + * e.g. `for (auto& entry : std::filesystem::directory_iterator(".")) ...` + */ + inline directory_iterator + begin(directory_iterator __iter) noexcept + { return __iter; } + + /// Return a past-the-end directory_iterator + inline directory_iterator + end(directory_iterator) noexcept + { return directory_iterator(); } + /// @} + + /// Iterator type for recursively traversing a directory hierarchy. + /** + * @headerfile filesystem + * @since C++17 + */ + class recursive_directory_iterator + { + public: + typedef directory_entry value_type; + typedef ptrdiff_t difference_type; + typedef const directory_entry* pointer; + typedef const directory_entry& reference; + typedef input_iterator_tag iterator_category; + + recursive_directory_iterator() = default; + + explicit + recursive_directory_iterator(const path& __p) + : recursive_directory_iterator(__p, directory_options::none, nullptr) { } + + recursive_directory_iterator(const path& __p, directory_options __options) + : recursive_directory_iterator(__p, __options, nullptr) { } + + recursive_directory_iterator(const path& __p, directory_options __options, + error_code& __ec) + : recursive_directory_iterator(__p, __options, &__ec) { } + + recursive_directory_iterator(const path& __p, error_code& __ec) + : recursive_directory_iterator(__p, directory_options::none, &__ec) { } + + recursive_directory_iterator( + const recursive_directory_iterator&) = default; + + recursive_directory_iterator(recursive_directory_iterator&&) = default; + + ~recursive_directory_iterator(); + + // observers + directory_options options() const noexcept; + int depth() const noexcept; + bool recursion_pending() const noexcept; + + const directory_entry& operator*() const noexcept; + const directory_entry* operator->() const noexcept { return &**this; } + + // modifiers + recursive_directory_iterator& + operator=(const recursive_directory_iterator& __rhs) noexcept; + recursive_directory_iterator& + operator=(recursive_directory_iterator&& __rhs) noexcept; + + recursive_directory_iterator& operator++(); + recursive_directory_iterator& increment(error_code& __ec); + + __directory_iterator_proxy operator++(int) + { + __directory_iterator_proxy __pr{**this}; + ++*this; + return __pr; + } + + void pop(); + void pop(error_code&); + + void disable_recursion_pending() noexcept; + + friend bool + operator==(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) noexcept + { + return !__rhs._M_dirs.owner_before(__lhs._M_dirs) + && !__lhs._M_dirs.owner_before(__rhs._M_dirs); + } + +#if __cplusplus >= 202002L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3719. Directory iterators should be usable with default sentinel + bool operator==(default_sentinel_t) const noexcept + { return !_M_dirs; } +#endif + +#if __cpp_impl_three_way_comparison < 201907L + friend bool + operator!=(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) noexcept + { return !(__lhs == __rhs); } +#endif + + private: + recursive_directory_iterator(const path&, directory_options, error_code*); + + struct _Dir_stack; + std::__shared_ptr<_Dir_stack> _M_dirs; + + recursive_directory_iterator& + __erase(error_code* = nullptr); + + friend uintmax_t + filesystem::remove_all(const path&, error_code&); + friend uintmax_t + filesystem::remove_all(const path&); + }; + + /** @relates std::filesystem::directory_iterator + * @headerfile filesystem + * @since C++17 + * @{ + */ + + /** @brief Enable range-based `for` using recursive_directory_iterator. + * + * e.g. `for (auto& entry : recursive_directory_iterator(".")) ...` + */ + inline recursive_directory_iterator + begin(recursive_directory_iterator __iter) noexcept + { return __iter; } + + /// Return a past-the-end recursive_directory_iterator + inline recursive_directory_iterator + end(recursive_directory_iterator) noexcept + { return recursive_directory_iterator(); } + /// @} + +_GLIBCXX_END_NAMESPACE_CXX11 + + /// @} group filesystem +} // namespace filesystem + + // Use explicit instantiations of these types. Any inconsistency in the + // value of __default_lock_policy between code including this header and + // the library will cause a linker error. + extern template class + __shared_ptr; + extern template class + __shared_ptr; + +#if __glibcxx_ranges // >= C++20 +// _GLIBCXX_RESOLVE_LIB_DEFECTS +// 3480. directory_iterator and recursive_directory_iterator are not ranges +namespace ranges +{ + template<> + inline constexpr bool + enable_borrowed_range = true; + template<> + inline constexpr bool + enable_borrowed_range = true; + + template<> + inline constexpr bool + enable_view = true; + template<> + inline constexpr bool + enable_view = true; +} // namespace ranges +#endif // ranges + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++17 + +#endif // _GLIBCXX_FS_DIR_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_dir.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_dir.h.blob new file mode 100644 index 0000000..7840708 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_dir.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_fwd.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_fwd.h new file mode 100644 index 0000000..649613d --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_fwd.h @@ -0,0 +1,382 @@ +// Filesystem declarations -*- C++ -*- + +// Copyright (C) 2014-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/fs_fwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{filesystem} + */ + +#ifndef _GLIBCXX_FS_FWD_H +#define _GLIBCXX_FS_FWD_H 1 + +#if __cplusplus >= 201703L + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +/// ISO C++ 2017 namespace for File System library +namespace filesystem +{ +#if _GLIBCXX_USE_CXX11_ABI +/// @cond undocumented +inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } +/// @endcond +#endif + +/** @addtogroup filesystem + * @{ + */ + + class file_status; +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + class path; + class filesystem_error; + class directory_entry; + class directory_iterator; + class recursive_directory_iterator; +_GLIBCXX_END_NAMESPACE_CXX11 + + /// Information about free space on a disk + struct space_info + { + uintmax_t capacity; + uintmax_t free; + uintmax_t available; + +#if __cpp_impl_three_way_comparison >= 201907L + friend bool operator==(const space_info&, const space_info&) = default; +#endif + }; + + /// Enumerated type representing the type of a file + enum class file_type : signed char { + none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3, + block = 4, character = 5, fifo = 6, socket = 7, unknown = 8 + }; + + /// Bitmask type controlling effects of `filesystem::copy` + enum class copy_options : unsigned short { + none = 0, + skip_existing = 1, overwrite_existing = 2, update_existing = 4, + recursive = 8, + copy_symlinks = 16, skip_symlinks = 32, + directories_only = 64, create_symlinks = 128, create_hard_links = 256 + }; + + /// @{ + /// @relates copy_options + [[nodiscard]] + constexpr copy_options + operator&(copy_options __x, copy_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr copy_options + operator|(copy_options __x, copy_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr copy_options + operator^(copy_options __x, copy_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr copy_options + operator~(copy_options __x) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline copy_options& + operator&=(copy_options& __x, copy_options __y) noexcept + { return __x = __x & __y; } + + inline copy_options& + operator|=(copy_options& __x, copy_options __y) noexcept + { return __x = __x | __y; } + + inline copy_options& + operator^=(copy_options& __x, copy_options __y) noexcept + { return __x = __x ^ __y; } + /// @} + + + /// Bitmask type representing file access permissions + enum class perms : unsigned { + none = 0, + owner_read = 0400, + owner_write = 0200, + owner_exec = 0100, + owner_all = 0700, + group_read = 040, + group_write = 020, + group_exec = 010, + group_all = 070, + others_read = 04, + others_write = 02, + others_exec = 01, + others_all = 07, + all = 0777, + set_uid = 04000, + set_gid = 02000, + sticky_bit = 01000, + mask = 07777, + unknown = 0xFFFF, + }; + + /// @{ + /// @relates perms + [[nodiscard]] + constexpr perms + operator&(perms __x, perms __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr perms + operator|(perms __x, perms __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr perms + operator^(perms __x, perms __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr perms + operator~(perms __x) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline perms& + operator&=(perms& __x, perms __y) noexcept + { return __x = __x & __y; } + + inline perms& + operator|=(perms& __x, perms __y) noexcept + { return __x = __x | __y; } + + inline perms& + operator^=(perms& __x, perms __y) noexcept + { return __x = __x ^ __y; } + /// @} + + /// Bitmask type controlling changes to permissions + enum class perm_options : unsigned { + replace = 0x1, + add = 0x2, + remove = 0x4, + nofollow = 0x8 + }; + + /// @{ + /// @relates perm_options + [[nodiscard]] + constexpr perm_options + operator&(perm_options __x, perm_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr perm_options + operator|(perm_options __x, perm_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr perm_options + operator^(perm_options __x, perm_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr perm_options + operator~(perm_options __x) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline perm_options& + operator&=(perm_options& __x, perm_options __y) noexcept + { return __x = __x & __y; } + + inline perm_options& + operator|=(perm_options& __x, perm_options __y) noexcept + { return __x = __x | __y; } + + inline perm_options& + operator^=(perm_options& __x, perm_options __y) noexcept + { return __x = __x ^ __y; } + /// @} + + /// Bitmask type controlling directory iteration + enum class directory_options : unsigned char { + none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 + }; + + /// @{ + /// @relates directory_options + [[nodiscard]] + constexpr directory_options + operator&(directory_options __x, directory_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr directory_options + operator|(directory_options __x, directory_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr directory_options + operator^(directory_options __x, directory_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + [[nodiscard]] + constexpr directory_options + operator~(directory_options __x) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline directory_options& + operator&=(directory_options& __x, directory_options __y) noexcept + { return __x = __x & __y; } + + inline directory_options& + operator|=(directory_options& __x, directory_options __y) noexcept + { return __x = __x | __y; } + + inline directory_options& + operator^=(directory_options& __x, directory_options __y) noexcept + { return __x = __x ^ __y; } + /// @} + + /// The type used for file timestamps + using file_time_type = __file_clock::time_point; + + // operational functions + + void copy(const path& __from, const path& __to, copy_options __options); + void copy(const path& __from, const path& __to, copy_options __options, + error_code&); + + bool copy_file(const path& __from, const path& __to, copy_options __option); + bool copy_file(const path& __from, const path& __to, copy_options __option, + error_code&); + + path current_path(); + + bool exists(file_status) noexcept; + + bool is_other(file_status) noexcept; + + uintmax_t file_size(const path&); + uintmax_t file_size(const path&, error_code&) noexcept; + uintmax_t hard_link_count(const path&); + uintmax_t hard_link_count(const path&, error_code&) noexcept; + file_time_type last_write_time(const path&); + file_time_type last_write_time(const path&, error_code&) noexcept; + + void permissions(const path&, perms, perm_options, error_code&) noexcept; + + path proximate(const path& __p, const path& __base, error_code& __ec); + path proximate(const path& __p, const path& __base, error_code& __ec); + + path relative(const path& __p, const path& __base, error_code& __ec); + + file_status status(const path&); + file_status status(const path&, error_code&) noexcept; + + bool status_known(file_status) noexcept; + + file_status symlink_status(const path&); + file_status symlink_status(const path&, error_code&) noexcept; + + bool is_regular_file(file_status) noexcept; + bool is_symlink(file_status) noexcept; + + bool remove(const path&, error_code&) noexcept; + uintmax_t remove_all(const path&); + uintmax_t remove_all(const path&, error_code&); + +/// @} +} // namespace filesystem +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 +#endif // _GLIBCXX_FS_FWD_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_fwd.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_fwd.h.blob new file mode 100644 index 0000000..83254db Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_fwd.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_ops.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_ops.h new file mode 100644 index 0000000..3f47dd6 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_ops.h @@ -0,0 +1,392 @@ +// Filesystem operational functions -*- C++ -*- + +// Copyright (C) 2014-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your __option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/fs_ops.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{filesystem} + */ + +#ifndef _GLIBCXX_FS_OPS_H +#define _GLIBCXX_FS_OPS_H 1 + +#if __cplusplus >= 201703L + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +namespace filesystem +{ + /** @addtogroup filesystem + * @{ + */ + + [[nodiscard]] + path absolute(const path& __p); + + [[nodiscard]] + path absolute(const path& __p, error_code& __ec); + + [[nodiscard]] + path canonical(const path& __p); + + [[nodiscard]] + path canonical(const path& __p, error_code& __ec); + + inline void + copy(const path& __from, const path& __to) + { copy(__from, __to, copy_options::none); } + + inline void + copy(const path& __from, const path& __to, error_code& __ec) + { copy(__from, __to, copy_options::none, __ec); } + + void copy(const path& __from, const path& __to, copy_options __options); + void copy(const path& __from, const path& __to, copy_options __options, + error_code& __ec); + + inline bool + copy_file(const path& __from, const path& __to) + { return copy_file(__from, __to, copy_options::none); } + + inline bool + copy_file(const path& __from, const path& __to, error_code& __ec) + { return copy_file(__from, __to, copy_options::none, __ec); } + + bool copy_file(const path& __from, const path& __to, copy_options __option); + bool copy_file(const path& __from, const path& __to, copy_options __option, + error_code& __ec); + + void copy_symlink(const path& __existing_symlink, const path& __new_symlink); + void copy_symlink(const path& __existing_symlink, const path& __new_symlink, + error_code& __ec) noexcept; + + bool create_directories(const path& __p); + bool create_directories(const path& __p, error_code& __ec); + + bool create_directory(const path& __p); + bool create_directory(const path& __p, error_code& __ec) noexcept; + + bool create_directory(const path& __p, const path& __attributes); + bool create_directory(const path& __p, const path& __attributes, + error_code& __ec) noexcept; + + void create_directory_symlink(const path& __to, const path& __new_symlink); + void create_directory_symlink(const path& __to, const path& __new_symlink, + error_code& __ec) noexcept; + + void create_hard_link(const path& __to, const path& __new_hard_link); + void create_hard_link(const path& __to, const path& __new_hard_link, + error_code& __ec) noexcept; + + void create_symlink(const path& __to, const path& __new_symlink); + void create_symlink(const path& __to, const path& __new_symlink, + error_code& __ec) noexcept; + + [[nodiscard]] + path current_path(); + + [[nodiscard]] + path current_path(error_code& __ec); + + void current_path(const path& __p); + void current_path(const path& __p, error_code& __ec) noexcept; + + [[nodiscard]] + bool + equivalent(const path& __p1, const path& __p2); + + [[nodiscard]] + bool + equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept; + + [[nodiscard]] + inline bool + exists(file_status __s) noexcept + { return status_known(__s) && __s.type() != file_type::not_found; } + + [[nodiscard]] + inline bool + exists(const path& __p) + { return exists(status(__p)); } + + [[nodiscard]] + inline bool + exists(const path& __p, error_code& __ec) noexcept + { + auto __s = status(__p, __ec); + if (status_known(__s)) + { + __ec.clear(); + return __s.type() != file_type::not_found; + } + return false; + } + + [[nodiscard]] + uintmax_t file_size(const path& __p); + + [[nodiscard]] + uintmax_t file_size(const path& __p, error_code& __ec) noexcept; + + [[nodiscard]] + uintmax_t hard_link_count(const path& __p); + + [[nodiscard]] + uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept; + + [[nodiscard]] + inline bool + is_block_file(file_status __s) noexcept + { return __s.type() == file_type::block; } + + [[nodiscard]] + inline bool + is_block_file(const path& __p) + { return is_block_file(status(__p)); } + + [[nodiscard]] + inline bool + is_block_file(const path& __p, error_code& __ec) noexcept + { return is_block_file(status(__p, __ec)); } + + [[nodiscard]] + inline bool + is_character_file(file_status __s) noexcept + { return __s.type() == file_type::character; } + + [[nodiscard]] + inline bool + is_character_file(const path& __p) + { return is_character_file(status(__p)); } + + [[nodiscard]] + inline bool + is_character_file(const path& __p, error_code& __ec) noexcept + { return is_character_file(status(__p, __ec)); } + + [[nodiscard]] + inline bool + is_directory(file_status __s) noexcept + { return __s.type() == file_type::directory; } + + [[nodiscard]] + inline bool + is_directory(const path& __p) + { return is_directory(status(__p)); } + + [[nodiscard]] + inline bool + is_directory(const path& __p, error_code& __ec) noexcept + { return is_directory(status(__p, __ec)); } + + [[nodiscard]] + bool is_empty(const path& __p); + + [[nodiscard]] + bool is_empty(const path& __p, error_code& __ec); + + [[nodiscard]] + inline bool + is_fifo(file_status __s) noexcept + { return __s.type() == file_type::fifo; } + + [[nodiscard]] + inline bool + is_fifo(const path& __p) + { return is_fifo(status(__p)); } + + [[nodiscard]] + inline bool + is_fifo(const path& __p, error_code& __ec) noexcept + { return is_fifo(status(__p, __ec)); } + + [[nodiscard]] + inline bool + is_other(file_status __s) noexcept + { + return exists(__s) && !is_regular_file(__s) && !is_directory(__s) + && !is_symlink(__s); + } + + [[nodiscard]] + inline bool + is_other(const path& __p) + { return is_other(status(__p)); } + + [[nodiscard]] + inline bool + is_other(const path& __p, error_code& __ec) noexcept + { return is_other(status(__p, __ec)); } + + [[nodiscard]] + inline bool + is_regular_file(file_status __s) noexcept + { return __s.type() == file_type::regular; } + + [[nodiscard]] + inline bool + is_regular_file(const path& __p) + { return is_regular_file(status(__p)); } + + [[nodiscard]] + inline bool + is_regular_file(const path& __p, error_code& __ec) noexcept + { return is_regular_file(status(__p, __ec)); } + + [[nodiscard]] + inline bool + is_socket(file_status __s) noexcept + { return __s.type() == file_type::socket; } + + [[nodiscard]] + inline bool + is_socket(const path& __p) + { return is_socket(status(__p)); } + + [[nodiscard]] + inline bool + is_socket(const path& __p, error_code& __ec) noexcept + { return is_socket(status(__p, __ec)); } + + [[nodiscard]] + inline bool + is_symlink(file_status __s) noexcept + { return __s.type() == file_type::symlink; } + + [[nodiscard]] + inline bool + is_symlink(const path& __p) + { return is_symlink(symlink_status(__p)); } + + [[nodiscard]] + inline bool + is_symlink(const path& __p, error_code& __ec) noexcept + { return is_symlink(symlink_status(__p, __ec)); } + + [[nodiscard]] + file_time_type last_write_time(const path& __p); + + [[nodiscard]] + file_time_type last_write_time(const path& __p, error_code& __ec) noexcept; + + void last_write_time(const path& __p, file_time_type __new_time); + void last_write_time(const path& __p, file_time_type __new_time, + error_code& __ec) noexcept; + + void + permissions(const path& __p, perms __prms, + perm_options __opts = perm_options::replace); + + inline void + permissions(const path& __p, perms __prms, error_code& __ec) noexcept + { permissions(__p, __prms, perm_options::replace, __ec); } + + void + permissions(const path& __p, perms __prms, perm_options __opts, + error_code& __ec) noexcept; + + [[nodiscard]] + inline path proximate(const path& __p, error_code& __ec) + { return proximate(__p, current_path(), __ec); } + + [[nodiscard]] + path proximate(const path& __p, const path& __base = current_path()); + + [[nodiscard]] + path proximate(const path& __p, const path& __base, error_code& __ec); + + [[nodiscard]] + path read_symlink(const path& __p); + + [[nodiscard]] + path read_symlink(const path& __p, error_code& __ec); + + [[nodiscard]] + inline path relative(const path& __p, error_code& __ec) + { return relative(__p, current_path(), __ec); } + + [[nodiscard]] + path relative(const path& __p, const path& __base = current_path()); + + [[nodiscard]] + path relative(const path& __p, const path& __base, error_code& __ec); + + bool remove(const path& __p); + bool remove(const path& __p, error_code& __ec) noexcept; + + uintmax_t remove_all(const path& __p); + uintmax_t remove_all(const path& __p, error_code& __ec); + + void rename(const path& __from, const path& __to); + void rename(const path& __from, const path& __to, error_code& __ec) noexcept; + + void resize_file(const path& __p, uintmax_t __size); + void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept; + + [[nodiscard]] + space_info space(const path& __p); + + [[nodiscard]] + space_info space(const path& __p, error_code& __ec) noexcept; + + [[nodiscard]] + file_status status(const path& __p); + + [[nodiscard]] + file_status status(const path& __p, error_code& __ec) noexcept; + + [[nodiscard]] + inline bool status_known(file_status __s) noexcept + { return __s.type() != file_type::none; } + + [[nodiscard]] + file_status symlink_status(const path& __p); + + [[nodiscard]] + file_status symlink_status(const path& __p, error_code& __ec) noexcept; + + [[nodiscard]] + path temp_directory_path(); + + [[nodiscard]] + path temp_directory_path(error_code& __ec); + + [[nodiscard]] + path weakly_canonical(const path& __p); + + [[nodiscard]] + path weakly_canonical(const path& __p, error_code& __ec); + + /// @} group filesystem +} // namespace filesystem + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++17 + +#endif // _GLIBCXX_FS_OPS_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_ops.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_ops.h.blob new file mode 100644 index 0000000..48c3042 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_ops.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_path.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_path.h new file mode 100644 index 0000000..ccf1d70 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_path.h @@ -0,0 +1,1459 @@ +// Class filesystem::path -*- C++ -*- + +// Copyright (C) 2014-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/fs_path.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{filesystem} + */ + +#ifndef _GLIBCXX_FS_PATH_H +#define _GLIBCXX_FS_PATH_H 1 + +#if __cplusplus >= 201703L + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if __cplusplus > 201703L +# include +#endif + +#if defined(_WIN32) && !defined(__CYGWIN__) +# define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1 +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +namespace filesystem +{ +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + class path; + + /// @cond undocumented +namespace __detail +{ + /// @addtogroup filesystem + /// @{ + template + inline constexpr bool __is_encoded_char = false; + template<> + inline constexpr bool __is_encoded_char = true; +#ifdef _GLIBCXX_USE_CHAR8_T + template<> + inline constexpr bool __is_encoded_char = true; +#endif +#if _GLIBCXX_USE_WCHAR_T + template<> + inline constexpr bool __is_encoded_char = true; +#endif + template<> + inline constexpr bool __is_encoded_char = true; + template<> + inline constexpr bool __is_encoded_char = true; + +#if __cpp_concepts >= 201907L + template + using __safe_iterator_traits = std::iterator_traits<_Iter>; +#else + template + struct __safe_iterator_traits : std::iterator_traits<_Iter> + { }; + + // Protect against ill-formed iterator_traits specializations in C++17 + template<> struct __safe_iterator_traits { }; + template<> struct __safe_iterator_traits { }; + template<> struct __safe_iterator_traits { }; + template<> struct __safe_iterator_traits { }; +#endif + + template + inline constexpr bool __is_path_iter_src = false; + + template + inline constexpr bool + __is_path_iter_src<_Iter_traits, void_t> + = __is_encoded_char; + + template + inline constexpr bool __is_path_src + = __is_path_iter_src>>; + + template<> + inline constexpr bool __is_path_src = false; + + template<> + inline constexpr bool __is_path_src = false; + + template<> + inline constexpr bool __is_path_src = false; + + template<> + inline constexpr bool __is_path_src = false; + + template<> + inline constexpr bool __is_path_src = false; + + template<> + inline constexpr bool __is_path_src = false; + + template + inline constexpr bool + __is_path_src> + = __is_encoded_char<_CharT>; + + template + inline constexpr bool + __is_path_src> + = __is_encoded_char<_CharT>; + + // SFINAE constraint for Source parameters as required by [fs.path.req]. + template + using _Path = enable_if_t<__is_path_src<_Tp>, path>; + + // SFINAE constraint for InputIterator parameters as required by [fs.req]. + template> + using _Path2 = enable_if_t<__is_path_iter_src<_Tr>, path>; + +#if __cpp_lib_concepts + template + constexpr bool __is_contiguous = std::contiguous_iterator<_Iter>; +#else + template + constexpr bool __is_contiguous = false; +#endif + + template + constexpr bool __is_contiguous<_Tp*> = true; + + template + constexpr bool + __is_contiguous<__gnu_cxx::__normal_iterator<_Tp*, _Seq>> = true; + +#if !defined _GLIBCXX_FILESYSTEM_IS_WINDOWS && defined _GLIBCXX_USE_CHAR8_T + // For POSIX treat char8_t sequences as char without encoding conversions. + template + using __unified_u8_t + = __conditional_t, char, _EcharT>; +#else + template + using __unified_u8_t = _EcharT; +#endif + + // The __effective_range overloads convert a Source parameter into + // either a basic_string_view or basic_string containing the + // effective range of the Source, as defined in [fs.path.req]. + + template + inline basic_string_view<_CharT> + __effective_range(const basic_string<_CharT, _Traits, _Alloc>& __source) + noexcept + { return __source; } + + template + inline basic_string_view<_CharT> + __effective_range(const basic_string_view<_CharT, _Traits>& __source) + noexcept + { return __source; } + + // Return the effective range of an NTCTS. + template + auto + __effective_range(const _Source& __source) + { + // Remove a level of normal/safe iterator indirection, or decay an array. + using _Iter = decltype(std::__niter_base(__source)); + using value_type = typename iterator_traits<_Iter>::value_type; + + if constexpr (__is_contiguous<_Iter>) + return basic_string_view{&*__source}; + else + { + // _Source is an input iterator that iterates over an NTCTS. + // Create a basic_string by reading until the null character. + basic_string<__unified_u8_t> __str; + _Source __it = __source; + for (value_type __ch = *__it; __ch != value_type(); __ch = *++__it) + __str.push_back(__ch); + return __str; + } + } + + // The value type of a Source parameter's effective range. + template + struct __source_value_type_impl + { + using type + = typename __safe_iterator_traits>::value_type; + }; + + template + struct __source_value_type_impl> + { + using type = _CharT; + }; + + template + struct __source_value_type_impl> + { + using type = _CharT; + }; + + // The value type of a Source parameter's effective range. + template + using __source_value_t = typename __source_value_type_impl<_Source>::type; + + // SFINAE helper to check that an effective range has value_type char, + // as required by path constructors taking a std::locale parameter. + // The type _Tp must have already been checked by _Path or _Path2<_Tp>. + template> + using __value_type_is_char + = std::enable_if_t, _Val>; + + // As above, but also allows char8_t, as required by u8path + // C++20 [depr.fs.path.factory] + template> + using __value_type_is_char_or_char8_t + = std::enable_if_t +#ifdef _GLIBCXX_USE_CHAR8_T + || std::is_same_v<_Val, char8_t> +#endif + , _Val>; + + // Create a basic_string or basic_string_view from an iterator range. + template + inline auto + __string_from_range(_InputIterator __first, _InputIterator __last) + { + using _EcharT + = typename std::iterator_traits<_InputIterator>::value_type; + static_assert(__is_encoded_char<_EcharT>); // C++17 [fs.req]/3 + + if constexpr (__is_contiguous<_InputIterator>) + { + // For contiguous iterators we can just return a string view. + if (auto __len = __last - __first) [[__likely__]] + return basic_string_view<_EcharT>(&*__first, __len); + return basic_string_view<_EcharT>(); + } + else + { + // Conversion requires contiguous characters, so create a string. + return basic_string<__unified_u8_t<_EcharT>>(__first, __last); + } + } + + /// @} group filesystem +} // namespace __detail + /// @endcond + + /// @addtogroup filesystem + /// @{ + + /// A filesystem path + /** + * @ingroup filesystem + * @headerfile filesystem + * @since C++17 + */ + class path + { + public: +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + using value_type = wchar_t; + static constexpr value_type preferred_separator = L'\\'; +#else +# ifdef _GLIBCXX_DOXYGEN + /// Windows uses wchar_t for path::value_type, POSIX uses char. + using value_type = __os_dependent__; +# else + using value_type = char; +# endif + static constexpr value_type preferred_separator = '/'; +#endif + using string_type = std::basic_string; + + /// path::format is ignored in this implementation + enum format : unsigned char { native_format, generic_format, auto_format }; + + // constructors and destructor + + path() noexcept { } + + path(const path& __p) = default; + + path(path&& __p) noexcept + : _M_pathname(std::move(__p._M_pathname)), + _M_cmpts(std::move(__p._M_cmpts)) + { __p.clear(); } + + path(string_type&& __source, format = auto_format) + : _M_pathname(std::move(__source)) + { _M_split_cmpts(); } + + template> + path(_Source const& __source, format = auto_format) + : _M_pathname(_S_convert(__detail::__effective_range(__source))) + { _M_split_cmpts(); } + + template> + path(_InputIterator __first, _InputIterator __last, format = auto_format) + : _M_pathname(_S_convert(__detail::__string_from_range(__first, __last))) + { _M_split_cmpts(); } + + template, + typename _Require2 = __detail::__value_type_is_char<_Source>> + path(_Source const& __src, const locale& __loc, format = auto_format) + : _M_pathname(_S_convert_loc(__detail::__effective_range(__src), __loc)) + { _M_split_cmpts(); } + + template, + typename _Req2 = __detail::__value_type_is_char<_InputIterator>> + path(_InputIterator __first, _InputIterator __last, const locale& __loc, + format = auto_format) + : _M_pathname(_S_convert_loc(__first, __last, __loc)) + { _M_split_cmpts(); } + + ~path() = default; + + // assignments + + path& operator=(const path&); + path& operator=(path&&) noexcept; + path& operator=(string_type&& __source); + path& assign(string_type&& __source); + + template + __detail::_Path<_Source>& + operator=(_Source const& __source) + { return *this = path(__source); } + + template + __detail::_Path<_Source>& + assign(_Source const& __source) + { return *this = path(__source); } + + template + __detail::_Path2<_InputIterator>& + assign(_InputIterator __first, _InputIterator __last) + { return *this = path(__first, __last); } + + // appends + + path& operator/=(const path& __p); + + template + __detail::_Path<_Source>& + operator/=(_Source const& __source) + { + _M_append(_S_convert(__detail::__effective_range(__source))); + return *this; + } + + template + __detail::_Path<_Source>& + append(_Source const& __source) + { + _M_append(_S_convert(__detail::__effective_range(__source))); + return *this; + } + + template + __detail::_Path2<_InputIterator>& + append(_InputIterator __first, _InputIterator __last) + { + _M_append(_S_convert(__detail::__string_from_range(__first, __last))); + return *this; + } + + // concatenation + + path& operator+=(const path& __x); + path& operator+=(const string_type& __x); + path& operator+=(const value_type* __x); + path& operator+=(value_type __x); + path& operator+=(basic_string_view __x); + + template + __detail::_Path<_Source>& + operator+=(_Source const& __x) { return concat(__x); } + + template + __detail::_Path2<_CharT*>& + operator+=(_CharT __x); + + template + __detail::_Path<_Source>& + concat(_Source const& __x) + { + _M_concat(_S_convert(__detail::__effective_range(__x))); + return *this; + } + + template + __detail::_Path2<_InputIterator>& + concat(_InputIterator __first, _InputIterator __last) + { + _M_concat(_S_convert(__detail::__string_from_range(__first, __last))); + return *this; + } + + // modifiers + + void clear() noexcept { _M_pathname.clear(); _M_split_cmpts(); } + + path& make_preferred(); + path& remove_filename(); + path& replace_filename(const path& __replacement); + path& replace_extension(const path& __replacement = path()); + + void swap(path& __rhs) noexcept; + + // native format observers + + const string_type& native() const noexcept { return _M_pathname; } + const value_type* c_str() const noexcept { return _M_pathname.c_str(); } + operator string_type() const { return _M_pathname; } + + template, + typename _Allocator = std::allocator<_CharT>> + std::basic_string<_CharT, _Traits, _Allocator> + string(const _Allocator& __a = _Allocator()) const; + + std::string string() const; +#if _GLIBCXX_USE_WCHAR_T + std::wstring wstring() const; +#endif +#ifdef _GLIBCXX_USE_CHAR8_T + __attribute__((__abi_tag__("__u8"))) + std::u8string u8string() const; +#else + std::string u8string() const; +#endif // _GLIBCXX_USE_CHAR8_T + std::u16string u16string() const; + std::u32string u32string() const; + + // generic format observers + template, + typename _Allocator = std::allocator<_CharT>> + std::basic_string<_CharT, _Traits, _Allocator> + generic_string(const _Allocator& __a = _Allocator()) const; + + std::string generic_string() const; +#if _GLIBCXX_USE_WCHAR_T + std::wstring generic_wstring() const; +#endif +#ifdef _GLIBCXX_USE_CHAR8_T + __attribute__((__abi_tag__("__u8"))) + std::u8string generic_u8string() const; +#else + std::string generic_u8string() const; +#endif // _GLIBCXX_USE_CHAR8_T + std::u16string generic_u16string() const; + std::u32string generic_u32string() const; + + // compare + + int compare(const path& __p) const noexcept; + int compare(const string_type& __s) const noexcept; + int compare(const value_type* __s) const noexcept; + int compare(basic_string_view __s) const noexcept; + + // decomposition + + path root_name() const; + path root_directory() const; + path root_path() const; + path relative_path() const; + path parent_path() const; + path filename() const; + path stem() const; + path extension() const; + + // query + + [[nodiscard]] bool empty() const noexcept { return _M_pathname.empty(); } + bool has_root_name() const noexcept; + bool has_root_directory() const noexcept; + bool has_root_path() const noexcept; + bool has_relative_path() const noexcept; + bool has_parent_path() const noexcept; + bool has_filename() const noexcept; + bool has_stem() const noexcept; + bool has_extension() const noexcept; + bool is_absolute() const noexcept; + bool is_relative() const noexcept { return !is_absolute(); } + + // generation + path lexically_normal() const; + path lexically_relative(const path& base) const; + path lexically_proximate(const path& base) const; + + // iterators + class iterator; + using const_iterator = iterator; + + iterator begin() const noexcept; + iterator end() const noexcept; + + /// Write a path to a stream + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, const path& __p) + { + __os << std::quoted(__p.string<_CharT, _Traits>()); + return __os; + } + + /// Read a path from a stream + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, path& __p) + { + std::basic_string<_CharT, _Traits> __tmp; + if (__is >> std::quoted(__tmp)) + __p = std::move(__tmp); + return __is; + } + + // non-member operators + + /// Compare paths + friend bool operator==(const path& __lhs, const path& __rhs) noexcept + { return path::_S_compare(__lhs, __rhs) == 0; } + +#if __cpp_lib_three_way_comparison + /// Compare paths + friend strong_ordering + operator<=>(const path& __lhs, const path& __rhs) noexcept + { return path::_S_compare(__lhs, __rhs) <=> 0; } +#else + /// Compare paths + friend bool operator!=(const path& __lhs, const path& __rhs) noexcept + { return !(__lhs == __rhs); } + + /// Compare paths + friend bool operator<(const path& __lhs, const path& __rhs) noexcept + { return __lhs.compare(__rhs) < 0; } + + /// Compare paths + friend bool operator<=(const path& __lhs, const path& __rhs) noexcept + { return !(__rhs < __lhs); } + + /// Compare paths + friend bool operator>(const path& __lhs, const path& __rhs) noexcept + { return __rhs < __lhs; } + + /// Compare paths + friend bool operator>=(const path& __lhs, const path& __rhs) noexcept + { return !(__lhs < __rhs); } +#endif + + /// Append one path to another + friend path operator/(const path& __lhs, const path& __rhs) + { + path __result(__lhs); + __result /= __rhs; + return __result; + } + + private: + enum class _Type : unsigned char { + _Multi = 0, _Root_name, _Root_dir, _Filename + }; + + path(basic_string_view __str, _Type __type); + + enum class _Split { _Stem, _Extension }; + + void _M_append(basic_string_view); + void _M_concat(basic_string_view); + + pair _M_find_extension() const noexcept; + + // path::_S_convert creates a basic_string or + // basic_string_view from a basic_string or + // basic_string_view, for an encoded character type C, + // performing the conversions required by [fs.path.type.cvt]. + template + static auto + _S_convert(_Tp __str) + noexcept(is_same_v) + { + if constexpr (is_same_v) + return __str; // No conversion needed. +#if !defined _GLIBCXX_FILESYSTEM_IS_WINDOWS && defined _GLIBCXX_USE_CHAR8_T + else if constexpr (is_same_v<_Tp, std::u8string>) + // Calling _S_convert will return a u8string_view that + // refers to __str and would dangle after this function returns. + // Return a string_type instead, to avoid dangling. + return string_type(_S_convert(__str.data(), + __str.data() + __str.size())); +#endif + else + return _S_convert(__str.data(), __str.data() + __str.size()); + } + + template + static auto + _S_convert(const _EcharT* __first, const _EcharT* __last); + + // _S_convert_loc converts a range of char to string_type, using the + // supplied locale for encoding conversions. + + static string_type + _S_convert_loc(const char* __first, const char* __last, + const std::locale& __loc); + + template + static string_type + _S_convert_loc(_Iter __first, _Iter __last, const std::locale& __loc) + { + const auto __s = __detail::__string_from_range(__first, __last); + return _S_convert_loc(__s.data(), __s.data() + __s.size(), __loc); + } + + template + static string_type + _S_convert_loc(const _Tp& __s, const std::locale& __loc) + { + return _S_convert_loc(__s.data(), __s.data() + __s.size(), __loc); + } + + template + static basic_string<_CharT, _Traits, _Allocator> + _S_str_convert(basic_string_view, const _Allocator&); + + // Returns lhs.compare(rhs), but defined after path::iterator is complete. + __attribute__((__always_inline__)) + static int + _S_compare(const path& __lhs, const path& __rhs) noexcept; + + void _M_split_cmpts(); + + _Type _M_type() const noexcept { return _M_cmpts.type(); } + + string_type _M_pathname; + + struct _Cmpt; + + struct _List + { + using value_type = _Cmpt; + using iterator = value_type*; + using const_iterator = const value_type*; + + _List(); + _List(const _List&); + _List(_List&&) = default; + _List& operator=(const _List&); + _List& operator=(_List&&) = default; + ~_List() = default; + + _Type type() const noexcept + { return _Type(reinterpret_cast<__UINTPTR_TYPE__>(_M_impl.get()) & 0x3); } + + void type(_Type) noexcept; + + int size() const noexcept; // zero unless type() == _Type::_Multi + bool empty() const noexcept; // true unless type() == _Type::_Multi + void clear(); + void swap(_List& __l) noexcept { _M_impl.swap(__l._M_impl); } + int capacity() const noexcept; + void reserve(int, bool); ///< @pre type() == _Type::_Multi + + // All the member functions below here have a precondition !empty() + // (and they should only be called from within the library). + + iterator begin() noexcept; + iterator end() noexcept; + const_iterator begin() const noexcept; + const_iterator end() const noexcept; + + value_type& front() noexcept; + value_type& back() noexcept; + const value_type& front() const noexcept; + const value_type& back() const noexcept; + + void pop_back(); + void _M_erase_from(const_iterator __pos); // erases [__pos,end()) + + struct _Impl; + struct _Impl_deleter + { + void operator()(_Impl*) const noexcept; + }; + unique_ptr<_Impl, _Impl_deleter> _M_impl; + }; + _List _M_cmpts; + + struct _Parser; + + template struct _Codecvt; + }; + + /// @{ + /// @relates std::filesystem::path + + inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); } + + size_t hash_value(const path& __p) noexcept; + + /// @} + + /// Exception type thrown by the Filesystem library + /** + * @headerfile filesystem + * @since C++17 + */ + class filesystem_error : public std::system_error + { + public: + filesystem_error(const string& __what_arg, error_code __ec); + + filesystem_error(const string& __what_arg, const path& __p1, + error_code __ec); + + filesystem_error(const string& __what_arg, const path& __p1, + const path& __p2, error_code __ec); + + filesystem_error(const filesystem_error&) = default; + filesystem_error& operator=(const filesystem_error&) = default; + + // No move constructor or assignment operator. + // Copy rvalues instead, so that _M_impl is not left empty. + + ~filesystem_error(); + + const path& path1() const noexcept; + const path& path2() const noexcept; + const char* what() const noexcept; + + private: + struct _Impl; + std::__shared_ptr _M_impl; + }; + + /// @cond undocumented +namespace __detail +{ + [[noreturn]] inline void + __throw_conversion_error() + { + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); + } + +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + template + inline std::wstring + __wstr_from_utf8(const _Tp& __str) + { + static_assert(std::is_same_v); + std::wstring __wstr; + // XXX This assumes native wide encoding is UTF-16. + std::codecvt_utf8_utf16 __wcvt; + const auto __p = __str.data(); + if (!__str_codecvt_in_all(__p, __p + __str.size(), __wstr, __wcvt)) + __detail::__throw_conversion_error(); + return __wstr; + } +#endif + +} // namespace __detail + /// @endcond + + + /** Create a path from a UTF-8-encoded sequence of char + * + * @relates std::filesystem::path + * @headerfile filesystem + * @since C++17 + */ + template, + typename _CharT + = __detail::__value_type_is_char_or_char8_t<_InputIterator>> + _GLIBCXX20_DEPRECATED_SUGGEST("path(u8string(first, last))") + inline path + u8path(_InputIterator __first, _InputIterator __last) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + if constexpr (is_same_v<_CharT, char>) + return path{ __detail::__wstr_from_utf8( + __detail::__string_from_range(__first, __last)) }; + else + return path{ __first, __last }; // constructor handles char8_t +#else + // This assumes native normal encoding is UTF-8. + return path{ __first, __last }; +#endif + } + + /** Create a path from a UTF-8-encoded sequence of char + * + * @relates std::filesystem::path + * @headerfile filesystem + * @since C++17 + */ + template, + typename _CharT = __detail::__value_type_is_char_or_char8_t<_Source>> + _GLIBCXX20_DEPRECATED_SUGGEST("path((const char8_t*)&*source)") + inline path + u8path(const _Source& __source) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + if constexpr (is_same_v<_CharT, char>) + return path{ __detail::__wstr_from_utf8( + __detail::__effective_range(__source)) }; + else + return path{ __source }; // constructor handles char8_t +#else + // This assumes native normal encoding is UTF-8. + return path{ __source }; +#endif + } + + /// @cond undocumented + + struct path::_Cmpt : path + { + _Cmpt(basic_string_view __s, _Type __t, size_t __pos); + + _Cmpt() : _M_pos(-1) { } + + size_t _M_pos; + }; + + // path::_Codecvt Performs conversions between C and path::string_type. + // The native encoding of char strings is the OS-dependent current + // encoding for pathnames. FIXME: We assume this is UTF-8 everywhere, + // but should use a Windows API to query it. + + // Converts between native pathname encoding and char16_t or char32_t. + template + struct path::_Codecvt + // Need derived class here because std::codecvt has protected destructor. + : std::codecvt<_EcharT, char, mbstate_t> + { }; + + // Converts between native pathname encoding and native wide encoding. + // The native encoding for wide strings is the execution wide-character + // set encoding. FIXME: We assume that this is either UTF-32 or UTF-16 + // (depending on the width of wchar_t). That matches GCC's default, + // but can be changed with -fwide-exec-charset. + // We need a custom codecvt converting the native pathname encoding + // to/from the native wide encoding. + template<> + struct path::_Codecvt + : __conditional_t, // UTF-8 <-> UTF-32 + std::codecvt_utf8_utf16> // UTF-8 <-> UTF-16 + { }; + + template + auto + path::_S_convert(const _EcharT* __f, const _EcharT* __l) + { + static_assert(__detail::__is_encoded_char<_EcharT>); + +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS +# define _GLIBCXX_CONV_FROM_UTF8(S) __detail::__wstr_from_utf8(S) +#else +# define _GLIBCXX_CONV_FROM_UTF8(S) S +#endif + + if constexpr (is_same_v<_EcharT, value_type>) + return basic_string_view(__f, __l - __f); +#ifdef _GLIBCXX_USE_CHAR8_T + else if constexpr (is_same_v<_EcharT, char8_t>) + { + string_view __str(reinterpret_cast(__f), __l - __f); + return _GLIBCXX_CONV_FROM_UTF8(__str); + } +#endif +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + else if constexpr (is_same_v<_EcharT, char>) + { + std::wstring __wstr; + path::_Codecvt __cvt; + if (__str_codecvt_in_all(__f, __l, __wstr, __cvt)) + return __wstr; + } +#endif + else + { + path::_Codecvt<_EcharT> __cvt; + std::string __str; + if (__str_codecvt_out_all(__f, __l, __str, __cvt)) + return _GLIBCXX_CONV_FROM_UTF8(__str); + } + __detail::__throw_conversion_error(); + } +#undef _GLIBCXX_CONV_FROM_UTF8 + + /// @endcond + + /// An iterator for the components of a path + /** + * @headerfile filesystem + * @since C++17 + */ + class path::iterator + { + public: + using difference_type = std::ptrdiff_t; + using value_type = path; + using reference = const path&; + using pointer = const path*; + using iterator_category = std::bidirectional_iterator_tag; + + iterator() noexcept : _M_path(nullptr), _M_cur(), _M_at_end() { } + + iterator(const iterator&) = default; + iterator& operator=(const iterator&) = default; + + reference operator*() const noexcept; + pointer operator->() const noexcept { return std::__addressof(**this); } + + iterator& operator++() noexcept; + + iterator operator++(int) noexcept + { auto __tmp = *this; ++*this; return __tmp; } + + iterator& operator--() noexcept; + + iterator operator--(int) noexcept + { auto __tmp = *this; --*this; return __tmp; } + + friend bool + operator==(const iterator& __lhs, const iterator& __rhs) noexcept + { return __lhs._M_equals(__rhs); } + + friend bool + operator!=(const iterator& __lhs, const iterator& __rhs) noexcept + { return !__lhs._M_equals(__rhs); } + + private: + friend class path; + + bool + _M_is_multi() const noexcept + { return _M_path->_M_type() == _Type::_Multi; } + + friend difference_type + __path_iter_distance(const iterator& __first, const iterator& __last) + noexcept + { + __glibcxx_assert(__first._M_path != nullptr); + __glibcxx_assert(__first._M_path == __last._M_path); + if (__first._M_is_multi()) + return std::distance(__first._M_cur, __last._M_cur); + else if (__first._M_at_end == __last._M_at_end) + return 0; + else + return __first._M_at_end ? -1 : 1; + } + + friend void + __path_iter_advance(iterator& __i, difference_type __n) noexcept + { + if (__n == 1) + ++__i; + else if (__n == -1) + --__i; + else if (__n != 0) + { + __glibcxx_assert(__i._M_path != nullptr); + __glibcxx_assert(__i._M_is_multi()); + // __glibcxx_assert(__i._M_path->_M_cmpts.end() - __i._M_cur >= __n); + __i._M_cur += __n; + } + } + + iterator(const path* __path, path::_List::const_iterator __iter) noexcept + : _M_path(__path), _M_cur(__iter), _M_at_end() + { } + + iterator(const path* __path, bool __at_end) noexcept + : _M_path(__path), _M_cur(), _M_at_end(__at_end) + { } + + bool _M_equals(iterator) const noexcept; + + const path* _M_path; + path::_List::const_iterator _M_cur; + bool _M_at_end; // only used when type != _Multi + }; + + + inline path& + path::operator=(path&& __p) noexcept + { + if (&__p == this) [[__unlikely__]] + return *this; + + _M_pathname = std::move(__p._M_pathname); + _M_cmpts = std::move(__p._M_cmpts); + __p.clear(); + return *this; + } + + inline path& + path::operator=(string_type&& __source) + { return *this = path(std::move(__source)); } + + inline path& + path::assign(string_type&& __source) + { return *this = path(std::move(__source)); } + + inline path& + path::operator+=(const string_type& __x) + { + _M_concat(__x); + return *this; + } + + inline path& + path::operator+=(const value_type* __x) + { + _M_concat(__x); + return *this; + } + + inline path& + path::operator+=(value_type __x) + { + _M_concat(basic_string_view(&__x, 1)); + return *this; + } + + inline path& + path::operator+=(basic_string_view __x) + { + _M_concat(__x); + return *this; + } + + template + inline __detail::_Path2<_CharT*>& + path::operator+=(const _CharT __x) + { + _M_concat(_S_convert(&__x, &__x + 1)); + return *this; + } + + inline path& + path::make_preferred() + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + auto __pos = _M_pathname.find(L'/'); + while (__pos != _M_pathname.npos) + { + _M_pathname[__pos] = preferred_separator; + __pos = _M_pathname.find(L'/', __pos); + } +#endif + return *this; + } + + inline void path::swap(path& __rhs) noexcept + { + _M_pathname.swap(__rhs._M_pathname); + _M_cmpts.swap(__rhs._M_cmpts); + } + + /// @cond undocumented + template + std::basic_string<_CharT, _Traits, _Allocator> + path::_S_str_convert(basic_string_view __str, + const _Allocator& __a) + { + static_assert(!is_same_v<_CharT, value_type>); + + using _WString = basic_string<_CharT, _Traits, _Allocator>; + + if (__str.size() == 0) + return _WString(__a); + +#ifndef _GLIBCXX_FILESYSTEM_IS_WINDOWS + string_view __u8str = __str; +#else + // First convert native string from UTF-16 to to UTF-8. + // XXX This assumes that the execution wide-character set is UTF-16. + std::codecvt_utf8_utf16 __cvt; + + using _CharAlloc = __alloc_rebind<_Allocator, char>; + using _String = basic_string, _CharAlloc>; + _String __u8str{_CharAlloc{__a}}; + const value_type* __wfirst = __str.data(); + const value_type* __wlast = __wfirst + __str.size(); + if (!__str_codecvt_out_all(__wfirst, __wlast, __u8str, __cvt)) + __detail::__throw_conversion_error(); + if constexpr (is_same_v<_CharT, char>) + return __u8str; // XXX assumes native ordinary encoding is UTF-8. + else +#endif + { + const char* __first = __u8str.data(); + const char* __last = __first + __u8str.size(); + + // Convert UTF-8 string to requested format. +#ifdef _GLIBCXX_USE_CHAR8_T + if constexpr (is_same_v<_CharT, char8_t>) + return _WString(__first, __last, __a); + else +#endif + { + // Convert UTF-8 to wide string. + _WString __wstr(__a); + path::_Codecvt<_CharT> __cvt; + if (__str_codecvt_in_all(__first, __last, __wstr, __cvt)) + return __wstr; + } + } + __detail::__throw_conversion_error(); + } + /// @endcond + + template + inline basic_string<_CharT, _Traits, _Allocator> + path::string(const _Allocator& __a) const + { + if constexpr (is_same_v<_CharT, value_type>) + return { _M_pathname.c_str(), _M_pathname.length(), __a }; + else + return _S_str_convert<_CharT, _Traits>(_M_pathname, __a); + } + + inline std::string + path::string() const { return string(); } + +#if _GLIBCXX_USE_WCHAR_T + inline std::wstring + path::wstring() const { return string(); } +#endif + +#ifdef _GLIBCXX_USE_CHAR8_T + inline std::u8string + path::u8string() const { return string(); } +#else + inline std::string + path::u8string() const + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + std::string __str; + // convert from native wide encoding (assumed to be UTF-16) to UTF-8 + std::codecvt_utf8_utf16 __cvt; + const value_type* __first = _M_pathname.data(); + const value_type* __last = __first + _M_pathname.size(); + if (__str_codecvt_out_all(__first, __last, __str, __cvt)) + return __str; + __detail::__throw_conversion_error(); +#else + return _M_pathname; +#endif + } +#endif // _GLIBCXX_USE_CHAR8_T + + inline std::u16string + path::u16string() const { return string(); } + + inline std::u32string + path::u32string() const { return string(); } + + template + inline std::basic_string<_CharT, _Traits, _Allocator> + path::generic_string(const _Allocator& __a) const + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + const value_type __slash = L'/'; +#else + const value_type __slash = '/'; +#endif + using _Alloc2 = typename allocator_traits<_Allocator>::template + rebind_alloc; + basic_string, _Alloc2> __str(__a); + + if (_M_type() == _Type::_Root_dir) + __str.assign(1, __slash); + else + { + __str.reserve(_M_pathname.size()); + bool __add_slash = false; + for (auto& __elem : *this) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + if (__elem._M_type() == _Type::_Root_dir) + { + __str += __slash; + continue; + } +#endif + if (__add_slash) + __str += __slash; + __str += basic_string_view(__elem._M_pathname); + __add_slash = __elem._M_type() == _Type::_Filename; + } + } + + if constexpr (is_same_v<_CharT, value_type>) + return __str; + else + return _S_str_convert<_CharT, _Traits>(__str, __a); + } + + inline std::string + path::generic_string() const + { return generic_string(); } + +#if _GLIBCXX_USE_WCHAR_T + inline std::wstring + path::generic_wstring() const + { return generic_string(); } +#endif + +#ifdef _GLIBCXX_USE_CHAR8_T + inline std::u8string + path::generic_u8string() const + { return generic_string(); } +#else + inline std::string + path::generic_u8string() const + { return generic_string(); } +#endif + + inline std::u16string + path::generic_u16string() const + { return generic_string(); } + + inline std::u32string + path::generic_u32string() const + { return generic_string(); } + + inline int + path::compare(const string_type& __s) const noexcept + { return compare(basic_string_view(__s)); } + + inline int + path::compare(const value_type* __s) const noexcept + { return compare(basic_string_view(__s)); } + + inline path + path::filename() const + { + if (empty()) + return {}; + else if (_M_type() == _Type::_Filename) + return *this; + else if (_M_type() == _Type::_Multi) + { + if (_M_pathname.back() == preferred_separator) + return {}; + auto __last = --end(); + if (__last->_M_type() == _Type::_Filename) + return *__last; + } + return {}; + } + + inline path + path::stem() const + { + auto ext = _M_find_extension(); + if (ext.first && ext.second != 0) + return path{ext.first->substr(0, ext.second)}; + return {}; + } + + inline path + path::extension() const + { + auto ext = _M_find_extension(); + if (ext.first && ext.second != string_type::npos) + return path{ext.first->substr(ext.second)}; + return {}; + } + + inline bool + path::has_stem() const noexcept + { + auto ext = _M_find_extension(); + return ext.first && ext.second != 0; + } + + inline bool + path::has_extension() const noexcept + { + auto ext = _M_find_extension(); + return ext.first && ext.second != string_type::npos; + } + + inline bool + path::is_absolute() const noexcept + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return has_root_name() && has_root_directory(); +#else + return has_root_directory(); +#endif + } + + inline path::iterator + path::begin() const noexcept + { + if (_M_type() == _Type::_Multi) + return iterator(this, _M_cmpts.begin()); + return iterator(this, empty()); + } + + inline path::iterator + path::end() const noexcept + { + if (_M_type() == _Type::_Multi) + return iterator(this, _M_cmpts.end()); + return iterator(this, true); + } + + inline path::iterator& + path::iterator::operator++() noexcept + { + __glibcxx_assert(_M_path != nullptr); + if (_M_is_multi()) + { + __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end()); + ++_M_cur; + } + else + { + __glibcxx_assert(!_M_at_end); + _M_at_end = true; + } + return *this; + } + + inline path::iterator& + path::iterator::operator--() noexcept + { + __glibcxx_assert(_M_path != nullptr); + if (_M_is_multi()) + { + __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin()); + --_M_cur; + } + else + { + __glibcxx_assert(_M_at_end); + _M_at_end = false; + } + return *this; + } + + inline path::iterator::reference + path::iterator::operator*() const noexcept + { + __glibcxx_assert(_M_path != nullptr); + if (_M_is_multi()) + { + __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end()); + return *_M_cur; + } + return *_M_path; + } + + inline bool + path::iterator::_M_equals(iterator __rhs) const noexcept + { + if (_M_path != __rhs._M_path) + return false; + if (_M_path == nullptr) + return true; + if (_M_is_multi()) + return _M_cur == __rhs._M_cur; + return _M_at_end == __rhs._M_at_end; + } + + // Define this now that path and path::iterator are complete. + // It needs to consider the string_view(Range&&) constructor during + // overload resolution, which depends on whether range is satisfied, + // which depends on whether path::iterator is complete. + inline int + path::_S_compare(const path& __lhs, const path& __rhs) noexcept + { return __lhs.compare(__rhs); } + + /// @} group filesystem +_GLIBCXX_END_NAMESPACE_CXX11 +} // namespace filesystem + +/// @cond undocumented + +inline ptrdiff_t +distance(filesystem::path::iterator __first, filesystem::path::iterator __last) +noexcept +{ return __path_iter_distance(__first, __last); } + +template + inline void + advance(filesystem::path::iterator& __i, _Distance __n) noexcept + { __path_iter_advance(__i, static_cast(__n)); } + +extern template class __shared_ptr; + +/// @endcond + +// _GLIBCXX_RESOLVE_LIB_DEFECTS +// 3657. std::hash is not enabled +template<> + struct hash + { + size_t + operator()(const filesystem::path& __p) const noexcept + { return filesystem::hash_value(__p); } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++17 + +#endif // _GLIBCXX_FS_PATH_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_path.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_path.h.blob new file mode 100644 index 0000000..55ab97b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@fs_path.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functexcept.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functexcept.h new file mode 100644 index 0000000..b1bf43a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functexcept.h @@ -0,0 +1,143 @@ +// Function-Based Exception Support -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/functexcept.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{exception} + * + * This header provides support for -fno-exceptions. + */ + +// +// ISO C++ 14882: 19.1 Exception classes +// + +#ifndef _FUNCTEXCEPT_H +#define _FUNCTEXCEPT_H 1 + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if _GLIBCXX_HOSTED + // Helper for exception objects in + void + __throw_bad_exception(void) __attribute__((__noreturn__)); + + // Helper for exception objects in + void + __throw_bad_alloc(void) __attribute__((__noreturn__)); + + void + __throw_bad_array_new_length(void) __attribute__((__noreturn__)); + + // Helper for exception objects in + void + __throw_bad_cast(void) __attribute__((__noreturn__,__cold__)); + + void + __throw_bad_typeid(void) __attribute__((__noreturn__,__cold__)); + + // Helpers for exception objects in + void + __throw_logic_error(const char*) __attribute__((__noreturn__,__cold__)); + + void + __throw_domain_error(const char*) __attribute__((__noreturn__,__cold__)); + + void + __throw_invalid_argument(const char*) __attribute__((__noreturn__,__cold__)); + + void + __throw_length_error(const char*) __attribute__((__noreturn__,__cold__)); + + void + __throw_out_of_range(const char*) __attribute__((__noreturn__,__cold__)); + + void + __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__,__cold__)) + __attribute__((__format__(__gnu_printf__, 1, 2))); + + void + __throw_runtime_error(const char*) __attribute__((__noreturn__,__cold__)); + + void + __throw_range_error(const char*) __attribute__((__noreturn__,__cold__)); + + void + __throw_overflow_error(const char*) __attribute__((__noreturn__,__cold__)); + + void + __throw_underflow_error(const char*) __attribute__((__noreturn__,__cold__)); + + // Helpers for exception objects in + void + __throw_ios_failure(const char*) __attribute__((__noreturn__,__cold__)); + + void + __throw_ios_failure(const char*, int) __attribute__((__noreturn__,__cold__)); + + // Helpers for exception objects in + void + __throw_system_error(int) __attribute__((__noreturn__,__cold__)); + + // Helpers for exception objects in + void + __throw_future_error(int) __attribute__((__noreturn__,__cold__)); + + // Helpers for exception objects in + void + __throw_bad_function_call() __attribute__((__noreturn__,__cold__)); + +#else // ! HOSTED + + __attribute__((__noreturn__)) inline void + __throw_invalid_argument(const char*) + { std::__terminate(); } + + __attribute__((__noreturn__)) inline void + __throw_out_of_range(const char*) + { std::__terminate(); } + + __attribute__((__noreturn__)) inline void + __throw_out_of_range_fmt(const char*, ...) + { std::__terminate(); } + + __attribute__((__noreturn__)) inline void + __throw_runtime_error(const char*) + { std::__terminate(); } + + __attribute__((__noreturn__)) inline void + __throw_overflow_error(const char*) + { std::__terminate(); } + +#endif // HOSTED + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functexcept.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functexcept.h.blob new file mode 100644 index 0000000..e67277c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functexcept.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functional_hash.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functional_hash.h new file mode 100644 index 0000000..e84c9ee --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functional_hash.h @@ -0,0 +1,308 @@ +// functional_hash.h header -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/functional_hash.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _FUNCTIONAL_HASH_H +#define _FUNCTIONAL_HASH_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** @defgroup hashes Hashes + * @ingroup functors + * + * Hashing functors taking a variable type and returning a @c std::size_t. + * + * @{ + */ + + template + struct __hash_base + { +#if __cplusplus < 202002L + typedef _Result result_type _GLIBCXX17_DEPRECATED; + typedef _Arg argument_type _GLIBCXX17_DEPRECATED; +#endif + }; + +#if ! _GLIBCXX_INLINE_VERSION + // Some std::hash specializations inherit this for ABI compatibility reasons. + template struct __hash_empty_base { }; +#endif + + /// Primary class template hash. + template + struct hash; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++14-extensions" + template + constexpr bool __is_hash_enabled_for = false; + + template + constexpr bool + __is_hash_enabled_for<_Tp, + __void_t()(declval<_Tp>()))>> + = true; +#pragma GCC diagnostic pop + + // Helper struct for defining disabled specializations of std::hash. + template + struct __hash_not_enabled + { + __hash_not_enabled(__hash_not_enabled&&) = delete; + ~__hash_not_enabled() = delete; + }; + + // Helper struct for hash with enum types. + template + struct __hash_enum : public __hash_base + { + size_t + operator()(_Tp __val) const noexcept + { + using __type = typename underlying_type<_Tp>::type; + return hash<__type>{}(static_cast<__type>(__val)); + } + }; + + /// Primary class template hash, usable for enum types only. + template + struct hash + : __conditional_t<__is_enum(_Tp), __hash_enum<_Tp>, __hash_not_enabled<_Tp>> + { }; + + /// Partial specializations for pointer types. + template + struct hash<_Tp*> : public __hash_base + { + size_t + operator()(_Tp* __p) const noexcept + { return reinterpret_cast(__p); } + }; + + // Explicit specializations for integer types. +#define _Cxx_hashtable_define_trivial_hash(_Tp) \ + template<> \ + struct hash<_Tp> : public __hash_base \ + { \ + size_t \ + operator()(_Tp __val) const noexcept \ + { return static_cast(__val); } \ + }; + + /// Explicit specialization for bool. + _Cxx_hashtable_define_trivial_hash(bool) + + /// Explicit specialization for char. + _Cxx_hashtable_define_trivial_hash(char) + + /// Explicit specialization for signed char. + _Cxx_hashtable_define_trivial_hash(signed char) + + /// Explicit specialization for unsigned char. + _Cxx_hashtable_define_trivial_hash(unsigned char) + + /// Explicit specialization for wchar_t. + _Cxx_hashtable_define_trivial_hash(wchar_t) + +#ifdef _GLIBCXX_USE_CHAR8_T + /// Explicit specialization for char8_t. + _Cxx_hashtable_define_trivial_hash(char8_t) +#endif + + /// Explicit specialization for char16_t. + _Cxx_hashtable_define_trivial_hash(char16_t) + + /// Explicit specialization for char32_t. + _Cxx_hashtable_define_trivial_hash(char32_t) + + /// Explicit specialization for short. + _Cxx_hashtable_define_trivial_hash(short) + + /// Explicit specialization for int. + _Cxx_hashtable_define_trivial_hash(int) + + /// Explicit specialization for long. + _Cxx_hashtable_define_trivial_hash(long) + + /// Explicit specialization for long long. + _Cxx_hashtable_define_trivial_hash(long long) + + /// Explicit specialization for unsigned short. + _Cxx_hashtable_define_trivial_hash(unsigned short) + + /// Explicit specialization for unsigned int. + _Cxx_hashtable_define_trivial_hash(unsigned int) + + /// Explicit specialization for unsigned long. + _Cxx_hashtable_define_trivial_hash(unsigned long) + + /// Explicit specialization for unsigned long long. + _Cxx_hashtable_define_trivial_hash(unsigned long long) + +#ifdef __GLIBCXX_TYPE_INT_N_0 + __extension__ + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_0) + __extension__ + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_0 unsigned) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_1 + __extension__ + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_1) + __extension__ + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_1 unsigned) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_2 + __extension__ + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_2) + __extension__ + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_2 unsigned) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_3 + __extension__ + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_3) + __extension__ + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_3 unsigned) +#endif + +#undef _Cxx_hashtable_define_trivial_hash + + struct _Hash_impl + { + static size_t + hash(const void* __ptr, size_t __clength, + size_t __seed = static_cast(0xc70f6907UL)) + { return _Hash_bytes(__ptr, __clength, __seed); } + + template + static size_t + hash(const _Tp& __val) + { return hash(&__val, sizeof(__val)); } + + template + static size_t + __hash_combine(const _Tp& __val, size_t __hash) + { return hash(&__val, sizeof(__val), __hash); } + }; + + // A hash function similar to FNV-1a (see PR59406 for how it differs). + struct _Fnv_hash_impl + { + static size_t + hash(const void* __ptr, size_t __clength, + size_t __seed = static_cast(2166136261UL)) + { return _Fnv_hash_bytes(__ptr, __clength, __seed); } + + template + static size_t + hash(const _Tp& __val) + { return hash(&__val, sizeof(__val)); } + + template + static size_t + __hash_combine(const _Tp& __val, size_t __hash) + { return hash(&__val, sizeof(__val), __hash); } + }; + + /// Specialization for float. + template<> + struct hash : public __hash_base + { + size_t + operator()(float __val) const noexcept + { + // 0 and -0 both hash to zero. + return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0; + } + }; + + /// Specialization for double. + template<> + struct hash : public __hash_base + { + size_t + operator()(double __val) const noexcept + { + // 0 and -0 both hash to zero. + return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0; + } + }; + + /// Specialization for long double. + template<> + struct hash + : public __hash_base + { + _GLIBCXX_PURE size_t + operator()(long double __val) const noexcept; + }; + +#if __cplusplus >= 201703L + template<> + struct hash : public __hash_base + { + size_t + operator()(nullptr_t) const noexcept + { return 0; } + }; +#endif + + /// @} group hashes + + /** Hint about performance of hash functions. + * + * If a given hash function object is not fast, the hash-based containers + * will cache the hash code. + * The default behavior is to consider that hashers are fast unless specified + * otherwise. + * + * Users can specialize this for their own hash functions in order to force + * caching of hash codes in unordered containers. Specializing this trait + * affects the ABI of the unordered containers, so use it carefully. + */ + template + struct __is_fast_hash : public std::true_type + { }; + + template<> + struct __is_fast_hash> : public std::false_type + { }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // _FUNCTIONAL_HASH_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functional_hash.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functional_hash.h.blob new file mode 100644 index 0000000..3909e2b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@functional_hash.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@hash_bytes.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@hash_bytes.h new file mode 100644 index 0000000..8266b50 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@hash_bytes.h @@ -0,0 +1,61 @@ +// Declarations for hash functions. -*- C++ -*- + +// Copyright (C) 2010-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/hash_bytes.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _HASH_BYTES_H +#define _HASH_BYTES_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Hash function implementation for the nontrivial specialization. + // All of them are based on a primitive that hashes a pointer to a + // byte array. The actual hash algorithm is not guaranteed to stay + // the same from release to release -- it may be updated or tuned to + // improve hash quality or speed. + size_t + _Hash_bytes(const void* __ptr, size_t __len, size_t __seed); + + // A similar hash primitive, using the FNV hash algorithm. This + // algorithm is guaranteed to stay the same from release to release. + // (although it might not produce the same values on different + // machines.) + size_t + _Fnv_hash_bytes(const void* __ptr, size_t __len, size_t __seed); + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@hash_bytes.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@hash_bytes.h.blob new file mode 100644 index 0000000..cbefc6e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@hash_bytes.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@invoke.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@invoke.h new file mode 100644 index 0000000..dc26cfb --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@invoke.h @@ -0,0 +1,162 @@ +// Implementation of INVOKE -*- C++ -*- + +// Copyright (C) 2016-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/invoke.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _GLIBCXX_INVOKE_H +#define _GLIBCXX_INVOKE_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus < 201103L +# include +#else + +#include +#include // forward + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup utilities + * @{ + */ + + // Used by __invoke_impl instead of std::forward<_Tp> so that a + // reference_wrapper is converted to an lvalue-reference. + template::type> + constexpr _Up&& + __invfwd(typename remove_reference<_Tp>::type& __t) noexcept + { return static_cast<_Up&&>(__t); } + + template + constexpr _Res + __invoke_impl(__invoke_other, _Fn&& __f, _Args&&... __args) + { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); } + + template + constexpr _Res + __invoke_impl(__invoke_memfun_ref, _MemFun&& __f, _Tp&& __t, + _Args&&... __args) + { return (__invfwd<_Tp>(__t).*__f)(std::forward<_Args>(__args)...); } + + template + constexpr _Res + __invoke_impl(__invoke_memfun_deref, _MemFun&& __f, _Tp&& __t, + _Args&&... __args) + { + return ((*std::forward<_Tp>(__t)).*__f)(std::forward<_Args>(__args)...); + } + + template + constexpr _Res + __invoke_impl(__invoke_memobj_ref, _MemPtr&& __f, _Tp&& __t) + { return __invfwd<_Tp>(__t).*__f; } + + template + constexpr _Res + __invoke_impl(__invoke_memobj_deref, _MemPtr&& __f, _Tp&& __t) + { return (*std::forward<_Tp>(__t)).*__f; } + + /// Invoke a callable object. + template + constexpr typename __invoke_result<_Callable, _Args...>::type + __invoke(_Callable&& __fn, _Args&&... __args) + noexcept(__is_nothrow_invocable<_Callable, _Args...>::value) + { + using __result = __invoke_result<_Callable, _Args...>; + using __type = typename __result::type; + using __tag = typename __result::__invoke_type; + return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn), + std::forward<_Args>(__args)...); + } + +#if __cplusplus >= 201703L + // INVOKE: Invoke a callable object and convert the result to R. + template + constexpr enable_if_t, _Res> + __invoke_r(_Callable&& __fn, _Args&&... __args) + noexcept(is_nothrow_invocable_r_v<_Res, _Callable, _Args...>) + { + using __result = __invoke_result<_Callable, _Args...>; + using __type = typename __result::type; + using __tag = typename __result::__invoke_type; + if constexpr (is_void_v<_Res>) + std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn), + std::forward<_Args>(__args)...); + else + return std::__invoke_impl<__type>(__tag{}, + std::forward<_Callable>(__fn), + std::forward<_Args>(__args)...); + } +#else // C++11 or C++14 + // This is a non-SFINAE-friendly std::invoke_r(fn, args...) for C++11/14. + // It's used in std::function, std::bind, and std::packaged_task. Only + // std::function is constrained on is_invocable_r, but that is checked on + // construction so doesn't need to be checked again when calling __invoke_r. + // Consequently, these __invoke_r overloads do not check for invocable + // arguments, nor check that the invoke result is convertible to R. + + // INVOKE: Invoke a callable object and convert the result to R. + template + constexpr __enable_if_t::value, _Res> + __invoke_r(_Callable&& __fn, _Args&&... __args) + { + using __result = __invoke_result<_Callable, _Args...>; + using __type = typename __result::type; +#if __has_builtin(__reference_converts_from_temporary) + static_assert(!__reference_converts_from_temporary(_Res, __type), + "INVOKE must not create a dangling reference"); +#endif + using __tag = typename __result::__invoke_type; + return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn), + std::forward<_Args>(__args)...); + } + + // INVOKE when R is cv void + template + _GLIBCXX14_CONSTEXPR __enable_if_t::value, _Res> + __invoke_r(_Callable&& __fn, _Args&&... __args) + { + using __result = __invoke_result<_Callable, _Args...>; + using __type = typename __result::type; + using __tag = typename __result::__invoke_type; + std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn), + std::forward<_Args>(__args)...); + } +#endif // C++11 or C++14 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_INVOKE_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@invoke.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@invoke.h.blob new file mode 100644 index 0000000..53d0821 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@invoke.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ios_base.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ios_base.h new file mode 100644 index 0000000..b94b2cd --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ios_base.h @@ -0,0 +1,1157 @@ +// Iostreams base classes -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ios_base.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ios} + */ + +// +// ISO C++ 14882: 27.4 Iostreams base classes +// + +#ifndef _IOS_BASE_H +#define _IOS_BASE_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include +#include + +#if __cplusplus < 201103L +# include +#else +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // The following definitions of bitmask types are enums, not ints, + // as permitted (but not required) in the standard, in order to provide + // better type safety in iostream calls. A side effect is that in C++98 + // expressions involving them are not compile-time constants. + enum _Ios_Fmtflags + { + _S_boolalpha = 1L << 0, + _S_dec = 1L << 1, + _S_fixed = 1L << 2, + _S_hex = 1L << 3, + _S_internal = 1L << 4, + _S_left = 1L << 5, + _S_oct = 1L << 6, + _S_right = 1L << 7, + _S_scientific = 1L << 8, + _S_showbase = 1L << 9, + _S_showpoint = 1L << 10, + _S_showpos = 1L << 11, + _S_skipws = 1L << 12, + _S_unitbuf = 1L << 13, + _S_uppercase = 1L << 14, + _S_adjustfield = _S_left | _S_right | _S_internal, + _S_basefield = _S_dec | _S_oct | _S_hex, + _S_floatfield = _S_scientific | _S_fixed, + _S_ios_fmtflags_end = 1L << 16, + _S_ios_fmtflags_max = __INT_MAX__, + _S_ios_fmtflags_min = ~__INT_MAX__ + }; + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Fmtflags + operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW + { return _Ios_Fmtflags(static_cast(__a) & static_cast(__b)); } + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Fmtflags + operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW + { return _Ios_Fmtflags(static_cast(__a) | static_cast(__b)); } + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Fmtflags + operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW + { return _Ios_Fmtflags(static_cast(__a) ^ static_cast(__b)); } + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Fmtflags + operator~(_Ios_Fmtflags __a) _GLIBCXX_NOTHROW + { return _Ios_Fmtflags(~static_cast(__a)); } + + _GLIBCXX14_CONSTEXPR + inline const _Ios_Fmtflags& + operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW + { return __a = __a | __b; } + + _GLIBCXX14_CONSTEXPR + inline const _Ios_Fmtflags& + operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW + { return __a = __a & __b; } + + _GLIBCXX14_CONSTEXPR + inline const _Ios_Fmtflags& + operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW + { return __a = __a ^ __b; } + + // If std::ios_base::noreplace isn't available, -Wswitch should ignore + // _S_noreplace. +#ifdef __glibcxx_ios_noreplace +#define _NOREPLACE_UNUSED +#else +#define _NOREPLACE_UNUSED __attribute__((__unused__)) +#endif + + enum __attribute__((__flag_enum__)) _Ios_Openmode + { + _S_app = 1L << 0, + _S_ate = 1L << 1, + _S_bin = 1L << 2, + _S_in = 1L << 3, + _S_out = 1L << 4, + _S_trunc = 1L << 5, + _S_noreplace _NOREPLACE_UNUSED = 1L << 6, + _S_ios_openmode_end __attribute__((__unused__)) = 1L << 16, + _S_ios_openmode_max __attribute__((__unused__)) = __INT_MAX__, + _S_ios_openmode_min __attribute__((__unused__)) = ~__INT_MAX__ + }; + +#undef _NOREPLACE_UNUSED + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Openmode + operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW + { return _Ios_Openmode(static_cast(__a) & static_cast(__b)); } + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Openmode + operator|(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW + { return _Ios_Openmode(static_cast(__a) | static_cast(__b)); } + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Openmode + operator^(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW + { return _Ios_Openmode(static_cast(__a) ^ static_cast(__b)); } + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Openmode + operator~(_Ios_Openmode __a) _GLIBCXX_NOTHROW + { return _Ios_Openmode(~static_cast(__a)); } + + _GLIBCXX14_CONSTEXPR + inline const _Ios_Openmode& + operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW + { return __a = __a | __b; } + + _GLIBCXX14_CONSTEXPR + inline const _Ios_Openmode& + operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW + { return __a = __a & __b; } + + _GLIBCXX14_CONSTEXPR + inline const _Ios_Openmode& + operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW + { return __a = __a ^ __b; } + + + enum _Ios_Iostate + { + _S_goodbit = 0, + _S_badbit = 1L << 0, + _S_eofbit = 1L << 1, + _S_failbit = 1L << 2, + _S_ios_iostate_end = 1L << 16, + _S_ios_iostate_max = __INT_MAX__, + _S_ios_iostate_min = ~__INT_MAX__ + }; + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Iostate + operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW + { return _Ios_Iostate(static_cast(__a) & static_cast(__b)); } + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Iostate + operator|(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW + { return _Ios_Iostate(static_cast(__a) | static_cast(__b)); } + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Iostate + operator^(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW + { return _Ios_Iostate(static_cast(__a) ^ static_cast(__b)); } + + _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR + inline _Ios_Iostate + operator~(_Ios_Iostate __a) _GLIBCXX_NOTHROW + { return _Ios_Iostate(~static_cast(__a)); } + + _GLIBCXX14_CONSTEXPR + inline const _Ios_Iostate& + operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW + { return __a = __a | __b; } + + _GLIBCXX14_CONSTEXPR + inline const _Ios_Iostate& + operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW + { return __a = __a & __b; } + + _GLIBCXX14_CONSTEXPR + inline const _Ios_Iostate& + operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW + { return __a = __a ^ __b; } + + + enum _Ios_Seekdir + { + _S_beg = 0, + _S_cur = _GLIBCXX_STDIO_SEEK_CUR, + _S_end = _GLIBCXX_STDIO_SEEK_END, + _S_ios_seekdir_end = 1L << 16 + }; + +#if __cplusplus >= 201103L + /// I/O error code + enum class io_errc { stream = 1 }; + + template <> struct is_error_code_enum : public true_type { }; + + [[__nodiscard__, __gnu__::__const__]] + const error_category& + iostream_category() noexcept; + + [[__nodiscard__]] + inline error_code + make_error_code(io_errc __e) noexcept + { return error_code(static_cast(__e), iostream_category()); } + + [[__nodiscard__]] + inline error_condition + make_error_condition(io_errc __e) noexcept + { return error_condition(static_cast(__e), iostream_category()); } +#endif + + // 27.4.2 Class ios_base + /** + * @brief The base of the I/O class hierarchy. + * @ingroup io + * + * This class defines everything that can be defined about I/O that does + * not depend on the type of characters being input or output. Most + * people will only see @c ios_base when they need to specify the full + * name of the various I/O flags (e.g., the openmodes). + */ + class ios_base + { +#if _GLIBCXX_USE_CXX11_ABI +#if __cplusplus < 201103L + // Type that is layout-compatible with std::system_error + struct system_error : std::runtime_error + { + // Type that is layout-compatible with std::error_code + struct error_code + { + error_code() { } + private: + int _M_value; + const void* _M_cat; + } _M_code; + }; +#endif +#endif + public: + + /** + * @brief These are thrown to indicate problems with io. + * @ingroup exceptions + * + * 27.4.2.1.1 Class ios_base::failure + */ +#if _GLIBCXX_USE_CXX11_ABI + class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error + { + public: + explicit + failure(const string& __str); + +#if __cplusplus >= 201103L + explicit + failure(const string&, const error_code&); + + explicit + failure(const char*, const error_code& = io_errc::stream); +#endif + + virtual + ~failure() throw(); + + virtual const char* + what() const throw(); + }; +#else + class failure : public exception + { + public: + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 48. Use of non-existent exception constructor + explicit + failure(const string& __str) throw(); + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Vague-Linkage.html + virtual + ~failure() throw(); + + virtual const char* + what() const throw(); + +#if __cplusplus >= 201103L + // Define the new members required by C++11, + // even though the error_code cannot be stored. + + explicit + failure(const string& __s, const error_code&) noexcept + : failure(__s) + { } + + explicit + failure(const char* __s, const error_code& = error_code{}) + : failure(string(__s)) + { } + + // Stand-in for system_error::code() but returning by value. + error_code code() const noexcept { return error_code{}; } +#endif + + private: + string _M_msg; + }; +#endif + + // 27.4.2.1.2 Type ios_base::fmtflags + /** + * @brief This is a bitmask type. + * + * @c @a _Ios_Fmtflags is implementation-defined, but it is valid to + * perform bitwise operations on these values and expect the Right + * Thing to happen. Defined objects of type fmtflags are: + * - boolalpha + * - dec + * - fixed + * - hex + * - internal + * - left + * - oct + * - right + * - scientific + * - showbase + * - showpoint + * - showpos + * - skipws + * - unitbuf + * - uppercase + * - adjustfield + * - basefield + * - floatfield + */ + typedef _Ios_Fmtflags fmtflags; + + /// Insert/extract @c bool in alphabetic rather than numeric format. + static const fmtflags boolalpha = _S_boolalpha; + + /// Converts integer input or generates integer output in decimal base. + static const fmtflags dec = _S_dec; + + /// Generate floating-point output in fixed-point notation. + static const fmtflags fixed = _S_fixed; + + /// Converts integer input or generates integer output in hexadecimal base. + static const fmtflags hex = _S_hex; + + /// Adds fill characters at a designated internal point in certain + /// generated output, or identical to @c right if no such point is + /// designated. + static const fmtflags internal = _S_internal; + + /// Adds fill characters on the right (final positions) of certain + /// generated output. (I.e., the thing you print is flush left.) + static const fmtflags left = _S_left; + + /// Converts integer input or generates integer output in octal base. + static const fmtflags oct = _S_oct; + + /// Adds fill characters on the left (initial positions) of certain + /// generated output. (I.e., the thing you print is flush right.) + static const fmtflags right = _S_right; + + /// Generates floating-point output in scientific notation. + static const fmtflags scientific = _S_scientific; + + /// Generates a prefix indicating the numeric base of generated integer + /// output. + static const fmtflags showbase = _S_showbase; + + /// Generates a decimal-point character unconditionally in generated + /// floating-point output. + static const fmtflags showpoint = _S_showpoint; + + /// Generates a + sign in non-negative generated numeric output. + static const fmtflags showpos = _S_showpos; + + /// Skips leading white space before certain input operations. + static const fmtflags skipws = _S_skipws; + + /// Flushes output after each output operation. + static const fmtflags unitbuf = _S_unitbuf; + + /// Replaces certain lowercase letters with their uppercase equivalents + /// in generated output. + static const fmtflags uppercase = _S_uppercase; + + /// A mask of left|right|internal. Useful for the 2-arg form of @c setf. + static const fmtflags adjustfield = _S_adjustfield; + + /// A mask of dec|oct|hex. Useful for the 2-arg form of @c setf. + static const fmtflags basefield = _S_basefield; + + /// A mask of scientific|fixed. Useful for the 2-arg form of @c setf. + static const fmtflags floatfield = _S_floatfield; + + // 27.4.2.1.3 Type ios_base::iostate + /** + * @brief This is a bitmask type. + * + * @c @a _Ios_Iostate is implementation-defined, but it is valid to + * perform bitwise operations on these values and expect the Right + * Thing to happen. Defined objects of type iostate are: + * - badbit + * - eofbit + * - failbit + * - goodbit + */ + typedef _Ios_Iostate iostate; + + /// Indicates a loss of integrity in an input or output sequence (such + /// as an irrecoverable read error from a file). + static const iostate badbit = _S_badbit; + + /// Indicates that an input operation reached the end of an input sequence. + static const iostate eofbit = _S_eofbit; + + /// Indicates that an input operation failed to read the expected + /// characters, or that an output operation failed to generate the + /// desired characters. + static const iostate failbit = _S_failbit; + + /// Indicates all is well. + static const iostate goodbit = _S_goodbit; + + // 27.4.2.1.4 Type ios_base::openmode + /** + * @brief This is a bitmask type. + * + * @c @a _Ios_Openmode is implementation-defined, but it is valid to + * perform bitwise operations on these values and expect the Right + * Thing to happen. Defined objects of type openmode are: + * - app + * - ate + * - binary + * - in + * - out + * - trunc + */ + typedef _Ios_Openmode openmode; + + /// Seek to end before each write. + static const openmode app = _S_app; + + /// Open and seek to end immediately after opening. + static const openmode ate = _S_ate; + + /// Perform input and output in binary mode (as opposed to text mode). + /// This is probably not what you think it is; see + /// https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary + static const openmode binary = _S_bin; + + /// Open for input. Default for @c ifstream and fstream. + static const openmode in = _S_in; + + /// Open for output. Default for @c ofstream and fstream. + static const openmode out = _S_out; + + /// Truncate an existing stream when opening. Default for @c ofstream. + static const openmode trunc = _S_trunc; + + static const openmode __noreplace = _S_noreplace; + +#ifdef __glibcxx_ios_noreplace // C++ >= 23 && HOSTED + /// Open a file in exclusive mode. + static const openmode noreplace = _S_noreplace; +#endif + + // 27.4.2.1.5 Type ios_base::seekdir + /** + * @brief This is an enumerated type. + * + * @c @a _Ios_Seekdir is implementation-defined. Defined values + * of type seekdir are: + * - beg + * - cur, equivalent to @c SEEK_CUR in the C standard library. + * - end, equivalent to @c SEEK_END in the C standard library. + */ + typedef _Ios_Seekdir seekdir; + + /// Request a seek relative to the beginning of the stream. + static const seekdir beg = _S_beg; + + /// Request a seek relative to the current position within the sequence. + static const seekdir cur = _S_cur; + + /// Request a seek relative to the current end of the sequence. + static const seekdir end = _S_end; + +#if __cplusplus <= 201402L + // Annex D.6 (removed in C++17) + typedef int io_state + _GLIBCXX_DEPRECATED_SUGGEST("std::iostate"); + typedef int open_mode + _GLIBCXX_DEPRECATED_SUGGEST("std::openmode"); + typedef int seek_dir + _GLIBCXX_DEPRECATED_SUGGEST("std::seekdir"); + + typedef std::streampos streampos + _GLIBCXX_DEPRECATED_SUGGEST("std::streampos"); + typedef std::streamoff streamoff + _GLIBCXX_DEPRECATED_SUGGEST("std::streamoff"); +#endif + + // Callbacks; + /** + * @brief The set of events that may be passed to an event callback. + * + * erase_event is used during ~ios() and copyfmt(). imbue_event is used + * during imbue(). copyfmt_event is used during copyfmt(). + */ + enum event + { + erase_event, + imbue_event, + copyfmt_event + }; + + /** + * @brief The type of an event callback function. + * @param __e One of the members of the event enum. + * @param __b Reference to the ios_base object. + * @param __i The integer provided when the callback was registered. + * + * Event callbacks are user defined functions that get called during + * several ios_base and basic_ios functions, specifically imbue(), + * copyfmt(), and ~ios(). + */ + typedef void (*event_callback) (event __e, ios_base& __b, int __i); + + /** + * @brief Add the callback __fn with parameter __index. + * @param __fn The function to add. + * @param __index The integer to pass to the function when invoked. + * + * Registers a function as an event callback with an integer parameter to + * be passed to the function when invoked. Multiple copies of the + * function are allowed. If there are multiple callbacks, they are + * invoked in the order they were registered. + */ + void + register_callback(event_callback __fn, int __index); + + protected: + streamsize _M_precision; + streamsize _M_width; + fmtflags _M_flags; + iostate _M_exception; + iostate _M_streambuf_state; + + // 27.4.2.6 Members for callbacks + // 27.4.2.6 ios_base callbacks + struct _Callback_list + { + // Data Members + _Callback_list* _M_next; + ios_base::event_callback _M_fn; + int _M_index; + _Atomic_word _M_refcount; // 0 means one reference. + + _Callback_list(ios_base::event_callback __fn, int __index, + _Callback_list* __cb) + : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { } + + void + _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } + + // 0 => OK to delete. + int + _M_remove_reference() + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); + int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); + if (__res == 0) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); + } + return __res; + } + }; + + _Callback_list* _M_callbacks; + + void + _M_call_callbacks(event __ev) throw(); + + void + _M_dispose_callbacks(void) throw(); + + // 27.4.2.5 Members for iword/pword storage + struct _Words + { + void* _M_pword; + long _M_iword; + _Words() : _M_pword(0), _M_iword(0) { } + }; + + // Only for failed iword/pword calls. + _Words _M_word_zero; + + // Guaranteed storage. + // The first 5 iword and pword slots are reserved for internal use. + enum { _S_local_word_size = 8 }; + _Words _M_local_word[_S_local_word_size]; + + // Allocated storage. + int _M_word_size; + _Words* _M_word; + + _Words& + _M_grow_words(int __index, bool __iword); + + // Members for locale and locale caching. + locale _M_ios_locale; + + void + _M_init() throw(); + + public: + + // 27.4.2.1.6 Class ios_base::Init + // Used to initialize standard streams. In theory, g++ could use + // -finit-priority to order this stuff correctly without going + // through these machinations. + class Init + { + friend class ios_base; + public: + Init(); + ~Init(); + +#if __cplusplus >= 201103L + Init(const Init&) = default; + Init& operator=(const Init&) = default; +#endif + + private: + static _Atomic_word _S_refcount; + static bool _S_synced_with_stdio; + }; + + // [27.4.2.2] fmtflags state functions + /** + * @brief Access to format flags. + * @return The format control flags for both input and output. + */ + _GLIBCXX_NODISCARD + fmtflags + flags() const + { return _M_flags; } + + /** + * @brief Setting new format flags all at once. + * @param __fmtfl The new flags to set. + * @return The previous format control flags. + * + * This function overwrites all the format flags with @a __fmtfl. + */ + fmtflags + flags(fmtflags __fmtfl) + { + fmtflags __old = _M_flags; + _M_flags = __fmtfl; + return __old; + } + + /** + * @brief Setting new format flags. + * @param __fmtfl Additional flags to set. + * @return The previous format control flags. + * + * This function sets additional flags in format control. Flags that + * were previously set remain set. + */ + fmtflags + setf(fmtflags __fmtfl) + { + fmtflags __old = _M_flags; + _M_flags |= __fmtfl; + return __old; + } + + /** + * @brief Setting new format flags. + * @param __fmtfl Additional flags to set. + * @param __mask The flags mask for @a fmtfl. + * @return The previous format control flags. + * + * This function clears @a mask in the format flags, then sets + * @a fmtfl @c & @a mask. An example mask is @c ios_base::adjustfield. + */ + fmtflags + setf(fmtflags __fmtfl, fmtflags __mask) + { + fmtflags __old = _M_flags; + _M_flags &= ~__mask; + _M_flags |= (__fmtfl & __mask); + return __old; + } + + /** + * @brief Clearing format flags. + * @param __mask The flags to unset. + * + * This function clears @a __mask in the format flags. + */ + void + unsetf(fmtflags __mask) + { _M_flags &= ~__mask; } + + /** + * @brief Flags access. + * @return The precision to generate on certain output operations. + * + * Be careful if you try to give a definition of @a precision here; see + * DR 189. + */ + _GLIBCXX_NODISCARD + streamsize + precision() const + { return _M_precision; } + + /** + * @brief Changing flags. + * @param __prec The new precision value. + * @return The previous value of precision(). + */ + streamsize + precision(streamsize __prec) + { + streamsize __old = _M_precision; + _M_precision = __prec; + return __old; + } + + /** + * @brief Flags access. + * @return The minimum field width to generate on output operations. + * + * Minimum field width refers to the number of characters. + */ + _GLIBCXX_NODISCARD + streamsize + width() const + { return _M_width; } + + /** + * @brief Changing flags. + * @param __wide The new width value. + * @return The previous value of width(). + */ + streamsize + width(streamsize __wide) + { + streamsize __old = _M_width; + _M_width = __wide; + return __old; + } + + // [27.4.2.4] ios_base static members + /** + * @brief Interaction with the standard C I/O objects. + * @param __sync Whether to synchronize or not. + * @return True if the standard streams were previously synchronized. + * + * The synchronization referred to is @e only that between the standard + * C facilities (e.g., stdout) and the standard C++ objects (e.g., + * cout). User-declared streams are unaffected. See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary + */ + static bool + sync_with_stdio(bool __sync = true); + + // [27.4.2.3] ios_base locale functions + /** + * @brief Setting a new locale. + * @param __loc The new locale. + * @return The previous locale. + * + * Sets the new locale for this stream, and then invokes each callback + * with imbue_event. + */ + locale + imbue(const locale& __loc) throw(); + + /** + * @brief Locale access + * @return A copy of the current locale. + * + * If @c imbue(loc) has previously been called, then this function + * returns @c loc. Otherwise, it returns a copy of @c std::locale(), + * the global C++ locale. + */ + _GLIBCXX_NODISCARD + locale + getloc() const + { return _M_ios_locale; } + + /** + * @brief Locale access + * @return A reference to the current locale. + * + * Like getloc above, but returns a reference instead of + * generating a copy. + */ + const locale& + _M_getloc() const + { return _M_ios_locale; } + + // [27.4.2.5] ios_base storage functions + /** + * @brief Access to unique indices. + * @return An integer different from all previous calls. + * + * This function returns a unique integer every time it is called. It + * can be used for any purpose, but is primarily intended to be a unique + * index for the iword and pword functions. The expectation is that an + * application calls xalloc in order to obtain an index in the iword and + * pword arrays that can be used without fear of conflict. + * + * The implementation maintains a static variable that is incremented and + * returned on each invocation. xalloc is guaranteed to return an index + * that is safe to use in the iword and pword arrays. + */ + static int + xalloc() throw(); + + /** + * @brief Access to integer array. + * @param __ix Index into the array. + * @return A reference to an integer associated with the index. + * + * The iword function provides access to an array of integers that can be + * used for any purpose. The array grows as required to hold the + * supplied index. All integers in the array are initialized to 0. + * + * The implementation reserves several indices. You should use xalloc to + * obtain an index that is safe to use. Also note that since the array + * can grow dynamically, it is not safe to hold onto the reference. + */ + long& + iword(int __ix) + { + _Words& __word = ((unsigned)__ix < (unsigned)_M_word_size) + ? _M_word[__ix] : _M_grow_words(__ix, true); + return __word._M_iword; + } + + /** + * @brief Access to void pointer array. + * @param __ix Index into the array. + * @return A reference to a void* associated with the index. + * + * The pword function provides access to an array of pointers that can be + * used for any purpose. The array grows as required to hold the + * supplied index. All pointers in the array are initialized to 0. + * + * The implementation reserves several indices. You should use xalloc to + * obtain an index that is safe to use. Also note that since the array + * can grow dynamically, it is not safe to hold onto the reference. + */ + void*& + pword(int __ix) + { + _Words& __word = ((unsigned)__ix < (unsigned)_M_word_size) + ? _M_word[__ix] : _M_grow_words(__ix, false); + return __word._M_pword; + } + + // Destructor + /** + * Invokes each callback with erase_event. Destroys local storage. + * + * Note that the ios_base object for the standard streams never gets + * destroyed. As a result, any callbacks registered with the standard + * streams will not get invoked with erase_event (unless copyfmt is + * used). + */ + virtual ~ios_base(); + + protected: + ios_base() throw (); + +#if __cplusplus < 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 50. Copy constructor and assignment operator of ios_base + private: + ios_base(const ios_base&); + + ios_base& + operator=(const ios_base&); +#else + public: + ios_base(const ios_base&) = delete; + + ios_base& + operator=(const ios_base&) = delete; + + protected: + void + _M_move(ios_base&) noexcept; + + void + _M_swap(ios_base& __rhs) noexcept; +#endif + }; + + // [27.4.5.1] fmtflags manipulators + /// Calls base.setf(ios_base::boolalpha). + inline ios_base& + boolalpha(ios_base& __base) + { + __base.setf(ios_base::boolalpha); + return __base; + } + + /// Calls base.unsetf(ios_base::boolalpha). + inline ios_base& + noboolalpha(ios_base& __base) + { + __base.unsetf(ios_base::boolalpha); + return __base; + } + + /// Calls base.setf(ios_base::showbase). + inline ios_base& + showbase(ios_base& __base) + { + __base.setf(ios_base::showbase); + return __base; + } + + /// Calls base.unsetf(ios_base::showbase). + inline ios_base& + noshowbase(ios_base& __base) + { + __base.unsetf(ios_base::showbase); + return __base; + } + + /// Calls base.setf(ios_base::showpoint). + inline ios_base& + showpoint(ios_base& __base) + { + __base.setf(ios_base::showpoint); + return __base; + } + + /// Calls base.unsetf(ios_base::showpoint). + inline ios_base& + noshowpoint(ios_base& __base) + { + __base.unsetf(ios_base::showpoint); + return __base; + } + + /// Calls base.setf(ios_base::showpos). + inline ios_base& + showpos(ios_base& __base) + { + __base.setf(ios_base::showpos); + return __base; + } + + /// Calls base.unsetf(ios_base::showpos). + inline ios_base& + noshowpos(ios_base& __base) + { + __base.unsetf(ios_base::showpos); + return __base; + } + + /// Calls base.setf(ios_base::skipws). + inline ios_base& + skipws(ios_base& __base) + { + __base.setf(ios_base::skipws); + return __base; + } + + /// Calls base.unsetf(ios_base::skipws). + inline ios_base& + noskipws(ios_base& __base) + { + __base.unsetf(ios_base::skipws); + return __base; + } + + /// Calls base.setf(ios_base::uppercase). + inline ios_base& + uppercase(ios_base& __base) + { + __base.setf(ios_base::uppercase); + return __base; + } + + /// Calls base.unsetf(ios_base::uppercase). + inline ios_base& + nouppercase(ios_base& __base) + { + __base.unsetf(ios_base::uppercase); + return __base; + } + + /// Calls base.setf(ios_base::unitbuf). + inline ios_base& + unitbuf(ios_base& __base) + { + __base.setf(ios_base::unitbuf); + return __base; + } + + /// Calls base.unsetf(ios_base::unitbuf). + inline ios_base& + nounitbuf(ios_base& __base) + { + __base.unsetf(ios_base::unitbuf); + return __base; + } + + // [27.4.5.2] adjustfield manipulators + /// Calls base.setf(ios_base::internal, ios_base::adjustfield). + inline ios_base& + internal(ios_base& __base) + { + __base.setf(ios_base::internal, ios_base::adjustfield); + return __base; + } + + /// Calls base.setf(ios_base::left, ios_base::adjustfield). + inline ios_base& + left(ios_base& __base) + { + __base.setf(ios_base::left, ios_base::adjustfield); + return __base; + } + + /// Calls base.setf(ios_base::right, ios_base::adjustfield). + inline ios_base& + right(ios_base& __base) + { + __base.setf(ios_base::right, ios_base::adjustfield); + return __base; + } + + // [27.4.5.3] basefield manipulators + /// Calls base.setf(ios_base::dec, ios_base::basefield). + inline ios_base& + dec(ios_base& __base) + { + __base.setf(ios_base::dec, ios_base::basefield); + return __base; + } + + /// Calls base.setf(ios_base::hex, ios_base::basefield). + inline ios_base& + hex(ios_base& __base) + { + __base.setf(ios_base::hex, ios_base::basefield); + return __base; + } + + /// Calls base.setf(ios_base::oct, ios_base::basefield). + inline ios_base& + oct(ios_base& __base) + { + __base.setf(ios_base::oct, ios_base::basefield); + return __base; + } + + // [27.4.5.4] floatfield manipulators + /// Calls base.setf(ios_base::fixed, ios_base::floatfield). + inline ios_base& + fixed(ios_base& __base) + { + __base.setf(ios_base::fixed, ios_base::floatfield); + return __base; + } + + /// Calls base.setf(ios_base::scientific, ios_base::floatfield). + inline ios_base& + scientific(ios_base& __base) + { + __base.setf(ios_base::scientific, ios_base::floatfield); + return __base; + } + +#if __cplusplus >= 201103L + // New C++11 floatfield manipulators + + /// Calls + /// base.setf(ios_base::fixed|ios_base::scientific, ios_base::floatfield) + inline ios_base& + hexfloat(ios_base& __base) + { + __base.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield); + return __base; + } + + /// Calls @c base.unsetf(ios_base::floatfield) + inline ios_base& + defaultfloat(ios_base& __base) + { + __base.unsetf(ios_base::floatfield); + return __base; + } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _IOS_BASE_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ios_base.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ios_base.h.blob new file mode 100644 index 0000000..34a55c6 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ios_base.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@istream.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@istream.tcc new file mode 100644 index 0000000..7a5f5b0 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@istream.tcc @@ -0,0 +1,1185 @@ +// istream classes -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/istream.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{istream} + */ + +// +// ISO C++ 14882: 27.6.1 Input streams +// + +#ifndef _ISTREAM_TCC +#define _ISTREAM_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + basic_istream<_CharT, _Traits>::sentry:: + sentry(basic_istream<_CharT, _Traits>& __in, bool __noskip) : _M_ok(false) + { + ios_base::iostate __err = ios_base::goodbit; + if (__in.good()) + { + __try + { + if (__in.tie()) + __in.tie()->flush(); + if (!__noskip && bool(__in.flags() & ios_base::skipws)) + { + const __int_type __eof = traits_type::eof(); + __streambuf_type* __sb = __in.rdbuf(); + __int_type __c = __sb->sgetc(); + + const __ctype_type& __ct = __check_facet(__in._M_ctype); + while (!traits_type::eq_int_type(__c, __eof) + && __ct.is(ctype_base::space, + traits_type::to_char_type(__c))) + __c = __sb->snextc(); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 195. Should basic_istream::sentry's constructor ever + // set eofbit? + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + } + } + __catch(__cxxabiv1::__forced_unwind&) + { + __in._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __in._M_setstate(ios_base::badbit); } + } + + if (__in.good() && __err == ios_base::goodbit) + _M_ok = true; + else + { + __err |= ios_base::failbit; + __in.setstate(__err); + } + } + + template + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + _M_extract(_ValueT& __v) + { + sentry __cerb(*this, false); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { +#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT + const __num_get_type& __ng = __check_facet(this->_M_num_get); +#else + const __num_get_type& __ng + = use_facet<__num_get_type>(this->_M_ios_locale); +#endif + __ng.get(*this, 0, *this, __err, __v); + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + operator>>(short& __n) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 118. basic_istream uses nonexistent num_get member functions. + sentry __cerb(*this, false); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + long __l; +#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT + const __num_get_type& __ng = __check_facet(this->_M_num_get); +#else + const __num_get_type& __ng + = use_facet<__num_get_type>(this->_M_ios_locale); +#endif + __ng.get(*this, 0, *this, __err, __l); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 696. istream::operator>>(int&) broken. + if (__l < __gnu_cxx::__numeric_traits::__min) + { + __err |= ios_base::failbit; + __n = __gnu_cxx::__numeric_traits::__min; + } + else if (__l > __gnu_cxx::__numeric_traits::__max) + { + __err |= ios_base::failbit; + __n = __gnu_cxx::__numeric_traits::__max; + } + else + __n = short(__l); + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + operator>>(int& __n) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 118. basic_istream uses nonexistent num_get member functions. + sentry __cerb(*this, false); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + long __l; +#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT + const __num_get_type& __ng = __check_facet(this->_M_num_get); +#else + const __num_get_type& __ng + = use_facet<__num_get_type>(this->_M_ios_locale); +#endif + __ng.get(*this, 0, *this, __err, __l); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 696. istream::operator>>(int&) broken. + if (__l < __gnu_cxx::__numeric_traits::__min) + { + __err |= ios_base::failbit; + __n = __gnu_cxx::__numeric_traits::__min; + } + else if (__l > __gnu_cxx::__numeric_traits::__max) + { + __err |= ios_base::failbit; + __n = __gnu_cxx::__numeric_traits::__max; + } + else + __n = int(__l); + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + operator>>(__streambuf_type* __sbout) + { + ios_base::iostate __err = ios_base::goodbit; + sentry __cerb(*this, false); + if (__cerb && __sbout) + { + __try + { + bool __ineof; + if (!__copy_streambufs_eof(this->rdbuf(), __sbout, __ineof)) + __err |= ios_base::failbit; + if (__ineof) + __err |= ios_base::eofbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::failbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::failbit); } + } + else if (!__sbout) + __err |= ios_base::failbit; + if (__err) + this->setstate(__err); + return *this; + } + + template + typename basic_istream<_CharT, _Traits>::int_type + basic_istream<_CharT, _Traits>:: + get(void) + { + const int_type __eof = traits_type::eof(); + int_type __c = __eof; + _M_gcount = 0; + ios_base::iostate __err = ios_base::goodbit; + sentry __cerb(*this, true); + if (__cerb) + { + __try + { + __c = this->rdbuf()->sbumpc(); + // 27.6.1.1 paragraph 3 + if (!traits_type::eq_int_type(__c, __eof)) + _M_gcount = 1; + else + __err |= ios_base::eofbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + } + if (!_M_gcount) + __err |= ios_base::failbit; + if (__err) + this->setstate(__err); + return __c; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + get(char_type& __c) + { + _M_gcount = 0; + ios_base::iostate __err = ios_base::goodbit; + sentry __cerb(*this, true); + if (__cerb) + { + __try + { + const int_type __cb = this->rdbuf()->sbumpc(); + // 27.6.1.1 paragraph 3 + if (!traits_type::eq_int_type(__cb, traits_type::eof())) + { + _M_gcount = 1; + __c = traits_type::to_char_type(__cb); + } + else + __err |= ios_base::eofbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + } + if (!_M_gcount) + __err |= ios_base::failbit; + if (__err) + this->setstate(__err); + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + get(char_type* __s, streamsize __n, char_type __delim) + { + _M_gcount = 0; + ios_base::iostate __err = ios_base::goodbit; + sentry __cerb(*this, true); + if (__cerb) + { + __try + { + const int_type __idelim = traits_type::to_int_type(__delim); + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + while (_M_gcount + 1 < __n + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __idelim)) + { + *__s++ = traits_type::to_char_type(__c); + ++_M_gcount; + __c = __sb->snextc(); + } + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 243. get and getline when sentry reports failure. + if (__n > 0) + *__s = char_type(); + if (!_M_gcount) + __err |= ios_base::failbit; + if (__err) + this->setstate(__err); + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + get(__streambuf_type& __sb, char_type __delim) + { + _M_gcount = 0; + ios_base::iostate __err = ios_base::goodbit; + sentry __cerb(*this, true); + if (__cerb) + { + __try + { + const int_type __idelim = traits_type::to_int_type(__delim); + const int_type __eof = traits_type::eof(); + __streambuf_type* __this_sb = this->rdbuf(); + int_type __c = __this_sb->sgetc(); + char_type __c2 = traits_type::to_char_type(__c); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + unsigned long long __gcount = 0; +#pragma GCC diagnostic pop + + while (!traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __idelim) + && !traits_type::eq_int_type(__sb.sputc(__c2), __eof)) + { + ++__gcount; + __c = __this_sb->snextc(); + __c2 = traits_type::to_char_type(__c); + } + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3464. istream::gcount() can overflow + if (__gcount <= __gnu_cxx::__numeric_traits::__max) + _M_gcount = __gcount; + else + _M_gcount = __gnu_cxx::__numeric_traits::__max; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + } + if (!_M_gcount) + __err |= ios_base::failbit; + if (__err) + this->setstate(__err); + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + getline(char_type* __s, streamsize __n, char_type __delim) + { + _M_gcount = 0; + ios_base::iostate __err = ios_base::goodbit; + sentry __cerb(*this, true); + if (__cerb) + { + __try + { + const int_type __idelim = traits_type::to_int_type(__delim); + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + while (_M_gcount + 1 < __n + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __idelim)) + { + *__s++ = traits_type::to_char_type(__c); + __c = __sb->snextc(); + ++_M_gcount; + } + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + else + { + if (traits_type::eq_int_type(__c, __idelim)) + { + __sb->sbumpc(); + ++_M_gcount; + } + else + __err |= ios_base::failbit; + } + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 243. get and getline when sentry reports failure. + if (__n > 0) + *__s = char_type(); + if (!_M_gcount) + __err |= ios_base::failbit; + if (__err) + this->setstate(__err); + return *this; + } + + // We provide three overloads, since the first two are much simpler + // than the general case. Also, the latter two can thus adopt the + // same "batchy" strategy used by getline above. + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + ignore(void) + { + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + + if (traits_type::eq_int_type(__sb->sbumpc(), __eof)) + __err |= ios_base::eofbit; + else + _M_gcount = 1; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + ignore(streamsize __n) + { + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb && __n > 0) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + // N.B. On LFS-enabled platforms streamsize is still 32 bits + // wide: if we want to implement the standard mandated behavior + // for n == max() (see 27.6.1.3/24) we are at risk of signed + // integer overflow: thus these contortions. Also note that, + // by definition, when more than 2G chars are actually ignored, + // _M_gcount (the return value of gcount, that is) cannot be + // really correct, being unavoidably too small. + bool __large_ignore = false; + while (true) + { + while (_M_gcount < __n + && !traits_type::eq_int_type(__c, __eof)) + { + ++_M_gcount; + __c = __sb->snextc(); + } + if (__n == __gnu_cxx::__numeric_traits::__max + && !traits_type::eq_int_type(__c, __eof)) + { + _M_gcount = + __gnu_cxx::__numeric_traits::__min; + __large_ignore = true; + } + else + break; + } + + if (__n == __gnu_cxx::__numeric_traits::__max) + { + if (__large_ignore) + _M_gcount = __gnu_cxx::__numeric_traits::__max; + + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + } + else if (_M_gcount < __n) + { + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + } + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + ignore(streamsize __n, int_type __delim) + { + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb && __n > 0) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + int_type __c = __sb->sgetc(); + + // See comment above. + bool __large_ignore = false; + while (true) + { + while (_M_gcount < __n + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __delim)) + { + ++_M_gcount; + __c = __sb->snextc(); + } + if (__n == __gnu_cxx::__numeric_traits::__max + && !traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __delim)) + { + _M_gcount = + __gnu_cxx::__numeric_traits::__min; + __large_ignore = true; + } + else + break; + } + + if (__n == __gnu_cxx::__numeric_traits::__max) + { + if (__large_ignore) + _M_gcount = __gnu_cxx::__numeric_traits::__max; + + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + else + { + if (_M_gcount != __n) + ++_M_gcount; + __sb->sbumpc(); + } + } + else if (_M_gcount < __n) // implies __c == __delim or EOF + { + if (traits_type::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + else + { + ++_M_gcount; + __sb->sbumpc(); + } + } + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + typename basic_istream<_CharT, _Traits>::int_type + basic_istream<_CharT, _Traits>:: + peek(void) + { + int_type __c = traits_type::eof(); + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + __c = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__c, traits_type::eof())) + __err |= ios_base::eofbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return __c; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + read(char_type* __s, streamsize __n) + { + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + _M_gcount = this->rdbuf()->sgetn(__s, __n); + if (_M_gcount != __n) + __err |= (ios_base::eofbit | ios_base::failbit); + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + streamsize + basic_istream<_CharT, _Traits>:: + readsome(char_type* __s, streamsize __n) + { + _M_gcount = 0; + sentry __cerb(*this, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + // Cannot compare int_type with streamsize generically. + const streamsize __num = this->rdbuf()->in_avail(); + if (__num > 0) + _M_gcount = this->rdbuf()->sgetn(__s, std::min(__num, __n)); + else if (__num == -1) + __err |= ios_base::eofbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return _M_gcount; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + putback(char_type __c) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 60. What is a formatted input function? + _M_gcount = 0; + // Clear eofbit per N3168. + this->clear(this->rdstate() & ~ios_base::eofbit); + sentry __cerb(*this, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + if (!__sb + || traits_type::eq_int_type(__sb->sputbackc(__c), __eof)) + __err |= ios_base::badbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + unget(void) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 60. What is a formatted input function? + _M_gcount = 0; + // Clear eofbit per N3168. + this->clear(this->rdstate() & ~ios_base::eofbit); + sentry __cerb(*this, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + const int_type __eof = traits_type::eof(); + __streambuf_type* __sb = this->rdbuf(); + if (!__sb + || traits_type::eq_int_type(__sb->sungetc(), __eof)) + __err |= ios_base::badbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + int + basic_istream<_CharT, _Traits>:: + sync(void) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR60. Do not change _M_gcount. + int __ret = -1; + sentry __cerb(*this, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + __streambuf_type* __sb = this->rdbuf(); + if (__sb) + { + if (__sb->pubsync() == -1) + __err |= ios_base::badbit; + else + __ret = 0; + } + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return __ret; + } + + template + typename basic_istream<_CharT, _Traits>::pos_type + basic_istream<_CharT, _Traits>:: + tellg(void) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR60. Do not change _M_gcount. + pos_type __ret = pos_type(-1); + sentry __cerb(*this, true); + if (__cerb) + { + __try + { + if (!this->fail()) + __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, + ios_base::in); + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + } + return __ret; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + seekg(pos_type __pos) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR60. Do not change _M_gcount. + // Clear eofbit per N3168. + this->clear(this->rdstate() & ~ios_base::eofbit); + sentry __cerb(*this, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + if (!this->fail()) + { + // 136. seekp, seekg setting wrong streams? + const pos_type __p = this->rdbuf()->pubseekpos(__pos, + ios_base::in); + + // 129. Need error indication from seekp() and seekg() + if (__p == pos_type(off_type(-1))) + __err |= ios_base::failbit; + } + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + basic_istream<_CharT, _Traits>& + basic_istream<_CharT, _Traits>:: + seekg(off_type __off, ios_base::seekdir __dir) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR60. Do not change _M_gcount. + // Clear eofbit per N3168. + this->clear(this->rdstate() & ~ios_base::eofbit); + sentry __cerb(*this, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + if (!this->fail()) + { + // 136. seekp, seekg setting wrong streams? + const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir, + ios_base::in); + + // 129. Need error indication from seekp() and seekg() + if (__p == pos_type(off_type(-1))) + __err |= ios_base::failbit; + } + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + // 27.6.1.2.3 Character extraction templates + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) + { + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef typename __istream_type::int_type __int_type; + + typename __istream_type::sentry __cerb(__in, false); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + const __int_type __cb = __in.rdbuf()->sbumpc(); + if (!_Traits::eq_int_type(__cb, _Traits::eof())) + __c = _Traits::to_char_type(__cb); + else + __err |= (ios_base::eofbit | ios_base::failbit); + } + __catch(__cxxabiv1::__forced_unwind&) + { + __in._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __in._M_setstate(ios_base::badbit); } + if (__err) + __in.setstate(__err); + } + return __in; + } + + template + void + __istream_extract(basic_istream<_CharT, _Traits>& __in, _CharT* __s, + streamsize __num) + { + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef basic_streambuf<_CharT, _Traits> __streambuf_type; + typedef typename _Traits::int_type int_type; + typedef _CharT char_type; + typedef ctype<_CharT> __ctype_type; + + streamsize __extracted = 0; + ios_base::iostate __err = ios_base::goodbit; + typename __istream_type::sentry __cerb(__in, false); + if (__cerb) + { + __try + { + // Figure out how many characters to extract. + streamsize __width = __in.width(); + if (0 < __width && __width < __num) + __num = __width; + + const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); + + const int_type __eof = _Traits::eof(); + __streambuf_type* __sb = __in.rdbuf(); + int_type __c = __sb->sgetc(); + + while (__extracted < __num - 1 + && !_Traits::eq_int_type(__c, __eof) + && !__ct.is(ctype_base::space, + _Traits::to_char_type(__c))) + { + *__s++ = _Traits::to_char_type(__c); + ++__extracted; + __c = __sb->snextc(); + } + + if (__extracted < __num - 1 + && _Traits::eq_int_type(__c, __eof)) + __err |= ios_base::eofbit; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 68. Extractors for char* should store null at end + *__s = char_type(); + __in.width(0); + } + __catch(__cxxabiv1::__forced_unwind&) + { + __in._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __in._M_setstate(ios_base::badbit); } + } + if (!__extracted) + __err |= ios_base::failbit; + if (__err) + __in.setstate(__err); + } + + // 27.6.1.4 Standard basic_istream manipulators + template + basic_istream<_CharT, _Traits>& + ws(basic_istream<_CharT, _Traits>& __in) + { + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef basic_streambuf<_CharT, _Traits> __streambuf_type; + typedef typename __istream_type::int_type __int_type; + typedef ctype<_CharT> __ctype_type; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 451. behavior of std::ws + typename __istream_type::sentry __cerb(__in, true); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); + const __int_type __eof = _Traits::eof(); + __streambuf_type* __sb = __in.rdbuf(); + __int_type __c = __sb->sgetc(); + + while (true) + { + if (_Traits::eq_int_type(__c, __eof)) + { + __err = ios_base::eofbit; + break; + } + if (!__ct.is(ctype_base::space, _Traits::to_char_type(__c))) + break; + __c = __sb->snextc(); + } + } + __catch (const __cxxabiv1::__forced_unwind&) + { + __in._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch (...) + { + __in._M_setstate(ios_base::badbit); + } + if (__err) + __in.setstate(__err); + } + return __in; + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template +#pragma GCC diagnostic ignored "-Wlong-long" + extern template class basic_istream; + extern template istream& ws(istream&); + extern template istream& operator>>(istream&, char&); + extern template istream& operator>>(istream&, unsigned char&); + extern template istream& operator>>(istream&, signed char&); + + extern template istream& istream::_M_extract(unsigned short&); + extern template istream& istream::_M_extract(unsigned int&); + extern template istream& istream::_M_extract(long&); + extern template istream& istream::_M_extract(unsigned long&); + extern template istream& istream::_M_extract(bool&); +#ifdef _GLIBCXX_USE_LONG_LONG +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + extern template istream& istream::_M_extract(long long&); + extern template istream& istream::_M_extract(unsigned long long&); +#pragma GCC diagnostic pop +#endif + extern template istream& istream::_M_extract(float&); + extern template istream& istream::_M_extract(double&); + extern template istream& istream::_M_extract(long double&); + extern template istream& istream::_M_extract(void*&); + + extern template class basic_iostream; + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class basic_istream; + extern template wistream& ws(wistream&); + extern template wistream& operator>>(wistream&, wchar_t&); + extern template void __istream_extract(wistream&, wchar_t*, streamsize); + + extern template wistream& wistream::_M_extract(unsigned short&); + extern template wistream& wistream::_M_extract(unsigned int&); + extern template wistream& wistream::_M_extract(long&); + extern template wistream& wistream::_M_extract(unsigned long&); + extern template wistream& wistream::_M_extract(bool&); +#ifdef _GLIBCXX_USE_LONG_LONG + extern template wistream& wistream::_M_extract(long long&); + extern template wistream& wistream::_M_extract(unsigned long long&); +#endif + extern template wistream& wistream::_M_extract(float&); + extern template wistream& wistream::_M_extract(double&); + extern template wistream& wistream::_M_extract(long double&); + extern template wistream& wistream::_M_extract(void*&); + + extern template class basic_iostream; +#endif +#pragma GCC diagnostic pop +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@istream.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@istream.tcc.blob new file mode 100644 index 0000000..9b28457 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@istream.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.h new file mode 100644 index 0000000..a759b7d --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.h @@ -0,0 +1,898 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_classes.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +#ifndef _LOCALE_CLASSES_H +#define _LOCALE_CLASSES_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include +#include + +#ifdef __glibcxx_text_encoding +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 22.1.1 Class locale + /** + * @brief Container class for localization functionality. + * @ingroup locales + * + * The locale class is first a class wrapper for C library locales. It is + * also an extensible container for user-defined localization. A locale is + * a collection of facets that implement various localization features such + * as money, time, and number printing. + * + * Constructing C++ locales does not change the C library locale. + * + * This library supports efficient construction and copying of locales + * through a reference counting implementation of the locale class. + */ + class locale + { + public: + // Types: + /// Definition of locale::category. + typedef int category; + + // Forward decls and friends: + class facet; + class id; + class _Impl; + + friend class facet; + friend class _Impl; + + template + friend bool + has_facet(const locale&) throw(); + + template + friend const _Facet& + use_facet(const locale&); + + template + friend const _Facet* + __try_use_facet(const locale&) _GLIBCXX_NOTHROW; + + template + friend struct __use_cache; + + ///@{ + /** + * @brief Category values. + * + * The standard category values are none, ctype, numeric, collate, time, + * monetary, and messages. They form a bitmask that supports union and + * intersection. The category all is the union of these values. + * + * NB: Order must match _S_facet_categories definition in locale.cc + */ + static const category none = 0; + static const category ctype = 1L << 0; + static const category numeric = 1L << 1; + static const category collate = 1L << 2; + static const category time = 1L << 3; + static const category monetary = 1L << 4; + static const category messages = 1L << 5; + static const category all = (ctype | numeric | collate | + time | monetary | messages); + ///@} + + // Construct/copy/destroy: + + /** + * @brief Default constructor. + * + * Constructs a copy of the global locale. If no locale has been + * explicitly set, this is the C locale. + */ + locale() throw(); + + /** + * @brief Copy constructor. + * + * Constructs a copy of @a other. + * + * @param __other The locale to copy. + */ + locale(const locale& __other) throw(); + + /** + * @brief Named locale constructor. + * + * Constructs a copy of the named C library locale. + * + * @param __s Name of the locale to construct. + * @throw std::runtime_error if __s is null or an undefined locale. + */ + explicit + locale(const char* __s); + + /** + * @brief Construct locale with facets from another locale. + * + * Constructs a copy of the locale @a base. The facets specified by @a + * cat are replaced with those from the locale named by @a s. If base is + * named, this locale instance will also be named. + * + * @param __base The locale to copy. + * @param __s Name of the locale to use facets from. + * @param __cat Set of categories defining the facets to use from __s. + * @throw std::runtime_error if __s is null or an undefined locale. + */ + locale(const locale& __base, const char* __s, category __cat); + +#if __cplusplus >= 201103L + /** + * @brief Named locale constructor. + * + * Constructs a copy of the named C library locale. + * + * @param __s Name of the locale to construct. + * @throw std::runtime_error if __s is an undefined locale. + */ + explicit + locale(const std::string& __s) : locale(__s.c_str()) { } + + /** + * @brief Construct locale with facets from another locale. + * + * Constructs a copy of the locale @a base. The facets specified by @a + * cat are replaced with those from the locale named by @a s. If base is + * named, this locale instance will also be named. + * + * @param __base The locale to copy. + * @param __s Name of the locale to use facets from. + * @param __cat Set of categories defining the facets to use from __s. + * @throw std::runtime_error if __s is an undefined locale. + */ + locale(const locale& __base, const std::string& __s, category __cat) + : locale(__base, __s.c_str(), __cat) { } +#endif + + /** + * @brief Construct locale with facets from another locale. + * + * Constructs a copy of the locale @a base. The facets specified by @a + * cat are replaced with those from the locale @a add. If @a base and @a + * add are named, this locale instance will also be named. + * + * @param __base The locale to copy. + * @param __add The locale to use facets from. + * @param __cat Set of categories defining the facets to use from add. + */ + locale(const locale& __base, const locale& __add, category __cat); + + /** + * @brief Construct locale with another facet. + * + * Constructs a copy of the locale @a __other. The facet @a __f + * is added to @a __other, replacing an existing facet of type + * Facet if there is one. If @a __f is null, this locale is a + * copy of @a __other. + * + * @param __other The locale to copy. + * @param __f The facet to add in. + */ + template + locale(const locale& __other, _Facet* __f); + + /// Locale destructor. + ~locale() throw(); + + /** + * @brief Assignment operator. + * + * Set this locale to be a copy of @a other. + * + * @param __other The locale to copy. + * @return A reference to this locale. + */ + const locale& + operator=(const locale& __other) throw(); + + /** + * @brief Construct locale with another facet. + * + * Constructs and returns a new copy of this locale. Adds or replaces an + * existing facet of type Facet from the locale @a other into the new + * locale. + * + * @tparam _Facet The facet type to copy from other + * @param __other The locale to copy from. + * @return Newly constructed locale. + * @throw std::runtime_error if __other has no facet of type _Facet. + */ + template + _GLIBCXX_NODISCARD + locale + combine(const locale& __other) const; + + // Locale operations: + /** + * @brief Return locale name. + * @return Locale name or "*" if unnamed. + */ + _GLIBCXX_NODISCARD _GLIBCXX_DEFAULT_ABI_TAG + string + name() const; + +#ifdef __glibcxx_text_encoding +# if __CHAR_BIT__ == 8 + text_encoding + encoding() const; +# else + text_encoding + encoding() const = delete; +# endif +#endif + + /** + * @brief Locale equality. + * + * @param __other The locale to compare against. + * @return True if other and this refer to the same locale instance, are + * copies, or have the same name. False otherwise. + */ + _GLIBCXX_NODISCARD + bool + operator==(const locale& __other) const throw(); + +#if __cpp_impl_three_way_comparison < 201907L + /** + * @brief Locale inequality. + * + * @param __other The locale to compare against. + * @return ! (*this == __other) + */ + _GLIBCXX_NODISCARD + bool + operator!=(const locale& __other) const throw() + { return !(this->operator==(__other)); } +#endif + + /** + * @brief Compare two strings according to collate. + * + * Template operator to compare two strings using the compare function of + * the collate facet in this locale. One use is to provide the locale to + * the sort function. For example, a vector v of strings could be sorted + * according to locale loc by doing: + * @code + * std::sort(v.begin(), v.end(), loc); + * @endcode + * + * @param __s1 First string to compare. + * @param __s2 Second string to compare. + * @return True if collate<_Char> facet compares __s1 < __s2, else false. + */ + template + _GLIBCXX_NODISCARD + bool + operator()(const basic_string<_Char, _Traits, _Alloc>& __s1, + const basic_string<_Char, _Traits, _Alloc>& __s2) const; + + // Global locale objects: + /** + * @brief Set global locale + * + * This function sets the global locale to the argument and returns a + * copy of the previous global locale. If the argument has a name, it + * will also call std::setlocale(LC_ALL, loc.name()). + * + * @param __loc The new locale to make global. + * @return Copy of the old global locale. + */ + static locale + global(const locale& __loc); + + /** + * @brief Return reference to the C locale. + */ + _GLIBCXX_NODISCARD + static const locale& + classic(); + + private: + // The (shared) implementation + _Impl* _M_impl; + + // The "C" reference locale + static _Impl* _S_classic; + + // Current global locale + static _Impl* _S_global; + + // Names of underlying locale categories. + // NB: locale::global() has to know how to modify all the + // underlying categories, not just the ones required by the C++ + // standard. + static const char* const* const _S_categories; + + // Number of standard categories. For C++, these categories are + // collate, ctype, monetary, numeric, time, and messages. These + // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE, + // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE + // 1003.1-2001) specifies LC_MESSAGES. + // In addition to the standard categories, the underlying + // operating system is allowed to define extra LC_* + // macros. For GNU systems, the following are also valid: + // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, + // and LC_IDENTIFICATION. + enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES }; + +#ifdef __GTHREADS + static __gthread_once_t _S_once; +#endif + + explicit + locale(_Impl*) throw(); + + static void + _S_initialize(); + + static void + _S_initialize_once() throw(); + + static category + _S_normalize_category(category); + + void + _M_coalesce(const locale& __base, const locale& __add, category __cat); + +#if _GLIBCXX_USE_CXX11_ABI + static const id* const _S_twinned_facets[]; +#endif + }; + +#if __cpp_lib_type_trait_variable_templates // C++ >= 17 + template + constexpr bool __is_facet = is_base_of_v; + template + constexpr bool __is_facet = false; +#endif + + // 22.1.1.1.2 Class locale::facet + /** + * @brief Localization functionality base class. + * @ingroup locales + * + * The facet class is the base class for a localization feature, such as + * money, time, and number printing. It provides common support for facets + * and reference management. + * + * Facets may not be copied or assigned. + */ + class locale::facet + { + private: + friend class locale; + friend class locale::_Impl; + + mutable _Atomic_word _M_refcount; + + // Contains data from the underlying "C" library for the classic locale. + static __c_locale _S_c_locale; + + // String literal for the name of the classic locale. + static const char _S_c_name[2]; + +#ifdef __GTHREADS + static __gthread_once_t _S_once; +#endif + + static void + _S_initialize_once(); + + protected: + /** + * @brief Facet constructor. + * + * This is the constructor provided by the standard. If refs is 0, the + * facet is destroyed when the last referencing locale is destroyed. + * Otherwise the facet will never be destroyed. + * + * @param __refs The initial value for reference count. + */ + explicit + facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0) + { } + + /// Facet destructor. + virtual + ~facet(); + + static void + _S_create_c_locale(__c_locale& __cloc, const char* __s, + __c_locale __old = 0); + + static __c_locale + _S_clone_c_locale(__c_locale& __cloc) throw(); + + static void + _S_destroy_c_locale(__c_locale& __cloc); + + static __c_locale + _S_lc_ctype_c_locale(__c_locale __cloc, const char* __s); + + // Returns data from the underlying "C" library data for the + // classic locale. + static __c_locale + _S_get_c_locale(); + + _GLIBCXX_CONST static const char* + _S_get_c_name() throw(); + +#if __cplusplus < 201103L + private: + facet(const facet&); // Not defined. + + facet& + operator=(const facet&); // Not defined. +#else + facet(const facet&) = delete; + + facet& + operator=(const facet&) = delete; +#endif + + private: + void + _M_add_reference() const throw() + { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } + + void + _M_remove_reference() const throw() + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); + __try + { delete this; } + __catch(...) + { } + } + } + + const facet* _M_sso_shim(const id*) const; + const facet* _M_cow_shim(const id*) const; + + protected: + class __shim; // For internal use only. + }; + + + // 22.1.1.1.3 Class locale::id + /** + * @brief Facet ID class. + * @ingroup locales + * + * The ID class provides facets with an index used to identify them. + * Every facet class must define a public static member locale::id, or be + * derived from a facet that provides this member, otherwise the facet + * cannot be used in a locale. The locale::id ensures that each class + * type gets a unique identifier. + */ + class locale::id + { + private: + friend class locale; + friend class locale::_Impl; + + template + friend const _Facet& + use_facet(const locale&); + + template + friend bool + has_facet(const locale&) throw(); + + template + friend const _Facet* + __try_use_facet(const locale&) _GLIBCXX_NOTHROW; + + // NB: There is no accessor for _M_index because it may be used + // before the constructor is run; the effect of calling a member + // function (even an inline) would be undefined. + mutable size_t _M_index; + + // Last id number assigned. + static _Atomic_word _S_refcount; + + void + operator=(const id&); // Not defined. + + id(const id&); // Not defined. + + public: + // NB: This class is always a static data member, and thus can be + // counted on to be zero-initialized. + /// Constructor. + id() { } + + size_t + _M_id() const throw(); + }; + + + // Implementation object for locale. + class locale::_Impl + { + public: + // Friends. + friend class locale; + friend class locale::facet; + + template + friend bool + has_facet(const locale&) throw(); + + template + friend const _Facet& + use_facet(const locale&); + + template + friend const _Facet* + __try_use_facet(const locale&) _GLIBCXX_NOTHROW; + + template + friend struct __use_cache; + + private: + // Data Members. + _Atomic_word _M_refcount; + const facet** _M_facets; + size_t _M_facets_size; + const facet** _M_caches; + char** _M_names; + static const locale::id* const _S_id_ctype[]; + static const locale::id* const _S_id_numeric[]; + static const locale::id* const _S_id_collate[]; + static const locale::id* const _S_id_time[]; + static const locale::id* const _S_id_monetary[]; + static const locale::id* const _S_id_messages[]; + static const locale::id* const* const _S_facet_categories[]; + + void + _M_add_reference() throw() + { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } + + void + _M_remove_reference() throw() + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); + __try + { delete this; } + __catch(...) + { } + } + } + + _Impl(const _Impl&, size_t); + _Impl(const char*, size_t); + _Impl(size_t) throw(); + + ~_Impl() throw(); + + _Impl(const _Impl&); // Not defined. + + void + operator=(const _Impl&); // Not defined. + + bool + _M_check_same_name() + { + bool __ret = true; + if (_M_names[1]) + // We must actually compare all the _M_names: can be all equal! + for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i) + __ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0; + return __ret; + } + + void + _M_replace_categories(const _Impl*, category); + + void + _M_replace_category(const _Impl*, const locale::id* const*); + + void + _M_replace_facet(const _Impl*, const locale::id*); + + void + _M_install_facet(const locale::id*, const facet*); + + template + void + _M_init_facet(_Facet* __facet) + { _M_install_facet(&_Facet::id, __facet); } + + template + void + _M_init_facet_unchecked(_Facet* __facet) + { + __facet->_M_add_reference(); + _M_facets[_Facet::id._M_id()] = __facet; + } + + void + _M_install_cache(const facet*, size_t); + + void _M_init_extra(facet**); + void _M_init_extra(void*, void*, const char*, const char*); + +#ifdef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT + void _M_init_extra_ldbl128(bool); +#endif + }; + + + /** + * @brief Facet for localized string comparison. + * + * This facet encapsulates the code to compare strings in a localized + * manner. + * + * The collate template uses protected virtual functions to provide + * the actual results. The public accessors forward the call to + * the virtual functions. These virtual functions are hooks for + * developers to implement the behavior they require from the + * collate facet. + */ + template + class _GLIBCXX_NAMESPACE_CXX11 collate : public locale::facet + { + public: + // Types: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + ///@} + + protected: + // Underlying "C" library locale information saved from + // initialization, needed by collate_byname as well. + __c_locale _M_c_locale_collate; + + public: + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + collate(size_t __refs = 0) + : facet(__refs), _M_c_locale_collate(_S_get_c_locale()) + { } + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __refs Passed to the base facet class. + */ + explicit + collate(__c_locale __cloc, size_t __refs = 0) + : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc)) + { } + + /** + * @brief Compare two strings. + * + * This function compares two strings and returns the result by calling + * collate::do_compare(). + * + * @param __lo1 Start of string 1. + * @param __hi1 End of string 1. + * @param __lo2 Start of string 2. + * @param __hi2 End of string 2. + * @return 1 if string1 > string2, -1 if string1 < string2, else 0. + */ + int + compare(const _CharT* __lo1, const _CharT* __hi1, + const _CharT* __lo2, const _CharT* __hi2) const + { return this->do_compare(__lo1, __hi1, __lo2, __hi2); } + + /** + * @brief Transform string to comparable form. + * + * This function is a wrapper for strxfrm functionality. It takes the + * input string and returns a modified string that can be directly + * compared to other transformed strings. In the C locale, this + * function just returns a copy of the input string. In some other + * locales, it may replace two chars with one, change a char for + * another, etc. It does so by returning collate::do_transform(). + * + * @param __lo Start of string. + * @param __hi End of string. + * @return Transformed string_type. + */ + string_type + transform(const _CharT* __lo, const _CharT* __hi) const + { return this->do_transform(__lo, __hi); } + + /** + * @brief Return hash of a string. + * + * This function computes and returns a hash on the input string. It + * does so by returning collate::do_hash(). + * + * @param __lo Start of string. + * @param __hi End of string. + * @return Hash value. + */ + long + hash(const _CharT* __lo, const _CharT* __hi) const + { return this->do_hash(__lo, __hi); } + + // Used to abstract out _CharT bits in virtual member functions, below. + int + _M_compare(const _CharT*, const _CharT*) const throw(); + + size_t + _M_transform(_CharT*, const _CharT*, size_t) const throw(); + + protected: + /// Destructor. + virtual + ~collate() + { _S_destroy_c_locale(_M_c_locale_collate); } + + /** + * @brief Compare two strings. + * + * This function is a hook for derived classes to change the value + * returned. @see compare(). + * + * @param __lo1 Start of string 1. + * @param __hi1 End of string 1. + * @param __lo2 Start of string 2. + * @param __hi2 End of string 2. + * @return 1 if string1 > string2, -1 if string1 < string2, else 0. + */ + virtual int + do_compare(const _CharT* __lo1, const _CharT* __hi1, + const _CharT* __lo2, const _CharT* __hi2) const; + + /** + * @brief Transform string to comparable form. + * + * This function is a hook for derived classes to change the value + * returned. + * + * @param __lo Start. + * @param __hi End. + * @return transformed string. + */ + virtual string_type + do_transform(const _CharT* __lo, const _CharT* __hi) const; + + /** + * @brief Return hash of a string. + * + * This function computes and returns a hash on the input string. This + * function is a hook for derived classes to change the value returned. + * + * @param __lo Start of string. + * @param __hi End of string. + * @return Hash value. + */ + virtual long + do_hash(const _CharT* __lo, const _CharT* __hi) const; + }; + + template + locale::id collate<_CharT>::id; + + // Specializations. + template<> + int + collate::_M_compare(const char*, const char*) const throw(); + + template<> + size_t + collate::_M_transform(char*, const char*, size_t) const throw(); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + int + collate::_M_compare(const wchar_t*, const wchar_t*) const throw(); + + template<> + size_t + collate::_M_transform(wchar_t*, const wchar_t*, size_t) const throw(); +#endif + + /// class collate_byname [22.2.4.2]. + template + class _GLIBCXX_NAMESPACE_CXX11 collate_byname : public collate<_CharT> + { + public: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + ///@} + + explicit + collate_byname(const char* __s, size_t __refs = 0) + : collate<_CharT>(__refs) + { + if (__builtin_strcmp(__s, "C") != 0 + && __builtin_strcmp(__s, "POSIX") != 0) + { + this->_S_destroy_c_locale(this->_M_c_locale_collate); + this->_S_create_c_locale(this->_M_c_locale_collate, __s); + } + } + +#if __cplusplus >= 201103L + explicit + collate_byname(const string& __s, size_t __refs = 0) + : collate_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~collate_byname() { } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +# include + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.h.blob new file mode 100644 index 0000000..4e93b1c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.tcc new file mode 100644 index 0000000..ff1e943 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.tcc @@ -0,0 +1,429 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_classes.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +#ifndef _LOCALE_CLASSES_TCC +#define _LOCALE_CLASSES_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template +#pragma GCC diagnostic ignored "-Wvariadic-macros" + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + locale:: + locale(const locale& __other, _Facet* __f) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2295. Locale name when the provided Facet is a nullptr + if (__builtin_expect(!__f, 0)) + { + _M_impl = __other._M_impl; + _M_impl->_M_add_reference(); + return; + } + + _M_impl = new _Impl(*__other._M_impl, 1); + + __try + { _M_impl->_M_install_facet(&_Facet::id, __f); } + __catch(...) + { + _M_impl->_M_remove_reference(); + __throw_exception_again; + } + delete [] _M_impl->_M_names[0]; + _M_impl->_M_names[0] = 0; // Unnamed. + } + + template + locale + locale:: + combine(const locale& __other) const + { +#if __cpp_lib_type_trait_variable_templates // C++ >= 17 + static_assert(__is_facet<_Facet>, "Template argument must be a facet"); +#endif + + _Impl* __tmp = new _Impl(*_M_impl, 1); + __try + { + __tmp->_M_replace_facet(__other._M_impl, &_Facet::id); + } + __catch(...) + { + __tmp->_M_remove_reference(); + __throw_exception_again; + } + delete[] __tmp->_M_names[0]; + __tmp->_M_names[0] = 0; // Unnamed. + return locale(__tmp); + } + + template + bool + locale:: + operator()(const basic_string<_CharT, _Traits, _Alloc>& __s1, + const basic_string<_CharT, _Traits, _Alloc>& __s2) const + { + typedef std::collate<_CharT> __collate_type; + const __collate_type& __collate = use_facet<__collate_type>(*this); + return (__collate.compare(__s1.data(), __s1.data() + __s1.length(), + __s2.data(), __s2.data() + __s2.length()) < 0); + } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + template + inline const _Facet* + __try_use_facet(const locale& __loc) _GLIBCXX_NOTHROW + { + const size_t __i = _Facet::id._M_id(); + const locale::facet** __facets = __loc._M_impl->_M_facets; + + // We know these standard facets are always installed in every locale + // so dynamic_cast always succeeds, just use static_cast instead. +#define _GLIBCXX_STD_FACET(...) \ + if _GLIBCXX_CONSTEXPR (__is_same(const _Facet, const __VA_ARGS__)) \ + return static_cast(__facets[__i]) + + _GLIBCXX_STD_FACET(ctype); + _GLIBCXX_STD_FACET(num_get); + _GLIBCXX_STD_FACET(num_put); + _GLIBCXX_STD_FACET(codecvt); + _GLIBCXX_STD_FACET(collate); + _GLIBCXX_STD_FACET(moneypunct); + _GLIBCXX_STD_FACET(moneypunct); + _GLIBCXX_STD_FACET(money_get); + _GLIBCXX_STD_FACET(money_put); + _GLIBCXX_STD_FACET(numpunct); + _GLIBCXX_STD_FACET(time_get); + _GLIBCXX_STD_FACET(time_put); + _GLIBCXX_STD_FACET(messages); + +#ifdef _GLIBCXX_USE_WCHAR_T + _GLIBCXX_STD_FACET(ctype); + _GLIBCXX_STD_FACET(num_get); + _GLIBCXX_STD_FACET(num_put); + _GLIBCXX_STD_FACET(codecvt); + _GLIBCXX_STD_FACET(collate); + _GLIBCXX_STD_FACET(moneypunct); + _GLIBCXX_STD_FACET(moneypunct); + _GLIBCXX_STD_FACET(money_get); + _GLIBCXX_STD_FACET(money_put); + _GLIBCXX_STD_FACET(numpunct); + _GLIBCXX_STD_FACET(time_get); + _GLIBCXX_STD_FACET(time_put); + _GLIBCXX_STD_FACET(messages); +#endif +#if __cplusplus >= 201103L + _GLIBCXX_STD_FACET(codecvt); + _GLIBCXX_STD_FACET(codecvt); +#endif + +#undef _GLIBCXX_STD_FACET + + if (__i >= __loc._M_impl->_M_facets_size || !__facets[__i]) + return 0; + +#if __cpp_rtti + return dynamic_cast(__facets[__i]); +#else + return static_cast(__facets[__i]); +#endif + } +#pragma GCC diagnostic pop + + /** + * @brief Test for the presence of a facet. + * @ingroup locales + * + * has_facet tests the locale argument for the presence of the facet type + * provided as the template parameter. Facets derived from the facet + * parameter will also return true. + * + * @tparam _Facet The facet type to test the presence of. + * @param __loc The locale to test. + * @return true if @p __loc contains a facet of type _Facet, else false. + */ + template + _GLIBCXX_NODISCARD + inline bool + has_facet(const locale& __loc) _GLIBCXX_USE_NOEXCEPT + { +#if __cplusplus >= 201103L + static_assert(__is_base_of(locale::facet, _Facet), + "template argument must be derived from locale::facet"); +#else + (void) static_cast(static_cast(0)); +#endif + return std::__try_use_facet<_Facet>(__loc) != 0; + } + + /** + * @brief Return a facet. + * @ingroup locales + * + * use_facet looks for and returns a reference to a facet of type Facet + * where Facet is the template parameter. If has_facet(locale) is true, + * there is a suitable facet to return. It throws std::bad_cast if the + * locale doesn't contain a facet of type Facet. + * + * @tparam _Facet The facet type to access. + * @param __loc The locale to use. + * @return Reference to facet of type Facet. + * @throw std::bad_cast if @p __loc doesn't contain a facet of type _Facet. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" + template + _GLIBCXX_NODISCARD + inline const _Facet& + use_facet(const locale& __loc) + { +#if __cplusplus >= 201103L + static_assert(__is_base_of(locale::facet, _Facet), + "template argument must be derived from locale::facet"); +#else + (void) static_cast(static_cast(0)); +#endif + if (const _Facet* __f = std::__try_use_facet<_Facet>(__loc)) + return *__f; + __throw_bad_cast(); + } +#pragma GCC diagnostic pop + + + // Generic version does nothing. + template + int + collate<_CharT>::_M_compare(const _CharT*, const _CharT*) const throw () + { return 0; } + + // Generic version does nothing. + template + size_t + collate<_CharT>::_M_transform(_CharT*, const _CharT*, size_t) const throw () + { return 0; } + + template + int + collate<_CharT>:: + do_compare(const _CharT* __lo1, const _CharT* __hi1, + const _CharT* __lo2, const _CharT* __hi2) const + { + // strcoll assumes zero-terminated strings so we make a copy + // and then put a zero at the end. + const string_type __one(__lo1, __hi1); + const string_type __two(__lo2, __hi2); + + const _CharT* __p = __one.c_str(); + const _CharT* __pend = __one.data() + __one.length(); + const _CharT* __q = __two.c_str(); + const _CharT* __qend = __two.data() + __two.length(); + + // strcoll stops when it sees a nul character so we break + // the strings into zero-terminated substrings and pass those + // to strcoll. + for (;;) + { + const int __res = _M_compare(__p, __q); + if (__res) + return __res; + + __p += char_traits<_CharT>::length(__p); + __q += char_traits<_CharT>::length(__q); + if (__p == __pend && __q == __qend) + return 0; + else if (__p == __pend) + return -1; + else if (__q == __qend) + return 1; + + __p++; + __q++; + } + } + + template + typename collate<_CharT>::string_type + collate<_CharT>:: + do_transform(const _CharT* __lo, const _CharT* __hi) const + { + string_type __ret; + + // strxfrm assumes zero-terminated strings so we make a copy + const string_type __str(__lo, __hi); + + const _CharT* __p = __str.c_str(); + const _CharT* __pend = __str.data() + __str.length(); + + size_t __len = (__hi - __lo) * 2; + + struct _Buf + { + _Buf(size_t __n, void* __buf, int __e) + : _M_c(__buf ? (_CharT*)__buf : new _CharT[__n]), + _M_stackbuf(__buf), + _M_errno(__e) + { } + + ~_Buf() + { + if (_M_c != _M_stackbuf) + delete[] _M_c; + if (errno == 0) + errno = _M_errno; + } + + void _M_realloc(size_t __len) + { + _CharT* __p = new _CharT[__len]; + if (_M_c != _M_stackbuf) + delete[] _M_c; + _M_c = __p; + } + + _CharT* _M_c; + void* const _M_stackbuf; + int _M_errno; + }; + + const size_t __bytes = __len * sizeof(_CharT); + _Buf __buf(__len, __bytes <= 256 ? __builtin_alloca(__bytes) : 0, errno); + errno = 0; + + // strxfrm stops when it sees a nul character so we break + // the string into zero-terminated substrings and pass those + // to strxfrm. + for (;;) + { + // First try a buffer perhaps big enough. + size_t __res = _M_transform(__buf._M_c, __p, __len); + // If the buffer was not large enough, try again with the + // correct size. + if (__res >= __len) + { + if (__builtin_expect(errno, 0)) + { +#if __cpp_exceptions + __throw_system_error(errno); +#else + // std::regex can call this function internally with + // char values that always fail, so we don't want to + // use _GLIBCXX_THROW_OR_ABORT here. + __ret.clear(); + break; +#endif + } + + __len = __res + 1; + __buf._M_realloc(__len); + __res = _M_transform(__buf._M_c, __p, __len); + } + + __ret.append(__buf._M_c, __res); + __p += char_traits<_CharT>::length(__p); + if (__p == __pend) + break; + + __p++; + __ret.push_back(_CharT()); + } + + return __ret; + } + + template + long + collate<_CharT>:: + do_hash(const _CharT* __lo, const _CharT* __hi) const + { + unsigned long __val = 0; + for (; __lo < __hi; ++__lo) + __val = + *__lo + ((__val << 7) + | (__val >> (__gnu_cxx::__numeric_traits:: + __digits - 7))); + return static_cast(__val); + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class collate; + extern template class collate_byname; + + extern template + const collate* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const collate& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class collate; + extern template class collate_byname; + + extern template + const collate* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const collate& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); +#endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.tcc.blob new file mode 100644 index 0000000..824d1dd Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_classes.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_conv.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_conv.h new file mode 100644 index 0000000..076e14f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_conv.h @@ -0,0 +1,635 @@ +// wstring_convert implementation -*- C++ -*- + +// Copyright (C) 2015-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_conv.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +#ifndef _LOCALE_CONV_H +#define _LOCALE_CONV_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup locales + * @{ + */ + + template + bool + __do_str_codecvt(const _InChar* __first, const _InChar* __last, + _OutStr& __outstr, const _Codecvt& __cvt, _State& __state, + size_t& __count, _Fn __fn) + { + if (__first == __last) + { + __outstr.clear(); + __count = 0; + return true; + } + + size_t __outchars = 0; + auto __next = __first; + const auto __maxlen = __cvt.max_length() + 1; + + codecvt_base::result __result; + do + { + __outstr.resize(__outstr.size() + (__last - __next) * __maxlen); + auto __outnext = &__outstr.front() + __outchars; + auto const __outlast = &__outstr.back() + 1; + __result = (__cvt.*__fn)(__state, __next, __last, __next, + __outnext, __outlast, __outnext); + __outchars = __outnext - &__outstr.front(); + } + while (__result == codecvt_base::partial && __next != __last + && ptrdiff_t(__outstr.size() - __outchars) < __maxlen); + + if (__result == codecvt_base::error) + { + __count = __next - __first; + return false; + } + + // The codecvt facet will only return noconv when the types are + // the same, so avoid instantiating basic_string::assign otherwise + if _GLIBCXX17_CONSTEXPR (is_same()) + if (__result == codecvt_base::noconv) + { + __outstr.assign(__first, __last); + __count = __last - __first; + return true; + } + + __outstr.resize(__outchars); + __count = __next - __first; + return true; + } + + // Convert narrow character string to wide. + template + inline bool + __str_codecvt_in(const char* __first, const char* __last, + basic_string<_CharT, _Traits, _Alloc>& __outstr, + const codecvt<_CharT, char, _State>& __cvt, + _State& __state, size_t& __count) + { + using _Codecvt = codecvt<_CharT, char, _State>; + using _ConvFn + = codecvt_base::result + (_Codecvt::*)(_State&, const char*, const char*, const char*&, + _CharT*, _CharT*, _CharT*&) const; + _ConvFn __fn = &codecvt<_CharT, char, _State>::in; + return __do_str_codecvt(__first, __last, __outstr, __cvt, __state, + __count, __fn); + } + + // As above, but with no __count parameter + template + inline bool + __str_codecvt_in(const char* __first, const char* __last, + basic_string<_CharT, _Traits, _Alloc>& __outstr, + const codecvt<_CharT, char, _State>& __cvt) + { + _State __state = {}; + size_t __n; + return __str_codecvt_in(__first, __last, __outstr, __cvt, __state, __n); + } + + // As above, but returns false for partial conversion + template + inline bool + __str_codecvt_in_all(const char* __first, const char* __last, + basic_string<_CharT, _Traits, _Alloc>& __outstr, + const codecvt<_CharT, char, _State>& __cvt) + { + _State __state = {}; + size_t __n; + return __str_codecvt_in(__first, __last, __outstr, __cvt, __state, __n) + && (__n == size_t(__last - __first)); + } + + // Convert wide character string to narrow. + template + inline bool + __str_codecvt_out(const _CharT* __first, const _CharT* __last, + basic_string& __outstr, + const codecvt<_CharT, char, _State>& __cvt, + _State& __state, size_t& __count) + { + using _Codecvt = codecvt<_CharT, char, _State>; + using _ConvFn + = codecvt_base::result + (_Codecvt::*)(_State&, const _CharT*, const _CharT*, const _CharT*&, + char*, char*, char*&) const; + _ConvFn __fn = &codecvt<_CharT, char, _State>::out; + return __do_str_codecvt(__first, __last, __outstr, __cvt, __state, + __count, __fn); + } + + // As above, but with no __count parameter + template + inline bool + __str_codecvt_out(const _CharT* __first, const _CharT* __last, + basic_string& __outstr, + const codecvt<_CharT, char, _State>& __cvt) + { + _State __state = {}; + size_t __n; + return __str_codecvt_out(__first, __last, __outstr, __cvt, __state, __n); + } + + // As above, but returns false for partial conversions + template + inline bool + __str_codecvt_out_all(const _CharT* __first, const _CharT* __last, + basic_string& __outstr, + const codecvt<_CharT, char, _State>& __cvt) + { + _State __state = {}; + size_t __n; + return __str_codecvt_out(__first, __last, __outstr, __cvt, __state, __n) + && (__n == size_t(__last - __first)); + } + +#ifdef _GLIBCXX_USE_CHAR8_T + + // Convert wide character string to narrow. + template + inline bool + __str_codecvt_out(const _CharT* __first, const _CharT* __last, + basic_string& __outstr, + const codecvt<_CharT, char8_t, _State>& __cvt, + _State& __state, size_t& __count) + { + using _Codecvt = codecvt<_CharT, char8_t, _State>; + using _ConvFn + = codecvt_base::result + (_Codecvt::*)(_State&, const _CharT*, const _CharT*, const _CharT*&, + char8_t*, char8_t*, char8_t*&) const; + _ConvFn __fn = &codecvt<_CharT, char8_t, _State>::out; + return __do_str_codecvt(__first, __last, __outstr, __cvt, __state, + __count, __fn); + } + + template + inline bool + __str_codecvt_out(const _CharT* __first, const _CharT* __last, + basic_string& __outstr, + const codecvt<_CharT, char8_t, _State>& __cvt) + { + _State __state = {}; + size_t __n; + return __str_codecvt_out(__first, __last, __outstr, __cvt, __state, __n); + } + +#endif // _GLIBCXX_USE_CHAR8_T + + namespace __detail + { + template + struct _Scoped_ptr + { + __attribute__((__nonnull__(2))) + explicit + _Scoped_ptr(_Tp* __ptr) noexcept + : _M_ptr(__ptr) + { } + + _Scoped_ptr(_Tp* __ptr, const char* __msg) + : _M_ptr(__ptr) + { + if (!__ptr) + __throw_logic_error(__msg); + } + + ~_Scoped_ptr() { delete _M_ptr; } + + _Scoped_ptr(const _Scoped_ptr&) = delete; + _Scoped_ptr& operator=(const _Scoped_ptr&) = delete; + + __attribute__((__returns_nonnull__)) + _Tp* operator->() const noexcept { return _M_ptr; } + + _Tp& operator*() const noexcept { return *_M_ptr; } + + private: + _Tp* _M_ptr; + }; + } + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /// String conversions + template, + typename _Byte_alloc = allocator> + class _GLIBCXX17_DEPRECATED wstring_convert + { + public: + typedef basic_string, _Byte_alloc> byte_string; + typedef basic_string<_Elem, char_traits<_Elem>, _Wide_alloc> wide_string; + typedef typename _Codecvt::state_type state_type; + typedef typename wide_string::traits_type::int_type int_type; + + /// Default constructor. + wstring_convert() : _M_cvt(new _Codecvt()) { } + + /** Constructor. + * + * @param __pcvt The facet to use for conversions. + * + * Takes ownership of @p __pcvt and will delete it in the destructor. + */ + explicit + wstring_convert(_Codecvt* __pcvt) : _M_cvt(__pcvt, "wstring_convert") + { } + + /** Construct with an initial converstion state. + * + * @param __pcvt The facet to use for conversions. + * @param __state Initial conversion state. + * + * Takes ownership of @p __pcvt and will delete it in the destructor. + * The object's conversion state will persist between conversions. + */ + wstring_convert(_Codecvt* __pcvt, state_type __state) + : _M_cvt(__pcvt, "std::wstring_convert"), + _M_state(__state), _M_with_cvtstate(true) + { } + + /** Construct with error strings. + * + * @param __byte_err A string to return on failed conversions. + * @param __wide_err A wide string to return on failed conversions. + */ + explicit + wstring_convert(const byte_string& __byte_err, + const wide_string& __wide_err = wide_string()) + : _M_cvt(new _Codecvt), + _M_byte_err_string(__byte_err), _M_wide_err_string(__wide_err), + _M_with_strings(true) + { } + + ~wstring_convert() = default; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2176. Special members for wstring_convert and wbuffer_convert + wstring_convert(const wstring_convert&) = delete; + wstring_convert& operator=(const wstring_convert&) = delete; + + /// @{ Convert from bytes. + wide_string + from_bytes(char __byte) + { + char __bytes[2] = { __byte }; + return from_bytes(__bytes, __bytes+1); + } + + wide_string + from_bytes(const char* __ptr) + { return from_bytes(__ptr, __ptr+char_traits::length(__ptr)); } + + wide_string + from_bytes(const byte_string& __str) + { + auto __ptr = __str.data(); + return from_bytes(__ptr, __ptr + __str.size()); + } + + wide_string + from_bytes(const char* __first, const char* __last) + { + if (!_M_with_cvtstate) + _M_state = state_type(); + wide_string __out{ _M_wide_err_string.get_allocator() }; + if (__str_codecvt_in(__first, __last, __out, *_M_cvt, _M_state, + _M_count)) + return __out; + if (_M_with_strings) + return _M_wide_err_string; + __throw_range_error("wstring_convert::from_bytes"); + } + /// @} + + /// @{ Convert to bytes. + byte_string + to_bytes(_Elem __wchar) + { + _Elem __wchars[2] = { __wchar }; + return to_bytes(__wchars, __wchars+1); + } + + byte_string + to_bytes(const _Elem* __ptr) + { + return to_bytes(__ptr, __ptr+wide_string::traits_type::length(__ptr)); + } + + byte_string + to_bytes(const wide_string& __wstr) + { + auto __ptr = __wstr.data(); + return to_bytes(__ptr, __ptr + __wstr.size()); + } + + byte_string + to_bytes(const _Elem* __first, const _Elem* __last) + { + if (!_M_with_cvtstate) + _M_state = state_type(); + byte_string __out{ _M_byte_err_string.get_allocator() }; + if (__str_codecvt_out(__first, __last, __out, *_M_cvt, _M_state, + _M_count)) + return __out; + if (_M_with_strings) + return _M_byte_err_string; + __throw_range_error("wstring_convert::to_bytes"); + } + /// @} + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2174. wstring_convert::converted() should be noexcept + /// The number of elements successfully converted in the last conversion. + size_t converted() const noexcept { return _M_count; } + + /// The final conversion state of the last conversion. + state_type state() const { return _M_state; } + + private: + __detail::_Scoped_ptr<_Codecvt> _M_cvt; + byte_string _M_byte_err_string; + wide_string _M_wide_err_string; + state_type _M_state = state_type(); + size_t _M_count = 0; + bool _M_with_cvtstate = false; + bool _M_with_strings = false; + }; + +_GLIBCXX_END_NAMESPACE_CXX11 + + /// Buffer conversions + template> + class _GLIBCXX17_DEPRECATED wbuffer_convert + : public basic_streambuf<_Elem, _Tr> + { + typedef basic_streambuf<_Elem, _Tr> _Wide_streambuf; + + public: + typedef typename _Codecvt::state_type state_type; + + /// Default constructor. + wbuffer_convert() : wbuffer_convert(nullptr) { } + + /** Constructor. + * + * @param __bytebuf The underlying byte stream buffer. + * @param __pcvt The facet to use for conversions. + * @param __state Initial conversion state. + * + * Takes ownership of @p __pcvt and will delete it in the destructor. + */ + explicit + wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt = new _Codecvt, + state_type __state = state_type()) + : _M_buf(__bytebuf), _M_cvt(__pcvt, "std::wbuffer_convert"), + _M_state(__state), _M_always_noconv(_M_cvt->always_noconv()) + { + if (_M_buf) + { + this->setp(_M_put_area, _M_put_area + _S_buffer_length); + this->setg(_M_get_area + _S_putback_length, + _M_get_area + _S_putback_length, + _M_get_area + _S_putback_length); + } + } + + ~wbuffer_convert() = default; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2176. Special members for wstring_convert and wbuffer_convert + wbuffer_convert(const wbuffer_convert&) = delete; + wbuffer_convert& operator=(const wbuffer_convert&) = delete; + + streambuf* rdbuf() const noexcept { return _M_buf; } + + streambuf* + rdbuf(streambuf *__bytebuf) noexcept + { + auto __prev = _M_buf; + _M_buf = __bytebuf; + return __prev; + } + + /// The conversion state following the last conversion. + state_type state() const noexcept { return _M_state; } + + protected: + int + sync() + { return _M_buf && _M_conv_put() && !_M_buf->pubsync() ? 0 : -1; } + + typename _Wide_streambuf::int_type + overflow(typename _Wide_streambuf::int_type __out) + { + if (!_M_buf || !_M_conv_put()) + return _Tr::eof(); + else if (!_Tr::eq_int_type(__out, _Tr::eof())) + return this->sputc(__out); + return _Tr::not_eof(__out); + } + + typename _Wide_streambuf::int_type + underflow() + { + if (!_M_buf) + return _Tr::eof(); + + if (this->gptr() < this->egptr() || (_M_buf && _M_conv_get())) + return _Tr::to_int_type(*this->gptr()); + else + return _Tr::eof(); + } + + streamsize + xsputn(const typename _Wide_streambuf::char_type* __s, streamsize __n) + { + if (!_M_buf || __n == 0) + return 0; + streamsize __done = 0; + do + { + auto __nn = std::min(this->epptr() - this->pptr(), + __n - __done); + _Tr::copy(this->pptr(), __s + __done, __nn); + this->pbump(__nn); + __done += __nn; + } while (__done < __n && _M_conv_put()); + return __done; + } + + private: + // fill the get area from converted contents of the byte stream buffer + bool + _M_conv_get() + { + const streamsize __pb1 = this->gptr() - this->eback(); + const streamsize __pb2 = _S_putback_length; + const streamsize __npb = std::min(__pb1, __pb2); + + _Tr::move(_M_get_area + _S_putback_length - __npb, + this->gptr() - __npb, __npb); + + streamsize __nbytes = sizeof(_M_get_buf) - _M_unconv; + __nbytes = std::min(__nbytes, _M_buf->in_avail()); + if (__nbytes < 1) + __nbytes = 1; + __nbytes = _M_buf->sgetn(_M_get_buf + _M_unconv, __nbytes); + if (__nbytes < 1) + return false; + __nbytes += _M_unconv; + + // convert _M_get_buf into _M_get_area + + _Elem* __outbuf = _M_get_area + _S_putback_length; + _Elem* __outnext = __outbuf; + const char* __bnext = _M_get_buf; + + codecvt_base::result __result; + if (_M_always_noconv) + __result = codecvt_base::noconv; + else + { + _Elem* __outend = _M_get_area + _S_buffer_length; + + __result = _M_cvt->in(_M_state, + __bnext, __bnext + __nbytes, __bnext, + __outbuf, __outend, __outnext); + } + + if (__result == codecvt_base::noconv) + { + // cast is safe because noconv means _Elem is same type as char + auto __get_buf = reinterpret_cast(_M_get_buf); + _Tr::copy(__outbuf, __get_buf, __nbytes); + _M_unconv = 0; + return true; + } + + if ((_M_unconv = _M_get_buf + __nbytes - __bnext)) + char_traits::move(_M_get_buf, __bnext, _M_unconv); + + this->setg(__outbuf, __outbuf, __outnext); + + return __result != codecvt_base::error; + } + + // unused + bool + _M_put(...) + { return false; } + + bool + _M_put(const char* __p, streamsize __n) + { + if (_M_buf->sputn(__p, __n) < __n) + return false; + return true; + } + + // convert the put area and write to the byte stream buffer + bool + _M_conv_put() + { + _Elem* const __first = this->pbase(); + const _Elem* const __last = this->pptr(); + const streamsize __pending = __last - __first; + + if (_M_always_noconv) + return _M_put(__first, __pending); + + char __outbuf[2 * _S_buffer_length]; + + const _Elem* __next = __first; + const _Elem* __start; + do + { + __start = __next; + char* __outnext = __outbuf; + char* const __outlast = __outbuf + sizeof(__outbuf); + auto __result = _M_cvt->out(_M_state, __next, __last, __next, + __outnext, __outlast, __outnext); + if (__result == codecvt_base::error) + return false; + else if (__result == codecvt_base::noconv) + return _M_put(__next, __pending); + + if (!_M_put(__outbuf, __outnext - __outbuf)) + return false; + } + while (__next != __last && __next != __start); + + if (__next != __last) + _Tr::move(__first, __next, __last - __next); + + this->pbump(__first - __next); + return __next != __first; + } + + streambuf* _M_buf; + __detail::_Scoped_ptr<_Codecvt> _M_cvt; + state_type _M_state; + + static const streamsize _S_buffer_length = 32; + static const streamsize _S_putback_length = 3; + _Elem _M_put_area[_S_buffer_length]; + _Elem _M_get_area[_S_buffer_length]; + streamsize _M_unconv = 0; + char _M_get_buf[_S_buffer_length-_S_putback_length]; + bool _M_always_noconv; + }; + + /// @} group locales + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // __cplusplus + +#endif /* _LOCALE_CONV_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_conv.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_conv.h.blob new file mode 100644 index 0000000..8a63c74 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_conv.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.h new file mode 100644 index 0000000..54d3920 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.h @@ -0,0 +1,2703 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_facets.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +#ifndef _LOCALE_FACETS_H +#define _LOCALE_FACETS_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // For wctype_t +#include +#include +#include +#include // For ios_base, ios_base::iostate +#include +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +// Number of standard facets (for narrow characters only) +#define _GLIBCXX_NUM_FACETS 14 + +// Number of duplicated facets for cxx11 ABI +#define _GLIBCXX_NUM_CXX11_FACETS (_GLIBCXX_USE_DUAL_ABI ? 8 : 0) + +// codecvt and codecvt +#ifdef _GLIBCXX_USE_CHAR8_T +# define _GLIBCXX_NUM_UNICODE_FACETS 4 +#else +# define _GLIBCXX_NUM_UNICODE_FACETS 2 +#endif + +// Facets duplicated for alt128 long double format +// num_get, num_put, money_get, money_put (+ cxx11 money_get, money_put) +#define _GLIBCXX_NUM_LBDL_ALT128_FACETS (4 + (_GLIBCXX_USE_DUAL_ABI ? 2 : 0)) + + // Convert string to numeric value of type _Tp and store results. + // NB: This is specialized for all required types, there is no + // generic definition. + template + void + __convert_to_v(const char*, _Tp&, ios_base::iostate&, + const __c_locale&) throw(); + + // Explicit specializations for required types. + template<> + void + __convert_to_v(const char*, float&, ios_base::iostate&, + const __c_locale&) throw(); + + template<> + void + __convert_to_v(const char*, double&, ios_base::iostate&, + const __c_locale&) throw(); + + template<> + void + __convert_to_v(const char*, long double&, ios_base::iostate&, + const __c_locale&) throw(); + + // NB: __pad is a struct, rather than a function, so it can be + // partially-specialized. + template + struct __pad + { + static void + _S_pad(ios_base& __io, _CharT __fill, _CharT* __news, + const _CharT* __olds, streamsize __newlen, streamsize __oldlen); + }; + + // Used by both numeric and monetary facets. + // Inserts "group separator" characters into an array of characters. + // It's recursive, one iteration per group. It moves the characters + // in the buffer this way: "xxxx12345" -> "12,345xxx". Call this + // only with __gsize != 0. + template + _CharT* + __add_grouping(_CharT* __s, _CharT __sep, + const char* __gbeg, size_t __gsize, + const _CharT* __first, const _CharT* __last); + + // This template permits specializing facet output code for + // ostreambuf_iterator. For ostreambuf_iterator, sputn is + // significantly more efficient than incrementing iterators. + template + inline + ostreambuf_iterator<_CharT> + __write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len) + { + __s._M_put(__ws, __len); + return __s; + } + + // This is the unspecialized form of the template. + template + inline + _OutIter + __write(_OutIter __s, const _CharT* __ws, int __len) + { + for (int __j = 0; __j < __len; __j++, ++__s) + *__s = __ws[__j]; + return __s; + } + + + // 22.2.1.1 Template class ctype + // Include host and configuration specific ctype enums for ctype_base. + + /** + * @brief Common base for ctype facet + * + * This template class provides implementations of the public functions + * that forward to the protected virtual functions. + * + * This template also provides abstract stubs for the protected virtual + * functions. + */ + template + class __ctype_abstract_base : public locale::facet, public ctype_base + { + public: + // Types: + /// Typedef for the template parameter + typedef _CharT char_type; + + /** + * @brief Test char_type classification. + * + * This function finds a mask M for @a __c and compares it to + * mask @a __m. It does so by returning the value of + * ctype::do_is(). + * + * @param __c The char_type to compare the mask of. + * @param __m The mask to compare against. + * @return (M & __m) != 0. + */ + bool + is(mask __m, char_type __c) const + { return this->do_is(__m, __c); } + + /** + * @brief Return a mask array. + * + * This function finds the mask for each char_type in the range [lo,hi) + * and successively writes it to vec. vec must have as many elements + * as the char array. It does so by returning the value of + * ctype::do_is(). + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __vec Pointer to an array of mask storage. + * @return @a __hi. + */ + const char_type* + is(const char_type *__lo, const char_type *__hi, mask *__vec) const + { return this->do_is(__lo, __hi, __vec); } + + /** + * @brief Find char_type matching a mask + * + * This function searches for and returns the first char_type c in + * [lo,hi) for which is(m,c) is true. It does so by returning + * ctype::do_scan_is(). + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to matching char_type if found, else @a __hi. + */ + const char_type* + scan_is(mask __m, const char_type* __lo, const char_type* __hi) const + { return this->do_scan_is(__m, __lo, __hi); } + + /** + * @brief Find char_type not matching a mask + * + * This function searches for and returns the first char_type c in + * [lo,hi) for which is(m,c) is false. It does so by returning + * ctype::do_scan_not(). + * + * @param __m The mask to compare against. + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @return Pointer to non-matching char if found, else @a __hi. + */ + const char_type* + scan_not(mask __m, const char_type* __lo, const char_type* __hi) const + { return this->do_scan_not(__m, __lo, __hi); } + + /** + * @brief Convert to uppercase. + * + * This function converts the argument to uppercase if possible. + * If not possible (for example, '2'), returns the argument. It does + * so by returning ctype::do_toupper(). + * + * @param __c The char_type to convert. + * @return The uppercase char_type if convertible, else @a __c. + */ + char_type + toupper(char_type __c) const + { return this->do_toupper(__c); } + + /** + * @brief Convert array to uppercase. + * + * This function converts each char_type in the range [lo,hi) to + * uppercase if possible. Other elements remain untouched. It does so + * by returning ctype:: do_toupper(lo, hi). + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + const char_type* + toupper(char_type *__lo, const char_type* __hi) const + { return this->do_toupper(__lo, __hi); } + + /** + * @brief Convert to lowercase. + * + * This function converts the argument to lowercase if possible. If + * not possible (for example, '2'), returns the argument. It does so + * by returning ctype::do_tolower(c). + * + * @param __c The char_type to convert. + * @return The lowercase char_type if convertible, else @a __c. + */ + char_type + tolower(char_type __c) const + { return this->do_tolower(__c); } + + /** + * @brief Convert array to lowercase. + * + * This function converts each char_type in the range [__lo,__hi) to + * lowercase if possible. Other elements remain untouched. It does so + * by returning ctype:: do_tolower(__lo, __hi). + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + const char_type* + tolower(char_type* __lo, const char_type* __hi) const + { return this->do_tolower(__lo, __hi); } + + /** + * @brief Widen char to char_type + * + * This function converts the char argument to char_type using the + * simplest reasonable transformation. It does so by returning + * ctype::do_widen(c). + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted char_type. + */ + char_type + widen(char __c) const + { return this->do_widen(__c); } + + /** + * @brief Widen array to char_type + * + * This function converts each char in the input to char_type using the + * simplest reasonable transformation. It does so by returning + * ctype::do_widen(c). + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + const char* + widen(const char* __lo, const char* __hi, char_type* __to) const + { return this->do_widen(__lo, __hi, __to); } + + /** + * @brief Narrow char_type to char + * + * This function converts the char_type to char using the simplest + * reasonable transformation. If the conversion fails, dfault is + * returned instead. It does so by returning + * ctype::do_narrow(__c). + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char_type to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted char. + */ + char + narrow(char_type __c, char __dfault) const + { return this->do_narrow(__c, __dfault); } + + /** + * @brief Narrow array to char array + * + * This function converts each char_type in the input to char using the + * simplest reasonable transformation and writes the results to the + * destination array. For any char_type in the input that cannot be + * converted, @a dfault is used instead. It does so by returning + * ctype::do_narrow(__lo, __hi, __dfault, __to). + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + const char_type* + narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const + { return this->do_narrow(__lo, __hi, __dfault, __to); } + + protected: + explicit + __ctype_abstract_base(size_t __refs = 0): facet(__refs) { } + + virtual + ~__ctype_abstract_base() { } + + /** + * @brief Test char_type classification. + * + * This function finds a mask M for @a c and compares it to mask @a m. + * + * do_is() is a hook for a derived facet to change the behavior of + * classifying. do_is() must always return the same result for the + * same input. + * + * @param __c The char_type to find the mask of. + * @param __m The mask to compare against. + * @return (M & __m) != 0. + */ + virtual bool + do_is(mask __m, char_type __c) const = 0; + + /** + * @brief Return a mask array. + * + * This function finds the mask for each char_type in the range [lo,hi) + * and successively writes it to vec. vec must have as many elements + * as the input. + * + * do_is() is a hook for a derived facet to change the behavior of + * classifying. do_is() must always return the same result for the + * same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __vec Pointer to an array of mask storage. + * @return @a __hi. + */ + virtual const char_type* + do_is(const char_type* __lo, const char_type* __hi, + mask* __vec) const = 0; + + /** + * @brief Find char_type matching mask + * + * This function searches for and returns the first char_type c in + * [__lo,__hi) for which is(__m,c) is true. + * + * do_scan_is() is a hook for a derived facet to change the behavior of + * match searching. do_is() must always return the same result for the + * same input. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a matching char_type if found, else @a __hi. + */ + virtual const char_type* + do_scan_is(mask __m, const char_type* __lo, + const char_type* __hi) const = 0; + + /** + * @brief Find char_type not matching mask + * + * This function searches for and returns a pointer to the first + * char_type c of [lo,hi) for which is(m,c) is false. + * + * do_scan_is() is a hook for a derived facet to change the behavior of + * match searching. do_is() must always return the same result for the + * same input. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a non-matching char_type if found, else @a __hi. + */ + virtual const char_type* + do_scan_not(mask __m, const char_type* __lo, + const char_type* __hi) const = 0; + + /** + * @brief Convert to uppercase. + * + * This virtual function converts the char_type argument to uppercase + * if possible. If not possible (for example, '2'), returns the + * argument. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __c The char_type to convert. + * @return The uppercase char_type if convertible, else @a __c. + */ + virtual char_type + do_toupper(char_type __c) const = 0; + + /** + * @brief Convert array to uppercase. + * + * This virtual function converts each char_type in the range [__lo,__hi) + * to uppercase if possible. Other elements remain untouched. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_toupper(char_type* __lo, const char_type* __hi) const = 0; + + /** + * @brief Convert to lowercase. + * + * This virtual function converts the argument to lowercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __c The char_type to convert. + * @return The lowercase char_type if convertible, else @a __c. + */ + virtual char_type + do_tolower(char_type __c) const = 0; + + /** + * @brief Convert array to lowercase. + * + * This virtual function converts each char_type in the range [__lo,__hi) + * to lowercase if possible. Other elements remain untouched. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_tolower(char_type* __lo, const char_type* __hi) const = 0; + + /** + * @brief Widen char + * + * This virtual function converts the char to char_type using the + * simplest reasonable transformation. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted char_type + */ + virtual char_type + do_widen(char __c) const = 0; + + /** + * @brief Widen char array + * + * This function converts each char in the input to char_type using the + * simplest reasonable transformation. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char* + do_widen(const char* __lo, const char* __hi, char_type* __to) const = 0; + + /** + * @brief Narrow char_type to char + * + * This virtual function converts the argument to char using the + * simplest reasonable transformation. If the conversion fails, dfault + * is returned instead. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char_type to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted char. + */ + virtual char + do_narrow(char_type __c, char __dfault) const = 0; + + /** + * @brief Narrow char_type array to char + * + * This virtual function converts each char_type in the range + * [__lo,__hi) to char using the simplest reasonable + * transformation and writes the results to the destination + * array. For any element in the input that cannot be + * converted, @a __dfault is used instead. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char_type* + do_narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const = 0; + }; + + /** + * @brief Primary class template ctype facet. + * @ingroup locales + * + * This template class defines classification and conversion functions for + * character sets. It wraps cctype functionality. Ctype gets used by + * streams for many I/O operations. + * + * This template provides the protected virtual functions the developer + * will have to replace in a derived class or specialization to make a + * working facet. The public functions that access them are defined in + * __ctype_abstract_base, to allow for implementation flexibility. See + * ctype for an example. The functions are documented in + * __ctype_abstract_base. + * + * Note: implementations are provided for all the protected virtual + * functions, but will likely not be useful. + */ + template + class ctype : public __ctype_abstract_base<_CharT> + { + public: + // Types: + typedef _CharT char_type; + typedef typename __ctype_abstract_base<_CharT>::mask mask; + + /// The facet id for ctype + static locale::id id; + + explicit + ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { } + + protected: + virtual + ~ctype(); + + virtual bool + do_is(mask __m, char_type __c) const; + + virtual const char_type* + do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; + + virtual const char_type* + do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; + + virtual const char_type* + do_scan_not(mask __m, const char_type* __lo, + const char_type* __hi) const; + + virtual char_type + do_toupper(char_type __c) const; + + virtual const char_type* + do_toupper(char_type* __lo, const char_type* __hi) const; + + virtual char_type + do_tolower(char_type __c) const; + + virtual const char_type* + do_tolower(char_type* __lo, const char_type* __hi) const; + + virtual char_type + do_widen(char __c) const; + + virtual const char* + do_widen(const char* __lo, const char* __hi, char_type* __dest) const; + + virtual char + do_narrow(char_type, char __dfault) const; + + virtual const char_type* + do_narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const; + }; + + template + locale::id ctype<_CharT>::id; + + // Incomplete to provide a compile time diagnostics for common misuse + // of [locale.convenience] functions with basic_string as a character type. + template + class ctype >; + + /** + * @brief The ctype specialization. + * @ingroup locales + * + * This class defines classification and conversion functions for + * the char type. It gets used by char streams for many I/O + * operations. The char specialization provides a number of + * optimizations as well. + */ + template<> + class ctype : public locale::facet, public ctype_base + { + public: + // Types: + /// Typedef for the template parameter char. + typedef char char_type; + + protected: + // Data Members: + __c_locale _M_c_locale_ctype; + bool _M_del; + __to_type _M_toupper; + __to_type _M_tolower; + const mask* _M_table; + mutable char _M_widen_ok; + mutable char _M_widen[1 + static_cast(-1)]; + mutable char _M_narrow[1 + static_cast(-1)]; + mutable char _M_narrow_ok; // 0 uninitialized, 1 init, + // 2 memcpy can't be used + + public: + /// The facet id for ctype + static locale::id id; + /// The size of the mask table. It is SCHAR_MAX + 1. + static const size_t table_size = 1 + static_cast(-1); + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __table If non-zero, table is used as the per-char mask. + * Else classic_table() is used. + * @param __del If true, passes ownership of table to this facet. + * @param __refs Passed to the base facet class. + */ + explicit + ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0); + + /** + * @brief Constructor performs static initialization. + * + * This constructor is used to construct the initial C locale facet. + * + * @param __cloc Handle to C locale data. + * @param __table If non-zero, table is used as the per-char mask. + * @param __del If true, passes ownership of table to this facet. + * @param __refs Passed to the base facet class. + */ + explicit + ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false, + size_t __refs = 0); + + /** + * @brief Test char classification. + * + * This function compares the mask table[c] to @a __m. + * + * @param __c The char to compare the mask of. + * @param __m The mask to compare against. + * @return True if __m & table[__c] is true, false otherwise. + */ + inline bool + is(mask __m, char __c) const; + + /** + * @brief Return a mask array. + * + * This function finds the mask for each char in the range [lo, hi) and + * successively writes it to vec. vec must have as many elements as + * the char array. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __vec Pointer to an array of mask storage. + * @return @a __hi. + */ + inline const char* + is(const char* __lo, const char* __hi, mask* __vec) const; + + /** + * @brief Find char matching a mask + * + * This function searches for and returns the first char in [lo,hi) for + * which is(m,char) is true. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a matching char if found, else @a __hi. + */ + inline const char* + scan_is(mask __m, const char* __lo, const char* __hi) const; + + /** + * @brief Find char not matching a mask + * + * This function searches for and returns a pointer to the first char + * in [__lo,__hi) for which is(m,char) is false. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a non-matching char if found, else @a __hi. + */ + inline const char* + scan_not(mask __m, const char* __lo, const char* __hi) const; + + /** + * @brief Convert to uppercase. + * + * This function converts the char argument to uppercase if possible. + * If not possible (for example, '2'), returns the argument. + * + * toupper() acts as if it returns ctype::do_toupper(c). + * do_toupper() must always return the same result for the same input. + * + * @param __c The char to convert. + * @return The uppercase char if convertible, else @a __c. + */ + char_type + toupper(char_type __c) const + { return this->do_toupper(__c); } + + /** + * @brief Convert array to uppercase. + * + * This function converts each char in the range [__lo,__hi) to uppercase + * if possible. Other chars remain untouched. + * + * toupper() acts as if it returns ctype:: do_toupper(__lo, __hi). + * do_toupper() must always return the same result for the same input. + * + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + const char_type* + toupper(char_type *__lo, const char_type* __hi) const + { return this->do_toupper(__lo, __hi); } + + /** + * @brief Convert to lowercase. + * + * This function converts the char argument to lowercase if possible. + * If not possible (for example, '2'), returns the argument. + * + * tolower() acts as if it returns ctype::do_tolower(__c). + * do_tolower() must always return the same result for the same input. + * + * @param __c The char to convert. + * @return The lowercase char if convertible, else @a __c. + */ + char_type + tolower(char_type __c) const + { return this->do_tolower(__c); } + + /** + * @brief Convert array to lowercase. + * + * This function converts each char in the range [lo,hi) to lowercase + * if possible. Other chars remain untouched. + * + * tolower() acts as if it returns ctype:: do_tolower(__lo, __hi). + * do_tolower() must always return the same result for the same input. + * + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + const char_type* + tolower(char_type* __lo, const char_type* __hi) const + { return this->do_tolower(__lo, __hi); } + + /** + * @brief Widen char + * + * This function converts the char to char_type using the simplest + * reasonable transformation. For an underived ctype facet, the + * argument will be returned unchanged. + * + * This function works as if it returns ctype::do_widen(c). + * do_widen() must always return the same result for the same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted character. + */ + char_type + widen(char __c) const + { + if (_M_widen_ok) + return _M_widen[static_cast(__c)]; + this->_M_widen_init(); + return this->do_widen(__c); + } + + /** + * @brief Widen char array + * + * This function converts each char in the input to char using the + * simplest reasonable transformation. For an underived ctype + * facet, the argument will be copied unchanged. + * + * This function works as if it returns ctype::do_widen(c). + * do_widen() must always return the same result for the same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + const char* + widen(const char* __lo, const char* __hi, char_type* __to) const + { + if (_M_widen_ok == 1) + { + if (__builtin_expect(__hi != __lo, true)) + __builtin_memcpy(__to, __lo, __hi - __lo); + return __hi; + } + if (!_M_widen_ok) + _M_widen_init(); + return this->do_widen(__lo, __hi, __to); + } + + /** + * @brief Narrow char + * + * This function converts the char to char using the simplest + * reasonable transformation. If the conversion fails, dfault is + * returned instead. For an underived ctype facet, @a c + * will be returned unchanged. + * + * This function works as if it returns ctype::do_narrow(c). + * do_narrow() must always return the same result for the same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted character. + */ + char + narrow(char_type __c, char __dfault) const + { + if (_M_narrow[static_cast(__c)]) + return _M_narrow[static_cast(__c)]; + const char __t = do_narrow(__c, __dfault); + if (__t != __dfault) + _M_narrow[static_cast(__c)] = __t; + return __t; + } + + /** + * @brief Narrow char array + * + * This function converts each char in the input to char using the + * simplest reasonable transformation and writes the results to the + * destination array. For any char in the input that cannot be + * converted, @a dfault is used instead. For an underived ctype + * facet, the argument will be copied unchanged. + * + * This function works as if it returns ctype::do_narrow(lo, hi, + * dfault, to). do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + const char_type* + narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const + { + if (__builtin_expect(_M_narrow_ok == 1, true)) + { + if (__builtin_expect(__hi != __lo, true)) + __builtin_memcpy(__to, __lo, __hi - __lo); + return __hi; + } + if (!_M_narrow_ok) + _M_narrow_init(); + return this->do_narrow(__lo, __hi, __dfault, __to); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 695. ctype::classic_table() not accessible. + /// Returns a pointer to the mask table provided to the constructor, or + /// the default from classic_table() if none was provided. + const mask* + table() const throw() + { return _M_table; } + + /// Returns a pointer to the C locale mask table. + static const mask* + classic_table() throw(); + protected: + + /** + * @brief Destructor. + * + * This function deletes table() if @a del was true in the + * constructor. + */ + virtual + ~ctype(); + + /** + * @brief Convert to uppercase. + * + * This virtual function converts the char argument to uppercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __c The char to convert. + * @return The uppercase char if convertible, else @a __c. + */ + virtual char_type + do_toupper(char_type __c) const; + + /** + * @brief Convert array to uppercase. + * + * This virtual function converts each char in the range [lo,hi) to + * uppercase if possible. Other chars remain untouched. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_toupper(char_type* __lo, const char_type* __hi) const; + + /** + * @brief Convert to lowercase. + * + * This virtual function converts the char argument to lowercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __c The char to convert. + * @return The lowercase char if convertible, else @a __c. + */ + virtual char_type + do_tolower(char_type __c) const; + + /** + * @brief Convert array to lowercase. + * + * This virtual function converts each char in the range [lo,hi) to + * lowercase if possible. Other chars remain untouched. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_tolower(char_type* __lo, const char_type* __hi) const; + + /** + * @brief Widen char + * + * This virtual function converts the char to char using the simplest + * reasonable transformation. For an underived ctype facet, the + * argument will be returned unchanged. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted character. + */ + virtual char_type + do_widen(char __c) const + { return __c; } + + /** + * @brief Widen char array + * + * This function converts each char in the range [lo,hi) to char using + * the simplest reasonable transformation. For an underived + * ctype facet, the argument will be copied unchanged. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char* + do_widen(const char* __lo, const char* __hi, char_type* __to) const + { + if (__builtin_expect(__hi != __lo, true)) + __builtin_memcpy(__to, __lo, __hi - __lo); + return __hi; + } + + /** + * @brief Narrow char + * + * This virtual function converts the char to char using the simplest + * reasonable transformation. If the conversion fails, dfault is + * returned instead. For an underived ctype facet, @a c will be + * returned unchanged. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted char. + */ + virtual char + do_narrow(char_type __c, char __dfault __attribute__((__unused__))) const + { return __c; } + + /** + * @brief Narrow char array to char array + * + * This virtual function converts each char in the range [lo,hi) to + * char using the simplest reasonable transformation and writes the + * results to the destination array. For any char in the input that + * cannot be converted, @a dfault is used instead. For an underived + * ctype facet, the argument will be copied unchanged. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char_type* + do_narrow(const char_type* __lo, const char_type* __hi, + char __dfault __attribute__((__unused__)), char* __to) const + { + if (__builtin_expect(__hi != __lo, true)) + __builtin_memcpy(__to, __lo, __hi - __lo); + return __hi; + } + + private: + void _M_narrow_init() const; + void _M_widen_init() const; + }; + +#ifdef _GLIBCXX_USE_WCHAR_T + /** + * @brief The ctype specialization. + * @ingroup locales + * + * This class defines classification and conversion functions for the + * wchar_t type. It gets used by wchar_t streams for many I/O operations. + * The wchar_t specialization provides a number of optimizations as well. + * + * ctype inherits its public methods from + * __ctype_abstract_base. + */ + template<> + class ctype : public __ctype_abstract_base + { + public: + // Types: + /// Typedef for the template parameter wchar_t. + typedef wchar_t char_type; + typedef wctype_t __wmask_type; + + protected: + __c_locale _M_c_locale_ctype; + + // Pre-computed narrowed and widened chars. + bool _M_narrow_ok; + char _M_narrow[128]; + wint_t _M_widen[1 + static_cast(-1)]; + + // Pre-computed elements for do_is. + mask _M_bit[16]; + __wmask_type _M_wmask[16]; + + public: + // Data Members: + /// The facet id for ctype + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + ctype(size_t __refs = 0); + + /** + * @brief Constructor performs static initialization. + * + * This constructor is used to construct the initial C locale facet. + * + * @param __cloc Handle to C locale data. + * @param __refs Passed to the base facet class. + */ + explicit + ctype(__c_locale __cloc, size_t __refs = 0); + + protected: + __wmask_type + _M_convert_to_wmask(const mask __m) const throw(); + + /// Destructor + virtual + ~ctype(); + + /** + * @brief Test wchar_t classification. + * + * This function finds a mask M for @a c and compares it to mask @a m. + * + * do_is() is a hook for a derived facet to change the behavior of + * classifying. do_is() must always return the same result for the + * same input. + * + * @param __c The wchar_t to find the mask of. + * @param __m The mask to compare against. + * @return (M & __m) != 0. + */ + virtual bool + do_is(mask __m, char_type __c) const; + + /** + * @brief Return a mask array. + * + * This function finds the mask for each wchar_t in the range [lo,hi) + * and successively writes it to vec. vec must have as many elements + * as the input. + * + * do_is() is a hook for a derived facet to change the behavior of + * classifying. do_is() must always return the same result for the + * same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __vec Pointer to an array of mask storage. + * @return @a __hi. + */ + virtual const char_type* + do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; + + /** + * @brief Find wchar_t matching mask + * + * This function searches for and returns the first wchar_t c in + * [__lo,__hi) for which is(__m,c) is true. + * + * do_scan_is() is a hook for a derived facet to change the behavior of + * match searching. do_is() must always return the same result for the + * same input. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a matching wchar_t if found, else @a __hi. + */ + virtual const char_type* + do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; + + /** + * @brief Find wchar_t not matching mask + * + * This function searches for and returns a pointer to the first + * wchar_t c of [__lo,__hi) for which is(__m,c) is false. + * + * do_scan_is() is a hook for a derived facet to change the behavior of + * match searching. do_is() must always return the same result for the + * same input. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a non-matching wchar_t if found, else @a __hi. + */ + virtual const char_type* + do_scan_not(mask __m, const char_type* __lo, + const char_type* __hi) const; + + /** + * @brief Convert to uppercase. + * + * This virtual function converts the wchar_t argument to uppercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __c The wchar_t to convert. + * @return The uppercase wchar_t if convertible, else @a __c. + */ + virtual char_type + do_toupper(char_type __c) const; + + /** + * @brief Convert array to uppercase. + * + * This virtual function converts each wchar_t in the range [lo,hi) to + * uppercase if possible. Other elements remain untouched. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_toupper(char_type* __lo, const char_type* __hi) const; + + /** + * @brief Convert to lowercase. + * + * This virtual function converts the argument to lowercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __c The wchar_t to convert. + * @return The lowercase wchar_t if convertible, else @a __c. + */ + virtual char_type + do_tolower(char_type __c) const; + + /** + * @brief Convert array to lowercase. + * + * This virtual function converts each wchar_t in the range [lo,hi) to + * lowercase if possible. Other elements remain untouched. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_tolower(char_type* __lo, const char_type* __hi) const; + + /** + * @brief Widen char to wchar_t + * + * This virtual function converts the char to wchar_t using the + * simplest reasonable transformation. For an underived ctype + * facet, the argument will be cast to wchar_t. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted wchar_t. + */ + virtual char_type + do_widen(char __c) const; + + /** + * @brief Widen char array to wchar_t array + * + * This function converts each char in the input to wchar_t using the + * simplest reasonable transformation. For an underived ctype + * facet, the argument will be copied, casting each element to wchar_t. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char* + do_widen(const char* __lo, const char* __hi, char_type* __to) const; + + /** + * @brief Narrow wchar_t to char + * + * This virtual function converts the argument to char using + * the simplest reasonable transformation. If the conversion + * fails, dfault is returned instead. For an underived + * ctype facet, @a c will be cast to char and + * returned. + * + * do_narrow() is a hook for a derived facet to change the + * behavior of narrowing. do_narrow() must always return the + * same result for the same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The wchar_t to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted char. + */ + virtual char + do_narrow(char_type __c, char __dfault) const; + + /** + * @brief Narrow wchar_t array to char array + * + * This virtual function converts each wchar_t in the range [lo,hi) to + * char using the simplest reasonable transformation and writes the + * results to the destination array. For any wchar_t in the input that + * cannot be converted, @a dfault is used instead. For an underived + * ctype facet, the argument will be copied, casting each + * element to char. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char_type* + do_narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const; + + // For use at construction time only. + void + _M_initialize_ctype() throw(); + }; +#endif //_GLIBCXX_USE_WCHAR_T + + /// class ctype_byname [22.2.1.2]. + template + class ctype_byname : public ctype<_CharT> + { + public: + typedef typename ctype<_CharT>::mask mask; + + explicit + ctype_byname(const char* __s, size_t __refs = 0); + +#if __cplusplus >= 201103L + explicit + ctype_byname(const string& __s, size_t __refs = 0) + : ctype_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~ctype_byname() { } + }; + + /// 22.2.1.4 Class ctype_byname specializations. + template<> + class ctype_byname : public ctype + { + public: + explicit + ctype_byname(const char* __s, size_t __refs = 0); + +#if __cplusplus >= 201103L + explicit + ctype_byname(const string& __s, size_t __refs = 0); +#endif + + protected: + virtual + ~ctype_byname(); + }; + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + class ctype_byname : public ctype + { + public: + explicit + ctype_byname(const char* __s, size_t __refs = 0); + +#if __cplusplus >= 201103L + explicit + ctype_byname(const string& __s, size_t __refs = 0); +#endif + + protected: + virtual + ~ctype_byname(); + }; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +// Include host and configuration specific ctype inlines. +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 22.2.2 The numeric category. + class __num_base + { + public: + // NB: Code depends on the order of _S_atoms_out elements. + // Below are the indices into _S_atoms_out. + enum + { + _S_ominus, + _S_oplus, + _S_ox, + _S_oX, + _S_odigits, + _S_odigits_end = _S_odigits + 16, + _S_oudigits = _S_odigits_end, + _S_oudigits_end = _S_oudigits + 16, + _S_oe = _S_odigits + 14, // For scientific notation, 'e' + _S_oE = _S_oudigits + 14, // For scientific notation, 'E' + _S_oend = _S_oudigits_end + }; + + // A list of valid numeric literals for output. This array + // contains chars that will be passed through the current locale's + // ctype<_CharT>.widen() and then used to render numbers. + // For the standard "C" locale, this is + // "-+xX0123456789abcdef0123456789ABCDEF". + static const char* _S_atoms_out; + + // String literal of acceptable (narrow) input, for num_get. + // "-+xX0123456789abcdefABCDEF" + static const char* _S_atoms_in; + + enum + { + _S_iminus, + _S_iplus, + _S_ix, + _S_iX, + _S_izero, + _S_ie = _S_izero + 14, + _S_iE = _S_izero + 20, + _S_iend = 26 + }; + + // num_put + // Construct and return valid scanf format for floating point types. + static void + _S_format_float(const ios_base& __io, char* __fptr, char __mod) throw(); + }; + + template + struct __numpunct_cache : public locale::facet + { + const char* _M_grouping; + size_t _M_grouping_size; + bool _M_use_grouping; + const _CharT* _M_truename; + size_t _M_truename_size; + const _CharT* _M_falsename; + size_t _M_falsename_size; + _CharT _M_decimal_point; + _CharT _M_thousands_sep; + + // A list of valid numeric literals for output: in the standard + // "C" locale, this is "-+xX0123456789abcdef0123456789ABCDEF". + // This array contains the chars after having been passed + // through the current locale's ctype<_CharT>.widen(). + _CharT _M_atoms_out[__num_base::_S_oend]; + + // A list of valid numeric literals for input: in the standard + // "C" locale, this is "-+xX0123456789abcdefABCDEF" + // This array contains the chars after having been passed + // through the current locale's ctype<_CharT>.widen(). + _CharT _M_atoms_in[__num_base::_S_iend]; + + bool _M_allocated; + + __numpunct_cache(size_t __refs = 0) + : facet(__refs), _M_grouping(0), _M_grouping_size(0), + _M_use_grouping(false), + _M_truename(0), _M_truename_size(0), _M_falsename(0), + _M_falsename_size(0), _M_decimal_point(_CharT()), + _M_thousands_sep(_CharT()), _M_allocated(false) + { } + + ~__numpunct_cache(); + + void + _M_cache(const locale& __loc); + + private: + __numpunct_cache& + operator=(const __numpunct_cache&); + + explicit + __numpunct_cache(const __numpunct_cache&); + }; + + template + __numpunct_cache<_CharT>::~__numpunct_cache() + { + if (_M_allocated) + { + delete [] _M_grouping; + delete [] _M_truename; + delete [] _M_falsename; + } + } + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @brief Primary class template numpunct. + * @ingroup locales + * + * This facet stores several pieces of information related to printing and + * scanning numbers, such as the decimal point character. It takes a + * template parameter specifying the char type. The numpunct facet is + * used by streams for many I/O operations involving numbers. + * + * The numpunct template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from a numpunct facet. + */ + template + class numpunct : public locale::facet + { + public: + // Types: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + ///@} + typedef __numpunct_cache<_CharT> __cache_type; + + protected: + __cache_type* _M_data; + + public: + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Numpunct constructor. + * + * @param __refs Refcount to pass to the base class. + */ + explicit + numpunct(size_t __refs = 0) + : facet(__refs), _M_data(0) + { _M_initialize_numpunct(); } + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up the + * predefined locale facets. + * + * @param __cache __numpunct_cache object. + * @param __refs Refcount to pass to the base class. + */ + explicit + numpunct(__cache_type* __cache, size_t __refs = 0) + : facet(__refs), _M_data(__cache) + { _M_initialize_numpunct(); } + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __refs Refcount to pass to the base class. + */ + explicit + numpunct(__c_locale __cloc, size_t __refs = 0) + : facet(__refs), _M_data(0) + { _M_initialize_numpunct(__cloc); } + + /** + * @brief Return decimal point character. + * + * This function returns a char_type to use as a decimal point. It + * does so by returning returning + * numpunct::do_decimal_point(). + * + * @return @a char_type representing a decimal point. + */ + char_type + decimal_point() const + { return this->do_decimal_point(); } + + /** + * @brief Return thousands separator character. + * + * This function returns a char_type to use as a thousands + * separator. It does so by returning returning + * numpunct::do_thousands_sep(). + * + * @return char_type representing a thousands separator. + */ + char_type + thousands_sep() const + { return this->do_thousands_sep(); } + + /** + * @brief Return grouping specification. + * + * This function returns a string representing groupings for the + * integer part of a number. Groupings indicate where thousands + * separators should be inserted in the integer part of a number. + * + * Each char in the return string is interpret as an integer + * rather than a character. These numbers represent the number + * of digits in a group. The first char in the string + * represents the number of digits in the least significant + * group. If a char is negative, it indicates an unlimited + * number of digits for the group. If more chars from the + * string are required to group a number, the last char is used + * repeatedly. + * + * For example, if the grouping() returns "\003\002" and is + * applied to the number 123456789, this corresponds to + * 12,34,56,789. Note that if the string was "32", this would + * put more than 50 digits into the least significant group if + * the character set is ASCII. + * + * The string is returned by calling + * numpunct::do_grouping(). + * + * @return string representing grouping specification. + */ + string + grouping() const + { return this->do_grouping(); } + + /** + * @brief Return string representation of bool true. + * + * This function returns a string_type containing the text + * representation for true bool variables. It does so by calling + * numpunct::do_truename(). + * + * @return string_type representing printed form of true. + */ + string_type + truename() const + { return this->do_truename(); } + + /** + * @brief Return string representation of bool false. + * + * This function returns a string_type containing the text + * representation for false bool variables. It does so by calling + * numpunct::do_falsename(). + * + * @return string_type representing printed form of false. + */ + string_type + falsename() const + { return this->do_falsename(); } + + protected: + /// Destructor. + virtual + ~numpunct(); + + /** + * @brief Return decimal point character. + * + * Returns a char_type to use as a decimal point. This function is a + * hook for derived classes to change the value returned. + * + * @return @a char_type representing a decimal point. + */ + virtual char_type + do_decimal_point() const + { return _M_data->_M_decimal_point; } + + /** + * @brief Return thousands separator character. + * + * Returns a char_type to use as a thousands separator. This function + * is a hook for derived classes to change the value returned. + * + * @return @a char_type representing a thousands separator. + */ + virtual char_type + do_thousands_sep() const + { return _M_data->_M_thousands_sep; } + + /** + * @brief Return grouping specification. + * + * Returns a string representing groupings for the integer part of a + * number. This function is a hook for derived classes to change the + * value returned. @see grouping() for details. + * + * @return String representing grouping specification. + */ + virtual string + do_grouping() const + { return _M_data->_M_grouping; } + + /** + * @brief Return string representation of bool true. + * + * Returns a string_type containing the text representation for true + * bool variables. This function is a hook for derived classes to + * change the value returned. + * + * @return string_type representing printed form of true. + */ + virtual string_type + do_truename() const + { return _M_data->_M_truename; } + + /** + * @brief Return string representation of bool false. + * + * Returns a string_type containing the text representation for false + * bool variables. This function is a hook for derived classes to + * change the value returned. + * + * @return string_type representing printed form of false. + */ + virtual string_type + do_falsename() const + { return _M_data->_M_falsename; } + + // For use at construction time only. + void + _M_initialize_numpunct(__c_locale __cloc = 0); + }; + + template + locale::id numpunct<_CharT>::id; + + template<> + numpunct::~numpunct(); + + template<> + void + numpunct::_M_initialize_numpunct(__c_locale __cloc); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + numpunct::~numpunct(); + + template<> + void + numpunct::_M_initialize_numpunct(__c_locale __cloc); +#endif + + /// class numpunct_byname [22.2.3.2]. + template + class numpunct_byname : public numpunct<_CharT> + { + public: + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + + explicit + numpunct_byname(const char* __s, size_t __refs = 0) + : numpunct<_CharT>(__refs) + { + if (__builtin_strcmp(__s, "C") != 0 + && __builtin_strcmp(__s, "POSIX") != 0) + { + __c_locale __tmp; + this->_S_create_c_locale(__tmp, __s); + this->_M_initialize_numpunct(__tmp); + this->_S_destroy_c_locale(__tmp); + } + } + +#if __cplusplus >= 201103L + explicit + numpunct_byname(const string& __s, size_t __refs = 0) + : numpunct_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~numpunct_byname() { } + }; + +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_BEGIN_NAMESPACE_LDBL + + /** + * @brief Primary class template num_get. + * @ingroup locales + * + * This facet encapsulates the code to parse and return a number + * from a string. It is used by the istream numeric extraction + * operators. + * + * The num_get template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from the num_get facet. + */ + template + class num_get : public locale::facet + { + public: + // Types: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef _InIter iter_type; + ///@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + num_get(size_t __refs = 0) : facet(__refs) { } + + /** + * @brief Numeric parsing. + * + * Parses the input stream into the bool @a v. It does so by calling + * num_get::do_get(). + * + * If ios_base::boolalpha is set, attempts to read + * ctype::truename() or ctype::falsename(). Sets + * @a v to true or false if successful. Sets err to + * ios_base::failbit if reading the string fails. Sets err to + * ios_base::eofbit if the stream is emptied. + * + * If ios_base::boolalpha is not set, proceeds as with reading a long, + * except if the value is 1, sets @a v to true, if the value is 0, sets + * @a v to false, and otherwise set err to ios_base::failbit. + * + * @param __in Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, bool& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + ///@{ + /** + * @brief Numeric parsing. + * + * Parses the input stream into the integral variable @a v. It does so + * by calling num_get::do_get(). + * + * Parsing is affected by the flag settings in @a io. + * + * The basic parse is affected by the value of io.flags() & + * ios_base::basefield. If equal to ios_base::oct, parses like the + * scanf %o specifier. Else if equal to ios_base::hex, parses like %X + * specifier. Else if basefield equal to 0, parses like the %i + * specifier. Otherwise, parses like %d for signed and %u for unsigned + * types. The matching type length modifier is also used. + * + * Digit grouping is interpreted according to + * numpunct::grouping() and numpunct::thousands_sep(). If the + * pattern of digit groups isn't consistent, sets err to + * ios_base::failbit. + * + * If parsing the string yields a valid value for @a v, @a v is set. + * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. + * Sets err to ios_base::eofbit if the stream is emptied. + * + * @param __in Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned short& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned int& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned long& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + +#ifdef _GLIBCXX_USE_LONG_LONG +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long long& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned long long& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } +#pragma GCC diagnostic pop +#endif + ///@} + + ///@{ + /** + * @brief Numeric parsing. + * + * Parses the input stream into the integral variable @a v. It does so + * by calling num_get::do_get(). + * + * The input characters are parsed like the scanf %g specifier. The + * matching type length modifier is also used. + * + * The decimal point character used is numpunct::decimal_point(). + * Digit grouping is interpreted according to + * numpunct::grouping() and numpunct::thousands_sep(). If the + * pattern of digit groups isn't consistent, sets err to + * ios_base::failbit. + * + * If parsing the string yields a valid value for @a v, @a v is set. + * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. + * Sets err to ios_base::eofbit if the stream is emptied. + * + * @param __in Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, float& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, double& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long double& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + ///@} + + /** + * @brief Numeric parsing. + * + * Parses the input stream into the pointer variable @a v. It does so + * by calling num_get::do_get(). + * + * The input characters are parsed like the scanf %p specifier. + * + * Digit grouping is interpreted according to + * numpunct::grouping() and numpunct::thousands_sep(). If the + * pattern of digit groups isn't consistent, sets err to + * ios_base::failbit. + * + * Note that the digit grouping effect for pointers is a bit ambiguous + * in the standard and shouldn't be relied on. See DR 344. + * + * If parsing the string yields a valid value for @a v, @a v is set. + * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. + * Sets err to ios_base::eofbit if the stream is emptied. + * + * @param __in Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, void*& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + protected: + /// Destructor. + virtual ~num_get() { } + + _GLIBCXX_DEFAULT_ABI_TAG + iter_type + _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&, + string&) const; + + template + _GLIBCXX_DEFAULT_ABI_TAG + iter_type + _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&, + _ValueT&) const; + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type + _M_find(const _CharT2*, size_t __len, _CharT2 __c) const + { + int __ret = -1; + if (__len <= 10) + { + if (__c >= _CharT2('0') && __c < _CharT2(_CharT2('0') + __len)) + __ret = __c - _CharT2('0'); + } + else + { + if (__c >= _CharT2('0') && __c <= _CharT2('9')) + __ret = __c - _CharT2('0'); + else if (__c >= _CharT2('a') && __c <= _CharT2('f')) + __ret = 10 + (__c - _CharT2('a')); + else if (__c >= _CharT2('A') && __c <= _CharT2('F')) + __ret = 10 + (__c - _CharT2('A')); + } + return __ret; + } + + template + typename __gnu_cxx::__enable_if::__value, + int>::__type + _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const + { + int __ret = -1; + const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c); + if (__q) + { + __ret = __q - __zero; + if (__ret > 15) + __ret -= 6; + } + return __ret; + } + + ///@{ + /** + * @brief Numeric parsing. + * + * Parses the input stream into the variable @a v. This function is a + * hook for derived classes to change the value returned. @see get() + * for more details. + * + * @param __beg Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const; + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned short& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned int& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned long& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + +#ifdef _GLIBCXX_USE_LONG_LONG +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long long& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned long long& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } +#pragma GCC diagnostic pop +#endif + + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, float&) const; + + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, + double&) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + // For __gnu_cxx_ldbl128::num_get and __gnu_cxx_ieee128::num_get + // this entry in the vtable is for a 64-bit "long double" with the + // same format as double. This keeps the vtable layout consistent + // with std::num_get (visible when -mlong-double-64 is used). + virtual iter_type + __do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, + double&) const; +#else + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, + long double&) const; +#endif + + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, void*&) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ + // For __gnu_cxx_ieee128::num_get this entry in the vtable is for + // the non-IEEE 128-bit "long double" (aka "double double"). This + // is consistent with __gnu_cxx_ldbl128::num_get (-mabi=ibmlongdouble) + virtual iter_type + __do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, + __ibm128&) const; +#endif + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + // For __gnu_cxx_ldbl128::num_get and __gnu_cxx_ieee128::num_get + // this entry in the vtable is for the 128-bit "long double" type. + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, + long double&) const; +#endif + ///@} + }; + + template + locale::id num_get<_CharT, _InIter>::id; + + + /** + * @brief Primary class template num_put. + * @ingroup locales + * + * This facet encapsulates the code to convert a number to a string. It is + * used by the ostream numeric insertion operators. + * + * The num_put template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from the num_put facet. + */ + template + class num_put : public locale::facet + { + public: + // Types: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef _OutIter iter_type; + ///@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + num_put(size_t __refs = 0) : facet(__refs) { } + + /** + * @brief Numeric formatting. + * + * Formats the boolean @a v and inserts it into a stream. It does so + * by calling num_put::do_put(). + * + * If ios_base::boolalpha is set, writes ctype::truename() or + * ctype::falsename(). Otherwise formats @a v as an int. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const + { return this->do_put(__s, __io, __fill, __v); } + + ///@{ + /** + * @brief Numeric formatting. + * + * Formats the integral value @a v and inserts it into a + * stream. It does so by calling num_put::do_put(). + * + * Formatting is affected by the flag settings in @a io. + * + * The basic format is affected by the value of io.flags() & + * ios_base::basefield. If equal to ios_base::oct, formats like the + * printf %o specifier. Else if equal to ios_base::hex, formats like + * %x or %X with ios_base::uppercase unset or set respectively. + * Otherwise, formats like %d, %ld, %lld for signed and %u, %lu, %llu + * for unsigned values. Note that if both oct and hex are set, neither + * will take effect. + * + * If ios_base::showpos is set, '+' is output before positive values. + * If ios_base::showbase is set, '0' precedes octal values (except 0) + * and '0[xX]' precedes hex values. + * + * The decimal point character used is numpunct::decimal_point(). + * Thousands separators are inserted according to + * numpunct::grouping() and numpunct::thousands_sep(). + * + * If io.width() is non-zero, enough @a fill characters are inserted to + * make the result at least that wide. If + * (io.flags() & ios_base::adjustfield) == ios_base::left, result is + * padded at the end. If ios_base::internal, then padding occurs + * immediately after either a '+' or '-' or after '0x' or '0X'. + * Otherwise, padding occurs at the beginning. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, long __v) const + { return this->do_put(__s, __io, __fill, __v); } + + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + unsigned long __v) const + { return this->do_put(__s, __io, __fill, __v); } + +#ifdef _GLIBCXX_USE_LONG_LONG +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const + { return this->do_put(__s, __io, __fill, __v); } + + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + unsigned long long __v) const + { return this->do_put(__s, __io, __fill, __v); } +#pragma GCC diagnostic pop +#endif + ///@} + + ///@{ + /** + * @brief Numeric formatting. + * + * Formats the floating point value @a v and inserts it into a stream. + * It does so by calling num_put::do_put(). + * + * Formatting is affected by the flag settings in @a io. + * + * The basic format is affected by the value of io.flags() & + * ios_base::floatfield. If equal to ios_base::fixed, formats like the + * printf %f specifier. Else if equal to ios_base::scientific, formats + * like %e or %E with ios_base::uppercase unset or set respectively. + * Otherwise, formats like %g or %G depending on uppercase. Note that + * if both fixed and scientific are set, the effect will also be like + * %g or %G. + * + * The output precision is given by io.precision(). This precision is + * capped at numeric_limits::digits10 + 2 (different for double and + * long double). The default precision is 6. + * + * If ios_base::showpos is set, '+' is output before positive values. + * If ios_base::showpoint is set, a decimal point will always be + * output. + * + * The decimal point character used is numpunct::decimal_point(). + * Thousands separators are inserted according to + * numpunct::grouping() and numpunct::thousands_sep(). + * + * If io.width() is non-zero, enough @a fill characters are inserted to + * make the result at least that wide. If + * (io.flags() & ios_base::adjustfield) == ios_base::left, result is + * padded at the end. If ios_base::internal, then padding occurs + * immediately after either a '+' or '-' or after '0x' or '0X'. + * Otherwise, padding occurs at the beginning. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, double __v) const + { return this->do_put(__s, __io, __fill, __v); } + + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + long double __v) const + { return this->do_put(__s, __io, __fill, __v); } + ///@} + + /** + * @brief Numeric formatting. + * + * Formats the pointer value @a v and inserts it into a stream. It + * does so by calling num_put::do_put(). + * + * This function formats @a v as an unsigned long with ios_base::hex + * and ios_base::showbase set. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + const void* __v) const + { return this->do_put(__s, __io, __fill, __v); } + + protected: + template + iter_type + _M_insert_float(iter_type, ios_base& __io, char_type __fill, + char __mod, _ValueT __v) const; + + void + _M_group_float(const char* __grouping, size_t __grouping_size, + char_type __sep, const char_type* __p, char_type* __new, + char_type* __cs, int& __len) const; + + template + iter_type + _M_insert_int(iter_type, ios_base& __io, char_type __fill, + _ValueT __v) const; + + void + _M_group_int(const char* __grouping, size_t __grouping_size, + char_type __sep, ios_base& __io, char_type* __new, + char_type* __cs, int& __len) const; + + void + _M_pad(char_type __fill, streamsize __w, ios_base& __io, + char_type* __new, const char_type* __cs, int& __len) const; + + /// Destructor. + virtual + ~num_put() { } + + ///@{ + /** + * @brief Numeric formatting. + * + * These functions do the work of formatting numeric values and + * inserting them into a stream. This function is a hook for derived + * classes to change the value returned. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const; + + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const + { return _M_insert_int(__s, __io, __fill, __v); } + + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, + unsigned long __v) const + { return _M_insert_int(__s, __io, __fill, __v); } + +#ifdef _GLIBCXX_USE_LONG_LONG +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, + long long __v) const + { return _M_insert_int(__s, __io, __fill, __v); } + + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, + unsigned long long __v) const + { return _M_insert_int(__s, __io, __fill, __v); } +#pragma GCC diagnostic pop +#endif + + virtual iter_type + do_put(iter_type, ios_base&, char_type, double) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + virtual iter_type + __do_put(iter_type, ios_base&, char_type, double) const; +#else + virtual iter_type + do_put(iter_type, ios_base&, char_type, long double) const; +#endif + + virtual iter_type + do_put(iter_type, ios_base&, char_type, const void*) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ + virtual iter_type + __do_put(iter_type, ios_base&, char_type, __ibm128) const; +#endif + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + virtual iter_type + do_put(iter_type, ios_base&, char_type, long double) const; +#endif + ///@} + }; + + template + locale::id num_put<_CharT, _OutIter>::id; + +_GLIBCXX_END_NAMESPACE_LDBL + + // Subclause convenience interfaces, inlines. + // NB: These are inline because, when used in a loop, some compilers + // can hoist the body out of the loop; then it's just as fast as the + // C is*() function. + + /// Convenience interface to ctype.is(ctype_base::space, __c). + template + inline bool + isspace(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::space, __c); } + + /// Convenience interface to ctype.is(ctype_base::print, __c). + template + inline bool + isprint(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::print, __c); } + + /// Convenience interface to ctype.is(ctype_base::cntrl, __c). + template + inline bool + iscntrl(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::cntrl, __c); } + + /// Convenience interface to ctype.is(ctype_base::upper, __c). + template + inline bool + isupper(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::upper, __c); } + + /// Convenience interface to ctype.is(ctype_base::lower, __c). + template + inline bool + islower(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::lower, __c); } + + /// Convenience interface to ctype.is(ctype_base::alpha, __c). + template + inline bool + isalpha(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::alpha, __c); } + + /// Convenience interface to ctype.is(ctype_base::digit, __c). + template + inline bool + isdigit(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::digit, __c); } + + /// Convenience interface to ctype.is(ctype_base::punct, __c). + template + inline bool + ispunct(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::punct, __c); } + + /// Convenience interface to ctype.is(ctype_base::xdigit, __c). + template + inline bool + isxdigit(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::xdigit, __c); } + + /// Convenience interface to ctype.is(ctype_base::alnum, __c). + template + inline bool + isalnum(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::alnum, __c); } + + /// Convenience interface to ctype.is(ctype_base::graph, __c). + template + inline bool + isgraph(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::graph, __c); } + +#if __cplusplus >= 201103L + /// Convenience interface to ctype.is(ctype_base::blank, __c). + template + inline bool + isblank(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::blank, __c); } +#endif + + /// Convenience interface to ctype.toupper(__c). + template + inline _CharT + toupper(_CharT __c, const locale& __loc) + { return use_facet >(__loc).toupper(__c); } + + /// Convenience interface to ctype.tolower(__c). + template + inline _CharT + tolower(_CharT __c, const locale& __loc) + { return use_facet >(__loc).tolower(__c); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +# include + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.h.blob new file mode 100644 index 0000000..8f11d67 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.tcc new file mode 100644 index 0000000..c5f3411 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.tcc @@ -0,0 +1,1447 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_facets.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +#ifndef _LOCALE_FACETS_TCC +#define _LOCALE_FACETS_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Routine to access a cache for the facet. If the cache didn't + // exist before, it gets constructed on the fly. + template + struct __use_cache + { + const _Facet* + operator() (const locale& __loc) const; + }; + + // Specializations. + template + struct __use_cache<__numpunct_cache<_CharT> > + { + const __numpunct_cache<_CharT>* + operator() (const locale& __loc) const + { + const size_t __i = numpunct<_CharT>::id._M_id(); + const locale::facet** __caches = __loc._M_impl->_M_caches; + if (!__caches[__i]) + { + __numpunct_cache<_CharT>* __tmp = 0; + __try + { + __tmp = new __numpunct_cache<_CharT>; + __tmp->_M_cache(__loc); + } + __catch(...) + { + delete __tmp; + __throw_exception_again; + } + __loc._M_impl->_M_install_cache(__tmp, __i); + } + return static_cast*>(__caches[__i]); + } + }; + + template + void + __numpunct_cache<_CharT>::_M_cache(const locale& __loc) + { + const numpunct<_CharT>& __np = use_facet >(__loc); + + char* __grouping = 0; + _CharT* __truename = 0; + _CharT* __falsename = 0; + __try + { + const string& __g = __np.grouping(); + _M_grouping_size = __g.size(); + __grouping = new char[_M_grouping_size]; + __g.copy(__grouping, _M_grouping_size); + _M_use_grouping = (_M_grouping_size + && static_cast(__grouping[0]) > 0 + && (__grouping[0] + != __gnu_cxx::__numeric_traits::__max)); + + const basic_string<_CharT>& __tn = __np.truename(); + _M_truename_size = __tn.size(); + __truename = new _CharT[_M_truename_size]; + __tn.copy(__truename, _M_truename_size); + + const basic_string<_CharT>& __fn = __np.falsename(); + _M_falsename_size = __fn.size(); + __falsename = new _CharT[_M_falsename_size]; + __fn.copy(__falsename, _M_falsename_size); + + _M_decimal_point = __np.decimal_point(); + _M_thousands_sep = __np.thousands_sep(); + + const ctype<_CharT>& __ct = use_facet >(__loc); + __ct.widen(__num_base::_S_atoms_out, + __num_base::_S_atoms_out + + __num_base::_S_oend, _M_atoms_out); + __ct.widen(__num_base::_S_atoms_in, + __num_base::_S_atoms_in + + __num_base::_S_iend, _M_atoms_in); + + _M_grouping = __grouping; + _M_truename = __truename; + _M_falsename = __falsename; + _M_allocated = true; + } + __catch(...) + { + delete [] __grouping; + delete [] __truename; + delete [] __falsename; + __throw_exception_again; + } + } + + // Used by both numeric and monetary facets. + // Check to make sure that the __grouping_tmp string constructed in + // money_get or num_get matches the canonical grouping for a given + // locale. + // __grouping_tmp is parsed L to R + // 1,222,444 == __grouping_tmp of "\1\3\3" + // __grouping is parsed R to L + // 1,222,444 == __grouping of "\3" == "\3\3\3" + _GLIBCXX_PURE bool + __verify_grouping(const char* __grouping, size_t __grouping_size, + const string& __grouping_tmp) throw (); + +_GLIBCXX_BEGIN_NAMESPACE_LDBL + + template + _GLIBCXX_DEFAULT_ABI_TAG + _InIter + num_get<_CharT, _InIter>:: + _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io, + ios_base::iostate& __err, string& __xtrc) const + { + typedef char_traits<_CharT> __traits_type; + typedef __numpunct_cache<_CharT> __cache_type; + __use_cache<__cache_type> __uc; + const locale& __loc = __io._M_getloc(); + const __cache_type* __lc = __uc(__loc); + const _CharT* __lit = __lc->_M_atoms_in; + char_type __c = char_type(); + + // True if __beg becomes equal to __end. + bool __testeof = __beg == __end; + + // First check for sign. + if (!__testeof) + { + __c = *__beg; + const bool __plus = __c == __lit[__num_base::_S_iplus]; + if ((__plus || __c == __lit[__num_base::_S_iminus]) + && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) + && !(__c == __lc->_M_decimal_point)) + { + __xtrc += __plus ? '+' : '-'; + if (++__beg != __end) + __c = *__beg; + else + __testeof = true; + } + } + + // Next, look for leading zeros. + bool __found_mantissa = false; + int __sep_pos = 0; + while (!__testeof) + { + if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) + || __c == __lc->_M_decimal_point) + break; + else if (__c == __lit[__num_base::_S_izero]) + { + if (!__found_mantissa) + { + __xtrc += '0'; + __found_mantissa = true; + } + ++__sep_pos; + + if (++__beg != __end) + __c = *__beg; + else + __testeof = true; + } + else + break; + } + + // Only need acceptable digits for floating point numbers. + bool __found_dec = false; + bool __found_sci = false; + string __found_grouping; + if (__lc->_M_use_grouping) + __found_grouping.reserve(32); + const char_type* __lit_zero = __lit + __num_base::_S_izero; + + if (!__lc->_M_allocated) + // "C" locale + while (!__testeof) + { + const int __digit = _M_find(__lit_zero, 10, __c); + if (__digit != -1) + { + __xtrc += '0' + __digit; + __found_mantissa = true; + } + else if (__c == __lc->_M_decimal_point + && !__found_dec && !__found_sci) + { + __xtrc += '.'; + __found_dec = true; + } + else if ((__c == __lit[__num_base::_S_ie] + || __c == __lit[__num_base::_S_iE]) + && !__found_sci && __found_mantissa) + { + // Scientific notation. + __xtrc += 'e'; + __found_sci = true; + + // Remove optional plus or minus sign, if they exist. + if (++__beg != __end) + { + __c = *__beg; + const bool __plus = __c == __lit[__num_base::_S_iplus]; + if (__plus || __c == __lit[__num_base::_S_iminus]) + __xtrc += __plus ? '+' : '-'; + else + continue; + } + else + { + __testeof = true; + break; + } + } + else + break; + + if (++__beg != __end) + __c = *__beg; + else + __testeof = true; + } + else + while (!__testeof) + { + // According to 22.2.2.1.2, p8-9, first look for thousands_sep + // and decimal_point. + if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) + { + if (!__found_dec && !__found_sci) + { + // NB: Thousands separator at the beginning of a string + // is a no-no, as is two consecutive thousands separators. + if (__sep_pos) + { + __found_grouping += static_cast(__sep_pos); + __sep_pos = 0; + } + else + { + // NB: __convert_to_v will not assign __v and will + // set the failbit. + __xtrc.clear(); + break; + } + } + else + break; + } + else if (__c == __lc->_M_decimal_point) + { + if (!__found_dec && !__found_sci) + { + // If no grouping chars are seen, no grouping check + // is applied. Therefore __found_grouping is adjusted + // only if decimal_point comes after some thousands_sep. + if (__found_grouping.size()) + __found_grouping += static_cast(__sep_pos); + __xtrc += '.'; + __found_dec = true; + } + else + break; + } + else + { + const char_type* __q = + __traits_type::find(__lit_zero, 10, __c); + if (__q) + { + __xtrc += '0' + (__q - __lit_zero); + __found_mantissa = true; + ++__sep_pos; + } + else if ((__c == __lit[__num_base::_S_ie] + || __c == __lit[__num_base::_S_iE]) + && !__found_sci && __found_mantissa) + { + // Scientific notation. + if (__found_grouping.size() && !__found_dec) + __found_grouping += static_cast(__sep_pos); + __xtrc += 'e'; + __found_sci = true; + + // Remove optional plus or minus sign, if they exist. + if (++__beg != __end) + { + __c = *__beg; + const bool __plus = __c == __lit[__num_base::_S_iplus]; + if ((__plus || __c == __lit[__num_base::_S_iminus]) + && !(__lc->_M_use_grouping + && __c == __lc->_M_thousands_sep) + && !(__c == __lc->_M_decimal_point)) + __xtrc += __plus ? '+' : '-'; + else + continue; + } + else + { + __testeof = true; + break; + } + } + else + break; + } + + if (++__beg != __end) + __c = *__beg; + else + __testeof = true; + } + + // Digit grouping is checked. If grouping and found_grouping don't + // match, then get very very upset, and set failbit. + if (__found_grouping.size()) + { + // Add the ending grouping if a decimal or 'e'/'E' wasn't found. + if (!__found_dec && !__found_sci) + __found_grouping += static_cast(__sep_pos); + + if (!std::__verify_grouping(__lc->_M_grouping, + __lc->_M_grouping_size, + __found_grouping)) + __err = ios_base::failbit; + } + + return __beg; + } + + template + template + _GLIBCXX_DEFAULT_ABI_TAG + _InIter + num_get<_CharT, _InIter>:: + _M_extract_int(_InIter __beg, _InIter __end, ios_base& __io, + ios_base::iostate& __err, _ValueT& __v) const + { + typedef char_traits<_CharT> __traits_type; + using __gnu_cxx::__add_unsigned; + typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; + typedef __numpunct_cache<_CharT> __cache_type; + __use_cache<__cache_type> __uc; + const locale& __loc = __io._M_getloc(); + const __cache_type* __lc = __uc(__loc); + const _CharT* __lit = __lc->_M_atoms_in; + char_type __c = char_type(); + + // NB: Iff __basefield == 0, __base can change based on contents. + const ios_base::fmtflags __basefield = __io.flags() + & ios_base::basefield; + const bool __oct = __basefield == ios_base::oct; + int __base = __oct ? 8 : (__basefield == ios_base::hex ? 16 : 10); + + // True if __beg becomes equal to __end. + bool __testeof = __beg == __end; + + // First check for sign. + bool __negative = false; + if (!__testeof) + { + __c = *__beg; + __negative = __c == __lit[__num_base::_S_iminus]; + if ((__negative || __c == __lit[__num_base::_S_iplus]) + && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) + && !(__c == __lc->_M_decimal_point)) + { + if (++__beg != __end) + __c = *__beg; + else + __testeof = true; + } + } + + // Next, look for leading zeros and check required digits + // for base formats. + bool __found_zero = false; + int __sep_pos = 0; + while (!__testeof) + { + if ((__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) + || __c == __lc->_M_decimal_point) + break; + else if (__c == __lit[__num_base::_S_izero] + && (!__found_zero || __base == 10)) + { + __found_zero = true; + ++__sep_pos; + if (__basefield == 0) + __base = 8; + if (__base == 8) + __sep_pos = 0; + } + else if (__found_zero + && (__c == __lit[__num_base::_S_ix] + || __c == __lit[__num_base::_S_iX])) + { + if (__basefield == 0) + __base = 16; + if (__base == 16) + { + __found_zero = false; + __sep_pos = 0; + } + else + break; + } + else + break; + + if (++__beg != __end) + { + __c = *__beg; + if (!__found_zero) + break; + } + else + __testeof = true; + } + + // At this point, base is determined. If not hex, only allow + // base digits as valid input. + const size_t __len = (__base == 16 ? __num_base::_S_iend + - __num_base::_S_izero : __base); + + // Extract. + typedef __gnu_cxx::__numeric_traits<_ValueT> __num_traits; + string __found_grouping; + if (__lc->_M_use_grouping) + __found_grouping.reserve(32); + bool __testfail = false; + bool __testoverflow = false; + const __unsigned_type __max = + (__negative && __num_traits::__is_signed) + ? -static_cast<__unsigned_type>(__num_traits::__min) + : __num_traits::__max; + const __unsigned_type __smax = __max / __base; + __unsigned_type __result = 0; + int __digit = 0; + const char_type* __lit_zero = __lit + __num_base::_S_izero; + + if (!__lc->_M_allocated) + // "C" locale + while (!__testeof) + { + __digit = _M_find(__lit_zero, __len, __c); + if (__digit == -1) + break; + + if (__result > __smax) + __testoverflow = true; + else + { + __result *= __base; + __testoverflow |= __result > __max - __digit; + __result += __digit; + ++__sep_pos; + } + + if (++__beg != __end) + __c = *__beg; + else + __testeof = true; + } + else + while (!__testeof) + { + // According to 22.2.2.1.2, p8-9, first look for thousands_sep + // and decimal_point. + if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) + { + // NB: Thousands separator at the beginning of a string + // is a no-no, as is two consecutive thousands separators. + if (__sep_pos) + { + __found_grouping += static_cast(__sep_pos); + __sep_pos = 0; + } + else + { + __testfail = true; + break; + } + } + else if (__c == __lc->_M_decimal_point) + break; + else + { + const char_type* __q = + __traits_type::find(__lit_zero, __len, __c); + if (!__q) + break; + + __digit = __q - __lit_zero; + if (__digit > 15) + __digit -= 6; + if (__result > __smax) + __testoverflow = true; + else + { + __result *= __base; + __testoverflow |= __result > __max - __digit; + __result += __digit; + ++__sep_pos; + } + } + + if (++__beg != __end) + __c = *__beg; + else + __testeof = true; + } + + // Digit grouping is checked. If grouping and found_grouping don't + // match, then get very very upset, and set failbit. + if (__found_grouping.size()) + { + // Add the ending grouping. + __found_grouping += static_cast(__sep_pos); + + if (!std::__verify_grouping(__lc->_M_grouping, + __lc->_M_grouping_size, + __found_grouping)) + __err = ios_base::failbit; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 23. Num_get overflow result. + if ((!__sep_pos && !__found_zero && !__found_grouping.size()) + || __testfail) + { + __v = 0; + __err = ios_base::failbit; + } + else if (__testoverflow) + { + if (__negative && __num_traits::__is_signed) + __v = __num_traits::__min; + else + __v = __num_traits::__max; + __err = ios_base::failbit; + } + else + __v = __negative ? -__result : __result; + + if (__testeof) + __err |= ios_base::eofbit; + return __beg; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 17. Bad bool parsing + template + _InIter + num_get<_CharT, _InIter>:: + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, bool& __v) const + { + if (!(__io.flags() & ios_base::boolalpha)) + { + // Parse bool values as long. + // NB: We can't just call do_get(long) here, as it might + // refer to a derived class. + long __l = -1; + __beg = _M_extract_int(__beg, __end, __io, __err, __l); + if (__l == 0 || __l == 1) + __v = bool(__l); + else + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 23. Num_get overflow result. + __v = true; + __err = ios_base::failbit; + if (__beg == __end) + __err |= ios_base::eofbit; + } + } + else + { + // Parse bool values as alphanumeric. + typedef __numpunct_cache<_CharT> __cache_type; + __use_cache<__cache_type> __uc; + const locale& __loc = __io._M_getloc(); + const __cache_type* __lc = __uc(__loc); + + bool __testf = true; + bool __testt = true; + bool __donef = __lc->_M_falsename_size == 0; + bool __donet = __lc->_M_truename_size == 0; + bool __testeof = false; + size_t __n = 0; + while (!__donef || !__donet) + { + if (__beg == __end) + { + __testeof = true; + break; + } + + const char_type __c = *__beg; + + if (!__donef) + __testf = __c == __lc->_M_falsename[__n]; + + if (!__testf && __donet) + break; + + if (!__donet) + __testt = __c == __lc->_M_truename[__n]; + + if (!__testt && __donef) + break; + + if (!__testt && !__testf) + break; + + ++__n; + ++__beg; + + __donef = !__testf || __n >= __lc->_M_falsename_size; + __donet = !__testt || __n >= __lc->_M_truename_size; + } + if (__testf && __n == __lc->_M_falsename_size && __n) + { + __v = false; + if (__testt && __n == __lc->_M_truename_size) + __err = ios_base::failbit; + else + __err = __testeof ? ios_base::eofbit : ios_base::goodbit; + } + else if (__testt && __n == __lc->_M_truename_size && __n) + { + __v = true; + __err = __testeof ? ios_base::eofbit : ios_base::goodbit; + } + else + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 23. Num_get overflow result. + __v = false; + __err = ios_base::failbit; + if (__testeof) + __err |= ios_base::eofbit; + } + } + return __beg; + } + + template + _InIter + num_get<_CharT, _InIter>:: + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, float& __v) const + { + string __xtrc; + __xtrc.reserve(32); + __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); + std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + + template + _InIter + num_get<_CharT, _InIter>:: + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, double& __v) const + { + string __xtrc; + __xtrc.reserve(32); + __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); + std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + template + _InIter + num_get<_CharT, _InIter>:: + __do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, double& __v) const + { + string __xtrc; + __xtrc.reserve(32); + __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); + std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } +#endif + + template + _InIter + num_get<_CharT, _InIter>:: + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long double& __v) const + { + string __xtrc; + __xtrc.reserve(32); + __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); + std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + + template + _InIter + num_get<_CharT, _InIter>:: + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, void*& __v) const + { + // Prepare for hex formatted input. + typedef ios_base::fmtflags fmtflags; + const fmtflags __fmt = __io.flags(); + __io.flags((__fmt & ~ios_base::basefield) | ios_base::hex); + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + typedef __gnu_cxx::__conditional_type<(sizeof(void*) + <= sizeof(unsigned long)), + unsigned long, unsigned long long>::__type _UIntPtrType; +#pragma GCC diagnostic pop + + _UIntPtrType __ul; + __beg = _M_extract_int(__beg, __end, __io, __err, __ul); + + // Reset from hex formatted input. + __io.flags(__fmt); + + __v = reinterpret_cast(__ul); + return __beg; + } + +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ + template + _InIter + num_get<_CharT, _InIter>:: + __do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, __ibm128& __v) const + { + string __xtrc; + __xtrc.reserve(32); + __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc); + std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale()); + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } +#endif + + // For use by integer and floating-point types after they have been + // converted into a char_type string. + template + void + num_put<_CharT, _OutIter>:: + _M_pad(_CharT __fill, streamsize __w, ios_base& __io, + _CharT* __new, const _CharT* __cs, int& __len) const + { + // [22.2.2.2.2] Stage 3. + // If necessary, pad. + __pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new, + __cs, __w, __len); + __len = static_cast(__w); + } + +_GLIBCXX_END_NAMESPACE_LDBL + + template + int + __int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit, + ios_base::fmtflags __flags, bool __dec) + { + _CharT* __buf = __bufend; + if (__builtin_expect(__dec, true)) + { + // Decimal. + do + { + *--__buf = __lit[(__v % 10) + __num_base::_S_odigits]; + __v /= 10; + } + while (__v != 0); + } + else if ((__flags & ios_base::basefield) == ios_base::oct) + { + // Octal. + do + { + *--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits]; + __v >>= 3; + } + while (__v != 0); + } + else + { + // Hex. + const bool __uppercase = __flags & ios_base::uppercase; + const int __case_offset = __uppercase ? __num_base::_S_oudigits + : __num_base::_S_odigits; + do + { + *--__buf = __lit[(__v & 0xf) + __case_offset]; + __v >>= 4; + } + while (__v != 0); + } + return __bufend - __buf; + } + +_GLIBCXX_BEGIN_NAMESPACE_LDBL + + template + void + num_put<_CharT, _OutIter>:: + _M_group_int(const char* __grouping, size_t __grouping_size, _CharT __sep, + ios_base&, _CharT* __new, _CharT* __cs, int& __len) const + { + _CharT* __p = std::__add_grouping(__new, __sep, __grouping, + __grouping_size, __cs, __cs + __len); + __len = __p - __new; + } + + template + template + _OutIter + num_put<_CharT, _OutIter>:: + _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill, + _ValueT __v) const + { + using __gnu_cxx::__add_unsigned; + typedef typename __add_unsigned<_ValueT>::__type __unsigned_type; + typedef __numpunct_cache<_CharT> __cache_type; + __use_cache<__cache_type> __uc; + const locale& __loc = __io._M_getloc(); + const __cache_type* __lc = __uc(__loc); + const _CharT* __lit = __lc->_M_atoms_out; + const ios_base::fmtflags __flags = __io.flags(); + + // Long enough to hold hex, dec, and octal representations. + const int __ilen = 5 * sizeof(_ValueT); + _CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) + * __ilen)); + + // [22.2.2.2.2] Stage 1, numeric conversion to character. + // Result is returned right-justified in the buffer. + const ios_base::fmtflags __basefield = __flags & ios_base::basefield; + const bool __dec = (__basefield != ios_base::oct + && __basefield != ios_base::hex); + const __unsigned_type __u = ((__v > 0 || !__dec) + ? __unsigned_type(__v) + : -__unsigned_type(__v)); + int __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec); + __cs += __ilen - __len; + + // Add grouping, if necessary. + if (__lc->_M_use_grouping) + { + // Grouping can add (almost) as many separators as the number + // of digits + space is reserved for numeric base or sign. + _CharT* __cs2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) + * (__len + 1) + * 2)); + _M_group_int(__lc->_M_grouping, __lc->_M_grouping_size, + __lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len); + __cs = __cs2 + 2; + } + + // Complete Stage 1, prepend numeric base or sign. + if (__builtin_expect(__dec, true)) + { + // Decimal. + if (__v >= 0) + { + if (bool(__flags & ios_base::showpos) + && __gnu_cxx::__numeric_traits<_ValueT>::__is_signed) + *--__cs = __lit[__num_base::_S_oplus], ++__len; + } + else + *--__cs = __lit[__num_base::_S_ominus], ++__len; + } + else if (bool(__flags & ios_base::showbase) && __v) + { + if (__basefield == ios_base::oct) + *--__cs = __lit[__num_base::_S_odigits], ++__len; + else + { + // 'x' or 'X' + const bool __uppercase = __flags & ios_base::uppercase; + *--__cs = __lit[__num_base::_S_ox + __uppercase]; + // '0' + *--__cs = __lit[__num_base::_S_odigits]; + __len += 2; + } + } + + // Pad. + const streamsize __w = __io.width(); + if (__w > static_cast(__len)) + { + _CharT* __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) + * __w)); + _M_pad(__fill, __w, __io, __cs3, __cs, __len); + __cs = __cs3; + } + __io.width(0); + + // [22.2.2.2.2] Stage 4. + // Write resulting, fully-formatted string to output iterator. + return std::__write(__s, __cs, __len); + } + + template + void + num_put<_CharT, _OutIter>:: + _M_group_float(const char* __grouping, size_t __grouping_size, + _CharT __sep, const _CharT* __p, _CharT* __new, + _CharT* __cs, int& __len) const + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 282. What types does numpunct grouping refer to? + // Add grouping, if necessary. + const int __declen = __p ? __p - __cs : __len; + _CharT* __p2 = std::__add_grouping(__new, __sep, __grouping, + __grouping_size, + __cs, __cs + __declen); + + // Tack on decimal part. + int __newlen = __p2 - __new; + if (__p) + { + char_traits<_CharT>::copy(__p2, __p, __len - __declen); + __newlen += __len - __declen; + } + __len = __newlen; + } + + // The following code uses vsnprintf (or vsprintf(), when + // _GLIBCXX_USE_C99_STDIO is not defined) to convert floating point + // values for insertion into a stream. An optimization would be to + // replace them with code that works directly on a wide buffer and + // then use __pad to do the padding. It would be good to replace + // them anyway to gain back the efficiency that C++ provides by + // knowing up front the type of the values to insert. Also, sprintf + // is dangerous since may lead to accidental buffer overruns. This + // implementation follows the C++ standard fairly directly as + // outlined in 22.2.2.2 [lib.locale.num.put] + template + template + _OutIter + num_put<_CharT, _OutIter>:: + _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod, + _ValueT __v) const + { + typedef __numpunct_cache<_CharT> __cache_type; + __use_cache<__cache_type> __uc; + const locale& __loc = __io._M_getloc(); + const __cache_type* __lc = __uc(__loc); + + // Use default precision if out of range. + const streamsize __prec = __io.precision() < 0 ? 6 : __io.precision(); + + const int __max_digits = + __gnu_cxx::__numeric_traits<_ValueT>::__digits10; + + // [22.2.2.2.2] Stage 1, numeric conversion to character. + int __len; + // Long enough for the max format spec. + char __fbuf[16]; + __num_base::_S_format_float(__io, __fbuf, __mod); + +#if _GLIBCXX_USE_C99_STDIO && !_GLIBCXX_HAVE_BROKEN_VSNPRINTF + // Precision is always used except for hexfloat format. + const bool __use_prec = + (__io.flags() & ios_base::floatfield) != ios_base::floatfield; + + // First try a buffer perhaps big enough (most probably sufficient + // for non-ios_base::fixed outputs) + int __cs_size = __max_digits * 3; + char* __cs = static_cast(__builtin_alloca(__cs_size)); + if (__use_prec) + __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, + __fbuf, __prec, __v); + else + __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, + __fbuf, __v); + + // If the buffer was not large enough, try again with the correct size. + if (__len >= __cs_size) + { + __cs_size = __len + 1; + __cs = static_cast(__builtin_alloca(__cs_size)); + if (__use_prec) + __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, + __fbuf, __prec, __v); + else + __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, + __fbuf, __v); + } +#else + // Consider the possibility of long ios_base::fixed outputs + const bool __fixed = __io.flags() & ios_base::fixed; + const int __max_exp = + __gnu_cxx::__numeric_traits<_ValueT>::__max_exponent10; + + // The size of the output string is computed as follows. + // ios_base::fixed outputs may need up to __max_exp + 1 chars + // for the integer part + __prec chars for the fractional part + // + 3 chars for sign, decimal point, '\0'. On the other hand, + // for non-fixed outputs __max_digits * 2 + __prec chars are + // largely sufficient. + const int __cs_size = __fixed ? __max_exp + __prec + 4 + : __max_digits * 2 + __prec; + char* __cs = static_cast(__builtin_alloca(__cs_size)); + __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf, + __prec, __v); +#endif + + // [22.2.2.2.2] Stage 2, convert to char_type, using correct + // numpunct.decimal_point() values for '.' and adding grouping. + const ctype<_CharT>& __ctype = use_facet >(__loc); + + _CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) + * __len)); + __ctype.widen(__cs, __cs + __len, __ws); + + // Replace decimal point. + _CharT* __wp = 0; + const char* __p = char_traits::find(__cs, __len, '.'); + if (__p) + { + __wp = __ws + (__p - __cs); + *__wp = __lc->_M_decimal_point; + } + + // Add grouping, if necessary. + // N.B. Make sure to not group things like 2e20, i.e., no decimal + // point, scientific notation. + if (__lc->_M_use_grouping + && (__wp || __len < 3 || (__cs[1] <= '9' && __cs[2] <= '9' + && __cs[1] >= '0' && __cs[2] >= '0'))) + { + // Grouping can add (almost) as many separators as the + // number of digits, but no more. + _CharT* __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) + * __len * 2)); + + streamsize __off = 0; + if (__cs[0] == '-' || __cs[0] == '+') + { + __off = 1; + __ws2[0] = __ws[0]; + __len -= 1; + } + + _M_group_float(__lc->_M_grouping, __lc->_M_grouping_size, + __lc->_M_thousands_sep, __wp, __ws2 + __off, + __ws + __off, __len); + __len += __off; + + __ws = __ws2; + } + + // Pad. + const streamsize __w = __io.width(); + if (__w > static_cast(__len)) + { + _CharT* __ws3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) + * __w)); + _M_pad(__fill, __w, __io, __ws3, __ws, __len); + __ws = __ws3; + } + __io.width(0); + + // [22.2.2.2.2] Stage 4. + // Write resulting, fully-formatted string to output iterator. + return std::__write(__s, __ws, __len); + } + + template + _OutIter + num_put<_CharT, _OutIter>:: + do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const + { + const ios_base::fmtflags __flags = __io.flags(); + if ((__flags & ios_base::boolalpha) == 0) + { + const long __l = __v; + __s = _M_insert_int(__s, __io, __fill, __l); + } + else + { + typedef __numpunct_cache<_CharT> __cache_type; + __use_cache<__cache_type> __uc; + const locale& __loc = __io._M_getloc(); + const __cache_type* __lc = __uc(__loc); + + const _CharT* __name = __v ? __lc->_M_truename + : __lc->_M_falsename; + int __len = __v ? __lc->_M_truename_size + : __lc->_M_falsename_size; + + const streamsize __w = __io.width(); + if (__w > static_cast(__len)) + { + const streamsize __plen = __w - __len; + _CharT* __ps + = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) + * __plen)); + + char_traits<_CharT>::assign(__ps, __plen, __fill); + __io.width(0); + + if ((__flags & ios_base::adjustfield) == ios_base::left) + { + __s = std::__write(__s, __name, __len); + __s = std::__write(__s, __ps, __plen); + } + else + { + __s = std::__write(__s, __ps, __plen); + __s = std::__write(__s, __name, __len); + } + return __s; + } + __io.width(0); + __s = std::__write(__s, __name, __len); + } + return __s; + } + + template + _OutIter + num_put<_CharT, _OutIter>:: + do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const + { return _M_insert_float(__s, __io, __fill, char(), __v); } + +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + template + _OutIter + num_put<_CharT, _OutIter>:: + __do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const + { return _M_insert_float(__s, __io, __fill, char(), __v); } +#endif + + template + _OutIter + num_put<_CharT, _OutIter>:: + do_put(iter_type __s, ios_base& __io, char_type __fill, + long double __v) const + { return _M_insert_float(__s, __io, __fill, 'L', __v); } + + template + _OutIter + num_put<_CharT, _OutIter>:: + do_put(iter_type __s, ios_base& __io, char_type __fill, + const void* __v) const + { + const ios_base::fmtflags __flags = __io.flags(); + const ios_base::fmtflags __fmt = ~(ios_base::basefield + | ios_base::uppercase); + __io.flags((__flags & __fmt) | (ios_base::hex | ios_base::showbase)); + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + typedef __gnu_cxx::__conditional_type<(sizeof(const void*) + <= sizeof(unsigned long)), + unsigned long, unsigned long long>::__type _UIntPtrType; +#pragma GCC diagnostic pop + + __s = _M_insert_int(__s, __io, __fill, + reinterpret_cast<_UIntPtrType>(__v)); + __io.flags(__flags); + return __s; + } + +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ + template + _OutIter + num_put<_CharT, _OutIter>:: + __do_put(iter_type __s, ios_base& __io, char_type __fill, + __ibm128 __v) const + { return _M_insert_float(__s, __io, __fill, 'L', __v); } +#endif +_GLIBCXX_END_NAMESPACE_LDBL + + // Construct correctly padded string, as per 22.2.2.2.2 + // Assumes + // __newlen > __oldlen + // __news is allocated for __newlen size + + // NB: Of the two parameters, _CharT can be deduced from the + // function arguments. The other (_Traits) has to be explicitly specified. + template + void + __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill, + _CharT* __news, const _CharT* __olds, + streamsize __newlen, streamsize __oldlen) + { + const size_t __plen = static_cast(__newlen - __oldlen); + const ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield; + + // Padding last. + if (__adjust == ios_base::left) + { + _Traits::copy(__news, __olds, __oldlen); + _Traits::assign(__news + __oldlen, __plen, __fill); + return; + } + + size_t __mod = 0; + if (__adjust == ios_base::internal) + { + // Pad after the sign, if there is one. + // Pad after 0[xX], if there is one. + // Who came up with these rules, anyway? Jeeze. + const locale& __loc = __io._M_getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + + if (__ctype.widen('-') == __olds[0] + || __ctype.widen('+') == __olds[0]) + { + __news[0] = __olds[0]; + __mod = 1; + ++__news; + } + else if (__ctype.widen('0') == __olds[0] + && __oldlen > 1 + && (__ctype.widen('x') == __olds[1] + || __ctype.widen('X') == __olds[1])) + { + __news[0] = __olds[0]; + __news[1] = __olds[1]; + __mod = 2; + __news += 2; + } + // else Padding first. + } + _Traits::assign(__news, __plen, __fill); + _Traits::copy(__news + __plen, __olds + __mod, __oldlen - __mod); + } + + template + _CharT* + __add_grouping(_CharT* __s, _CharT __sep, + const char* __gbeg, size_t __gsize, + const _CharT* __first, const _CharT* __last) + { + size_t __idx = 0; + size_t __ctr = 0; + + while (__last - __first > __gbeg[__idx] + && static_cast(__gbeg[__idx]) > 0 + && __gbeg[__idx] != __gnu_cxx::__numeric_traits::__max) + { + __last -= __gbeg[__idx]; + __idx < __gsize - 1 ? ++__idx : ++__ctr; + } + + while (__first != __last) + *__s++ = *__first++; + + while (__ctr--) + { + *__s++ = __sep; + for (char __i = __gbeg[__idx]; __i > 0; --__i) + *__s++ = *__first++; + } + + while (__idx--) + { + *__s++ = __sep; + for (char __i = __gbeg[__idx]; __i > 0; --__i) + *__s++ = *__first++; + } + + return __s; + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct; + extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname; + extern template class _GLIBCXX_NAMESPACE_LDBL num_get; + extern template class _GLIBCXX_NAMESPACE_LDBL num_put; + extern template class ctype_byname; + + extern template + const ctype* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const numpunct* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const num_put* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const num_get* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const ctype& + use_facet >(const locale&); + + extern template + const numpunct& + use_facet >(const locale&); + + extern template + const num_put& + use_facet >(const locale&); + + extern template + const num_get& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct; + extern template class _GLIBCXX_NAMESPACE_CXX11 numpunct_byname; + extern template class _GLIBCXX_NAMESPACE_LDBL num_get; + extern template class _GLIBCXX_NAMESPACE_LDBL num_put; + extern template class ctype_byname; + + extern template + const ctype* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const numpunct* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const num_put* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const num_get* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const ctype& + use_facet >(const locale&); + + extern template + const numpunct& + use_facet >(const locale&); + + extern template + const num_put& + use_facet >(const locale&); + + extern template + const num_get& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); +#endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#pragma GCC diagnostic pop +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.tcc.blob new file mode 100644 index 0000000..2eeaa1c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.h new file mode 100644 index 0000000..559ae0e --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.h @@ -0,0 +1,2073 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_facets_nonio.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +#ifndef _LOCALE_FACETS_NONIO_H +#define _LOCALE_FACETS_NONIO_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // For struct tm + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Time format ordering data. + * @ingroup locales + * + * This class provides an enum representing different orderings of + * time: day, month, and year. + */ + class time_base + { + public: + enum dateorder { no_order, dmy, mdy, ymd, ydm }; + }; + + template + struct __timepunct_cache : public locale::facet + { + // List of all known timezones, with GMT first. + static const _CharT* _S_timezones[14]; + + const _CharT* _M_date_format; + const _CharT* _M_date_era_format; + const _CharT* _M_time_format; + const _CharT* _M_time_era_format; + const _CharT* _M_date_time_format; + const _CharT* _M_date_time_era_format; + const _CharT* _M_am; + const _CharT* _M_pm; + const _CharT* _M_am_pm_format; + + // Day names, starting with "C"'s Sunday. + const _CharT* _M_day1; + const _CharT* _M_day2; + const _CharT* _M_day3; + const _CharT* _M_day4; + const _CharT* _M_day5; + const _CharT* _M_day6; + const _CharT* _M_day7; + + // Abbreviated day names, starting with "C"'s Sun. + const _CharT* _M_aday1; + const _CharT* _M_aday2; + const _CharT* _M_aday3; + const _CharT* _M_aday4; + const _CharT* _M_aday5; + const _CharT* _M_aday6; + const _CharT* _M_aday7; + + // Month names, starting with "C"'s January. + const _CharT* _M_month01; + const _CharT* _M_month02; + const _CharT* _M_month03; + const _CharT* _M_month04; + const _CharT* _M_month05; + const _CharT* _M_month06; + const _CharT* _M_month07; + const _CharT* _M_month08; + const _CharT* _M_month09; + const _CharT* _M_month10; + const _CharT* _M_month11; + const _CharT* _M_month12; + + // Abbreviated month names, starting with "C"'s Jan. + const _CharT* _M_amonth01; + const _CharT* _M_amonth02; + const _CharT* _M_amonth03; + const _CharT* _M_amonth04; + const _CharT* _M_amonth05; + const _CharT* _M_amonth06; + const _CharT* _M_amonth07; + const _CharT* _M_amonth08; + const _CharT* _M_amonth09; + const _CharT* _M_amonth10; + const _CharT* _M_amonth11; + const _CharT* _M_amonth12; + + bool _M_allocated; + + __timepunct_cache(size_t __refs = 0) : facet(__refs), + _M_date_format(0), _M_date_era_format(0), _M_time_format(0), + _M_time_era_format(0), _M_date_time_format(0), + _M_date_time_era_format(0), _M_am(0), _M_pm(0), + _M_am_pm_format(0), _M_day1(0), _M_day2(0), _M_day3(0), + _M_day4(0), _M_day5(0), _M_day6(0), _M_day7(0), + _M_aday1(0), _M_aday2(0), _M_aday3(0), _M_aday4(0), + _M_aday5(0), _M_aday6(0), _M_aday7(0), _M_month01(0), + _M_month02(0), _M_month03(0), _M_month04(0), _M_month05(0), + _M_month06(0), _M_month07(0), _M_month08(0), _M_month09(0), + _M_month10(0), _M_month11(0), _M_month12(0), _M_amonth01(0), + _M_amonth02(0), _M_amonth03(0), _M_amonth04(0), + _M_amonth05(0), _M_amonth06(0), _M_amonth07(0), + _M_amonth08(0), _M_amonth09(0), _M_amonth10(0), + _M_amonth11(0), _M_amonth12(0), _M_allocated(false) + { } + + ~__timepunct_cache(); + + private: + __timepunct_cache& + operator=(const __timepunct_cache&); + + explicit + __timepunct_cache(const __timepunct_cache&); + }; + + template + __timepunct_cache<_CharT>::~__timepunct_cache() + { + if (_M_allocated) + { + // Unused. + } + } + + // Specializations. + template<> + const char* + __timepunct_cache::_S_timezones[14]; + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + const wchar_t* + __timepunct_cache::_S_timezones[14]; +#endif + + // Generic. + template + const _CharT* __timepunct_cache<_CharT>::_S_timezones[14]; + + template + class __timepunct : public locale::facet + { + public: + // Types: + typedef _CharT __char_type; + typedef __timepunct_cache<_CharT> __cache_type; + + protected: + __cache_type* _M_data; + __c_locale _M_c_locale_timepunct; + const char* _M_name_timepunct; + + public: + /// Numpunct facet id. + static locale::id id; + + explicit + __timepunct(size_t __refs = 0); + + explicit + __timepunct(__cache_type* __cache, size_t __refs = 0); + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __s The name of a locale. + * @param refs Passed to the base facet class. + */ + explicit + __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0); + + // FIXME: for error checking purposes _M_put should return the return + // value of strftime/wcsftime. + void + _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format, + const tm* __tm) const throw (); + + void + _M_date_formats(const _CharT** __date) const + { + // Always have default first. + __date[0] = _M_data->_M_date_format; + __date[1] = _M_data->_M_date_era_format; + } + + void + _M_time_formats(const _CharT** __time) const + { + // Always have default first. + __time[0] = _M_data->_M_time_format; + __time[1] = _M_data->_M_time_era_format; + } + + void + _M_date_time_formats(const _CharT** __dt) const + { + // Always have default first. + __dt[0] = _M_data->_M_date_time_format; + __dt[1] = _M_data->_M_date_time_era_format; + } + +#if !_GLIBCXX_INLINE_VERSION + void + _M_am_pm_format(const _CharT*) const + { /* Kept for ABI compatibility, see PR65927 */ } +#endif + + void + _M_am_pm_format(const _CharT** __ampm_format) const + { + __ampm_format[0] = _M_data->_M_am_pm_format; + } + + void + _M_am_pm(const _CharT** __ampm) const + { + __ampm[0] = _M_data->_M_am; + __ampm[1] = _M_data->_M_pm; + } + + void + _M_days(const _CharT** __days) const + { + __days[0] = _M_data->_M_day1; + __days[1] = _M_data->_M_day2; + __days[2] = _M_data->_M_day3; + __days[3] = _M_data->_M_day4; + __days[4] = _M_data->_M_day5; + __days[5] = _M_data->_M_day6; + __days[6] = _M_data->_M_day7; + } + + void + _M_days_abbreviated(const _CharT** __days) const + { + __days[0] = _M_data->_M_aday1; + __days[1] = _M_data->_M_aday2; + __days[2] = _M_data->_M_aday3; + __days[3] = _M_data->_M_aday4; + __days[4] = _M_data->_M_aday5; + __days[5] = _M_data->_M_aday6; + __days[6] = _M_data->_M_aday7; + } + + void + _M_months(const _CharT** __months) const + { + __months[0] = _M_data->_M_month01; + __months[1] = _M_data->_M_month02; + __months[2] = _M_data->_M_month03; + __months[3] = _M_data->_M_month04; + __months[4] = _M_data->_M_month05; + __months[5] = _M_data->_M_month06; + __months[6] = _M_data->_M_month07; + __months[7] = _M_data->_M_month08; + __months[8] = _M_data->_M_month09; + __months[9] = _M_data->_M_month10; + __months[10] = _M_data->_M_month11; + __months[11] = _M_data->_M_month12; + } + + void + _M_months_abbreviated(const _CharT** __months) const + { + __months[0] = _M_data->_M_amonth01; + __months[1] = _M_data->_M_amonth02; + __months[2] = _M_data->_M_amonth03; + __months[3] = _M_data->_M_amonth04; + __months[4] = _M_data->_M_amonth05; + __months[5] = _M_data->_M_amonth06; + __months[6] = _M_data->_M_amonth07; + __months[7] = _M_data->_M_amonth08; + __months[8] = _M_data->_M_amonth09; + __months[9] = _M_data->_M_amonth10; + __months[10] = _M_data->_M_amonth11; + __months[11] = _M_data->_M_amonth12; + } + + protected: + virtual + ~__timepunct(); + + // For use at construction time only. + void + _M_initialize_timepunct(__c_locale __cloc = 0); + }; + + template + locale::id __timepunct<_CharT>::id; + + // Specializations. + template<> + void + __timepunct::_M_initialize_timepunct(__c_locale __cloc); + + template<> + void + __timepunct::_M_put(char*, size_t, const char*, const tm*) const throw (); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + void + __timepunct::_M_initialize_timepunct(__c_locale __cloc); + + template<> + void + __timepunct::_M_put(wchar_t*, size_t, const wchar_t*, + const tm*) const throw (); +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +// Include host and configuration specific timepunct functions. +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + struct __time_get_state + { + // Finalize state. + void + _M_finalize_state(tm* __tm); + + unsigned int _M_have_I : 1; + unsigned int _M_have_wday : 1; + unsigned int _M_have_yday : 1; + unsigned int _M_have_mon : 1; + unsigned int _M_have_mday : 1; + unsigned int _M_have_uweek : 1; + unsigned int _M_have_wweek : 1; + unsigned int _M_have_century : 1; + unsigned int _M_is_pm : 1; + unsigned int _M_want_century : 1; + unsigned int _M_want_xday : 1; + unsigned int _M_pad1 : 5; + unsigned int _M_week_no : 6; + unsigned int _M_pad2 : 10; + int _M_century; + int _M_pad3; + }; + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @brief Primary class template time_get. + * @ingroup locales + * + * This facet encapsulates the code to parse and return a date or + * time from a string. It is used by the istream numeric + * extraction operators. + * + * The time_get template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from the time_get facet. + */ + template + class time_get : public locale::facet, public time_base + { + public: + // Types: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef _InIter iter_type; + ///@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + time_get(size_t __refs = 0) + : facet (__refs) { } + + /** + * @brief Return preferred order of month, day, and year. + * + * This function returns an enum from time_base::dateorder giving the + * preferred ordering if the format @a x given to time_put::put() only + * uses month, day, and year. If the format @a x for the associated + * locale uses other fields, this function returns + * time_base::dateorder::noorder. + * + * NOTE: The library always returns noorder at the moment. + * + * @return A member of time_base::dateorder. + */ + dateorder + date_order() const + { return this->do_date_order(); } + + /** + * @brief Parse input time string. + * + * This function parses a time according to the format @a X and puts the + * results into a user-supplied struct tm. The result is returned by + * calling time_get::do_get_time(). + * + * If there is a valid time string according to format @a X, @a tm will + * be filled in accordingly and the returned iterator will point to the + * first character beyond the time string. If an error occurs before + * the end, err |= ios_base::failbit. If parsing reads all the + * characters, err |= ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond time string. + */ + iter_type + get_time(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_time(__beg, __end, __io, __err, __tm); } + + /** + * @brief Parse input date string. + * + * This function parses a date according to the format @a x and puts the + * results into a user-supplied struct tm. The result is returned by + * calling time_get::do_get_date(). + * + * If there is a valid date string according to format @a x, @a tm will + * be filled in accordingly and the returned iterator will point to the + * first character beyond the date string. If an error occurs before + * the end, err |= ios_base::failbit. If parsing reads all the + * characters, err |= ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond date string. + */ + iter_type + get_date(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_date(__beg, __end, __io, __err, __tm); } + + /** + * @brief Parse input weekday string. + * + * This function parses a weekday name and puts the results into a + * user-supplied struct tm. The result is returned by calling + * time_get::do_get_weekday(). + * + * Parsing starts by parsing an abbreviated weekday name. If a valid + * abbreviation is followed by a character that would lead to the full + * weekday name, parsing continues until the full name is found or an + * error occurs. Otherwise parsing finishes at the end of the + * abbreviated name. + * + * If an error occurs before the end, err |= ios_base::failbit. If + * parsing reads all the characters, err |= ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond weekday name. + */ + iter_type + get_weekday(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_weekday(__beg, __end, __io, __err, __tm); } + + /** + * @brief Parse input month string. + * + * This function parses a month name and puts the results into a + * user-supplied struct tm. The result is returned by calling + * time_get::do_get_monthname(). + * + * Parsing starts by parsing an abbreviated month name. If a valid + * abbreviation is followed by a character that would lead to the full + * month name, parsing continues until the full name is found or an + * error occurs. Otherwise parsing finishes at the end of the + * abbreviated name. + * + * If an error occurs before the end, err |= ios_base::failbit. If + * parsing reads all the characters, err |= + * ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond month name. + */ + iter_type + get_monthname(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_monthname(__beg, __end, __io, __err, __tm); } + + /** + * @brief Parse input year string. + * + * This function reads up to 4 characters to parse a year string and + * puts the results into a user-supplied struct tm. The result is + * returned by calling time_get::do_get_year(). + * + * 4 consecutive digits are interpreted as a full year. If there are + * exactly 2 consecutive digits, the library interprets this as the + * number of years since 1900. + * + * If an error occurs before the end, err |= ios_base::failbit. If + * parsing reads all the characters, err |= ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond year. + */ + iter_type + get_year(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_year(__beg, __end, __io, __err, __tm); } + +#if __cplusplus >= 201103L + /** + * @brief Parse input string according to format. + * + * This function calls time_get::do_get with the provided + * parameters. @see do_get() and get(). + * + * @param __s Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @param __format Format specifier. + * @param __modifier Format modifier. + * @return Iterator to first char not parsed. + */ + inline + iter_type get(iter_type __s, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, char __format, + char __modifier = 0) const + { + return this->do_get(__s, __end, __io, __err, __tm, __format, + __modifier); + } + + /** + * @brief Parse input string according to format. + * + * This function parses the input string according to a + * provided format string. It does the inverse of + * time_put::put. The format string follows the format + * specified for strftime(3)/strptime(3). The actual parsing + * is done by time_get::do_get. + * + * @param __s Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @param __fmt Start of the format string. + * @param __fmtend End of the format string. + * @return Iterator to first char not parsed. + */ + iter_type get(iter_type __s, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, const char_type* __fmt, + const char_type* __fmtend) const; +#endif // __cplusplus >= 201103L + + protected: + /// Destructor. + virtual + ~time_get() { } + + /** + * @brief Return preferred order of month, day, and year. + * + * This function returns an enum from time_base::dateorder giving the + * preferred ordering if the format @a x given to time_put::put() only + * uses month, day, and year. This function is a hook for derived + * classes to change the value returned. + * + * @return A member of time_base::dateorder. + */ + virtual dateorder + do_date_order() const; + + /** + * @brief Parse input time string. + * + * This function parses a time according to the format @a x and puts the + * results into a user-supplied struct tm. This function is a hook for + * derived classes to change the value returned. @see get_time() for + * details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond time string. + */ + virtual iter_type + do_get_time(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const; + + /** + * @brief Parse input date string. + * + * This function parses a date according to the format @a X and puts the + * results into a user-supplied struct tm. This function is a hook for + * derived classes to change the value returned. @see get_date() for + * details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond date string. + */ + virtual iter_type + do_get_date(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const; + + /** + * @brief Parse input weekday string. + * + * This function parses a weekday name and puts the results into a + * user-supplied struct tm. This function is a hook for derived + * classes to change the value returned. @see get_weekday() for + * details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond weekday name. + */ + virtual iter_type + do_get_weekday(iter_type __beg, iter_type __end, ios_base&, + ios_base::iostate& __err, tm* __tm) const; + + /** + * @brief Parse input month string. + * + * This function parses a month name and puts the results into a + * user-supplied struct tm. This function is a hook for derived + * classes to change the value returned. @see get_monthname() for + * details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond month name. + */ + virtual iter_type + do_get_monthname(iter_type __beg, iter_type __end, ios_base&, + ios_base::iostate& __err, tm* __tm) const; + + /** + * @brief Parse input year string. + * + * This function reads up to 4 characters to parse a year string and + * puts the results into a user-supplied struct tm. This function is a + * hook for derived classes to change the value returned. @see + * get_year() for details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond year. + */ + virtual iter_type + do_get_year(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const; + +#if __cplusplus >= 201103L + /** + * @brief Parse input string according to format. + * + * This function parses the string according to the provided + * format and optional modifier. This function is a hook for + * derived classes to change the value returned. @see get() + * for more details. + * + * @param __s Start of string to parse. + * @param __end End of string to parse. + * @param __f Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @param __format Format specifier. + * @param __modifier Format modifier. + * @return Iterator to first char not parsed. + */ +#if _GLIBCXX_USE_CXX11_ABI + virtual +#endif + iter_type + do_get(iter_type __s, iter_type __end, ios_base& __f, + ios_base::iostate& __err, tm* __tm, + char __format, char __modifier) const; +#endif // __cplusplus >= 201103L + + // Extract numeric component of length __len. + iter_type + _M_extract_num(iter_type __beg, iter_type __end, int& __member, + int __min, int __max, size_t __len, + ios_base& __io, ios_base::iostate& __err) const; + + // Extract any unique array of string literals in a const _CharT* array. + iter_type + _M_extract_name(iter_type __beg, iter_type __end, int& __member, + const _CharT** __names, size_t __indexlen, + ios_base& __io, ios_base::iostate& __err) const; + + // Extract day or month name in a const _CharT* array. + iter_type + _M_extract_wday_or_month(iter_type __beg, iter_type __end, int& __member, + const _CharT** __names, size_t __indexlen, + ios_base& __io, ios_base::iostate& __err) const; + + // Extract on a component-by-component basis, via __format argument. + iter_type + _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, + const _CharT* __format) const; + + // Extract on a component-by-component basis, via __format argument, with + // state. + iter_type + _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, + const _CharT* __format, + __time_get_state &__state) const; + }; + + template + locale::id time_get<_CharT, _InIter>::id; + + /// class time_get_byname [22.2.5.2]. + template + class time_get_byname : public time_get<_CharT, _InIter> + { + public: + // Types: + typedef _CharT char_type; + typedef _InIter iter_type; + + explicit + time_get_byname(const char*, size_t __refs = 0) + : time_get<_CharT, _InIter>(__refs) { } + +#if __cplusplus >= 201103L + explicit + time_get_byname(const string& __s, size_t __refs = 0) + : time_get_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~time_get_byname() { } + }; + +_GLIBCXX_END_NAMESPACE_CXX11 + + /** + * @brief Primary class template time_put. + * @ingroup locales + * + * This facet encapsulates the code to format and output dates and times + * according to formats used by strftime(). + * + * The time_put template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from the time_put facet. + */ + template + class time_put : public locale::facet + { + public: + // Types: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef _OutIter iter_type; + ///@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + time_put(size_t __refs = 0) + : facet(__refs) { } + + /** + * @brief Format and output a time or date. + * + * This function formats the data in struct tm according to the + * provided format string. The format string is interpreted as by + * strftime(). + * + * @param __s The stream to write to. + * @param __io Source of locale. + * @param __fill char_type to use for padding. + * @param __tm Struct tm with date and time info to format. + * @param __beg Start of format string. + * @param __end End of format string. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, + const _CharT* __beg, const _CharT* __end) const; + + /** + * @brief Format and output a time or date. + * + * This function formats the data in struct tm according to the + * provided format char and optional modifier. The format and modifier + * are interpreted as by strftime(). It does so by returning + * time_put::do_put(). + * + * @param __s The stream to write to. + * @param __io Source of locale. + * @param __fill char_type to use for padding. + * @param __tm Struct tm with date and time info to format. + * @param __format Format char. + * @param __mod Optional modifier char. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + const tm* __tm, char __format, char __mod = 0) const + { return this->do_put(__s, __io, __fill, __tm, __format, __mod); } + + protected: + /// Destructor. + virtual + ~time_put() + { } + + /** + * @brief Format and output a time or date. + * + * This function formats the data in struct tm according to the + * provided format char and optional modifier. This function is a hook + * for derived classes to change the value returned. @see put() for + * more details. + * + * @param __s The stream to write to. + * @param __io Source of locale. + * @param __fill char_type to use for padding. + * @param __tm Struct tm with date and time info to format. + * @param __format Format char. + * @param __mod Optional modifier char. + * @return Iterator after writing. + */ + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, + char __format, char __mod) const; + }; + + template + locale::id time_put<_CharT, _OutIter>::id; + + /// class time_put_byname [22.2.5.4]. + template + class time_put_byname : public time_put<_CharT, _OutIter> + { + public: + // Types: + typedef _CharT char_type; + typedef _OutIter iter_type; + + explicit + time_put_byname(const char*, size_t __refs = 0) + : time_put<_CharT, _OutIter>(__refs) + { } + +#if __cplusplus >= 201103L + explicit + time_put_byname(const string& __s, size_t __refs = 0) + : time_put_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~time_put_byname() { } + }; + + + /** + * @brief Money format ordering data. + * @ingroup locales + * + * This class contains an ordered array of 4 fields to represent the + * pattern for formatting a money amount. Each field may contain one entry + * from the part enum. symbol, sign, and value must be present and the + * remaining field must contain either none or space. @see + * moneypunct::pos_format() and moneypunct::neg_format() for details of how + * these fields are interpreted. + */ + class money_base + { + public: + enum part { none, space, symbol, sign, value }; + struct pattern { char field[4]; }; + + static const pattern _S_default_pattern; + + enum + { + _S_minus, + _S_zero, + _S_end = 11 + }; + + // String literal of acceptable (narrow) input/output, for + // money_get/money_put. "-0123456789" + static const char* _S_atoms; + + // Construct and return valid pattern consisting of some combination of: + // space none symbol sign value + _GLIBCXX_CONST static pattern + _S_construct_pattern(char __precedes, char __space, char __posn) throw (); + }; + + template + struct __moneypunct_cache : public locale::facet + { + const char* _M_grouping; + size_t _M_grouping_size; + bool _M_use_grouping; + _CharT _M_decimal_point; + _CharT _M_thousands_sep; + const _CharT* _M_curr_symbol; + size_t _M_curr_symbol_size; + const _CharT* _M_positive_sign; + size_t _M_positive_sign_size; + const _CharT* _M_negative_sign; + size_t _M_negative_sign_size; + int _M_frac_digits; + money_base::pattern _M_pos_format; + money_base::pattern _M_neg_format; + + // A list of valid numeric literals for input and output: in the standard + // "C" locale, this is "-0123456789". This array contains the chars after + // having been passed through the current locale's ctype<_CharT>.widen(). + _CharT _M_atoms[money_base::_S_end]; + + bool _M_allocated; + + __moneypunct_cache(size_t __refs = 0) : facet(__refs), + _M_grouping(0), _M_grouping_size(0), _M_use_grouping(false), + _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()), + _M_curr_symbol(0), _M_curr_symbol_size(0), + _M_positive_sign(0), _M_positive_sign_size(0), + _M_negative_sign(0), _M_negative_sign_size(0), + _M_frac_digits(0), + _M_pos_format(money_base::pattern()), + _M_neg_format(money_base::pattern()), _M_allocated(false) + { } + + ~__moneypunct_cache(); + + void + _M_cache(const locale& __loc); + + private: + __moneypunct_cache& + operator=(const __moneypunct_cache&); + + explicit + __moneypunct_cache(const __moneypunct_cache&); + }; + + template + __moneypunct_cache<_CharT, _Intl>::~__moneypunct_cache() + { + if (_M_allocated) + { + delete [] _M_grouping; + delete [] _M_curr_symbol; + delete [] _M_positive_sign; + delete [] _M_negative_sign; + } + } + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @brief Primary class template moneypunct. + * @ingroup locales + * + * This facet encapsulates the punctuation, grouping and other formatting + * features of money amount string representations. + */ + template + class moneypunct : public locale::facet, public money_base + { + public: + // Types: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + ///@} + typedef __moneypunct_cache<_CharT, _Intl> __cache_type; + + private: + __cache_type* _M_data; + + public: + /// This value is provided by the standard, but no reason for its + /// existence. + static const bool intl = _Intl; + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + moneypunct(size_t __refs = 0) + : facet(__refs), _M_data(0) + { _M_initialize_moneypunct(); } + + /** + * @brief Constructor performs initialization. + * + * This is an internal constructor. + * + * @param __cache Cache for optimization. + * @param __refs Passed to the base facet class. + */ + explicit + moneypunct(__cache_type* __cache, size_t __refs = 0) + : facet(__refs), _M_data(__cache) + { _M_initialize_moneypunct(); } + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __s The name of a locale. + * @param __refs Passed to the base facet class. + */ + explicit + moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0) + : facet(__refs), _M_data(0) + { _M_initialize_moneypunct(__cloc, __s); } + + /** + * @brief Return decimal point character. + * + * This function returns a char_type to use as a decimal point. It + * does so by returning returning + * moneypunct::do_decimal_point(). + * + * @return @a char_type representing a decimal point. + */ + char_type + decimal_point() const + { return this->do_decimal_point(); } + + /** + * @brief Return thousands separator character. + * + * This function returns a char_type to use as a thousands + * separator. It does so by returning returning + * moneypunct::do_thousands_sep(). + * + * @return char_type representing a thousands separator. + */ + char_type + thousands_sep() const + { return this->do_thousands_sep(); } + + /** + * @brief Return grouping specification. + * + * This function returns a string representing groupings for the + * integer part of an amount. Groupings indicate where thousands + * separators should be inserted. + * + * Each char in the return string is interpret as an integer rather + * than a character. These numbers represent the number of digits in a + * group. The first char in the string represents the number of digits + * in the least significant group. If a char is negative, it indicates + * an unlimited number of digits for the group. If more chars from the + * string are required to group a number, the last char is used + * repeatedly. + * + * For example, if the grouping() returns \003\002 + * and is applied to the number 123456789, this corresponds to + * 12,34,56,789. Note that if the string was 32, this would + * put more than 50 digits into the least significant group if + * the character set is ASCII. + * + * The string is returned by calling + * moneypunct::do_grouping(). + * + * @return string representing grouping specification. + */ + string + grouping() const + { return this->do_grouping(); } + + /** + * @brief Return currency symbol string. + * + * This function returns a string_type to use as a currency symbol. It + * does so by returning returning + * moneypunct::do_curr_symbol(). + * + * @return @a string_type representing a currency symbol. + */ + string_type + curr_symbol() const + { return this->do_curr_symbol(); } + + /** + * @brief Return positive sign string. + * + * This function returns a string_type to use as a sign for positive + * amounts. It does so by returning returning + * moneypunct::do_positive_sign(). + * + * If the return value contains more than one character, the first + * character appears in the position indicated by pos_format() and the + * remainder appear at the end of the formatted string. + * + * @return @a string_type representing a positive sign. + */ + string_type + positive_sign() const + { return this->do_positive_sign(); } + + /** + * @brief Return negative sign string. + * + * This function returns a string_type to use as a sign for negative + * amounts. It does so by returning returning + * moneypunct::do_negative_sign(). + * + * If the return value contains more than one character, the first + * character appears in the position indicated by neg_format() and the + * remainder appear at the end of the formatted string. + * + * @return @a string_type representing a negative sign. + */ + string_type + negative_sign() const + { return this->do_negative_sign(); } + + /** + * @brief Return number of digits in fraction. + * + * This function returns the exact number of digits that make up the + * fractional part of a money amount. It does so by returning + * returning moneypunct::do_frac_digits(). + * + * The fractional part of a money amount is optional. But if it is + * present, there must be frac_digits() digits. + * + * @return Number of digits in amount fraction. + */ + int + frac_digits() const + { return this->do_frac_digits(); } + + ///@{ + /** + * @brief Return pattern for money values. + * + * This function returns a pattern describing the formatting of a + * positive or negative valued money amount. It does so by returning + * returning moneypunct::do_pos_format() or + * moneypunct::do_neg_format(). + * + * The pattern has 4 fields describing the ordering of symbol, sign, + * value, and none or space. There must be one of each in the pattern. + * The none and space enums may not appear in the first field and space + * may not appear in the final field. + * + * The parts of a money string must appear in the order indicated by + * the fields of the pattern. The symbol field indicates that the + * value of curr_symbol() may be present. The sign field indicates + * that the value of positive_sign() or negative_sign() must be + * present. The value field indicates that the absolute value of the + * money amount is present. none indicates 0 or more whitespace + * characters, except at the end, where it permits no whitespace. + * space indicates that 1 or more whitespace characters must be + * present. + * + * For example, for the US locale and pos_format() pattern + * {symbol,sign,value,none}, curr_symbol() == '$' + * positive_sign() == '+', and value 10.01, and + * options set to force the symbol, the corresponding string is + * $+10.01. + * + * @return Pattern for money values. + */ + pattern + pos_format() const + { return this->do_pos_format(); } + + pattern + neg_format() const + { return this->do_neg_format(); } + ///@} + + protected: + /// Destructor. + virtual + ~moneypunct(); + + /** + * @brief Return decimal point character. + * + * Returns a char_type to use as a decimal point. This function is a + * hook for derived classes to change the value returned. + * + * @return @a char_type representing a decimal point. + */ + virtual char_type + do_decimal_point() const + { return _M_data->_M_decimal_point; } + + /** + * @brief Return thousands separator character. + * + * Returns a char_type to use as a thousands separator. This function + * is a hook for derived classes to change the value returned. + * + * @return @a char_type representing a thousands separator. + */ + virtual char_type + do_thousands_sep() const + { return _M_data->_M_thousands_sep; } + + /** + * @brief Return grouping specification. + * + * Returns a string representing groupings for the integer part of a + * number. This function is a hook for derived classes to change the + * value returned. @see grouping() for details. + * + * @return String representing grouping specification. + */ + virtual string + do_grouping() const + { return _M_data->_M_grouping; } + + /** + * @brief Return currency symbol string. + * + * This function returns a string_type to use as a currency symbol. + * This function is a hook for derived classes to change the value + * returned. @see curr_symbol() for details. + * + * @return @a string_type representing a currency symbol. + */ + virtual string_type + do_curr_symbol() const + { return _M_data->_M_curr_symbol; } + + /** + * @brief Return positive sign string. + * + * This function returns a string_type to use as a sign for positive + * amounts. This function is a hook for derived classes to change the + * value returned. @see positive_sign() for details. + * + * @return @a string_type representing a positive sign. + */ + virtual string_type + do_positive_sign() const + { return _M_data->_M_positive_sign; } + + /** + * @brief Return negative sign string. + * + * This function returns a string_type to use as a sign for negative + * amounts. This function is a hook for derived classes to change the + * value returned. @see negative_sign() for details. + * + * @return @a string_type representing a negative sign. + */ + virtual string_type + do_negative_sign() const + { return _M_data->_M_negative_sign; } + + /** + * @brief Return number of digits in fraction. + * + * This function returns the exact number of digits that make up the + * fractional part of a money amount. This function is a hook for + * derived classes to change the value returned. @see frac_digits() + * for details. + * + * @return Number of digits in amount fraction. + */ + virtual int + do_frac_digits() const + { return _M_data->_M_frac_digits; } + + /** + * @brief Return pattern for money values. + * + * This function returns a pattern describing the formatting of a + * positive valued money amount. This function is a hook for derived + * classes to change the value returned. @see pos_format() for + * details. + * + * @return Pattern for money values. + */ + virtual pattern + do_pos_format() const + { return _M_data->_M_pos_format; } + + /** + * @brief Return pattern for money values. + * + * This function returns a pattern describing the formatting of a + * negative valued money amount. This function is a hook for derived + * classes to change the value returned. @see neg_format() for + * details. + * + * @return Pattern for money values. + */ + virtual pattern + do_neg_format() const + { return _M_data->_M_neg_format; } + + // For use at construction time only. + void + _M_initialize_moneypunct(__c_locale __cloc = 0, + const char* __name = 0); + }; + + template + locale::id moneypunct<_CharT, _Intl>::id; + + template + const bool moneypunct<_CharT, _Intl>::intl; + + template<> + moneypunct::~moneypunct(); + + template<> + moneypunct::~moneypunct(); + + template<> + void + moneypunct::_M_initialize_moneypunct(__c_locale, const char*); + + template<> + void + moneypunct::_M_initialize_moneypunct(__c_locale, const char*); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + moneypunct::~moneypunct(); + + template<> + moneypunct::~moneypunct(); + + template<> + void + moneypunct::_M_initialize_moneypunct(__c_locale, + const char*); + + template<> + void + moneypunct::_M_initialize_moneypunct(__c_locale, + const char*); +#endif + + /// class moneypunct_byname [22.2.6.4]. + template + class moneypunct_byname : public moneypunct<_CharT, _Intl> + { + public: + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + + static const bool intl = _Intl; + + explicit + moneypunct_byname(const char* __s, size_t __refs = 0) + : moneypunct<_CharT, _Intl>(__refs) + { + if (__builtin_strcmp(__s, "C") != 0 + && __builtin_strcmp(__s, "POSIX") != 0) + { + __c_locale __tmp; + this->_S_create_c_locale(__tmp, __s); + this->_M_initialize_moneypunct(__tmp); + this->_S_destroy_c_locale(__tmp); + } + } + +#if __cplusplus >= 201103L + explicit + moneypunct_byname(const string& __s, size_t __refs = 0) + : moneypunct_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~moneypunct_byname() { } + }; + + template + const bool moneypunct_byname<_CharT, _Intl>::intl; + +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 + + /** + * @brief Primary class template money_get. + * @ingroup locales + * + * This facet encapsulates the code to parse and return a monetary + * amount from a string. + * + * The money_get template uses protected virtual functions to + * provide the actual results. The public accessors forward the + * call to the virtual functions. These virtual functions are + * hooks for developers to implement the behavior they require from + * the money_get facet. + */ + template + class money_get : public locale::facet + { + public: + // Types: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef _InIter iter_type; + typedef basic_string<_CharT> string_type; + ///@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + money_get(size_t __refs = 0) : facet(__refs) { } + + /** + * @brief Read and parse a monetary value. + * + * This function reads characters from @a __s, interprets them as a + * monetary value according to moneypunct and ctype facets retrieved + * from io.getloc(), and returns the result in @a units as an integral + * value moneypunct::frac_digits() * the actual amount. For example, + * the string $10.01 in a US locale would store 1001 in @a units. + * + * Any characters not part of a valid money amount are not consumed. + * + * If a money value cannot be parsed from the input stream, sets + * err=(err|io.failbit). If the stream is consumed before finishing + * parsing, sets err=(err|io.failbit|io.eofbit). @a units is + * unchanged if parsing fails. + * + * This function works by returning the result of do_get(). + * + * @param __s Start of characters to parse. + * @param __end End of characters to parse. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __err Error field to set if parsing fails. + * @param __units Place to store result of parsing. + * @return Iterator referencing first character beyond valid money + * amount. + */ + iter_type + get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, long double& __units) const + { return this->do_get(__s, __end, __intl, __io, __err, __units); } + + /** + * @brief Read and parse a monetary value. + * + * This function reads characters from @a __s, interprets them as + * a monetary value according to moneypunct and ctype facets + * retrieved from io.getloc(), and returns the result in @a + * digits. For example, the string $10.01 in a US locale would + * store 1001 in @a digits. + * + * Any characters not part of a valid money amount are not consumed. + * + * If a money value cannot be parsed from the input stream, sets + * err=(err|io.failbit). If the stream is consumed before finishing + * parsing, sets err=(err|io.failbit|io.eofbit). + * + * This function works by returning the result of do_get(). + * + * @param __s Start of characters to parse. + * @param __end End of characters to parse. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __err Error field to set if parsing fails. + * @param __digits Place to store result of parsing. + * @return Iterator referencing first character beyond valid money + * amount. + */ + iter_type + get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, string_type& __digits) const + { return this->do_get(__s, __end, __intl, __io, __err, __digits); } + + protected: + /// Destructor. + virtual + ~money_get() { } + + /** + * @brief Read and parse a monetary value. + * + * This function reads and parses characters representing a monetary + * value. This function is a hook for derived classes to change the + * value returned. @see get() for details. + */ + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__) + virtual iter_type + __do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, double& __units) const; +#else + virtual iter_type + do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, long double& __units) const; +#endif + + /** + * @brief Read and parse a monetary value. + * + * This function reads and parses characters representing a monetary + * value. This function is a hook for derived classes to change the + * value returned. @see get() for details. + */ + virtual iter_type + do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, string_type& __digits) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ + virtual iter_type + __do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, __ibm128& __units) const; +#endif + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__) + virtual iter_type + do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, long double& __units) const; +#endif + + template + iter_type + _M_extract(iter_type __s, iter_type __end, ios_base& __io, + ios_base::iostate& __err, string& __digits) const; + }; + + template + locale::id money_get<_CharT, _InIter>::id; + + /** + * @brief Primary class template money_put. + * @ingroup locales + * + * This facet encapsulates the code to format and output a monetary + * amount. + * + * The money_put template uses protected virtual functions to + * provide the actual results. The public accessors forward the + * call to the virtual functions. These virtual functions are + * hooks for developers to implement the behavior they require from + * the money_put facet. + */ + template + class money_put : public locale::facet + { + public: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef _OutIter iter_type; + typedef basic_string<_CharT> string_type; + ///@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + money_put(size_t __refs = 0) : facet(__refs) { } + + /** + * @brief Format and output a monetary value. + * + * This function formats @a units as a monetary value according to + * moneypunct and ctype facets retrieved from io.getloc(), and writes + * the resulting characters to @a __s. For example, the value 1001 in a + * US locale would write $10.01 to @a __s. + * + * This function works by returning the result of do_put(). + * + * @param __s The stream to write to. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __fill char_type to use for padding. + * @param __units Place to store result of parsing. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, bool __intl, ios_base& __io, + char_type __fill, long double __units) const + { return this->do_put(__s, __intl, __io, __fill, __units); } + + /** + * @brief Format and output a monetary value. + * + * This function formats @a digits as a monetary value + * according to moneypunct and ctype facets retrieved from + * io.getloc(), and writes the resulting characters to @a __s. + * For example, the string 1001 in a US locale + * would write $10.01 to @a __s. + * + * This function works by returning the result of do_put(). + * + * @param __s The stream to write to. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __fill char_type to use for padding. + * @param __digits Place to store result of parsing. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, bool __intl, ios_base& __io, + char_type __fill, const string_type& __digits) const + { return this->do_put(__s, __intl, __io, __fill, __digits); } + + protected: + /// Destructor. + virtual + ~money_put() { } + + /** + * @brief Format and output a monetary value. + * + * This function formats @a units as a monetary value according to + * moneypunct and ctype facets retrieved from io.getloc(), and writes + * the resulting characters to @a __s. For example, the value 1001 in a + * US locale would write $10.01 to @a __s. + * + * This function is a hook for derived classes to change the value + * returned. @see put(). + * + * @param __s The stream to write to. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __fill char_type to use for padding. + * @param __units Place to store result of parsing. + * @return Iterator after writing. + */ + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__) + virtual iter_type + __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + double __units) const; +#else + virtual iter_type + do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + long double __units) const; +#endif + + /** + * @brief Format and output a monetary value. + * + * This function formats @a digits as a monetary value + * according to moneypunct and ctype facets retrieved from + * io.getloc(), and writes the resulting characters to @a __s. + * For example, the string 1001 in a US locale + * would write $10.01 to @a __s. + * + * This function is a hook for derived classes to change the value + * returned. @see put(). + * + * @param __s The stream to write to. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __fill char_type to use for padding. + * @param __digits Place to store result of parsing. + * @return Iterator after writing. + */ + virtual iter_type + do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + const string_type& __digits) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ + virtual iter_type + __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + __ibm128 __units) const; +#endif + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__) + virtual iter_type + do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + long double __units) const; +#endif + + template + iter_type + _M_insert(iter_type __s, ios_base& __io, char_type __fill, + const string_type& __digits) const; + }; + + template + locale::id money_put<_CharT, _OutIter>::id; + +_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 + + /** + * @brief Messages facet base class providing catalog typedef. + * @ingroup locales + */ + struct messages_base + { + typedef int catalog; + }; + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @brief Primary class template messages. + * @ingroup locales + * + * This facet encapsulates the code to retrieve messages from + * message catalogs. The only thing defined by the standard for this facet + * is the interface. All underlying functionality is + * implementation-defined. + * + * This library currently implements 3 versions of the message facet. The + * first version (gnu) is a wrapper around gettext, provided by libintl. + * The second version (ieee) is a wrapper around catgets. The final + * version (default) does no actual translation. These implementations are + * only provided for char and wchar_t instantiations. + * + * The messages template uses protected virtual functions to + * provide the actual results. The public accessors forward the + * call to the virtual functions. These virtual functions are + * hooks for developers to implement the behavior they require from + * the messages facet. + */ + template + class messages : public locale::facet, public messages_base + { + public: + // Types: + ///@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + ///@} + + protected: + // Underlying "C" library locale information saved from + // initialization, needed by messages_byname as well. + __c_locale _M_c_locale_messages; + const char* _M_name_messages; + + public: + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + messages(size_t __refs = 0); + + // Non-standard. + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __s The name of a locale. + * @param __refs Refcount to pass to the base class. + */ + explicit + messages(__c_locale __cloc, const char* __s, size_t __refs = 0); + + /* + * @brief Open a message catalog. + * + * This function opens and returns a handle to a message catalog by + * returning do_open(__s, __loc). + * + * @param __s The catalog to open. + * @param __loc Locale to use for character set conversions. + * @return Handle to the catalog or value < 0 if open fails. + */ + catalog + open(const basic_string& __s, const locale& __loc) const + { return this->do_open(__s, __loc); } + + // Non-standard and unorthodox, yet effective. + /* + * @brief Open a message catalog. + * + * This non-standard function opens and returns a handle to a message + * catalog by returning do_open(s, loc). The third argument provides a + * message catalog root directory for gnu gettext and is ignored + * otherwise. + * + * @param __s The catalog to open. + * @param __loc Locale to use for character set conversions. + * @param __dir Message catalog root directory. + * @return Handle to the catalog or value < 0 if open fails. + */ + catalog + open(const basic_string&, const locale&, const char*) const; + + /* + * @brief Look up a string in a message catalog. + * + * This function retrieves and returns a message from a catalog by + * returning do_get(c, set, msgid, s). + * + * For gnu, @a __set and @a msgid are ignored. Returns gettext(s). + * For default, returns s. For ieee, returns catgets(c,set,msgid,s). + * + * @param __c The catalog to access. + * @param __set Implementation-defined. + * @param __msgid Implementation-defined. + * @param __s Default return value if retrieval fails. + * @return Retrieved message or @a __s if get fails. + */ + string_type + get(catalog __c, int __set, int __msgid, const string_type& __s) const + { return this->do_get(__c, __set, __msgid, __s); } + + /* + * @brief Close a message catalog. + * + * Closes catalog @a c by calling do_close(c). + * + * @param __c The catalog to close. + */ + void + close(catalog __c) const + { return this->do_close(__c); } + + protected: + /// Destructor. + virtual + ~messages(); + + /* + * @brief Open a message catalog. + * + * This function opens and returns a handle to a message catalog in an + * implementation-defined manner. This function is a hook for derived + * classes to change the value returned. + * + * @param __s The catalog to open. + * @param __loc Locale to use for character set conversions. + * @return Handle to the opened catalog, value < 0 if open failed. + */ + virtual catalog + do_open(const basic_string&, const locale&) const; + + /* + * @brief Look up a string in a message catalog. + * + * This function retrieves and returns a message from a catalog in an + * implementation-defined manner. This function is a hook for derived + * classes to change the value returned. + * + * For gnu, @a __set and @a __msgid are ignored. Returns gettext(s). + * For default, returns s. For ieee, returns catgets(c,set,msgid,s). + * + * @param __c The catalog to access. + * @param __set Implementation-defined. + * @param __msgid Implementation-defined. + * @param __s Default return value if retrieval fails. + * @return Retrieved message or @a __s if get fails. + */ + virtual string_type + do_get(catalog, int, int, const string_type& __dfault) const; + + /* + * @brief Close a message catalog. + * + * @param __c The catalog to close. + */ + virtual void + do_close(catalog) const; + + // Returns a locale and codeset-converted string, given a char* message. + char* + _M_convert_to_char(const string_type& __msg) const + { + // XXX + return reinterpret_cast(const_cast<_CharT*>(__msg.c_str())); + } + + // Returns a locale and codeset-converted string, given a char* message. + string_type + _M_convert_from_char(char*) const + { + // XXX + return string_type(); + } + }; + + template + locale::id messages<_CharT>::id; + + /// Specializations for required instantiations. + template<> + string + messages::do_get(catalog, int, int, const string&) const; + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + wstring + messages::do_get(catalog, int, int, const wstring&) const; +#endif + + /// class messages_byname [22.2.7.2]. + template + class messages_byname : public messages<_CharT> + { + public: + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + + explicit + messages_byname(const char* __s, size_t __refs = 0); + +#if __cplusplus >= 201103L + explicit + messages_byname(const string& __s, size_t __refs = 0) + : messages_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~messages_byname() + { } + }; + +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +// Include host and configuration specific messages functions. +#include + +// 22.2.1.5 Template class codecvt +#include + +#include + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.h.blob new file mode 100644 index 0000000..6469ea7 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.tcc new file mode 100644 index 0000000..27b7273 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.tcc @@ -0,0 +1,1910 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_facets_nonio.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +#ifndef _LOCALE_FACETS_NONIO_TCC +#define _LOCALE_FACETS_NONIO_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + struct __use_cache<__moneypunct_cache<_CharT, _Intl> > + { + const __moneypunct_cache<_CharT, _Intl>* + operator() (const locale& __loc) const + { + const size_t __i = moneypunct<_CharT, _Intl>::id._M_id(); + const locale::facet** __caches = __loc._M_impl->_M_caches; + if (!__caches[__i]) + { + __moneypunct_cache<_CharT, _Intl>* __tmp = 0; + __try + { + __tmp = new __moneypunct_cache<_CharT, _Intl>; + __tmp->_M_cache(__loc); + } + __catch(...) + { + delete __tmp; + __throw_exception_again; + } + __loc._M_impl->_M_install_cache(__tmp, __i); + } + return static_cast< + const __moneypunct_cache<_CharT, _Intl>*>(__caches[__i]); + } + }; + + template + void + __moneypunct_cache<_CharT, _Intl>::_M_cache(const locale& __loc) + { + const moneypunct<_CharT, _Intl>& __mp = + use_facet >(__loc); + + struct _Scoped_str + { + size_t _M_len; + _CharT* _M_str; + + explicit + _Scoped_str(const basic_string<_CharT>& __str) + : _M_len(__str.size()), _M_str(new _CharT[_M_len]) + { __str.copy(_M_str, _M_len); } + + ~_Scoped_str() { delete[] _M_str; } + + void + _M_release(const _CharT*& __p, size_t& __n) + { + __p = _M_str; + __n = _M_len; + _M_str = 0; + } + }; + + _Scoped_str __curr_symbol(__mp.curr_symbol()); + _Scoped_str __positive_sign(__mp.positive_sign()); + _Scoped_str __negative_sign(__mp.negative_sign()); + + const string& __g = __mp.grouping(); + const size_t __g_size = __g.size(); + char* const __grouping = new char[__g_size]; + __g.copy(__grouping, __g_size); + + // All allocations succeeded without throwing, OK to modify *this now. + + _M_grouping = __grouping; + _M_grouping_size = __g_size; + _M_use_grouping = (__g_size + && static_cast(__grouping[0]) > 0 + && (__grouping[0] + != __gnu_cxx::__numeric_traits::__max)); + + _M_decimal_point = __mp.decimal_point(); + _M_thousands_sep = __mp.thousands_sep(); + + __curr_symbol._M_release(_M_curr_symbol, _M_curr_symbol_size); + __positive_sign._M_release(_M_positive_sign, _M_positive_sign_size); + __negative_sign._M_release(_M_negative_sign, _M_negative_sign_size); + + _M_frac_digits = __mp.frac_digits(); + _M_pos_format = __mp.pos_format(); + _M_neg_format = __mp.neg_format(); + + const ctype<_CharT>& __ct = use_facet >(__loc); + __ct.widen(money_base::_S_atoms, + money_base::_S_atoms + money_base::_S_end, _M_atoms); + + _M_allocated = true; + } + +_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 + + template + template + _InIter + money_get<_CharT, _InIter>:: + _M_extract(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, string& __units) const + { + typedef char_traits<_CharT> __traits_type; + typedef typename string_type::size_type size_type; + typedef money_base::part part; + typedef __moneypunct_cache<_CharT, _Intl> __cache_type; + + const locale& __loc = __io._M_getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + + __use_cache<__cache_type> __uc; + const __cache_type* __lc = __uc(__loc); + const char_type* __lit = __lc->_M_atoms; + + // Deduced sign. + bool __negative = false; + // Sign size. + size_type __sign_size = 0; + // True if sign is mandatory. + const bool __mandatory_sign = (__lc->_M_positive_sign_size + && __lc->_M_negative_sign_size); + // String of grouping info from thousands_sep plucked from __units. + string __grouping_tmp; + if (__lc->_M_use_grouping) + __grouping_tmp.reserve(32); + // Last position before the decimal point. + int __last_pos = 0; + // Separator positions, then, possibly, fractional digits. + int __n = 0; + // If input iterator is in a valid state. + bool __testvalid = true; + // Flag marking when a decimal point is found. + bool __testdecfound = false; + + // The tentative returned string is stored here. + string __res; + __res.reserve(32); + + const char_type* __lit_zero = __lit + money_base::_S_zero; + const money_base::pattern __p = __lc->_M_neg_format; + for (int __i = 0; __i < 4 && __testvalid; ++__i) + { + const part __which = static_cast(__p.field[__i]); + switch (__which) + { + case money_base::symbol: + // According to 22.2.6.1.2, p2, symbol is required + // if (__io.flags() & ios_base::showbase), otherwise + // is optional and consumed only if other characters + // are needed to complete the format. + if (__io.flags() & ios_base::showbase || __sign_size > 1 + || __i == 0 + || (__i == 1 && (__mandatory_sign + || (static_cast(__p.field[0]) + == money_base::sign) + || (static_cast(__p.field[2]) + == money_base::space))) + || (__i == 2 && ((static_cast(__p.field[3]) + == money_base::value) + || (__mandatory_sign + && (static_cast(__p.field[3]) + == money_base::sign))))) + { + const size_type __len = __lc->_M_curr_symbol_size; + size_type __j = 0; + for (; __beg != __end && __j < __len + && *__beg == __lc->_M_curr_symbol[__j]; + ++__beg, (void)++__j); + if (__j != __len + && (__j || __io.flags() & ios_base::showbase)) + __testvalid = false; + } + break; + case money_base::sign: + // Sign might not exist, or be more than one character long. + if (__lc->_M_positive_sign_size && __beg != __end + && *__beg == __lc->_M_positive_sign[0]) + { + __sign_size = __lc->_M_positive_sign_size; + ++__beg; + } + else if (__lc->_M_negative_sign_size && __beg != __end + && *__beg == __lc->_M_negative_sign[0]) + { + __negative = true; + __sign_size = __lc->_M_negative_sign_size; + ++__beg; + } + else if (__lc->_M_positive_sign_size + && !__lc->_M_negative_sign_size) + // "... if no sign is detected, the result is given the sign + // that corresponds to the source of the empty string" + __negative = true; + else if (__mandatory_sign) + __testvalid = false; + break; + case money_base::value: + // Extract digits, remove and stash away the + // grouping of found thousands separators. + for (; __beg != __end; ++__beg) + { + const char_type __c = *__beg; + const char_type* __q = __traits_type::find(__lit_zero, + 10, __c); + if (__q != 0) + { + __res += money_base::_S_atoms[__q - __lit]; + ++__n; + } + else if (__c == __lc->_M_decimal_point + && !__testdecfound) + { + if (__lc->_M_frac_digits <= 0) + break; + + __last_pos = __n; + __n = 0; + __testdecfound = true; + } + else if (__lc->_M_use_grouping + && __c == __lc->_M_thousands_sep + && !__testdecfound) + { + if (__n) + { + // Mark position for later analysis. + __grouping_tmp += static_cast(__n); + __n = 0; + } + else + { + __testvalid = false; + break; + } + } + else + break; + } + if (__res.empty()) + __testvalid = false; + break; + case money_base::space: + // At least one space is required. + if (__beg != __end && __ctype.is(ctype_base::space, *__beg)) + ++__beg; + else + __testvalid = false; + // fallthrough + case money_base::none: + // Only if not at the end of the pattern. + if (__i != 3) + for (; __beg != __end + && __ctype.is(ctype_base::space, *__beg); ++__beg); + break; + } + } + + // Need to get the rest of the sign characters, if they exist. + if (__sign_size > 1 && __testvalid) + { + const char_type* __sign = __negative ? __lc->_M_negative_sign + : __lc->_M_positive_sign; + size_type __i = 1; + for (; __beg != __end && __i < __sign_size + && *__beg == __sign[__i]; ++__beg, (void)++__i); + + if (__i != __sign_size) + __testvalid = false; + } + + if (__testvalid) + { + // Strip leading zeros. + if (__res.size() > 1) + { + const size_type __first = __res.find_first_not_of('0'); + const bool __only_zeros = __first == string::npos; + if (__first) + __res.erase(0, __only_zeros ? __res.size() - 1 : __first); + } + + // 22.2.6.1.2, p4 + if (__negative && __res[0] != '0') + __res.insert(__res.begin(), '-'); + + // Test for grouping fidelity. + if (__grouping_tmp.size()) + { + // Add the ending grouping. + __grouping_tmp += static_cast(__testdecfound ? __last_pos + : __n); + if (!std::__verify_grouping(__lc->_M_grouping, + __lc->_M_grouping_size, + __grouping_tmp)) + __err |= ios_base::failbit; + } + + // Iff not enough digits were supplied after the decimal-point. + if (__testdecfound && __n != __lc->_M_frac_digits) + __testvalid = false; + } + + // Iff valid sequence is not recognized. + if (!__testvalid) + __err |= ios_base::failbit; + else + __units.swap(__res); + + // Iff no more characters are available. + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__) + template + _InIter + money_get<_CharT, _InIter>:: + __do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, double& __units) const + { + string __str; + __beg = __intl ? _M_extract(__beg, __end, __io, __err, __str) + : _M_extract(__beg, __end, __io, __err, __str); + std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale()); + return __beg; + } +#endif + + template + _InIter + money_get<_CharT, _InIter>:: + do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, long double& __units) const + { + string __str; + __beg = __intl ? _M_extract(__beg, __end, __io, __err, __str) + : _M_extract(__beg, __end, __io, __err, __str); + std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale()); + return __beg; + } + + template + _InIter + money_get<_CharT, _InIter>:: + do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, string_type& __digits) const + { + typedef typename string::size_type size_type; + + const locale& __loc = __io._M_getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + + string __str; + __beg = __intl ? _M_extract(__beg, __end, __io, __err, __str) + : _M_extract(__beg, __end, __io, __err, __str); + const size_type __len = __str.size(); + if (__len) + { + __digits.resize(__len); + __ctype.widen(__str.data(), __str.data() + __len, &__digits[0]); + } + return __beg; + } + +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ + template + _InIter + money_get<_CharT, _InIter>:: + __do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, __ibm128& __units) const + { + string __str; + __beg = __intl ? _M_extract(__beg, __end, __io, __err, __str) + : _M_extract(__beg, __end, __io, __err, __str); + std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale()); + return __beg; + } +#endif + + template + template + _OutIter + money_put<_CharT, _OutIter>:: + _M_insert(iter_type __s, ios_base& __io, char_type __fill, + const string_type& __digits) const + { + typedef typename string_type::size_type size_type; + typedef money_base::part part; + typedef __moneypunct_cache<_CharT, _Intl> __cache_type; + + const locale& __loc = __io._M_getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + + __use_cache<__cache_type> __uc; + const __cache_type* __lc = __uc(__loc); + const char_type* __lit = __lc->_M_atoms; + + // Determine if negative or positive formats are to be used, and + // discard leading negative_sign if it is present. + const char_type* __beg = __digits.data(); + + money_base::pattern __p; + const char_type* __sign; + size_type __sign_size; + if (!(*__beg == __lit[money_base::_S_minus])) + { + __p = __lc->_M_pos_format; + __sign = __lc->_M_positive_sign; + __sign_size = __lc->_M_positive_sign_size; + } + else + { + __p = __lc->_M_neg_format; + __sign = __lc->_M_negative_sign; + __sign_size = __lc->_M_negative_sign_size; + if (__digits.size()) + ++__beg; + } + + // Look for valid numbers in the ctype facet within input digits. + size_type __len = __ctype.scan_not(ctype_base::digit, __beg, + __beg + __digits.size()) - __beg; + if (__len) + { + // Assume valid input, and attempt to format. + // Break down input numbers into base components, as follows: + // final_value = grouped units + (decimal point) + (digits) + string_type __value; + __value.reserve(2 * __len); + + // Add thousands separators to non-decimal digits, per + // grouping rules. + long __paddec = __len - __lc->_M_frac_digits; + if (__paddec > 0) + { + if (__lc->_M_frac_digits < 0) + __paddec = __len; + if (__lc->_M_grouping_size) + { + __value.assign(2 * __paddec, char_type()); + _CharT* __vend = + std::__add_grouping(&__value[0], __lc->_M_thousands_sep, + __lc->_M_grouping, + __lc->_M_grouping_size, + __beg, __beg + __paddec); + __value.erase(__vend - &__value[0]); + } + else + __value.assign(__beg, __paddec); + } + + // Deal with decimal point, decimal digits. + if (__lc->_M_frac_digits > 0) + { + __value += __lc->_M_decimal_point; + if (__paddec >= 0) + __value.append(__beg + __paddec, __lc->_M_frac_digits); + else + { + // Have to pad zeros in the decimal position. + __value.append(-__paddec, __lit[money_base::_S_zero]); + __value.append(__beg, __len); + } + } + + // Calculate length of resulting string. + const ios_base::fmtflags __f = __io.flags() + & ios_base::adjustfield; + __len = __value.size() + __sign_size; + __len += ((__io.flags() & ios_base::showbase) + ? __lc->_M_curr_symbol_size : 0); + + string_type __res; + __res.reserve(2 * __len); + + const size_type __width = static_cast(__io.width()); + const bool __testipad = (__f == ios_base::internal + && __len < __width); + // Fit formatted digits into the required pattern. + for (int __i = 0; __i < 4; ++__i) + { + const part __which = static_cast(__p.field[__i]); + switch (__which) + { + case money_base::symbol: + if (__io.flags() & ios_base::showbase) + __res.append(__lc->_M_curr_symbol, + __lc->_M_curr_symbol_size); + break; + case money_base::sign: + // Sign might not exist, or be more than one + // character long. In that case, add in the rest + // below. + if (__sign_size) + __res += __sign[0]; + break; + case money_base::value: + __res += __value; + break; + case money_base::space: + // At least one space is required, but if internal + // formatting is required, an arbitrary number of + // fill spaces will be necessary. + if (__testipad) + __res.append(__width - __len, __fill); + else + __res += __fill; + break; + case money_base::none: + if (__testipad) + __res.append(__width - __len, __fill); + break; + } + } + + // Special case of multi-part sign parts. + if (__sign_size > 1) + __res.append(__sign + 1, __sign_size - 1); + + // Pad, if still necessary. + __len = __res.size(); + if (__width > __len) + { + if (__f == ios_base::left) + // After. + __res.append(__width - __len, __fill); + else + // Before. + __res.insert(0, __width - __len, __fill); + __len = __width; + } + + // Write resulting, fully-formatted string to output iterator. + __s = std::__write(__s, __res.data(), __len); + } + __io.width(0); + return __s; + } + +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && (_GLIBCXX_USE_CXX11_ABI == 0 || defined __LONG_DOUBLE_IEEE128__) + template + _OutIter + money_put<_CharT, _OutIter>:: + __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + double __units) const + { return this->do_put(__s, __intl, __io, __fill, (long double) __units); } +#endif + + template + _OutIter + money_put<_CharT, _OutIter>:: + do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + long double __units) const + { + const locale __loc = __io.getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); +#if _GLIBCXX_USE_C99_STDIO + // First try a buffer perhaps big enough. + int __cs_size = 64; + char* __cs = static_cast(__builtin_alloca(__cs_size)); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 328. Bad sprintf format modifier in money_put<>::do_put() + int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, + "%.*Lf", 0, __units); + // If the buffer was not large enough, try again with the correct size. + if (__len >= __cs_size) + { + __cs_size = __len + 1; + __cs = static_cast(__builtin_alloca(__cs_size)); + __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size, + "%.*Lf", 0, __units); + } +#else + // max_exponent10 + 1 for the integer part, + 2 for sign and '\0'. + const int __cs_size = + __gnu_cxx::__numeric_traits::__max_exponent10 + 3; + char* __cs = static_cast(__builtin_alloca(__cs_size)); + int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, "%.*Lf", + 0, __units); +#endif + string_type __digits(__len, char_type()); + __ctype.widen(__cs, __cs + __len, &__digits[0]); + return __intl ? _M_insert(__s, __io, __fill, __digits) + : _M_insert(__s, __io, __fill, __digits); + } + + template + _OutIter + money_put<_CharT, _OutIter>:: + do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + const string_type& __digits) const + { return __intl ? _M_insert(__s, __io, __fill, __digits) + : _M_insert(__s, __io, __fill, __digits); } + +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ +// The snprintf symbol in glibc that works with __ibm128 format is not visible +// when compiling with -mabi=ieeelongdouble so we use this name for it instead. +// N.B. we don't use __typeof__(__builtin_snprintf) for the type because that +// would inherit __attribute__((format(printf, 3, 4))) and give a warning for +// passing __ibm128 to %Lf instead of long double. The warning would be wrong +// because long double in this TU is __ieee128 and snprintf expects __ibm128. +extern "C" int +__glibcxx_snprintfibm128(char*, size_t, const char*, ...) __asm__("snprintf"); + + template + _OutIter + money_put<_CharT, _OutIter>:: + __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + __ibm128 __units) const + { + const locale __loc = __io.getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + // First try a buffer perhaps big enough. + int __cs_size = 64; + char* __cs = static_cast(__builtin_alloca(__cs_size)); + const __c_locale __old = __gnu_cxx::__uselocale(_S_get_c_locale()); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 328. Bad sprintf format modifier in money_put<>::do_put() + int __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0, + __units); + // If the buffer was not large enough, try again with the correct size. + if (__len >= __cs_size) + { + __cs_size = __len + 1; + __cs = static_cast(__builtin_alloca(__cs_size)); + __len = __glibcxx_snprintfibm128(__cs, __cs_size, "%.*Lf", 0, + __units); + } + __gnu_cxx::__uselocale(__old); + string_type __digits(__len, char_type()); + __ctype.widen(__cs, __cs + __len, &__digits[0]); + return __intl ? _M_insert(__s, __io, __fill, __digits) + : _M_insert(__s, __io, __fill, __digits); + } +#endif + +_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 + + // NB: Not especially useful. Without an ios_base object or some + // kind of locale reference, we are left clawing at the air where + // the side of the mountain used to be... + template + time_base::dateorder + time_get<_CharT, _InIter>::do_date_order() const + { return time_base::no_order; } + + // Expand a strptime format string and parse it. E.g., do_get_date() may + // pass %m/%d/%Y => extracted characters. + template + _InIter + time_get<_CharT, _InIter>:: + _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, + const _CharT* __format, + __time_get_state &__state) const + { + const locale& __loc = __io._M_getloc(); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); + const ctype<_CharT>& __ctype = use_facet >(__loc); + const size_t __len = char_traits<_CharT>::length(__format); + + ios_base::iostate __tmperr = ios_base::goodbit; + size_t __i = 0; + for (; __beg != __end && __i < __len && !__tmperr; ++__i) + { + if (__ctype.narrow(__format[__i], 0) == '%') + { + // Verify valid formatting code, attempt to extract. + char __c = __ctype.narrow(__format[++__i], 0); + int __mem = 0; + if (__c == 'E' || __c == 'O') + __c = __ctype.narrow(__format[++__i], 0); + switch (__c) + { + const char* __cs; + _CharT __wcs[10]; + case 'a': + case 'A': + // Weekday name (possibly abbreviated) [tm_wday] + const char_type* __days[14]; + __tp._M_days(&__days[0]); + __tp._M_days_abbreviated(&__days[7]); + __beg = _M_extract_name(__beg, __end, __mem, __days, + 14, __io, __tmperr); + if (!__tmperr) + { + __tm->tm_wday = __mem % 7; + __state._M_have_wday = 1; + } + break; + case 'h': + case 'b': + case 'B': + // Month name (possibly abbreviated) [tm_mon] + const char_type* __months[24]; + __tp._M_months(&__months[0]); + __tp._M_months_abbreviated(&__months[12]); + __beg = _M_extract_name(__beg, __end, __mem, + __months, 24, __io, __tmperr); + if (!__tmperr) + { + __tm->tm_mon = __mem % 12; + __state._M_have_mon = 1; + __state._M_want_xday = 1; + } + break; + case 'c': + // Default time and date representation. + const char_type* __dt[2]; + __tp._M_date_time_formats(__dt); + __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, + __tm, __dt[0], __state); + if (!__tmperr) + __state._M_want_xday = 1; + break; + case 'C': + // Century. + __beg = _M_extract_num(__beg, __end, __mem, 0, 99, 2, + __io, __tmperr); + if (!__tmperr) + { + __state._M_century = __mem; + __state._M_have_century = 1; + __state._M_want_xday = 1; + } + break; + case 'd': + case 'e': + // Day [1, 31]. [tm_mday] + if (__ctype.is(ctype_base::space, *__beg)) + ++__beg; + __beg = _M_extract_num(__beg, __end, __mem, 1, 31, 2, + __io, __tmperr); + if (!__tmperr) + { + __tm->tm_mday = __mem; + __state._M_have_mday = 1; + __state._M_want_xday = 1; + } + break; + case 'D': + // Equivalent to %m/%d/%y.[tm_mon, tm_mday, tm_year] + __cs = "%m/%d/%y"; + __ctype.widen(__cs, __cs + 9, __wcs); + __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, + __tm, __wcs, __state); + if (!__tmperr) + __state._M_want_xday = 1; + break; + case 'H': + // Hour [00, 23]. [tm_hour] + __beg = _M_extract_num(__beg, __end, __mem, 0, 23, 2, + __io, __tmperr); + if (!__tmperr) + { + __tm->tm_hour = __mem; + __state._M_have_I = 0; + } + break; + case 'I': + // Hour [01, 12]. [tm_hour] + __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2, + __io, __tmperr); + if (!__tmperr) + { + __tm->tm_hour = __mem % 12; + __state._M_have_I = 1; + } + break; + case 'j': + // Day number of year. + __beg = _M_extract_num(__beg, __end, __mem, 1, 366, 3, + __io, __tmperr); + if (!__tmperr) + { + __tm->tm_yday = __mem - 1; + __state._M_have_yday = 1; + } + break; + case 'm': + // Month [01, 12]. [tm_mon] + __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2, + __io, __tmperr); + if (!__tmperr) + { + __tm->tm_mon = __mem - 1; + __state._M_have_mon = 1; + } + break; + case 'M': + // Minute [00, 59]. [tm_min] + __beg = _M_extract_num(__beg, __end, __mem, 0, 59, 2, + __io, __tmperr); + if (!__tmperr) + __tm->tm_min = __mem; + break; + case 'n': + case 't': + while (__beg != __end + && __ctype.is(ctype_base::space, *__beg)) + ++__beg; + break; + case 'p': + // Locale's a.m. or p.m. + const char_type* __ampm[2]; + __tp._M_am_pm(&__ampm[0]); + if (!__ampm[0][0] || !__ampm[1][0]) + break; + __beg = _M_extract_name(__beg, __end, __mem, __ampm, + 2, __io, __tmperr); + if (!__tmperr && __mem) + __state._M_is_pm = 1; + break; + case 'r': + // Locale's 12-hour clock time format (in C %I:%M:%S %p). + const char_type* __ampm_format; + __tp._M_am_pm_format(&__ampm_format); + __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, + __tm, __ampm_format, __state); + break; + case 'R': + // Equivalent to (%H:%M). + __cs = "%H:%M"; + __ctype.widen(__cs, __cs + 6, __wcs); + __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, + __tm, __wcs, __state); + break; + case 'S': + // Seconds. [tm_sec] + // [00, 60] in C99 (one leap-second), [00, 61] in C89. +#if _GLIBCXX_USE_C99 + __beg = _M_extract_num(__beg, __end, __mem, 0, 60, 2, +#else + __beg = _M_extract_num(__beg, __end, __mem, 0, 61, 2, +#endif + __io, __tmperr); + if (!__tmperr) + __tm->tm_sec = __mem; + break; + case 'T': + // Equivalent to (%H:%M:%S). + __cs = "%H:%M:%S"; + __ctype.widen(__cs, __cs + 9, __wcs); + __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, + __tm, __wcs, __state); + break; + case 'U': + // Week number of the year (Sunday as first day of week). + __beg = _M_extract_num(__beg, __end, __mem, 0, 53, 2, + __io, __tmperr); + if (!__tmperr) + { + __state._M_week_no = __mem; + __state._M_have_uweek = 1; + } + break; + case 'w': + // Weekday [tm_wday] + __beg = _M_extract_num(__beg, __end, __mem, 0, 6, 1, + __io, __tmperr); + if (!__tmperr) + { + __tm->tm_wday = __mem; + __state._M_have_wday = 1; + } + break; + case 'W': + // Week number of the year (Monday as first day of week). + __beg = _M_extract_num(__beg, __end, __mem, 0, 53, 2, + __io, __tmperr); + if (!__tmperr) + { + __state._M_week_no = __mem; + __state._M_have_wweek = 1; + } + break; + case 'x': + // Locale's date. + const char_type* __dates[2]; + __tp._M_date_formats(__dates); + __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, + __tm, __dates[0], __state); + break; + case 'X': + // Locale's time. + const char_type* __times[2]; + __tp._M_time_formats(__times); + __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, + __tm, __times[0], __state); + break; + case 'y': + // The last 2 digits of year. + __beg = _M_extract_num(__beg, __end, __mem, 0, 99, 2, + __io, __tmperr); + if (!__tmperr) + { + __state._M_want_century = 1; + __state._M_want_xday = 1; + // As an extension, if the 2 digits are followed by + // 1-2 further digits, treat it like %Y. + __c = 0; + if (__beg != __end) + __c = __ctype.narrow(*__beg, '*'); + if (__c >= '0' && __c <= '9') + { + ++__beg; + __mem = __mem * 10 + (__c - '0'); + if (__beg != __end) + { + __c = __ctype.narrow(*__beg, '*'); + if (__c >= '0' && __c <= '9') + { + ++__beg; + __mem = __mem * 10 + (__c - '0'); + } + } + __mem -= 1900; + __state._M_want_century = 0; + } + // Otherwise, as per POSIX 2008, 00-68 is 2000-2068, + // while 69-99 is 1969-1999. + else if (__mem < 69) + __mem += 100; + __tm->tm_year = __mem; + } + break; + case 'Y': + // Year. + __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4, + __io, __tmperr); + if (!__tmperr) + { + __tm->tm_year = __mem - 1900; + __state._M_want_century = 0; + __state._M_want_xday = 1; + } + break; + case 'Z': + // Timezone info. + if (__ctype.is(ctype_base::upper, *__beg)) + { + int __tmp; + __beg = _M_extract_name(__beg, __end, __tmp, + __timepunct_cache<_CharT>::_S_timezones, + 14, __io, __tmperr); + + // GMT requires special effort. + if (__beg != __end && !__tmperr && __tmp == 0 + && (*__beg == __ctype.widen('-') + || *__beg == __ctype.widen('+'))) + { + __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2, + __io, __tmperr); + __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2, + __io, __tmperr); + } + } + else + __tmperr |= ios_base::failbit; + break; + case '%': + if (*__beg == __ctype.widen('%')) + ++__beg; + else + __tmperr |= ios_base::failbit; + break; + default: + // Not recognized. + __tmperr |= ios_base::failbit; + } + } + else if (__ctype.is(ctype_base::space, __format[__i])) + { + // Skip any whitespace. + while (__beg != __end + && __ctype.is(ctype_base::space, *__beg)) + ++__beg; + } + else + { + // Verify format and input match, extract and discard. + // TODO real case-insensitive comparison + if (__ctype.tolower(__format[__i]) == __ctype.tolower(*__beg) + || __ctype.toupper(__format[__i]) == __ctype.toupper(*__beg)) + ++__beg; + else + __tmperr |= ios_base::failbit; + } + } + + if (__tmperr || __i != __len) + __err |= ios_base::failbit; + + return __beg; + } + + template + _InIter + time_get<_CharT, _InIter>:: + _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, + const _CharT* __format) const + { + __time_get_state __state = __time_get_state(); + return _M_extract_via_format(__beg, __end, __io, __err, __tm, + __format, __state); + } + + template + _InIter + time_get<_CharT, _InIter>:: + _M_extract_num(iter_type __beg, iter_type __end, int& __member, + int __min, int __max, size_t __len, + ios_base& __io, ios_base::iostate& __err) const + { + const locale& __loc = __io._M_getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + + size_t __i = 0; + int __value = 0; + for (; __beg != __end && __i < __len; ++__beg, (void)++__i) + { + const char __c = __ctype.narrow(*__beg, '*'); + if (__c >= '0' && __c <= '9') + { + __value = __value * 10 + (__c - '0'); + if (__value > __max) + break; + } + else + break; + } + if (__i && __value >= __min && __value <= __max) + __member = __value; + else + __err |= ios_base::failbit; + + return __beg; + } + + // Assumptions: + // All elements in __names are unique, except if __indexlen is + // even __names in the first half could be the same as corresponding + // __names in the second half (May is abbreviated as May). Some __names + // elements could be prefixes of other __names elements. + template + _InIter + time_get<_CharT, _InIter>:: + _M_extract_name(iter_type __beg, iter_type __end, int& __member, + const _CharT** __names, size_t __indexlen, + ios_base& __io, ios_base::iostate& __err) const + { + typedef char_traits<_CharT> __traits_type; + const locale& __loc = __io._M_getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + + size_t* __matches + = static_cast(__builtin_alloca(2 * sizeof(size_t) + * __indexlen)); + size_t* __lengths = __matches + __indexlen; + size_t __nmatches = 0; + size_t __pos = 0; + bool __testvalid = true; + const char_type* __name; + bool __begupdated = false; + + // Look for initial matches. + if (__beg != __end) + { + const char_type __c = *__beg; + // TODO real case-insensitive comparison + const char_type __cl = __ctype.tolower(__c); + const char_type __cu = __ctype.toupper(__c); + for (size_t __i1 = 0; __i1 < __indexlen; ++__i1) + if (__cl == __ctype.tolower(__names[__i1][0]) + || __cu == __ctype.toupper(__names[__i1][0])) + { + __lengths[__nmatches] + = __traits_type::length(__names[__i1]); + __matches[__nmatches++] = __i1; + } + } + + while (__nmatches > 1) + { + // Find smallest matching string. + size_t __minlen = __lengths[0]; + for (size_t __i2 = 1; __i2 < __nmatches; ++__i2) + __minlen = std::min(__minlen, __lengths[__i2]); + ++__pos; + ++__beg; + if (__pos == __minlen) + { + // If some match has remaining length of 0, + // need to decide if any match with remaining + // length non-zero matches the next character. + // If so, remove all matches with remaining length + // 0 from consideration, otherwise keep only matches + // with remaining length 0. + bool __match_longer = false; + + if (__beg != __end) + { + // TODO real case-insensitive comparison + const char_type __cl = __ctype.tolower(*__beg); + const char_type __cu = __ctype.toupper(*__beg); + for (size_t __i3 = 0; __i3 < __nmatches; ++__i3) + { + __name = __names[__matches[__i3]]; + if (__lengths[__i3] > __pos + && (__ctype.tolower(__name[__pos]) == __cl + || __ctype.toupper(__name[__pos]) == __cu)) + { + __match_longer = true; + break; + } + } + } + for (size_t __i4 = 0; __i4 < __nmatches;) + if (__match_longer == (__lengths[__i4] == __pos)) + { + __matches[__i4] = __matches[--__nmatches]; + __lengths[__i4] = __lengths[__nmatches]; + } + else + ++__i4; + if (__match_longer) + { + __minlen = __lengths[0]; + for (size_t __i5 = 1; __i5 < __nmatches; ++__i5) + __minlen = std::min(__minlen, __lengths[__i5]); + } + else + { + // Deal with May being full as well as abbreviated month + // name. Pick the smaller index. + if (__nmatches == 2 && (__indexlen & 1) == 0) + { + if (__matches[0] < __indexlen / 2) + { + if (__matches[1] == __matches[0] + __indexlen / 2) + __nmatches = 1; + } + else if (__matches[1] == __matches[0] - __indexlen / 2) + { + __matches[0] = __matches[1]; + __lengths[0] = __lengths[1]; + __nmatches = 1; + } + } + __begupdated = true; + break; + } + } + if (__pos < __minlen && __beg != __end) + { + // TODO real case-insensitive comparison + const char_type __cl = __ctype.tolower(*__beg); + const char_type __cu = __ctype.toupper(*__beg); + for (size_t __i6 = 0; __i6 < __nmatches;) + { + __name = __names[__matches[__i6]]; + if (__ctype.tolower(__name[__pos]) != __cl + && __ctype.toupper(__name[__pos]) != __cu) + { + __matches[__i6] = __matches[--__nmatches]; + __lengths[__i6] = __lengths[__nmatches]; + } + else + ++__i6; + } + } + else + break; + } + + if (__nmatches == 1) + { + // Make sure found name is completely extracted. + if (!__begupdated) + { + ++__beg; + ++__pos; + } + __name = __names[__matches[0]]; + const size_t __len = __lengths[0]; + while (__pos < __len + && __beg != __end + // TODO real case-insensitive comparison + && (__ctype.tolower(__name[__pos]) == __ctype.tolower(*__beg) + || (__ctype.toupper(__name[__pos]) + == __ctype.toupper(*__beg)))) + ++__beg, (void)++__pos; + + if (__len == __pos) + __member = __matches[0]; + else + __testvalid = false; + } + else + __testvalid = false; + if (!__testvalid) + __err |= ios_base::failbit; + + return __beg; + } + + template + _InIter + time_get<_CharT, _InIter>:: + _M_extract_wday_or_month(iter_type __beg, iter_type __end, int& __member, + const _CharT** __names, size_t __indexlen, + ios_base& __io, ios_base::iostate& __err) const + { + typedef char_traits<_CharT> __traits_type; + const locale& __loc = __io._M_getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + + int* __matches = static_cast(__builtin_alloca(2 * sizeof(int) + * __indexlen)); + size_t __nmatches = 0; + size_t* __matches_lengths = 0; + size_t __pos = 0; + + if (__beg != __end) + { + const char_type __c = *__beg; + for (size_t __i = 0; __i < 2 * __indexlen; ++__i) + if (__c == __names[__i][0] + || __c == __ctype.toupper(__names[__i][0])) + __matches[__nmatches++] = __i; + } + + if (__nmatches) + { + ++__beg; + ++__pos; + + __matches_lengths + = static_cast(__builtin_alloca(sizeof(size_t) + * __nmatches)); + for (size_t __i = 0; __i < __nmatches; ++__i) + __matches_lengths[__i] + = __traits_type::length(__names[__matches[__i]]); + } + + for (; __beg != __end; ++__beg, (void)++__pos) + { + size_t __nskipped = 0; + const char_type __c = *__beg; + for (size_t __i = 0; __i < __nmatches;) + { + const char_type* __name = __names[__matches[__i]]; + if (__pos >= __matches_lengths[__i]) + ++__nskipped, ++__i; + else if (!(__name[__pos] == __c)) + { + --__nmatches; + __matches[__i] = __matches[__nmatches]; + __matches_lengths[__i] = __matches_lengths[__nmatches]; + } + else + ++__i; + } + if (__nskipped == __nmatches) + break; + } + + if ((__nmatches == 1 && __matches_lengths[0] == __pos) + || (__nmatches == 2 && (__matches_lengths[0] == __pos + || __matches_lengths[1] == __pos))) + __member = (__matches[0] >= (int)__indexlen + ? __matches[0] - (int)__indexlen : __matches[0]); + else + __err |= ios_base::failbit; + + return __beg; + } + + template + _InIter + time_get<_CharT, _InIter>:: + do_get_time(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { + const locale& __loc = __io._M_getloc(); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); + const char_type* __times[2]; + __tp._M_time_formats(__times); + __time_get_state __state = __time_get_state(); + __beg = _M_extract_via_format(__beg, __end, __io, __err, + __tm, __times[0], __state); + __state._M_finalize_state(__tm); + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + + template + _InIter + time_get<_CharT, _InIter>:: + do_get_date(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { + const locale& __loc = __io._M_getloc(); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); + const char_type* __dates[2]; + __tp._M_date_formats(__dates); + __time_get_state __state = __time_get_state(); + __beg = _M_extract_via_format(__beg, __end, __io, __err, + __tm, __dates[0], __state); + __state._M_finalize_state(__tm); + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + + template + _InIter + time_get<_CharT, _InIter>:: + do_get_weekday(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { + const locale& __loc = __io._M_getloc(); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); + const char_type* __days[14]; + __tp._M_days_abbreviated(__days); + __tp._M_days(__days + 7); + int __tmpwday; + ios_base::iostate __tmperr = ios_base::goodbit; + + __beg = _M_extract_wday_or_month(__beg, __end, __tmpwday, __days, 7, + __io, __tmperr); + if (!__tmperr) + __tm->tm_wday = __tmpwday; + else + __err |= ios_base::failbit; + + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + + template + _InIter + time_get<_CharT, _InIter>:: + do_get_monthname(iter_type __beg, iter_type __end, + ios_base& __io, ios_base::iostate& __err, tm* __tm) const + { + const locale& __loc = __io._M_getloc(); + const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc); + const char_type* __months[24]; + __tp._M_months_abbreviated(__months); + __tp._M_months(__months + 12); + int __tmpmon; + ios_base::iostate __tmperr = ios_base::goodbit; + + __beg = _M_extract_wday_or_month(__beg, __end, __tmpmon, __months, 12, + __io, __tmperr); + if (!__tmperr) + __tm->tm_mon = __tmpmon; + else + __err |= ios_base::failbit; + + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + + template + _InIter + time_get<_CharT, _InIter>:: + do_get_year(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { + int __tmpyear; + ios_base::iostate __tmperr = ios_base::goodbit; + const locale& __loc = __io._M_getloc(); + const ctype<_CharT>& __ctype = use_facet >(__loc); + + __beg = _M_extract_num(__beg, __end, __tmpyear, 0, 99, 2, + __io, __tmperr); + if (!__tmperr) + { + char __c = 0; + if (__beg != __end) + __c = __ctype.narrow(*__beg, '*'); + // For 1-2 digit year, assume 69-99 is 1969-1999, 0-68 is 2000-2068. + // For 3-4 digit year, use it as year. + // __tm->tm_year needs year - 1900 though. + if (__c >= '0' && __c <= '9') + { + ++__beg; + __tmpyear = __tmpyear * 10 + (__c - '0'); + if (__beg != __end) + { + __c = __ctype.narrow(*__beg, '*'); + if (__c >= '0' && __c <= '9') + { + ++__beg; + __tmpyear = __tmpyear * 10 + (__c - '0'); + } + } + __tmpyear -= 1900; + } + else if (__tmpyear < 69) + __tmpyear += 100; + __tm->tm_year = __tmpyear; + } + else + __err |= ios_base::failbit; + + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + +#if __cplusplus >= 201103L + template + inline + _InIter + time_get<_CharT, _InIter>:: + get(iter_type __s, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, const char_type* __fmt, + const char_type* __fmtend) const + { + const locale& __loc = __io._M_getloc(); + ctype<_CharT> const& __ctype = use_facet >(__loc); + __err = ios_base::goodbit; + bool __use_state = false; +#if __GNUC__ >= 5 && !defined(_GLIBCXX_CLANG) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpmf-conversions" + // Nasty hack. The C++ standard mandates that get invokes the do_get + // virtual method, but unfortunately at least without an ABI change + // for the facets we can't keep state across the different do_get + // calls. So e.g. if __fmt is "%p %I:%M:%S", we can't handle it + // properly, because we first handle the %p am/pm specifier and only + // later the 12-hour format specifier. + if ((void*)(this->*(&time_get::do_get)) == (void*)(&time_get::do_get)) + __use_state = true; +#pragma GCC diagnostic pop +#endif + __time_get_state __state = __time_get_state(); + while (__fmt != __fmtend && + __err == ios_base::goodbit) + { + if (__s == __end) + { + __err = ios_base::eofbit | ios_base::failbit; + break; + } + else if (__ctype.narrow(*__fmt, 0) == '%') + { + const char_type* __fmt_start = __fmt; + char __format; + char __mod = 0; + if (++__fmt == __fmtend) + { + __err = ios_base::failbit; + break; + } + const char __c = __ctype.narrow(*__fmt, 0); + if (__c != 'E' && __c != 'O') + __format = __c; + else if (++__fmt != __fmtend) + { + __mod = __c; + __format = __ctype.narrow(*__fmt, 0); + } + else + { + __err = ios_base::failbit; + break; + } + if (__use_state) + { + char_type __new_fmt[4]; + __new_fmt[0] = __fmt_start[0]; + __new_fmt[1] = __fmt_start[1]; + if (__mod) + { + __new_fmt[2] = __fmt_start[2]; + __new_fmt[3] = char_type(); + } + else + __new_fmt[2] = char_type(); + __s = _M_extract_via_format(__s, __end, __io, __err, __tm, + __new_fmt, __state); + if (__s == __end) + __err |= ios_base::eofbit; + } + else + __s = this->do_get(__s, __end, __io, __err, __tm, __format, + __mod); + ++__fmt; + } + else if (__ctype.is(ctype_base::space, *__fmt)) + { + ++__fmt; + while (__fmt != __fmtend && + __ctype.is(ctype_base::space, *__fmt)) + ++__fmt; + + while (__s != __end && + __ctype.is(ctype_base::space, *__s)) + ++__s; + } + // TODO real case-insensitive comparison + else if (__ctype.tolower(*__s) == __ctype.tolower(*__fmt) || + __ctype.toupper(*__s) == __ctype.toupper(*__fmt)) + { + ++__s; + ++__fmt; + } + else + { + __err = ios_base::failbit; + break; + } + } + if (__use_state) + __state._M_finalize_state(__tm); + return __s; + } + + template + inline + _InIter + time_get<_CharT, _InIter>:: + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, + char __format, char __mod) const + { + const locale& __loc = __io._M_getloc(); + ctype<_CharT> const& __ctype = use_facet >(__loc); + __err = ios_base::goodbit; + + char_type __fmt[4]; + __fmt[0] = __ctype.widen('%'); + if (!__mod) + { + __fmt[1] = __format; + __fmt[2] = char_type(); + } + else + { + __fmt[1] = __mod; + __fmt[2] = __format; + __fmt[3] = char_type(); + } + + __time_get_state __state = __time_get_state(); + __beg = _M_extract_via_format(__beg, __end, __io, __err, __tm, __fmt, + __state); + __state._M_finalize_state(__tm); + if (__beg == __end) + __err |= ios_base::eofbit; + return __beg; + } + +#endif // __cplusplus >= 201103L + + template + _OutIter + time_put<_CharT, _OutIter>:: + put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, + const _CharT* __beg, const _CharT* __end) const + { + const locale& __loc = __io._M_getloc(); + ctype<_CharT> const& __ctype = use_facet >(__loc); + for (; __beg != __end; ++__beg) + if (__ctype.narrow(*__beg, 0) != '%') + { + *__s = *__beg; + ++__s; + } + else if (++__beg != __end) + { + char __format; + char __mod = 0; + const char __c = __ctype.narrow(*__beg, 0); + if (__c != 'E' && __c != 'O') + __format = __c; + else if (++__beg != __end) + { + __mod = __c; + __format = __ctype.narrow(*__beg, 0); + } + else + break; + __s = this->do_put(__s, __io, __fill, __tm, __format, __mod); + } + else + break; + return __s; + } + + template + _OutIter + time_put<_CharT, _OutIter>:: + do_put(iter_type __s, ios_base& __io, char_type, const tm* __tm, + char __format, char __mod) const + { + const locale& __loc = __io._M_getloc(); + ctype<_CharT> const& __ctype = use_facet >(__loc); + __timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc); + + // NB: This size is arbitrary. Should this be a data member, + // initialized at construction? + const size_t __maxlen = 128; + char_type __res[__maxlen]; + + // NB: In IEEE 1003.1-200x, and perhaps other locale models, it + // is possible that the format character will be longer than one + // character. Possibilities include 'E' or 'O' followed by a + // format character: if __mod is not the default argument, assume + // it's a valid modifier. + char_type __fmt[4]; + __fmt[0] = __ctype.widen('%'); + if (!__mod) + { + __fmt[1] = __format; + __fmt[2] = char_type(); + } + else + { + __fmt[1] = __mod; + __fmt[2] = __format; + __fmt[3] = char_type(); + } + + __tp._M_put(__res, __maxlen, __fmt, __tm); + + // Write resulting, fully-formatted string to output iterator. + return std::__write(__s, __res, char_traits::length(__res)); + } + + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template +#pragma GCC diagnostic ignored "-Wlong-long" + extern template class moneypunct; + extern template class moneypunct; + extern template class moneypunct_byname; + extern template class moneypunct_byname; + extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_get; + extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_put; + extern template class __timepunct; + extern template class time_put; + extern template class time_put_byname; + extern template class time_get; + extern template class time_get_byname; + extern template class messages; + extern template class messages_byname; + + extern template + const moneypunct* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const moneypunct* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const money_put* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const money_get* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const __timepunct* + __try_use_facet<__timepunct >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const time_put* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const time_get* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const messages* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const moneypunct& + use_facet >(const locale&); + + extern template + const moneypunct& + use_facet >(const locale&); + + extern template + const money_put& + use_facet >(const locale&); + + extern template + const money_get& + use_facet >(const locale&); + + extern template + const __timepunct& + use_facet<__timepunct >(const locale&); + + extern template + const time_put& + use_facet >(const locale&); + + extern template + const time_get& + use_facet >(const locale&); + + extern template + const messages& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet<__timepunct >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class moneypunct; + extern template class moneypunct; + extern template class moneypunct_byname; + extern template class moneypunct_byname; + extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_get; + extern template class _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 money_put; + extern template class __timepunct; + extern template class time_put; + extern template class time_put_byname; + extern template class time_get; + extern template class time_get_byname; + extern template class messages; + extern template class messages_byname; + + extern template + const moneypunct* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const moneypunct* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const money_put* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const money_get* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const __timepunct* + __try_use_facet<__timepunct >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const time_put* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const time_get* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const messages* + __try_use_facet >(const locale&) _GLIBCXX_NOTHROW; + + extern template + const moneypunct& + use_facet >(const locale&); + + extern template + const moneypunct& + use_facet >(const locale&); + + extern template + const money_put& + use_facet >(const locale&); + + extern template + const money_get& + use_facet >(const locale&); + + extern template + const __timepunct& + use_facet<__timepunct >(const locale&); + + extern template + const time_put& + use_facet >(const locale&); + + extern template + const time_get& + use_facet >(const locale&); + + extern template + const messages& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet<__timepunct >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); +#endif +#pragma GCC diagnostic pop +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.tcc.blob new file mode 100644 index 0000000..e26d793 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@locale_facets_nonio.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@localefwd.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@localefwd.h new file mode 100644 index 0000000..23925c0 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@localefwd.h @@ -0,0 +1,216 @@ +// Forward declarations -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/localefwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +#ifndef _LOCALE_FWD_H +#define _LOCALE_FWD_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include // Defines __c_locale, config-specific include +#include // For ostreambuf_iterator, istreambuf_iterator +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup locales Locales + * + * Classes and functions for internationalization and localization. + */ + + // 22.1.1 Locale + class locale; + + template + bool + has_facet(const locale&) throw(); + + template + const _Facet& + use_facet(const locale&); + + // 22.1.3 Convenience interfaces + template + bool + isspace(_CharT, const locale&); + + template + bool + isprint(_CharT, const locale&); + + template + bool + iscntrl(_CharT, const locale&); + + template + bool + isupper(_CharT, const locale&); + + template + bool + islower(_CharT, const locale&); + + template + bool + isalpha(_CharT, const locale&); + + template + bool + isdigit(_CharT, const locale&); + + template + bool + ispunct(_CharT, const locale&); + + template + bool + isxdigit(_CharT, const locale&); + + template + bool + isalnum(_CharT, const locale&); + + template + bool + isgraph(_CharT, const locale&); + +#if __cplusplus >= 201103L + template + bool + isblank(_CharT, const locale&); +#endif + + template + _CharT + toupper(_CharT, const locale&); + + template + _CharT + tolower(_CharT, const locale&); + + // 22.2.1 and 22.2.1.3 ctype + struct ctype_base; + template + class ctype; + template<> class ctype; +#ifdef _GLIBCXX_USE_WCHAR_T + template<> class ctype; +#endif + template + class ctype_byname; + // NB: Specialized for char and wchar_t in locale_facets.h. + + class codecvt_base; + template + class codecvt; + template<> class codecvt; +#ifdef _GLIBCXX_USE_WCHAR_T + template<> class codecvt; +#endif +#if __cplusplus >= 201103L + template<> class codecvt; + template<> class codecvt; +#ifdef _GLIBCXX_USE_CHAR8_T + template<> class codecvt; + template<> class codecvt; +#endif +#endif + template + class codecvt_byname; + + // 22.2.2 and 22.2.3 numeric +_GLIBCXX_BEGIN_NAMESPACE_LDBL + template > + class num_get; + template > + class num_put; +_GLIBCXX_END_NAMESPACE_LDBL +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template class numpunct; + template class numpunct_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + // 22.2.4 collation + template + class collate; + template + class collate_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + + // 22.2.5 date and time + class time_base; +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template > + class time_get; + template > + class time_get_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + template > + class time_put; + template > + class time_put_byname; + + // 22.2.6 money + class money_base; +_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 + template > + class money_get; + template > + class money_put; +_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template + class moneypunct; + template + class moneypunct_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + + // 22.2.7 message retrieval + struct messages_base; +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template + class messages; + template + class messages_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@localefwd.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@localefwd.h.blob new file mode 100644 index 0000000..ab9a6a4 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@localefwd.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memory_resource.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memory_resource.h new file mode 100644 index 0000000..d4ed06c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memory_resource.h @@ -0,0 +1,525 @@ +// -*- C++ -*- + +// Copyright (C) 2018-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/memory_resource.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory_resource} + */ + +#ifndef _GLIBCXX_MEMORY_RESOURCE_H +#define _GLIBCXX_MEMORY_RESOURCE_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus >= 201703L + +#include // operator new(size_t, void*) +#include // size_t, max_align_t, byte +#include // __throw_bad_array_new_length +#include // allocator_arg_t, __use_alloc +#include // uninitialized_construct_using_alloc +#include // __int_traits +#include + +#if ! __glibcxx_make_obj_using_allocator +# include // index_sequence +# include // tuple, forward_as_tuple +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +namespace pmr +{ + /// Class `memory_resource` + /** + * @ingroup pmr + * @headerfile memory_resource + * @since C++17 + */ + class memory_resource + { + static constexpr size_t _S_max_align = alignof(max_align_t); + + public: + memory_resource() = default; + memory_resource(const memory_resource&) = default; + virtual ~memory_resource(); // key function + + memory_resource& operator=(const memory_resource&) = default; + + [[nodiscard]] + void* + allocate(size_t __bytes, size_t __alignment = _S_max_align) + __attribute__((__returns_nonnull__,__alloc_size__(2),__alloc_align__(3))) + { return ::operator new(__bytes, do_allocate(__bytes, __alignment)); } + + void + deallocate(void* __p, size_t __bytes, size_t __alignment = _S_max_align) + __attribute__((__nonnull__)) + { return do_deallocate(__p, __bytes, __alignment); } + + [[nodiscard]] + bool + is_equal(const memory_resource& __other) const noexcept + { return do_is_equal(__other); } + + private: + virtual void* + do_allocate(size_t __bytes, size_t __alignment) = 0; + + virtual void + do_deallocate(void* __p, size_t __bytes, size_t __alignment) = 0; + + virtual bool + do_is_equal(const memory_resource& __other) const noexcept = 0; + }; + + [[nodiscard]] + inline bool + operator==(const memory_resource& __a, const memory_resource& __b) noexcept + { return &__a == &__b || __a.is_equal(__b); } + +#if __cpp_impl_three_way_comparison < 201907L + [[nodiscard]] + inline bool + operator!=(const memory_resource& __a, const memory_resource& __b) noexcept + { return !(__a == __b); } +#endif + + // C++17 23.12.3 Class template polymorphic_allocator + + /// Class template polymorphic_allocator + /** + * @ingroup pmr + * @headerfile memory_resource + * @since C++17 + */ + template + class polymorphic_allocator + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2975. Missing case for pair construction in polymorphic allocators + template + struct __not_pair { using type = void; }; + + template + struct __not_pair> { }; + + public: + using value_type = _Tp; + + polymorphic_allocator() noexcept + { + extern memory_resource* get_default_resource() noexcept + __attribute__((__returns_nonnull__)); + _M_resource = get_default_resource(); + } + + polymorphic_allocator(memory_resource* __r) noexcept + __attribute__((__nonnull__)) + : _M_resource(__r) + { _GLIBCXX_DEBUG_ASSERT(__r); } + + polymorphic_allocator(const polymorphic_allocator& __other) = default; + + template + polymorphic_allocator(const polymorphic_allocator<_Up>& __x) noexcept + : _M_resource(__x.resource()) + { } + + polymorphic_allocator& + operator=(const polymorphic_allocator&) = delete; + + [[nodiscard]] + _Tp* + allocate(size_t __n) + __attribute__((__returns_nonnull__)) + { + if ((__gnu_cxx::__int_traits::__max / sizeof(_Tp)) < __n) + std::__throw_bad_array_new_length(); + return static_cast<_Tp*>(_M_resource->allocate(__n * sizeof(_Tp), + alignof(_Tp))); + } + + void + deallocate(_Tp* __p, size_t __n) noexcept + __attribute__((__nonnull__)) + { _M_resource->deallocate(__p, __n * sizeof(_Tp), alignof(_Tp)); } + +#ifdef __glibcxx_polymorphic_allocator // >= C++20 + [[nodiscard]] void* + allocate_bytes(size_t __nbytes, + size_t __alignment = alignof(max_align_t)) + { return _M_resource->allocate(__nbytes, __alignment); } + + void + deallocate_bytes(void* __p, size_t __nbytes, + size_t __alignment = alignof(max_align_t)) + { _M_resource->deallocate(__p, __nbytes, __alignment); } + + template + [[nodiscard]] _Up* + allocate_object(size_t __n = 1) + { + if ((__gnu_cxx::__int_traits::__max / sizeof(_Up)) < __n) + std::__throw_bad_array_new_length(); + return static_cast<_Up*>(allocate_bytes(__n * sizeof(_Up), + alignof(_Up))); + } + + template + void + deallocate_object(_Up* __p, size_t __n = 1) + { deallocate_bytes(__p, __n * sizeof(_Up), alignof(_Up)); } + + template + [[nodiscard]] _Up* + new_object(_CtorArgs&&... __ctor_args) + { + _Up* __p = allocate_object<_Up>(); + __try + { + construct(__p, std::forward<_CtorArgs>(__ctor_args)...); + } + __catch (...) + { + deallocate_object(__p); + __throw_exception_again; + } + return __p; + } + + template + void + delete_object(_Up* __p) + { + __p->~_Up(); + deallocate_object(__p); + } +#endif // C++20 + +#if ! __glibcxx_make_obj_using_allocator // >= C++20 + template + __attribute__((__nonnull__)) + typename __not_pair<_Tp1>::type + construct(_Tp1* __p, _Args&&... __args) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2969. polymorphic_allocator::construct() shouldn't pass resource() + using __use_tag + = std::__uses_alloc_t<_Tp1, polymorphic_allocator, _Args...>; + if constexpr (is_base_of_v<__uses_alloc0, __use_tag>) + ::new(__p) _Tp1(std::forward<_Args>(__args)...); + else if constexpr (is_base_of_v<__uses_alloc1_, __use_tag>) + ::new(__p) _Tp1(allocator_arg, *this, + std::forward<_Args>(__args)...); + else + ::new(__p) _Tp1(std::forward<_Args>(__args)..., *this); + } + + template + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p, piecewise_construct_t, + tuple<_Args1...> __x, tuple<_Args2...> __y) + { + auto __x_tag = + __use_alloc<_Tp1, polymorphic_allocator, _Args1...>(*this); + auto __y_tag = + __use_alloc<_Tp2, polymorphic_allocator, _Args2...>(*this); + index_sequence_for<_Args1...> __x_i; + index_sequence_for<_Args2...> __y_i; + + ::new(__p) pair<_Tp1, _Tp2>(piecewise_construct, + _S_construct_p(__x_tag, __x_i, __x), + _S_construct_p(__y_tag, __y_i, __y)); + } + + template + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p) + { this->construct(__p, piecewise_construct, tuple<>(), tuple<>()); } + + template + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p, _Up&& __x, _Vp&& __y) + { + this->construct(__p, piecewise_construct, + std::forward_as_tuple(std::forward<_Up>(__x)), + std::forward_as_tuple(std::forward<_Vp>(__y))); + } + + template + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p, const std::pair<_Up, _Vp>& __pr) + { + this->construct(__p, piecewise_construct, + std::forward_as_tuple(__pr.first), + std::forward_as_tuple(__pr.second)); + } + + template + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p, pair<_Up, _Vp>&& __pr) + { + this->construct(__p, piecewise_construct, + std::forward_as_tuple(std::forward<_Up>(__pr.first)), + std::forward_as_tuple(std::forward<_Vp>(__pr.second))); + } +#else // make_obj_using_allocator + template + __attribute__((__nonnull__)) + void + construct(_Tp1* __p, _Args&&... __args) + { + std::uninitialized_construct_using_allocator(__p, *this, + std::forward<_Args>(__args)...); + } +#endif + + template + __attribute__((__nonnull__)) + void + destroy(_Up* __p) + { __p->~_Up(); } + + polymorphic_allocator + select_on_container_copy_construction() const noexcept + { return polymorphic_allocator(); } + + memory_resource* + resource() const noexcept + __attribute__((__returns_nonnull__)) + { return _M_resource; } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3683. operator== for polymorphic_allocator cannot deduce template arg + [[nodiscard]] + friend bool + operator==(const polymorphic_allocator& __a, + const polymorphic_allocator& __b) noexcept + { return *__a.resource() == *__b.resource(); } + +#if __cpp_impl_three_way_comparison < 201907L + [[nodiscard]] + friend bool + operator!=(const polymorphic_allocator& __a, + const polymorphic_allocator& __b) noexcept + { return !(__a == __b); } +#endif + + private: +#if ! __glibcxx_make_obj_using_allocator // >= C++20 + using __uses_alloc1_ = __uses_alloc1; + using __uses_alloc2_ = __uses_alloc2; + + template + static tuple<_Args&&...> + _S_construct_p(__uses_alloc0, _Ind, tuple<_Args...>& __t) + { return std::move(__t); } + + template + static tuple + _S_construct_p(__uses_alloc1_ __ua, index_sequence<_Ind...>, + tuple<_Args...>& __t) + { + return { + allocator_arg, *__ua._M_a, std::get<_Ind>(std::move(__t))... + }; + } + + template + static tuple<_Args&&..., polymorphic_allocator> + _S_construct_p(__uses_alloc2_ __ua, index_sequence<_Ind...>, + tuple<_Args...>& __t) + { return { std::get<_Ind>(std::move(__t))..., *__ua._M_a }; } +#endif + + memory_resource* _M_resource; + }; + + template + [[nodiscard]] + inline bool + operator==(const polymorphic_allocator<_Tp1>& __a, + const polymorphic_allocator<_Tp2>& __b) noexcept + { return *__a.resource() == *__b.resource(); } + +#if __cpp_impl_three_way_comparison < 201907L + template + [[nodiscard]] + inline bool + operator!=(const polymorphic_allocator<_Tp1>& __a, + const polymorphic_allocator<_Tp2>& __b) noexcept + { return !(__a == __b); } +#endif + +} // namespace pmr + + template struct allocator_traits; + + /// Partial specialization for `std::pmr::polymorphic_allocator` + /** + * @ingroup pmr + * @headerfile memory_resource + * @since C++17 + */ + template + struct allocator_traits> + { + /// The allocator type + using allocator_type = pmr::polymorphic_allocator<_Tp>; + + /// The allocated type + using value_type = _Tp; + + /// The allocator's pointer type. + using pointer = _Tp*; + + /// The allocator's const pointer type. + using const_pointer = const _Tp*; + + /// The allocator's void pointer type. + using void_pointer = void*; + + /// The allocator's const void pointer type. + using const_void_pointer = const void*; + + /// The allocator's difference type + using difference_type = std::ptrdiff_t; + + /// The allocator's size type + using size_type = std::size_t; + + /** @{ + * A `polymorphic_allocator` does not propagate when a + * container is copied, moved, or swapped. + */ + using propagate_on_container_copy_assignment = false_type; + using propagate_on_container_move_assignment = false_type; + using propagate_on_container_swap = false_type; + + static allocator_type + select_on_container_copy_construction(const allocator_type&) noexcept + { return allocator_type(); } + /// @} + + /// Whether all instances of the allocator type compare equal. + using is_always_equal = false_type; + + template + using rebind_alloc = pmr::polymorphic_allocator<_Up>; + + template + using rebind_traits = allocator_traits>; + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * + * Calls `a.allocate(n)`. + */ + [[nodiscard]] static pointer + allocate(allocator_type& __a, size_type __n) + { return __a.allocate(__n); } + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * @return Memory of suitable size and alignment for `n` objects + * of type `value_type`. + * + * The third parameter is ignored.. + * + * Returns `a.allocate(n)`. + */ + [[nodiscard]] static pointer + allocate(allocator_type& __a, size_type __n, const_void_pointer) + { return __a.allocate(__n); } + + /** + * @brief Deallocate memory. + * @param __a An allocator. + * @param __p Pointer to the memory to deallocate. + * @param __n The number of objects space was allocated for. + * + * Calls `a.deallocate(p, n)`. + */ + static void + deallocate(allocator_type& __a, pointer __p, size_type __n) + { __a.deallocate(__p, __n); } + + /** + * @brief Construct an object of type `_Up` + * @param __a An allocator. + * @param __p Pointer to memory of suitable size and alignment for + * an object of type `_Up`. + * @param __args Constructor arguments. + * + * Calls `__a.construct(__p, std::forward<_Args>(__args)...)` + * in C++11, C++14 and C++17. Changed in C++20 to call + * `std::construct_at(__p, std::forward<_Args>(__args)...)` instead. + */ + template + static void + construct(allocator_type& __a, _Up* __p, _Args&&... __args) + { __a.construct(__p, std::forward<_Args>(__args)...); } + + /** + * @brief Destroy an object of type `_Up` + * @param __a An allocator. + * @param __p Pointer to the object to destroy + * + * Calls `p->_Up()`. + */ + template + static _GLIBCXX20_CONSTEXPR void + destroy(allocator_type&, _Up* __p) + noexcept(is_nothrow_destructible<_Up>::value) + { __p->~_Up(); } + + /** + * @brief The maximum supported allocation size + * @return `numeric_limits::max() / sizeof(value_type)` + */ + static _GLIBCXX20_CONSTEXPR size_type + max_size(const allocator_type&) noexcept + { return size_t(-1) / sizeof(value_type); } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++17 +#endif // _GLIBCXX_MEMORY_RESOURCE_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memory_resource.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memory_resource.h.blob new file mode 100644 index 0000000..71008a8 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memory_resource.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memoryfwd.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memoryfwd.h new file mode 100644 index 0000000..0da5cbb --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memoryfwd.h @@ -0,0 +1,86 @@ +// Forward declarations -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * Copyright (c) 1996-1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/memoryfwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _MEMORYFWD_H +#define _MEMORYFWD_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup allocators Allocators + * @ingroup memory + * + * Classes encapsulating memory operations. + * + * @{ + */ + + // Included in freestanding as a libstdc++ extension. + template + class allocator; + + template<> + class allocator; + +#if __cplusplus >= 201103L + /// Declare uses_allocator so it can be specialized in `` etc. + template + struct uses_allocator; + + template + struct allocator_traits; +#endif + + /// @} group memory + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memoryfwd.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memoryfwd.h.blob new file mode 100644 index 0000000..2c7a731 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@memoryfwd.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@move.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@move.h new file mode 100644 index 0000000..e91b003 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@move.h @@ -0,0 +1,262 @@ +// Move, forward and identity for C++11 + swap -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/move.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{utility} + */ + +#ifndef _MOVE_H +#define _MOVE_H 1 + +#include +#if __cplusplus < 201103L +# include +#else +# include // Brings in std::declval too. +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Used, in C++03 mode too, by allocators, etc. + /** + * @brief Same as C++11 std::addressof + * @ingroup utilities + */ + template + __attribute__((__always_inline__)) + inline _GLIBCXX_CONSTEXPR _Tp* + __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT + { return __builtin_addressof(__r); } + +#if __cplusplus >= 201103L + + /** + * @addtogroup utilities + * @{ + */ + + /** + * @brief Forward an lvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + * @since C++11 + */ + template + [[__nodiscard__,__gnu__::__always_inline__]] + constexpr _Tp&& + forward(typename std::remove_reference<_Tp>::type& __t) noexcept + { return static_cast<_Tp&&>(__t); } + + /** + * @brief Forward an rvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + * @since C++11 + */ + template + [[__nodiscard__,__gnu__::__always_inline__]] + constexpr _Tp&& + forward(typename std::remove_reference<_Tp>::type&& __t) noexcept + { + static_assert(!std::is_lvalue_reference<_Tp>::value, + "std::forward must not be used to convert an rvalue to an lvalue"); + return static_cast<_Tp&&>(__t); + } + +#if __glibcxx_forward_like // C++ >= 23 + template + struct __like_impl; // _Tp must be a reference and _Up an lvalue reference + + template + struct __like_impl<_Tp&, _Up&> + { using type = _Up&; }; + + template + struct __like_impl + { using type = const _Up&; }; + + template + struct __like_impl<_Tp&&, _Up&> + { using type = _Up&&; }; + + template + struct __like_impl + { using type = const _Up&&; }; + + template + using __like_t = typename __like_impl<_Tp&&, _Up&>::type; + + /** @brief Forward with the cv-qualifiers and value category of another type. + * @tparam _Tp An lvalue reference or rvalue reference. + * @tparam _Up An lvalue reference type deduced from the function argument. + * @param __x An lvalue. + * @return `__x` converted to match the qualifiers of `_Tp`. + * @since C++23 + */ + template + [[nodiscard,__gnu__::__always_inline__]] + constexpr __like_t<_Tp, _Up> + forward_like(_Up&& __x) noexcept + { return static_cast<__like_t<_Tp, _Up>>(__x); } +#endif + + /** + * @brief Convert a value to an rvalue. + * @param __t A thing of arbitrary type. + * @return The parameter cast to an rvalue-reference to allow moving it. + * @since C++11 + */ + template + [[__nodiscard__,__gnu__::__always_inline__]] + constexpr typename std::remove_reference<_Tp>::type&& + move(_Tp&& __t) noexcept + { return static_cast::type&&>(__t); } + + + template + struct __move_if_noexcept_cond + : public __and_<__not_>, + is_copy_constructible<_Tp>>::type { }; + + /** + * @brief Conditionally convert a value to an rvalue. + * @param __x A thing of arbitrary type. + * @return The parameter, possibly cast to an rvalue-reference. + * + * Same as std::move unless the type's move constructor could throw and the + * type is copyable, in which case an lvalue-reference is returned instead. + * @since C++11 + */ + template + [[__nodiscard__,__gnu__::__always_inline__]] + constexpr + __conditional_t<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&> + move_if_noexcept(_Tp& __x) noexcept + { return std::move(__x); } + + // declval, from type_traits. + + /** + * @brief Returns the actual address of the object or function + * referenced by r, even in the presence of an overloaded + * operator&. + * @param __r Reference to an object or function. + * @return The actual address. + * @since C++11 + */ + template + [[__nodiscard__,__gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR _Tp* + addressof(_Tp& __r) noexcept + { return std::__addressof(__r); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2598. addressof works on temporaries + template + const _Tp* addressof(const _Tp&&) = delete; + + // C++11 version of std::exchange for internal use. + template + _GLIBCXX20_CONSTEXPR + inline _Tp + __exchange(_Tp& __obj, _Up&& __new_val) + { + _Tp __old_val = std::move(__obj); + __obj = std::forward<_Up>(__new_val); + return __old_val; + } + + /// @} group utilities + +#define _GLIBCXX_FWDREF(_Tp) _Tp&& +#define _GLIBCXX_MOVE(__val) std::move(__val) +#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val) +#else +#define _GLIBCXX_FWDREF(_Tp) const _Tp& +#define _GLIBCXX_MOVE(__val) (__val) +#define _GLIBCXX_FORWARD(_Tp, __val) (__val) +#endif + + /** + * @addtogroup utilities + * @{ + */ + + /** + * @brief Swaps two values. + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @return Nothing. + */ + template + _GLIBCXX20_CONSTEXPR + inline +#if __cplusplus >= 201103L + typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>, + is_move_constructible<_Tp>, + is_move_assignable<_Tp>>::value>::type +#else + void +#endif + swap(_Tp& __a, _Tp& __b) + _GLIBCXX_NOEXCEPT_IF(__and_, + is_nothrow_move_assignable<_Tp>>::value) + { +#if __cplusplus < 201103L + // concept requirements + __glibcxx_function_requires(_SGIAssignableConcept<_Tp>) +#endif + _Tp __tmp = _GLIBCXX_MOVE(__a); + __a = _GLIBCXX_MOVE(__b); + __b = _GLIBCXX_MOVE(__tmp); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 809. std::swap should be overloaded for array types. + /// Swap the contents of two arrays. + template + _GLIBCXX20_CONSTEXPR + inline +#if __cplusplus >= 201103L + typename enable_if<__is_swappable<_Tp>::value>::type +#else + void +#endif + swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) + _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Tp>::value) + { + for (size_t __n = 0; __n < _Nm; ++__n) + swap(__a[__n], __b[__n]); + } + + /// @} group utilities +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _MOVE_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@move.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@move.h.blob new file mode 100644 index 0000000..0d6d315 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@move.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@nested_exception.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@nested_exception.h new file mode 100644 index 0000000..c9f63e5 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@nested_exception.h @@ -0,0 +1,243 @@ +// Nested Exception support header (nested_exception class) for -*- C++ -*- + +// Copyright (C) 2009-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/nested_exception.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{exception} + */ + +#ifndef _GLIBCXX_NESTED_EXCEPTION_H +#define _GLIBCXX_NESTED_EXCEPTION_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include +#include + +extern "C++" { + +namespace std _GLIBCXX_VISIBILITY(default) +{ + /** + * @addtogroup exceptions + * @{ + */ + + /** Mixin class that stores the current exception. + * + * This type can be used via `std::throw_with_nested` to store + * the current exception nested within another exception. + * + * @headerfile exception + * @since C++11 + * @see std::throw_with_nested + * @ingroup exceptions + */ + class nested_exception + { + exception_ptr _M_ptr; + + public: + /// The default constructor stores the current exception (if any). + nested_exception() noexcept : _M_ptr(current_exception()) { } + + nested_exception(const nested_exception&) noexcept = default; + + nested_exception& operator=(const nested_exception&) noexcept = default; + + virtual ~nested_exception() noexcept; + + /// Rethrow the stored exception, or terminate if none was stored. + [[noreturn]] + void + rethrow_nested() const + { + if (_M_ptr) + rethrow_exception(_M_ptr); + std::terminate(); + } + + /// Access the stored exception. + exception_ptr + nested_ptr() const noexcept + { return _M_ptr; } + }; + + /// @cond undocumented + + template + struct _Nested_exception : public _Except, public nested_exception + { + explicit _Nested_exception(const _Except& __ex) + : _Except(__ex) + { } + + explicit _Nested_exception(_Except&& __ex) + : _Except(static_cast<_Except&&>(__ex)) + { } + }; + +#if __cplusplus < 201703L || ! defined __cpp_if_constexpr + // [except.nested]/8 + // Throw an exception of unspecified type that is publicly derived from + // both remove_reference_t<_Tp> and nested_exception. + template + [[noreturn]] + inline void + __throw_with_nested_impl(_Tp&& __t, true_type) + { + throw _Nested_exception<__remove_cvref_t<_Tp>>{std::forward<_Tp>(__t)}; + } + + template + [[noreturn]] + inline void + __throw_with_nested_impl(_Tp&& __t, false_type) + { throw std::forward<_Tp>(__t); } +#endif + + /// @endcond + + /** Throw an exception that also stores the currently active exception. + * + * If `_Tp` is derived from `std::nested_exception` or is not usable + * as a base-class, throws a copy of `__t`. + * Otherwise, throws an object of an implementation-defined type derived + * from both `_Tp` and `std::nested_exception`, containing a copy of `__t` + * and the result of `std::current_exception()`. + * + * In other words, throws the argument as a new exception that contains + * the currently active exception nested within it. This is intended for + * use in a catch handler to replace the caught exception with a different + * type, while still preserving the original exception. When the new + * exception is caught, the nested exception can be rethrown by using + * `std::rethrow_if_nested`. + * + * This can be used at API boundaries, for example to catch a library's + * internal exception type and rethrow it nested with a `std::runtime_error`, + * or vice versa. + * + * @since C++11 + */ + template + [[noreturn]] + inline void + throw_with_nested(_Tp&& __t) + { + using _Up = typename decay<_Tp>::type; + using _CopyConstructible + = __and_, is_move_constructible<_Up>>; + static_assert(_CopyConstructible::value, + "throw_with_nested argument must be CopyConstructible"); + +#if __cplusplus >= 201703L && __cpp_if_constexpr + if constexpr (is_class_v<_Up>) + if constexpr (!is_final_v<_Up>) + if constexpr (!is_base_of_v) + throw _Nested_exception<_Up>{std::forward<_Tp>(__t)}; + throw std::forward<_Tp>(__t); +#else + using __nest = __and_, __bool_constant, + __not_>>; + std::__throw_with_nested_impl(std::forward<_Tp>(__t), __nest{}); +#endif + } + +#if __cplusplus < 201703L || ! defined __cpp_if_constexpr + /// @cond undocumented + + // Attempt dynamic_cast to nested_exception and call rethrow_nested(). + template + inline void + __rethrow_if_nested_impl(const _Ex* __ptr, true_type) + { + if (auto __ne_ptr = dynamic_cast(__ptr)) + __ne_ptr->rethrow_nested(); + } + + // Otherwise, no effects. + inline void + __rethrow_if_nested_impl(const void*, false_type) + { } + + /// @endcond +#endif + + /** Rethrow a nested exception + * + * If `__ex` contains a `std::nested_exception` object, call its + * `rethrow_nested()` member to rethrow the stored exception. + * + * After catching an exception thrown by a call to `std::throw_with_nested` + * this function can be used to rethrow the exception that was active when + * `std::throw_with_nested` was called. + * + * @since C++11 + */ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2484. rethrow_if_nested() is doubly unimplementable + // 2784. Resolution to LWG 2484 is missing "otherwise, no effects" and [...] + template +# if ! __cpp_rtti + [[__gnu__::__always_inline__]] +#endif + inline void + rethrow_if_nested(const _Ex& __ex) + { + const _Ex* __ptr = __builtin_addressof(__ex); +#if __cplusplus < 201703L || ! defined __cpp_if_constexpr +# if __cpp_rtti + using __cast = __and_, + __or_<__not_>, + is_convertible<_Ex*, nested_exception*>>>; +# else + using __cast = __and_, + is_base_of, + is_convertible<_Ex*, nested_exception*>>; +# endif + std::__rethrow_if_nested_impl(__ptr, __cast{}); +#else + if constexpr (!is_polymorphic_v<_Ex>) + return; + else if constexpr (is_base_of_v + && !is_convertible_v<_Ex*, nested_exception*>) + return; // nested_exception base class is inaccessible or ambiguous. +# if ! __cpp_rtti + else if constexpr (!is_base_of_v) + return; // Cannot do polymorphic casts without RTTI. +# endif + else if (auto __ne_ptr = dynamic_cast(__ptr)) + __ne_ptr->rethrow_nested(); +#endif + } + + /// @} group exceptions +} // namespace std + +} // extern "C++" + +#endif // C++11 +#endif // _GLIBCXX_NESTED_EXCEPTION_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@nested_exception.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@nested_exception.h.blob new file mode 100644 index 0000000..f11f03c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@nested_exception.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@new_allocator.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@new_allocator.h new file mode 100644 index 0000000..8f1bc57 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@new_allocator.h @@ -0,0 +1,243 @@ +// Allocator that wraps operator new -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/new_allocator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _STD_NEW_ALLOCATOR_H +#define _STD_NEW_ALLOCATOR_H 1 + +#include +#include +#include +#include +#if __cplusplus >= 201103L +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief An allocator that uses global `new`, as per C++03 [20.4.1]. + * @ingroup allocators + * + * This is precisely the allocator defined in the C++ Standard. + * - all allocation calls `operator new` + * - all deallocation calls `operator delete` + * + * This is the default base-class implementation of `std::allocator`, + * and is also the base-class of the `__gnu_cxx::new_allocator` extension. + * You should use either `std::allocator` or `__gnu_cxx::new_allocator` + * instead of using this directly. + * + * @tparam _Tp Type of allocated object. + * + * @headerfile memory + */ + template + class __new_allocator + { + public: + typedef _Tp value_type; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; +#if __cplusplus <= 201703L + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + + template + struct rebind + { typedef __new_allocator<_Tp1> other; }; +#endif + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + __new_allocator() _GLIBCXX_USE_NOEXCEPT { } + + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + __new_allocator(const __new_allocator&) _GLIBCXX_USE_NOEXCEPT { } + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + __new_allocator(const __new_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT { } + +#if __cplusplus >= 201103L + __new_allocator& operator=(const __new_allocator&) = default; +#endif + +#if __cplusplus <= 201703L + ~__new_allocator() _GLIBCXX_USE_NOEXCEPT { } + + pointer + address(reference __x) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__x); } + + const_pointer + address(const_reference __x) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__x); } +#endif + +#if __has_builtin(__builtin_operator_new) >= 201802L +# define _GLIBCXX_OPERATOR_NEW __builtin_operator_new +# define _GLIBCXX_OPERATOR_DELETE __builtin_operator_delete +#else +# define _GLIBCXX_OPERATOR_NEW ::operator new +# define _GLIBCXX_OPERATOR_DELETE ::operator delete +#endif + + // NB: __n is permitted to be 0. The C++ standard says nothing + // about what the return value is when __n == 0. + _GLIBCXX_NODISCARD _Tp* + allocate(size_type __n, const void* = static_cast(0)) + { +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3308. std::allocator().allocate(n) + static_assert(sizeof(_Tp) != 0, "cannot allocate incomplete types"); +#endif + + if (__builtin_expect(__n > this->_M_max_size(), false)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3190. allocator::allocate sometimes returns too little storage + if (__n > (std::size_t(-1) / sizeof(_Tp))) + std::__throw_bad_array_new_length(); + std::__throw_bad_alloc(); + } + +#if __cpp_aligned_new && __cplusplus >= 201103L + if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) + { + std::align_val_t __al = std::align_val_t(alignof(_Tp)); + return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp), + __al)); + } +#endif + return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp))); + } + + // __p is not permitted to be a null pointer. + void + deallocate(_Tp* __p, size_type __n __attribute__ ((__unused__))) + { +#if __cpp_sized_deallocation +# define _GLIBCXX_SIZED_DEALLOC(p, n) (p), (n) * sizeof(_Tp) +#else +# define _GLIBCXX_SIZED_DEALLOC(p, n) (p) +#endif + +#if __cpp_aligned_new && __cplusplus >= 201103L + if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) + { + _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n), + std::align_val_t(alignof(_Tp))); + return; + } +#endif + _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n)); + } + +#undef _GLIBCXX_SIZED_DEALLOC +#undef _GLIBCXX_OPERATOR_DELETE +#undef _GLIBCXX_OPERATOR_NEW + +#if __cplusplus <= 201703L + __attribute__((__always_inline__)) + size_type + max_size() const _GLIBCXX_USE_NOEXCEPT + { return _M_max_size(); } + +#if __cplusplus >= 201103L + template + __attribute__((__always_inline__)) + void + construct(_Up* __p, _Args&&... __args) + noexcept(__is_nothrow_new_constructible<_Up, _Args...>) + { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } + + template + __attribute__((__always_inline__)) + void + destroy(_Up* __p) + noexcept(std::is_nothrow_destructible<_Up>::value) + { __p->~_Up(); } +#else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 402. wrong new expression in [some_] allocator::construct + __attribute__((__always_inline__)) + void + construct(pointer __p, const _Tp& __val) + { ::new((void *)__p) _Tp(__val); } + + __attribute__((__always_inline__)) + void + destroy(pointer __p) { __p->~_Tp(); } +#endif +#endif // ! C++20 + + template + friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR bool + operator==(const __new_allocator&, const __new_allocator<_Up>&) + _GLIBCXX_NOTHROW + { return true; } + +#if __cpp_impl_three_way_comparison < 201907L + template + friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR bool + operator!=(const __new_allocator&, const __new_allocator<_Up>&) + _GLIBCXX_NOTHROW + { return false; } +#endif + + private: + __attribute__((__always_inline__)) + _GLIBCXX_CONSTEXPR size_type + _M_max_size() const _GLIBCXX_USE_NOEXCEPT + { +#if __PTRDIFF_MAX__ < __SIZE_MAX__ + return std::size_t(__PTRDIFF_MAX__) / sizeof(_Tp); +#else + return std::size_t(-1) / sizeof(_Tp); +#endif + } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@new_allocator.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@new_allocator.h.blob new file mode 100644 index 0000000..199f970 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@new_allocator.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.h new file mode 100644 index 0000000..d19a76a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.h @@ -0,0 +1,846 @@ +// Output streams -*- C++ -*- + +// Copyright (C) 1997-2024 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ostream.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ostream} + */ + +// +// ISO C++ 14882: 27.6.2 Output streams +// + +#ifndef _GLIBCXX_OSTREAM_H +#define _GLIBCXX_OSTREAM_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // iostreams + +#include +#include + +# define __glibcxx_want_print +#include // __glibcxx_syncbuf + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Template class basic_ostream. + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * + * This is the base class for all output streams. It provides text + * formatting of all builtin types, and communicates with any class + * derived from basic_streambuf to do the actual output. + */ + template + class basic_ostream : virtual public basic_ios<_CharT, _Traits> + { + public: + // Types (inherited from basic_ios): + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + // Non-standard Types: + typedef basic_streambuf<_CharT, _Traits> __streambuf_type; + typedef basic_ios<_CharT, _Traits> __ios_type; + typedef basic_ostream<_CharT, _Traits> __ostream_type; + typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > + __num_put_type; + typedef ctype<_CharT> __ctype_type; + + /** + * @brief Base constructor. + * + * This ctor is almost never called by the user directly, rather from + * derived classes' initialization lists, which pass a pointer to + * their own stream buffer. + */ + explicit + basic_ostream(__streambuf_type* __sb) + { this->init(__sb); } + + /** + * @brief Base destructor. + * + * This does very little apart from providing a virtual base dtor. + */ + virtual + ~basic_ostream() { } + + /// Safe prefix/suffix operations. + class sentry; + friend class sentry; + + ///@{ + /** + * @brief Interface for manipulators. + * + * Manipulators such as @c std::endl and @c std::hex use these + * functions in constructs like "std::cout << std::endl". For more + * information, see the iomanip header. + */ + __ostream_type& + operator<<(__ostream_type& (*__pf)(__ostream_type&)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // The inserters for manipulators are *not* formatted output functions. + return __pf(*this); + } + + __ostream_type& + operator<<(__ios_type& (*__pf)(__ios_type&)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // The inserters for manipulators are *not* formatted output functions. + __pf(*this); + return *this; + } + + __ostream_type& + operator<<(ios_base& (*__pf) (ios_base&)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // The inserters for manipulators are *not* formatted output functions. + __pf(*this); + return *this; + } + ///@} + + ///@{ + /** + * @name Inserters + * + * All the @c operator<< functions (aka formatted output + * functions) have some common behavior. Each starts by + * constructing a temporary object of type std::basic_ostream::sentry. + * This can have several effects, concluding with the setting of a + * status flag; see the sentry documentation for more. + * + * If the sentry status is good, the function tries to generate + * whatever data is appropriate for the type of the argument. + * + * If an exception is thrown during insertion, ios_base::badbit + * will be turned on in the stream's error state without causing an + * ios_base::failure to be thrown. The original exception will then + * be rethrown. + */ + + ///@{ + /** + * @brief Integer arithmetic inserters + * @param __n A variable of builtin integral type. + * @return @c *this if successful + * + * These functions use the stream's current locale (specifically, the + * @c num_get facet) to perform numeric formatting. + */ + __ostream_type& + operator<<(long __n) + { return _M_insert(__n); } + + __ostream_type& + operator<<(unsigned long __n) + { return _M_insert(__n); } + + __ostream_type& + operator<<(bool __n) + { return _M_insert(__n); } + + __ostream_type& + operator<<(short __n); + + __ostream_type& + operator<<(unsigned short __n) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + return _M_insert(static_cast(__n)); + } + + __ostream_type& + operator<<(int __n); + + __ostream_type& + operator<<(unsigned int __n) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + return _M_insert(static_cast(__n)); + } + +#ifdef _GLIBCXX_USE_LONG_LONG +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + __ostream_type& + operator<<(long long __n) + { return _M_insert(__n); } + + __ostream_type& + operator<<(unsigned long long __n) + { return _M_insert(__n); } +#pragma GCC diagnostic pop +#endif + ///@} + + ///@{ + /** + * @brief Floating point arithmetic inserters + * @param __f A variable of builtin floating point type. + * @return @c *this if successful + * + * These functions use the stream's current locale (specifically, the + * @c num_get facet) to perform numeric formatting. + */ + __ostream_type& + operator<<(double __f) + { return _M_insert(__f); } + + __ostream_type& + operator<<(float __f) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + return _M_insert(_S_cast_flt(__f)); + } + + __ostream_type& + operator<<(long double __f) + { return _M_insert(__f); } + ///@} + +#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) + __attribute__((__always_inline__)) + __ostream_type& + operator<<(_Float16 __f) + { + return _M_insert(_S_cast_flt(__f)); + } +#endif + +#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) + __attribute__((__always_inline__)) + __ostream_type& + operator<<(_Float32 __f) + { + return _M_insert(_S_cast_flt(__f)); + } +#endif + +#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) + __attribute__((__always_inline__)) + __ostream_type& + operator<<(_Float64 __f) + { + return _M_insert(_S_cast_flt(__f)); + } +#endif + +#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) + __attribute__((__always_inline__)) + __ostream_type& + operator<<(_Float128 __f) + { + return _M_insert(_S_cast_flt(__f)); + } +#endif + +#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) + __attribute__((__always_inline__)) + __ostream_type& + operator<<(__gnu_cxx::__bfloat16_t __f) + { + return _M_insert(_S_cast_flt(__f)); + } +#endif + + /** + * @brief Pointer arithmetic inserters + * @param __p A variable of pointer type. + * @return @c *this if successful + * + * These functions use the stream's current locale (specifically, the + * @c num_get facet) to perform numeric formatting. + */ + __ostream_type& + operator<<(const void* __p) + { return _M_insert(__p); } + +#if __cplusplus >= 201703L + __ostream_type& + operator<<(nullptr_t) + { return *this << "nullptr"; } +#endif + +#if __cplusplus > 202002L + __attribute__((__always_inline__)) + __ostream_type& + operator<<(const volatile void* __p) + { return _M_insert(const_cast(__p)); } +#endif + + /** + * @brief Extracting from another streambuf. + * @param __sb A pointer to a streambuf + * + * This function behaves like one of the basic arithmetic extractors, + * in that it also constructs a sentry object and has the same error + * handling behavior. + * + * If @p __sb is NULL, the stream will set failbit in its error state. + * + * Characters are extracted from @p __sb and inserted into @c *this + * until one of the following occurs: + * + * - the input stream reaches end-of-file, + * - insertion into the output sequence fails (in this case, the + * character that would have been inserted is not extracted), or + * - an exception occurs while getting a character from @p __sb, which + * sets failbit in the error state + * + * If the function inserts no characters, failbit is set. + */ + __ostream_type& + operator<<(__streambuf_type* __sb); + ///@} + + ///@{ + /** + * @name Unformatted Output Functions + * + * All the unformatted output functions have some common behavior. + * Each starts by constructing a temporary object of type + * std::basic_ostream::sentry. This has several effects, concluding + * with the setting of a status flag; see the sentry documentation + * for more. + * + * If the sentry status is good, the function tries to generate + * whatever data is appropriate for the type of the argument. + * + * If an exception is thrown during insertion, ios_base::badbit + * will be turned on in the stream's error state. If badbit is on in + * the stream's exceptions mask, the exception will be rethrown + * without completing its actions. + */ + + /** + * @brief Simple insertion. + * @param __c The character to insert. + * @return *this + * + * Tries to insert @p __c. + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __ostream_type& + put(char_type __c); + + /** + * @brief Character string insertion. + * @param __s The array to insert. + * @param __n Maximum number of characters to insert. + * @return *this + * + * Characters are copied from @p __s and inserted into the stream until + * one of the following happens: + * + * - @p __n characters are inserted + * - inserting into the output sequence fails (in this case, badbit + * will be set in the stream's error state) + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __ostream_type& + write(const char_type* __s, streamsize __n); + ///@} + + /** + * @brief Synchronizing the stream buffer. + * @return *this + * + * If @c rdbuf() is a null pointer, changes nothing. + * + * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1, + * sets badbit. + */ + __ostream_type& + flush(); + + /** + * @brief Getting the current write position. + * @return A file position object. + * + * If @c fail() is not false, returns @c pos_type(-1) to indicate + * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,out). + */ + pos_type + tellp(); + + /** + * @brief Changing the current write position. + * @param __pos A file position object. + * @return *this + * + * If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos). If + * that function fails, sets failbit. + */ + __ostream_type& + seekp(pos_type); + + /** + * @brief Changing the current write position. + * @param __off A file offset object. + * @param __dir The direction in which to seek. + * @return *this + * + * If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir). + * If that function fails, sets failbit. + */ + __ostream_type& + seekp(off_type, ios_base::seekdir); + + protected: + basic_ostream() + { this->init(0); } + +#if __cplusplus >= 201103L + // Non-standard constructor that does not call init() + basic_ostream(basic_iostream<_CharT, _Traits>&) { } + + basic_ostream(const basic_ostream&) = delete; + + basic_ostream(basic_ostream&& __rhs) + : __ios_type() + { __ios_type::move(__rhs); } + + // 27.7.3.3 Assign/swap + + basic_ostream& operator=(const basic_ostream&) = delete; + + basic_ostream& + operator=(basic_ostream&& __rhs) + { + swap(__rhs); + return *this; + } + + void + swap(basic_ostream& __rhs) + { __ios_type::swap(__rhs); } +#endif + + template + __ostream_type& + _M_insert(_ValueT __v); + + private: +#if !_GLIBCXX_INLINE_VERSION + void + _M_write(const char_type* __s, streamsize __n) + { std::__ostream_insert(*this, __s, __n); } +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // for if-constexpr + template + static _To + _S_cast_flt(_From __f) + { + _To __d = static_cast<_To>(__f); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 4101: LWG 117 loses the sign for negative NaN on some arches. +#if defined __riscv + _To __sign; +#if __cpp_constexpr && __has_builtin(__builtin_bit_cast) + if constexpr (sizeof(__f) == sizeof(short)) + __sign = static_cast<_To>(__builtin_bit_cast(short, __f)); + else if constexpr (sizeof(__f) == sizeof(int)) + __sign = static_cast<_To>(__builtin_bit_cast(int, __f)); + else if constexpr (sizeof(__f) == sizeof(long long)) + __sign = static_cast<_To>(__builtin_bit_cast(long long, __f)); + else +#endif + __sign = __builtin_signbit(__f) ? _To(-1.0) : _To(+1.0); + + if _GLIBCXX17_CONSTEXPR (__is_same(_To, double)) + __d = __builtin_copysign(__d, __sign); + else if _GLIBCXX17_CONSTEXPR (__is_same(_To, long double)) + __d = __builtin_copysignl(__d, __sign); +#endif + return __d; + } +#pragma GCC diagnostic pop + + // RAII type to clear and restore an ostream's exceptions mask. + struct _Disable_exceptions + { + _Disable_exceptions(basic_ostream& __os) + : _M_os(__os), _M_exception(_M_os._M_exception) + { _M_os._M_exception = ios_base::goodbit; } + + ~_Disable_exceptions() + { _M_os._M_exception = _M_exception; } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // deleted functions + _Disable_exceptions(const _Disable_exceptions&) = delete; + _Disable_exceptions& operator=(const _Disable_exceptions&) = delete; +#pragma GCC diagnostic pop + + private: + basic_ostream& _M_os; + const ios_base::iostate _M_exception; + }; + }; + + /** + * @brief Performs setup work for output streams. + * + * Objects of this class are created before all of the standard + * inserters are run. It is responsible for exception-safe prefix and + * suffix operations. + */ + template + class basic_ostream<_CharT, _Traits>::sentry + { + // Data Members. + bool _M_ok; + basic_ostream<_CharT, _Traits>& _M_os; + + public: + /** + * @brief The constructor performs preparatory work. + * @param __os The output stream to guard. + * + * If the stream state is good (@a __os.good() is true), then if the + * stream is tied to another output stream, @c is.tie()->flush() + * is called to synchronize the output sequences. + * + * If the stream state is still good, then the sentry state becomes + * true (@a okay). + */ + explicit + sentry(basic_ostream<_CharT, _Traits>& __os); + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + /** + * @brief Possibly flushes the stream. + * + * If `ios_base::unitbuf` is set in `os.flags()`, and + * `std::uncaught_exception()` is true, the sentry destructor flushes + * the output stream. + */ + ~sentry() + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 397. ostream::sentry dtor throws exceptions + // 835. Tying two streams together (correction to DR 581) + // 4188. ostream::sentry destructor should handle exceptions + if (bool(_M_os.flags() & ios_base::unitbuf) && _M_os.good() + && !uncaught_exception()) // XXX MT + { + _Disable_exceptions __noex(_M_os); + __try + { + // Can't call _M_os.flush() directly because that constructs + // another sentry. + if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1) + _M_os.setstate(ios_base::badbit); + } + __catch(...) + { _M_os.setstate(ios_base::badbit); } + } + } +#pragma GCC diagnostic pop + + /** + * @brief Quick status checking. + * @return The sentry state. + * + * For ease of use, sentries may be converted to booleans. The + * return value is that of the sentry state (true == okay). + */ +#if __cplusplus >= 201103L + explicit +#endif + operator bool() const + { return _M_ok; } + }; + + ///@{ + /** + * @brief Character inserters + * @param __out An output stream. + * @param __c A character. + * @return out + * + * Behaves like one of the formatted arithmetic inserters described in + * std::basic_ostream. After constructing a sentry object with good + * status, this function inserts a single character and any required + * padding (as determined by [22.2.2.2.2]). @c __out.width(0) is then + * called. + * + * If @p __c is of type @c char and the character type of the stream is not + * @c char, the character is widened before insertion. + */ + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) + { + if (__out.width() != 0) + return __ostream_insert(__out, &__c, 1); + __out.put(__c); + return __out; + } + + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) + { return (__out << __out.widen(__c)); } + + // Specialization + template + inline basic_ostream& + operator<<(basic_ostream& __out, char __c) + { + if (__out.width() != 0) + return __ostream_insert(__out, &__c, 1); + __out.put(__c); + return __out; + } + + // Signed and unsigned + template + inline basic_ostream& + operator<<(basic_ostream& __out, signed char __c) + { return (__out << static_cast(__c)); } + + template + inline basic_ostream& + operator<<(basic_ostream& __out, unsigned char __c) + { return (__out << static_cast(__c)); } + +#if __cplusplus > 201703L + // The following deleted overloads prevent formatting character values as + // numeric values. + + template + basic_ostream& + operator<<(basic_ostream&, wchar_t) = delete; + +#ifdef _GLIBCXX_USE_CHAR8_T + template + basic_ostream& + operator<<(basic_ostream&, char8_t) = delete; +#endif + + template + basic_ostream& + operator<<(basic_ostream&, char16_t) = delete; + + template + basic_ostream& + operator<<(basic_ostream&, char32_t) = delete; + +#ifdef _GLIBCXX_USE_WCHAR_T +#ifdef _GLIBCXX_USE_CHAR8_T + template + basic_ostream& + operator<<(basic_ostream&, char8_t) = delete; +#endif // _GLIBCXX_USE_CHAR8_T + + template + basic_ostream& + operator<<(basic_ostream&, char16_t) = delete; + + template + basic_ostream& + operator<<(basic_ostream&, char32_t) = delete; +#endif // _GLIBCXX_USE_WCHAR_T +#endif // C++20 + ///@} + + ///@{ + /** + * @brief String inserters + * @param __out An output stream. + * @param __s A character string. + * @return out + * @pre @p __s must be a non-NULL pointer + * + * Behaves like one of the formatted arithmetic inserters described in + * std::basic_ostream. After constructing a sentry object with good + * status, this function inserts @c traits::length(__s) characters starting + * at @p __s, widened if necessary, followed by any required padding (as + * determined by [22.2.2.2.2]). @c __out.width(0) is then called. + */ + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) + { + if (!__s) + __out.setstate(ios_base::badbit); + else + __ostream_insert(__out, __s, + static_cast(_Traits::length(__s))); + return __out; + } + + template + basic_ostream<_CharT, _Traits> & + operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s); + + // Partial specializations + template + inline basic_ostream& + operator<<(basic_ostream& __out, const char* __s) + { + if (!__s) + __out.setstate(ios_base::badbit); + else + __ostream_insert(__out, __s, + static_cast(_Traits::length(__s))); + return __out; + } + + // Signed and unsigned + template + inline basic_ostream& + operator<<(basic_ostream& __out, const signed char* __s) + { return (__out << reinterpret_cast(__s)); } + + template + inline basic_ostream & + operator<<(basic_ostream& __out, const unsigned char* __s) + { return (__out << reinterpret_cast(__s)); } + +#if __cplusplus > 201703L + // The following deleted overloads prevent formatting strings as + // pointer values. + + template + basic_ostream& + operator<<(basic_ostream&, const wchar_t*) = delete; + +#ifdef _GLIBCXX_USE_CHAR8_T + template + basic_ostream& + operator<<(basic_ostream&, const char8_t*) = delete; +#endif // _GLIBCXX_USE_CHAR8_T + + template + basic_ostream& + operator<<(basic_ostream&, const char16_t*) = delete; + + template + basic_ostream& + operator<<(basic_ostream&, const char32_t*) = delete; + +#ifdef _GLIBCXX_USE_WCHAR_T +#ifdef _GLIBCXX_USE_CHAR8_T + template + basic_ostream& + operator<<(basic_ostream&, const char8_t*) = delete; +#endif + + template + basic_ostream& + operator<<(basic_ostream&, const char16_t*) = delete; + + template + basic_ostream& + operator<<(basic_ostream&, const char32_t*) = delete; +#endif // _GLIBCXX_USE_WCHAR_T +#endif // C++20 + ///@} + +#if __cplusplus >= 201103L + // C++11 27.7.3.9 Rvalue stream insertion [ostream.rvalue] + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 1203. More useful rvalue stream insertion + +#if __cpp_concepts >= 201907L && __glibcxx_type_trait_variable_templates + // Use concepts if possible because they're cheaper to evaluate. + template + concept __derived_from_ios_base = is_class_v<_Tp> + && (!is_same_v<_Tp, ios_base>) + && requires (_Tp* __t, ios_base* __b) { __b = __t; }; + + template + requires __derived_from_ios_base<_Os> + && requires (_Os& __os, const _Tp& __t) { __os << __t; } + using __rvalue_stream_insertion_t = _Os&&; +#else + template + using _Require_derived_from_ios_base + = _Require, __not_>, + is_convertible::type, ios_base*>>; + + template, + typename + = decltype(std::declval<_Os&>() << std::declval())> + using __rvalue_stream_insertion_t = _Os&&; +#endif + + /** + * @brief Generic inserter for rvalue stream + * @param __os An input stream. + * @param __x A reference to the object being inserted. + * @return __os + * + * This is just a forwarding function to allow insertion to + * rvalue streams since they won't bind to the inserter functions + * that take an lvalue reference. + */ + template + inline __rvalue_stream_insertion_t<_Ostream, _Tp> + operator<<(_Ostream&& __os, const _Tp& __x) + { + __os << __x; + return std::move(__os); + } +#endif // C++11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif /* _GLIBCXX_OSTREAM_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.h.blob new file mode 100644 index 0000000..6b8c3e1 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.tcc new file mode 100644 index 0000000..a4fe9d4 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.tcc @@ -0,0 +1,404 @@ +// ostream classes -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ostream.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ostream} + */ + +// +// ISO C++ 14882: 27.6.2 Output streams +// + +#ifndef _OSTREAM_TCC +#define _OSTREAM_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + basic_ostream<_CharT, _Traits>::sentry:: + sentry(basic_ostream<_CharT, _Traits>& __os) + : _M_ok(false), _M_os(__os) + { + // XXX MT + if (__os.tie() && __os.good()) + __os.tie()->flush(); + + if (__os.good()) + _M_ok = true; + else if (__os.bad()) + __os.setstate(ios_base::failbit); + } + + template + template + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + _M_insert(_ValueT __v) + { + sentry __cerb(*this); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { +#ifndef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT + const __num_put_type& __np = __check_facet(this->_M_num_put); +#else + const __num_put_type& __np + = use_facet<__num_put_type>(this->_M_ios_locale); +#endif + if (__np.put(*this, *this, this->fill(), __v).failed()) + __err |= ios_base::badbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + operator<<(short __n) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; + if (__fmt == ios_base::oct || __fmt == ios_base::hex) + return _M_insert(static_cast(static_cast(__n))); + else + return _M_insert(static_cast(__n)); + } + + template + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + operator<<(int __n) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield; + if (__fmt == ios_base::oct || __fmt == ios_base::hex) + return _M_insert(static_cast(static_cast(__n))); + else + return _M_insert(static_cast(__n)); + } + + template + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + operator<<(__streambuf_type* __sbin) + { + ios_base::iostate __err = ios_base::goodbit; + sentry __cerb(*this); + if (__cerb && __sbin) + { + __try + { + if (!__copy_streambufs(__sbin, this->rdbuf())) + __err |= ios_base::failbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::failbit); } + } + else if (!__sbin) + __err |= ios_base::badbit; + if (__err) + this->setstate(__err); + return *this; + } + + template + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + put(char_type __c) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // basic_ostream::put(char_type) is an unformatted output function. + // DR 63. Exception-handling policy for unformatted output. + // Unformatted output functions should catch exceptions thrown + // from streambuf members. + sentry __cerb(*this); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + const int_type __put = this->rdbuf()->sputc(__c); + if (traits_type::eq_int_type(__put, traits_type::eof())) + __err |= ios_base::badbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + write(const _CharT* __s, streamsize __n) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // basic_ostream::write(const char_type*, streamsize) is an + // unformatted output function. + // DR 63. Exception-handling policy for unformatted output. + // Unformatted output functions should catch exceptions thrown + // from streambuf members. + sentry __cerb(*this); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + if (this->rdbuf()->sputn(__s, __n) != __n) + __err = ios_base::badbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(ios_base::badbit); + } + return *this; + } + + template + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + flush() + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // basic_ostream::flush() is *not* an unformatted output function. + // 581. flush() not unformatted function + // basic_ostream::flush() *is* an unformatted output function. + if (__streambuf_type* __buf = this->rdbuf()) + { + sentry __cerb(*this); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + if (this->rdbuf()->pubsync() == -1) + __err |= ios_base::badbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + this->_M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + } + return *this; + } + + template + typename basic_ostream<_CharT, _Traits>::pos_type + basic_ostream<_CharT, _Traits>:: + tellp() + { + sentry __cerb(*this); + pos_type __ret = pos_type(-1); + if (!this->fail()) + __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out); + return __ret; + } + + template + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + seekp(pos_type __pos) + { + sentry __cerb(*this); + if (!this->fail()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 136. seekp, seekg setting wrong streams? + const pos_type __p = this->rdbuf()->pubseekpos(__pos, ios_base::out); + + // 129. Need error indication from seekp() and seekg() + if (__p == pos_type(off_type(-1))) + this->setstate(ios_base::failbit); + } + return *this; + } + + template + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + seekp(off_type __off, ios_base::seekdir __dir) + { + sentry __cerb(*this); + if (!this->fail()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 136. seekp, seekg setting wrong streams? + const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir, + ios_base::out); + + // 129. Need error indication from seekp() and seekg() + if (__p == pos_type(off_type(-1))) + this->setstate(ios_base::failbit); + } + return *this; + } + + template + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) + { + if (!__s) + __out.setstate(ios_base::badbit); + else + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 167. Improper use of traits_type::length() + const size_t __clen = char_traits::length(__s); + __try + { + struct __ptr_guard + { + _CharT *__p; + __ptr_guard (_CharT *__ip): __p(__ip) { } + ~__ptr_guard() { delete[] __p; } + _CharT* __get() { return __p; } + } __pg (new _CharT[__clen]); + + _CharT *__ws = __pg.__get(); + for (size_t __i = 0; __i < __clen; ++__i) + __ws[__i] = __out.widen(__s[__i]); + __ostream_insert(__out, __ws, __clen); + } + __catch(__cxxabiv1::__forced_unwind&) + { + __out._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __out._M_setstate(ios_base::badbit); } + } + return __out; + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class basic_ostream; + extern template ostream& endl(ostream&); + extern template ostream& ends(ostream&); + extern template ostream& flush(ostream&); + extern template ostream& operator<<(ostream&, char); + extern template ostream& operator<<(ostream&, unsigned char); + extern template ostream& operator<<(ostream&, signed char); + extern template ostream& operator<<(ostream&, const char*); + extern template ostream& operator<<(ostream&, const unsigned char*); + extern template ostream& operator<<(ostream&, const signed char*); + + extern template ostream& ostream::_M_insert(long); + extern template ostream& ostream::_M_insert(unsigned long); + extern template ostream& ostream::_M_insert(bool); +#ifdef _GLIBCXX_USE_LONG_LONG +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + extern template ostream& ostream::_M_insert(long long); + extern template ostream& ostream::_M_insert(unsigned long long); +#pragma GCC diagnostic pop +#endif + extern template ostream& ostream::_M_insert(double); + extern template ostream& ostream::_M_insert(long double); + extern template ostream& ostream::_M_insert(const void*); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class basic_ostream; + extern template wostream& endl(wostream&); + extern template wostream& ends(wostream&); + extern template wostream& flush(wostream&); + extern template wostream& operator<<(wostream&, wchar_t); + extern template wostream& operator<<(wostream&, char); + extern template wostream& operator<<(wostream&, const wchar_t*); + extern template wostream& operator<<(wostream&, const char*); + + extern template wostream& wostream::_M_insert(long); + extern template wostream& wostream::_M_insert(unsigned long); + extern template wostream& wostream::_M_insert(bool); +#ifdef _GLIBCXX_USE_LONG_LONG +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + extern template wostream& wostream::_M_insert(long long); + extern template wostream& wostream::_M_insert(unsigned long long); +#pragma GCC diagnostic pop +#endif + extern template wostream& wostream::_M_insert(double); + extern template wostream& wostream::_M_insert(long double); + extern template wostream& wostream::_M_insert(const void*); +#endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.tcc.blob new file mode 100644 index 0000000..0aef460 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream_insert.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream_insert.h new file mode 100644 index 0000000..c18fb9d --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream_insert.h @@ -0,0 +1,140 @@ +// Helpers for ostream inserters -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ostream_insert.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ostream} + */ + +#ifndef _OSTREAM_INSERT_H +#define _OSTREAM_INSERT_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// @cond undocumented + + template + inline void + __ostream_write(basic_ostream<_CharT, _Traits>& __out, + const _CharT* __s, streamsize __n) + { + typedef basic_ostream<_CharT, _Traits> __ostream_type; + typedef typename __ostream_type::ios_base __ios_base; + + const streamsize __put = __out.rdbuf()->sputn(__s, __n); + if (__put != __n) + __out.setstate(__ios_base::badbit); + } + + template + inline void + __ostream_fill(basic_ostream<_CharT, _Traits>& __out, streamsize __n) + { + typedef basic_ostream<_CharT, _Traits> __ostream_type; + typedef typename __ostream_type::ios_base __ios_base; + + const _CharT __c = __out.fill(); + for (; __n > 0; --__n) + { + const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c); + if (_Traits::eq_int_type(__put, _Traits::eof())) + { + __out.setstate(__ios_base::badbit); + break; + } + } + } + + template + basic_ostream<_CharT, _Traits>& + __ostream_insert(basic_ostream<_CharT, _Traits>& __out, + const _CharT* __s, streamsize __n) + { + typedef basic_ostream<_CharT, _Traits> __ostream_type; + typedef typename __ostream_type::ios_base __ios_base; + + typename __ostream_type::sentry __cerb(__out); + if (__cerb) + { + __try + { + const streamsize __w = __out.width(); + if (__w > __n) + { + const bool __left = ((__out.flags() + & __ios_base::adjustfield) + == __ios_base::left); + if (!__left) + __ostream_fill(__out, __w - __n); + if (__out.good()) + __ostream_write(__out, __s, __n); + if (__left && __out.good()) + __ostream_fill(__out, __w - __n); + } + else + __ostream_write(__out, __s, __n); + __out.width(0); + } + __catch(__cxxabiv1::__forced_unwind&) + { + __out._M_setstate(__ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __out._M_setstate(__ios_base::badbit); } + } + return __out; + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template ostream& __ostream_insert(ostream&, const char*, streamsize); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template wostream& __ostream_insert(wostream&, const wchar_t*, + streamsize); +#endif +#endif + + /// @endcond + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif /* _OSTREAM_INSERT_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream_insert.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream_insert.h.blob new file mode 100644 index 0000000..239c922 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ostream_insert.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@parse_numbers.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@parse_numbers.h new file mode 100644 index 0000000..b678aec --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@parse_numbers.h @@ -0,0 +1,297 @@ +// Components for compile-time parsing of numbers -*- C++ -*- + +// Copyright (C) 2013-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/parse_numbers.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{chrono} + */ + +#ifndef _GLIBCXX_PARSE_NUMBERS_H +#define _GLIBCXX_PARSE_NUMBERS_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +// From n3642.pdf except I added binary literals and digit separator '\''. + +#if __cplusplus >= 201402L + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +namespace __parse_int +{ + template + struct _Digit; + + template + struct _Digit<_Base, '0'> : integral_constant + { + using __valid = true_type; + }; + + template + struct _Digit<_Base, '1'> : integral_constant + { + using __valid = true_type; + }; + + template + struct _Digit_impl : integral_constant + { + static_assert(_Base > _Val, "invalid digit"); + using __valid = true_type; + }; + + template + struct _Digit<_Base, '2'> : _Digit_impl<_Base, 2> + { }; + + template + struct _Digit<_Base, '3'> : _Digit_impl<_Base, 3> + { }; + + template + struct _Digit<_Base, '4'> : _Digit_impl<_Base, 4> + { }; + + template + struct _Digit<_Base, '5'> : _Digit_impl<_Base, 5> + { }; + + template + struct _Digit<_Base, '6'> : _Digit_impl<_Base, 6> + { }; + + template + struct _Digit<_Base, '7'> : _Digit_impl<_Base, 7> + { }; + + template + struct _Digit<_Base, '8'> : _Digit_impl<_Base, 8> + { }; + + template + struct _Digit<_Base, '9'> : _Digit_impl<_Base, 9> + { }; + + template + struct _Digit<_Base, 'a'> : _Digit_impl<_Base, 0xa> + { }; + + template + struct _Digit<_Base, 'A'> : _Digit_impl<_Base, 0xa> + { }; + + template + struct _Digit<_Base, 'b'> : _Digit_impl<_Base, 0xb> + { }; + + template + struct _Digit<_Base, 'B'> : _Digit_impl<_Base, 0xb> + { }; + + template + struct _Digit<_Base, 'c'> : _Digit_impl<_Base, 0xc> + { }; + + template + struct _Digit<_Base, 'C'> : _Digit_impl<_Base, 0xc> + { }; + + template + struct _Digit<_Base, 'd'> : _Digit_impl<_Base, 0xd> + { }; + + template + struct _Digit<_Base, 'D'> : _Digit_impl<_Base, 0xd> + { }; + + template + struct _Digit<_Base, 'e'> : _Digit_impl<_Base, 0xe> + { }; + + template + struct _Digit<_Base, 'E'> : _Digit_impl<_Base, 0xe> + { }; + + template + struct _Digit<_Base, 'f'> : _Digit_impl<_Base, 0xf> + { }; + + template + struct _Digit<_Base, 'F'> : _Digit_impl<_Base, 0xf> + { }; + + // Digit separator + template + struct _Digit<_Base, '\''> : integral_constant + { + using __valid = false_type; + }; + +//------------------------------------------------------------------------------ + + template + using __ull_constant = integral_constant; + + template + struct _Power_help + { + using __next = typename _Power_help<_Base, _Digs...>::type; + using __valid_digit = typename _Digit<_Base, _Dig>::__valid; + using type + = __ull_constant<__next::value * (__valid_digit{} ? _Base : 1ULL)>; + }; + + template + struct _Power_help<_Base, _Dig> + { + using __valid_digit = typename _Digit<_Base, _Dig>::__valid; + using type = __ull_constant<__valid_digit::value>; + }; + + template + struct _Power : _Power_help<_Base, _Digs...>::type + { }; + + template + struct _Power<_Base> : __ull_constant<0> + { }; + +//------------------------------------------------------------------------------ + + template + struct _Number_help + { + using __digit = _Digit<_Base, _Dig>; + using __valid_digit = typename __digit::__valid; + using __next = _Number_help<_Base, + __valid_digit::value ? _Pow / _Base : _Pow, + _Digs...>; + using type = __ull_constant<_Pow * __digit::value + __next::type::value>; + static_assert((type::value / _Pow) == __digit::value, + "integer literal does not fit in unsigned long long"); + }; + + // Skip past digit separators: + template + struct _Number_help<_Base, _Pow, '\'', _Dig, _Digs...> + : _Number_help<_Base, _Pow, _Dig, _Digs...> + { }; + + // Terminating case for recursion: + template + struct _Number_help<_Base, 1ULL, _Dig> + { + using type = __ull_constant<_Digit<_Base, _Dig>::value>; + }; + + template + struct _Number + : _Number_help<_Base, _Power<_Base, _Digs...>::value, _Digs...>::type + { }; + + template + struct _Number<_Base> + : __ull_constant<0> + { }; + +//------------------------------------------------------------------------------ + + template + struct _Parse_int; + + template + struct _Parse_int<'0', 'b', _Digs...> + : _Number<2U, _Digs...>::type + { }; + + template + struct _Parse_int<'0', 'B', _Digs...> + : _Number<2U, _Digs...>::type + { }; + + template + struct _Parse_int<'0', 'x', _Digs...> + : _Number<16U, _Digs...>::type + { }; + + template + struct _Parse_int<'0', 'X', _Digs...> + : _Number<16U, _Digs...>::type + { }; + + template + struct _Parse_int<'0', _Digs...> + : _Number<8U, _Digs...>::type + { }; + + template + struct _Parse_int + : _Number<10U, _Digs...>::type + { }; + +} // namespace __parse_int + + +namespace __select_int +{ + template + struct _Select_int_base; + + template + struct _Select_int_base<_Val, _IntType, _Ints...> + : __conditional_t<(_Val <= __gnu_cxx::__int_traits<_IntType>::__max), + integral_constant<_IntType, (_IntType)_Val>, + _Select_int_base<_Val, _Ints...>> + { }; + + template + struct _Select_int_base<_Val> + { }; + + template + using _Select_int = typename _Select_int_base< + __parse_int::_Parse_int<_Digs...>::value, + unsigned char, + unsigned short, + unsigned int, + unsigned long, + unsigned long long + >::type; + +} // namespace __select_int + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++14 + +#endif // _GLIBCXX_PARSE_NUMBERS_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@parse_numbers.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@parse_numbers.h.blob new file mode 100644 index 0000000..f93f7ac Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@parse_numbers.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@postypes.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@postypes.h new file mode 100644 index 0000000..77c0058 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@postypes.h @@ -0,0 +1,228 @@ +// Position types -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/postypes.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iosfwd} + */ + +// +// ISO C++ 14882: 27.4.1 - Types +// ISO C++ 14882: 27.4.3 - Template class fpos +// + +#ifndef _GLIBCXX_POSTYPES_H +#define _GLIBCXX_POSTYPES_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // For mbstate_t + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // The types streamoff, streampos and wstreampos and the class + // template fpos<> are described in clauses 21.1.2, 21.1.3, 27.1.2, + // 27.2, 27.4.1, 27.4.3 and D.6. Despite all this verbiage, the + // behaviour of these types is mostly implementation defined or + // unspecified. The behaviour in this implementation is as noted + // below. + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + /** + * @brief Type used by fpos, char_traits, and char_traits. + * + * In clauses 21.1.3.1 and 27.4.1 streamoff is described as an + * implementation defined type. + * Note: In versions of GCC up to and including GCC 3.3, streamoff + * was typedef long. + */ +#ifdef __INT64_TYPE__ + typedef __INT64_TYPE__ streamoff; +#else + typedef long long streamoff; +#endif +#pragma GCC diagnostic pop + + /// Integral type for I/O operation counts and buffer sizes. + typedef ptrdiff_t streamsize; // Signed integral type + + /** + * @brief Class representing stream positions. + * + * The standard places no requirements upon the template parameter StateT. + * In this implementation StateT must be DefaultConstructible, + * CopyConstructible and Assignable. The standard only requires that fpos + * should contain a member of type StateT. In this implementation it also + * contains an offset stored as a signed integer. + * + * @param StateT Type passed to and returned from state(). + */ + template + class fpos + { + private: + streamoff _M_off; + _StateT _M_state; + + public: + // The standard doesn't require that fpos objects can be default + // constructed. This implementation provides a default + // constructor that initializes the offset to 0 and default + // constructs the state. + fpos() + : _M_off(0), _M_state() { } + + // The standard requires that fpos objects can be constructed + // from streamoff objects using the constructor syntax, and + // fails to give any meaningful semantics. In this + // implementation implicit conversion is also allowed, and this + // constructor stores the streamoff as the offset and default + // constructs the state. + /// Construct position from offset. + fpos(streamoff __off) + : _M_off(__off), _M_state() { } + +#if __cplusplus >= 201103L + fpos(const fpos&) = default; + fpos& operator=(const fpos&) = default; + ~fpos() = default; +#endif + + /// Convert to streamoff. + operator streamoff() const { return _M_off; } + + /// Remember the value of @a st. + void + state(_StateT __st) + { _M_state = __st; } + + /// Return the last set value of @a st. + _StateT + state() const + { return _M_state; } + + // The standard requires that this operator must be defined, but + // gives no semantics. In this implementation it just adds its + // argument to the stored offset and returns *this. + /// Add offset to this position. + fpos& + operator+=(streamoff __off) + { + _M_off += __off; + return *this; + } + + // The standard requires that this operator must be defined, but + // gives no semantics. In this implementation it just subtracts + // its argument from the stored offset and returns *this. + /// Subtract offset from this position. + fpos& + operator-=(streamoff __off) + { + _M_off -= __off; + return *this; + } + + // The standard requires that this operator must be defined, but + // defines its semantics only in terms of operator-. In this + // implementation it constructs a copy of *this, adds the + // argument to that copy using operator+= and then returns the + // copy. + /// Add position and offset. + fpos + operator+(streamoff __off) const + { + fpos __pos(*this); + __pos += __off; + return __pos; + } + + // The standard requires that this operator must be defined, but + // defines its semantics only in terms of operator+. In this + // implementation it constructs a copy of *this, subtracts the + // argument from that copy using operator-= and then returns the + // copy. + /// Subtract offset from position. + fpos + operator-(streamoff __off) const + { + fpos __pos(*this); + __pos -= __off; + return __pos; + } + + // The standard requires that this operator must be defined, but + // defines its semantics only in terms of operator+. In this + // implementation it returns the difference between the offset + // stored in *this and in the argument. + /// Subtract position to return offset. + streamoff + operator-(const fpos& __other) const + { return _M_off - __other._M_off; } + }; + + // The standard only requires that operator== must be an + // equivalence relation. In this implementation two fpos + // objects belong to the same equivalence class if the contained + // offsets compare equal. + /// Test if equivalent to another position. + template + inline bool + operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) + { return streamoff(__lhs) == streamoff(__rhs); } + + template + inline bool + operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) + { return streamoff(__lhs) != streamoff(__rhs); } + + // Clauses 21.1.3.1 and 21.1.3.2 describe streampos and wstreampos + // as implementation defined types, but clause 27.2 requires that + // they must both be typedefs for fpos + /// File position for char streams. + typedef fpos streampos; + /// File position for wchar_t streams. + typedef fpos wstreampos; + +#ifdef _GLIBCXX_USE_CHAR8_T + /// File position for char8_t streams. + typedef fpos u8streampos; +#endif + +#if __cplusplus >= 201103L + /// File position for char16_t streams. + typedef fpos u16streampos; + /// File position for char32_t streams. + typedef fpos u32streampos; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@postypes.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@postypes.h.blob new file mode 100644 index 0000000..e407a87 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@postypes.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@predefined_ops.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@predefined_ops.h new file mode 100644 index 0000000..5759ebd --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@predefined_ops.h @@ -0,0 +1,407 @@ +// Default predicates for internal use -*- C++ -*- + +// Copyright (C) 2013-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file predefined_ops.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. @headername{algorithm} + */ + +#ifndef _GLIBCXX_PREDEFINED_OPS_H +#define _GLIBCXX_PREDEFINED_OPS_H 1 + +#include + +namespace __gnu_cxx +{ +namespace __ops +{ + struct _Iter_less_iter + { + template + _GLIBCXX14_CONSTEXPR + bool + operator()(_Iterator1 __it1, _Iterator2 __it2) const + { return *__it1 < *__it2; } + }; + + _GLIBCXX14_CONSTEXPR + inline _Iter_less_iter + __iter_less_iter() + { return _Iter_less_iter(); } + + struct _Iter_less_val + { +#if __cplusplus >= 201103L + constexpr _Iter_less_val() = default; +#else + _Iter_less_val() { } +#endif + + _GLIBCXX20_CONSTEXPR + explicit + _Iter_less_val(_Iter_less_iter) { } + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator __it, _Value& __val) const + { return *__it < __val; } + }; + + _GLIBCXX20_CONSTEXPR + inline _Iter_less_val + __iter_less_val() + { return _Iter_less_val(); } + + _GLIBCXX20_CONSTEXPR + inline _Iter_less_val + __iter_comp_val(_Iter_less_iter) + { return _Iter_less_val(); } + + struct _Val_less_iter + { +#if __cplusplus >= 201103L + constexpr _Val_less_iter() = default; +#else + _Val_less_iter() { } +#endif + + _GLIBCXX20_CONSTEXPR + explicit + _Val_less_iter(_Iter_less_iter) { } + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Value& __val, _Iterator __it) const + { return __val < *__it; } + }; + + _GLIBCXX20_CONSTEXPR + inline _Val_less_iter + __val_less_iter() + { return _Val_less_iter(); } + + _GLIBCXX20_CONSTEXPR + inline _Val_less_iter + __val_comp_iter(_Iter_less_iter) + { return _Val_less_iter(); } + + struct _Iter_equal_to_iter + { + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator1 __it1, _Iterator2 __it2) const + { return *__it1 == *__it2; } + }; + + _GLIBCXX20_CONSTEXPR + inline _Iter_equal_to_iter + __iter_equal_to_iter() + { return _Iter_equal_to_iter(); } + + struct _Iter_equal_to_val + { + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator __it, _Value& __val) const + { return *__it == __val; } + }; + + _GLIBCXX20_CONSTEXPR + inline _Iter_equal_to_val + __iter_equal_to_val() + { return _Iter_equal_to_val(); } + + _GLIBCXX20_CONSTEXPR + inline _Iter_equal_to_val + __iter_comp_val(_Iter_equal_to_iter) + { return _Iter_equal_to_val(); } + + template + struct _Iter_comp_iter + { + _Compare _M_comp; + + explicit _GLIBCXX14_CONSTEXPR + _Iter_comp_iter(_Compare __comp) + : _M_comp(_GLIBCXX_MOVE(__comp)) + { } + + template + _GLIBCXX14_CONSTEXPR + bool + operator()(_Iterator1 __it1, _Iterator2 __it2) + { return bool(_M_comp(*__it1, *__it2)); } + }; + + template + _GLIBCXX14_CONSTEXPR + inline _Iter_comp_iter<_Compare> + __iter_comp_iter(_Compare __comp) + { return _Iter_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + struct _Iter_comp_val + { + _Compare _M_comp; + + _GLIBCXX20_CONSTEXPR + explicit + _Iter_comp_val(_Compare __comp) + : _M_comp(_GLIBCXX_MOVE(__comp)) + { } + + _GLIBCXX20_CONSTEXPR + explicit + _Iter_comp_val(const _Iter_comp_iter<_Compare>& __comp) + : _M_comp(__comp._M_comp) + { } + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + explicit + _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) + : _M_comp(std::move(__comp._M_comp)) + { } +#endif + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator __it, _Value& __val) + { return bool(_M_comp(*__it, __val)); } + }; + + template + _GLIBCXX20_CONSTEXPR + inline _Iter_comp_val<_Compare> + __iter_comp_val(_Compare __comp) + { return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + _GLIBCXX20_CONSTEXPR + inline _Iter_comp_val<_Compare> + __iter_comp_val(_Iter_comp_iter<_Compare> __comp) + { return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + struct _Val_comp_iter + { + _Compare _M_comp; + + _GLIBCXX20_CONSTEXPR + explicit + _Val_comp_iter(_Compare __comp) + : _M_comp(_GLIBCXX_MOVE(__comp)) + { } + + _GLIBCXX20_CONSTEXPR + explicit + _Val_comp_iter(const _Iter_comp_iter<_Compare>& __comp) + : _M_comp(__comp._M_comp) + { } + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + explicit + _Val_comp_iter(_Iter_comp_iter<_Compare>&& __comp) + : _M_comp(std::move(__comp._M_comp)) + { } +#endif + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Value& __val, _Iterator __it) + { return bool(_M_comp(__val, *__it)); } + }; + + template + _GLIBCXX20_CONSTEXPR + inline _Val_comp_iter<_Compare> + __val_comp_iter(_Compare __comp) + { return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + _GLIBCXX20_CONSTEXPR + inline _Val_comp_iter<_Compare> + __val_comp_iter(_Iter_comp_iter<_Compare> __comp) + { return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + struct _Iter_equals_val + { + _Value& _M_value; + + _GLIBCXX20_CONSTEXPR + explicit + _Iter_equals_val(_Value& __value) + : _M_value(__value) + { } + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator __it) + { return *__it == _M_value; } + }; + + template + _GLIBCXX20_CONSTEXPR + inline _Iter_equals_val<_Value> + __iter_equals_val(_Value& __val) + { return _Iter_equals_val<_Value>(__val); } + + template + struct _Iter_equals_iter + { + _Iterator1 _M_it1; + + _GLIBCXX20_CONSTEXPR + explicit + _Iter_equals_iter(_Iterator1 __it1) + : _M_it1(__it1) + { } + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator2 __it2) + { return *__it2 == *_M_it1; } + }; + + template + _GLIBCXX20_CONSTEXPR + inline _Iter_equals_iter<_Iterator> + __iter_comp_iter(_Iter_equal_to_iter, _Iterator __it) + { return _Iter_equals_iter<_Iterator>(__it); } + + template + struct _Iter_pred + { + _Predicate _M_pred; + + _GLIBCXX20_CONSTEXPR + explicit + _Iter_pred(_Predicate __pred) + : _M_pred(_GLIBCXX_MOVE(__pred)) + { } + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator __it) + { return bool(_M_pred(*__it)); } + }; + + template + _GLIBCXX20_CONSTEXPR + inline _Iter_pred<_Predicate> + __pred_iter(_Predicate __pred) + { return _Iter_pred<_Predicate>(_GLIBCXX_MOVE(__pred)); } + + template + struct _Iter_comp_to_val + { + _Compare _M_comp; + _Value& _M_value; + + _GLIBCXX20_CONSTEXPR + _Iter_comp_to_val(_Compare __comp, _Value& __value) + : _M_comp(_GLIBCXX_MOVE(__comp)), _M_value(__value) + { } + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator __it) + { return bool(_M_comp(*__it, _M_value)); } + }; + + template + _Iter_comp_to_val<_Compare, _Value> + _GLIBCXX20_CONSTEXPR + __iter_comp_val(_Compare __comp, _Value &__val) + { + return _Iter_comp_to_val<_Compare, _Value>(_GLIBCXX_MOVE(__comp), __val); + } + + template + struct _Iter_comp_to_iter + { + _Compare _M_comp; + _Iterator1 _M_it1; + + _GLIBCXX20_CONSTEXPR + _Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1) + : _M_comp(_GLIBCXX_MOVE(__comp)), _M_it1(__it1) + { } + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator2 __it2) + { return bool(_M_comp(*__it2, *_M_it1)); } + }; + + template + _GLIBCXX20_CONSTEXPR + inline _Iter_comp_to_iter<_Compare, _Iterator> + __iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it) + { + return _Iter_comp_to_iter<_Compare, _Iterator>( + _GLIBCXX_MOVE(__comp._M_comp), __it); + } + + template + struct _Iter_negate + { + _Predicate _M_pred; + + _GLIBCXX20_CONSTEXPR + explicit + _Iter_negate(_Predicate __pred) + : _M_pred(_GLIBCXX_MOVE(__pred)) + { } + + template + _GLIBCXX20_CONSTEXPR + bool + operator()(_Iterator __it) + { return !bool(_M_pred(*__it)); } + }; + + template + _GLIBCXX20_CONSTEXPR + inline _Iter_negate<_Predicate> + __negate(_Iter_pred<_Predicate> __pred) + { return _Iter_negate<_Predicate>(_GLIBCXX_MOVE(__pred._M_pred)); } + +} // namespace __ops +} // namespace __gnu_cxx + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@predefined_ops.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@predefined_ops.h.blob new file mode 100644 index 0000000..c5dab8b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@predefined_ops.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ptr_traits.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ptr_traits.h new file mode 100644 index 0000000..d3c1765 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ptr_traits.h @@ -0,0 +1,273 @@ +// Pointer Traits -*- C++ -*- + +// Copyright (C) 2011-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ptr_traits.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _PTR_TRAITS_H +#define _PTR_TRAITS_H 1 + +#if __cplusplus >= 201103L + +#include + +#if __cplusplus > 201703L +#include +namespace __gnu_debug { struct _Safe_iterator_base; } +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// @cond undocumented + + class __undefined; + + // For a specialization `SomeTemplate` the member `type` is T, + // otherwise `type` is `__undefined`. + template + struct __get_first_arg + { using type = __undefined; }; + + template class _SomeTemplate, typename _Tp, + typename... _Types> + struct __get_first_arg<_SomeTemplate<_Tp, _Types...>> + { using type = _Tp; }; + + // For a specialization `SomeTemplate` and a type `U` the member + // `type` is `SomeTemplate`, otherwise there is no member `type`. + template + struct __replace_first_arg + { }; + + template class _SomeTemplate, typename _Up, + typename _Tp, typename... _Types> + struct __replace_first_arg<_SomeTemplate<_Tp, _Types...>, _Up> + { using type = _SomeTemplate<_Up, _Types...>; }; + + // Detect the element type of a pointer-like type. + template + struct __ptr_traits_elem : __get_first_arg<_Ptr> + { }; + + // Use _Ptr::element_type if is a valid type. +#if __cpp_concepts + template requires requires { typename _Ptr::element_type; } + struct __ptr_traits_elem<_Ptr, void> + { using type = typename _Ptr::element_type; }; +#else + template + struct __ptr_traits_elem<_Ptr, __void_t> + { using type = typename _Ptr::element_type; }; +#endif + + template + using __ptr_traits_elem_t = typename __ptr_traits_elem<_Ptr>::type; + + /// @endcond + + // Define pointer_traits

::pointer_to. + template::value> + struct __ptr_traits_ptr_to + { + using pointer = _Ptr; + using element_type = _Elt; + + /** + * @brief Obtain a pointer to an object + * @param __r A reference to an object of type `element_type` + * @return `pointer::pointer_to(__r)` + * @pre `pointer::pointer_to(__r)` is a valid expression. + */ + static pointer + pointer_to(element_type& __r) +#if __cpp_lib_concepts + requires requires { + { pointer::pointer_to(__r) } -> convertible_to; + } +#endif + { return pointer::pointer_to(__r); } + }; + + // Do not define pointer_traits

::pointer_to if element type is void. + template + struct __ptr_traits_ptr_to<_Ptr, _Elt, true> + { }; + + // Partial specialization defining pointer_traits::pointer_to(T&). + template + struct __ptr_traits_ptr_to<_Tp*, _Tp, false> + { + using pointer = _Tp*; + using element_type = _Tp; + + /** + * @brief Obtain a pointer to an object + * @param __r A reference to an object of type `element_type` + * @return `addressof(__r)` + */ + static _GLIBCXX20_CONSTEXPR pointer + pointer_to(element_type& __r) noexcept + { return std::addressof(__r); } + }; + + template + struct __ptr_traits_impl : __ptr_traits_ptr_to<_Ptr, _Elt> + { + private: + template + using __diff_t = typename _Tp::difference_type; + + template + using __rebind = __type_identity>; + + public: + /// The pointer type. + using pointer = _Ptr; + + /// The type pointed to. + using element_type = _Elt; + + /// The type used to represent the difference between two pointers. + using difference_type = __detected_or_t; + + /// A pointer to a different type. + template + using rebind = typename __detected_or_t<__replace_first_arg<_Ptr, _Up>, + __rebind, _Ptr, _Up>::type; + }; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3545. std::pointer_traits should be SFINAE-friendly + template + struct __ptr_traits_impl<_Ptr, __undefined> + { }; + + /** + * @brief Uniform interface to all pointer-like types + * @headerfile memory + * @ingroup pointer_abstractions + * @since C++11 + */ + template + struct pointer_traits : __ptr_traits_impl<_Ptr, __ptr_traits_elem_t<_Ptr>> + { }; + + /** + * @brief Partial specialization for built-in pointers. + * @headerfile memory + * @ingroup pointer_abstractions + * @since C++11 + */ + template + struct pointer_traits<_Tp*> : __ptr_traits_ptr_to<_Tp*, _Tp> + { + /// The pointer type + typedef _Tp* pointer; + /// The type pointed to + typedef _Tp element_type; + /// Type used to represent the difference between two pointers + typedef ptrdiff_t difference_type; + /// A pointer to a different type. + template using rebind = _Up*; + }; + + /// Convenience alias for rebinding pointers. + template + using __ptr_rebind = typename pointer_traits<_Ptr>::template rebind<_Tp>; + +#ifndef __glibcxx_to_address // C++ < 20 + template + [[__gnu__::__always_inline__]] + constexpr _Tp* + __to_address(_Tp* __ptr) noexcept + { + static_assert(!std::is_function<_Tp>::value, "std::to_address argument " + "must not be a function pointer"); + return __ptr; + } + + // This should only be used for pointer-like types (e.g. allocator pointers) + // and (in C++20 and later) for types satisfying std::contiguous_iterator. + // It should not be used for arbitrary random access iterators, because + // they might not be contiguous iterators (e.g. deque::iterator isn't). + template + constexpr typename std::pointer_traits<_Ptr>::element_type* + __to_address(const _Ptr& __ptr) + { return std::__to_address(__ptr.operator->()); } +#else + /** + * @brief Obtain address referenced by a pointer to an object + * @param __ptr A pointer to an object + * @return @c __ptr + * @ingroup pointer_abstractions + */ + template + [[__gnu__::__always_inline__]] + constexpr _Tp* + to_address(_Tp* __ptr) noexcept + { + static_assert(!is_function_v<_Tp>, "std::to_address argument " + "must not be a function pointer"); + return __ptr; + } + + /** + * @brief Obtain address referenced by a pointer to an object + * @param __ptr A pointer to an object + * @return @c pointer_traits<_Ptr>::to_address(__ptr) if that expression is + well-formed, otherwise @c to_address(__ptr.operator->()) + * @ingroup pointer_abstractions + */ + template + constexpr auto + to_address(const _Ptr& __ptr) noexcept + { + if constexpr (requires { pointer_traits<_Ptr>::to_address(__ptr); }) + return pointer_traits<_Ptr>::to_address(__ptr); + else if constexpr (is_base_of_v<__gnu_debug::_Safe_iterator_base, _Ptr>) + return std::to_address(__ptr.base().operator->()); + else + return std::to_address(__ptr.operator->()); + } + + /// @cond undocumented + /// Compatibility for use in code that is also compiled as pre-C++20. + template + [[__gnu__::__always_inline__]] + constexpr auto + __to_address(const _Ptr& __ptr) noexcept + { return std::to_address(__ptr); } + /// @endcond +#endif // __glibcxx_to_address + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ptr_traits.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ptr_traits.h.blob new file mode 100644 index 0000000..53aed43 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@ptr_traits.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@quoted_string.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@quoted_string.h new file mode 100644 index 0000000..3a828d5 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@quoted_string.h @@ -0,0 +1,188 @@ +// Helpers for quoted stream manipulators -*- C++ -*- + +// Copyright (C) 2013-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/quoted_string.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iomanip} + */ + +#ifndef _GLIBCXX_QUOTED_STRING_H +#define _GLIBCXX_QUOTED_STRING_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus < 201103L +# include +#else +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + namespace __detail { + /** + * @brief Struct for delimited strings. + */ + template + struct _Quoted_string + { + static_assert(is_reference<_String>::value + || is_pointer<_String>::value, + "String type must be pointer or reference"); + + _Quoted_string(_String __str, _CharT __del, _CharT __esc) + : _M_string(__str), _M_delim{__del}, _M_escape{__esc} + { } + + _Quoted_string& + operator=(_Quoted_string&) = delete; + + _String _M_string; + _CharT _M_delim; + _CharT _M_escape; + }; + +#if __cplusplus >= 201703L + template + struct _Quoted_string, _CharT> + { + _Quoted_string(basic_string_view<_CharT, _Traits> __str, + _CharT __del, _CharT __esc) + : _M_string(__str), _M_delim{__del}, _M_escape{__esc} + { } + + _Quoted_string& + operator=(_Quoted_string&) = delete; + + basic_string_view<_CharT, _Traits> _M_string; + _CharT _M_delim; + _CharT _M_escape; + }; +#endif // C++17 + + /** + * @brief Inserter for quoted strings. + * + * @headerfile iomanip + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const _Quoted_string& __str) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 2344 quoted()'s interaction with padding is unclear + std::basic_ostringstream<_CharT, _Traits> __ostr; + __ostr << __str._M_delim; + for (const _CharT* __c = __str._M_string; *__c; ++__c) + { + if (*__c == __str._M_delim || *__c == __str._M_escape) + __ostr << __str._M_escape; + __ostr << *__c; + } + __ostr << __str._M_delim; + + return __os << __ostr.str(); + } + + /** + * @brief Inserter for quoted strings. + * + * @headerfile iomanip + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const _Quoted_string<_String, _CharT>& __str) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 2344 quoted()'s interaction with padding is unclear + std::basic_ostringstream<_CharT, _Traits> __ostr; + __ostr << __str._M_delim; + for (auto __c : __str._M_string) + { + if (__c == __str._M_delim || __c == __str._M_escape) + __ostr << __str._M_escape; + __ostr << __c; + } + __ostr << __str._M_delim; + + return __os << __ostr.str(); + } + + /** + * @brief Extractor for delimited strings. + * The left and right delimiters can be different. + * + * @headerfile iomanip + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + const _Quoted_string&, + _CharT>& __str) + { + _CharT __c; + __is >> __c; + if (!__is.good()) + return __is; + if (__c != __str._M_delim) + { + __is.unget(); + __is >> __str._M_string; + return __is; + } + __str._M_string.clear(); + std::ios_base::fmtflags __flags + = __is.flags(__is.flags() & ~std::ios_base::skipws); + do + { + __is >> __c; + if (!__is.good()) + break; + if (__c == __str._M_escape) + { + __is >> __c; + if (!__is.good()) + break; + } + else if (__c == __str._M_delim) + break; + __str._M_string += __c; + } + while (true); + __is.setf(__flags); + + return __is; + } + } // namespace __detail + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 +#endif /* _GLIBCXX_QUOTED_STRING_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@quoted_string.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@quoted_string.h.blob new file mode 100644 index 0000000..5ebb658 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@quoted_string.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@range_access.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@range_access.h new file mode 100644 index 0000000..e0afee4 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@range_access.h @@ -0,0 +1,381 @@ +// Range access functions for containers -*- C++ -*- + +// Copyright (C) 2010-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/range_access.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ + +#ifndef _GLIBCXX_RANGE_ACCESS_H +#define _GLIBCXX_RANGE_ACCESS_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus >= 201103L +#include +#include // common_type_t, make_signed_t +#include // reverse_iterator + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Return an iterator pointing to the first element of + * the container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + begin(_Container& __cont) noexcept(noexcept(__cont.begin())) + -> decltype(__cont.begin()) + { return __cont.begin(); } + + /** + * @brief Return an iterator pointing to the first element of + * the const container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + begin(const _Container& __cont) noexcept(noexcept(__cont.begin())) + -> decltype(__cont.begin()) + { return __cont.begin(); } + + /** + * @brief Return an iterator pointing to one past the last element of + * the container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + end(_Container& __cont) noexcept(noexcept(__cont.end())) + -> decltype(__cont.end()) + { return __cont.end(); } + + /** + * @brief Return an iterator pointing to one past the last element of + * the const container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + end(const _Container& __cont) noexcept(noexcept(__cont.end())) + -> decltype(__cont.end()) + { return __cont.end(); } + + /** + * @brief Return an iterator pointing to the first element of the array. + * @param __arr Array. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX14_CONSTEXPR _Tp* + begin(_Tp (&__arr)[_Nm]) noexcept + { return __arr; } + + /** + * @brief Return an iterator pointing to one past the last element + * of the array. + * @param __arr Array. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX14_CONSTEXPR _Tp* + end(_Tp (&__arr)[_Nm]) noexcept + { return __arr + _Nm; } + +#if __cplusplus >= 201402L + + template class valarray; + // These overloads must be declared for cbegin and cend to use them. + template _Tp* begin(valarray<_Tp>&) noexcept; + template const _Tp* begin(const valarray<_Tp>&) noexcept; + template _Tp* end(valarray<_Tp>&) noexcept; + template const _Tp* end(const valarray<_Tp>&) noexcept; + + /** + * @brief Return an iterator pointing to the first element of + * the const container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + constexpr auto + cbegin(const _Container& __cont) noexcept(noexcept(std::begin(__cont))) + -> decltype(std::begin(__cont)) + { return std::begin(__cont); } + + /** + * @brief Return an iterator pointing to one past the last element of + * the const container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + constexpr auto + cend(const _Container& __cont) noexcept(noexcept(std::end(__cont))) + -> decltype(std::end(__cont)) + { return std::end(__cont); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + rbegin(_Container& __cont) noexcept(noexcept(__cont.rbegin())) + -> decltype(__cont.rbegin()) + { return __cont.rbegin(); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the const container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + rbegin(const _Container& __cont) noexcept(noexcept(__cont.rbegin())) + -> decltype(__cont.rbegin()) + { return __cont.rbegin(); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + rend(_Container& __cont) noexcept(noexcept(__cont.rend())) + -> decltype(__cont.rend()) + { return __cont.rend(); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the const container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + rend(const _Container& __cont) noexcept(noexcept(__cont.rend())) + -> decltype(__cont.rend()) + { return __cont.rend(); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the array. + * @param __arr Array. + */ + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*> + rbegin(_Tp (&__arr)[_Nm]) noexcept + { return reverse_iterator<_Tp*>(__arr + _Nm); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the array. + * @param __arr Array. + */ + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*> + rend(_Tp (&__arr)[_Nm]) noexcept + { return reverse_iterator<_Tp*>(__arr); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the initializer_list. + * @param __il initializer_list. + */ + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR reverse_iterator + rbegin(initializer_list<_Tp> __il) noexcept + { return reverse_iterator(__il.end()); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the initializer_list. + * @param __il initializer_list. + */ + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR reverse_iterator + rend(initializer_list<_Tp> __il) noexcept + { return reverse_iterator(__il.begin()); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the const container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + crbegin(const _Container& __cont) noexcept(noexcept(std::rbegin(__cont))) + -> decltype(std::rbegin(__cont)) + { return std::rbegin(__cont); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the const container. + * @param __cont Container. + */ + template + [[__nodiscard__, __gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR auto + crend(const _Container& __cont) noexcept(noexcept(std::rend(__cont))) + -> decltype(std::rend(__cont)) + { return std::rend(__cont); } + +#endif // C++14 + +#ifdef __glibcxx_nonmember_container_access // C++ >= 17 + /** + * @brief Return the size of a container. + * @param __cont Container. + */ + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr auto + size(const _Container& __cont) noexcept(noexcept(__cont.size())) + -> decltype(__cont.size()) + { return __cont.size(); } + + /** + * @brief Return the size of an array. + */ + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr size_t + size(const _Tp (&)[_Nm]) noexcept + { return _Nm; } + + /** + * @brief Return whether a container is empty. + * @param __cont Container. + */ + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr auto + empty(const _Container& __cont) noexcept(noexcept(__cont.empty())) + -> decltype(__cont.empty()) + { return __cont.empty(); } + + /** + * @brief Return whether an array is empty (always false). + */ + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr bool + empty(const _Tp (&)[_Nm]) noexcept + { return false; } + + /** + * @brief Return whether an initializer_list is empty. + * @param __il Initializer list. + */ + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr bool + empty(initializer_list<_Tp> __il) noexcept + { return __il.size() == 0;} + + /** + * @brief Return the data pointer of a container. + * @param __cont Container. + */ + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr auto + data(_Container& __cont) noexcept(noexcept(__cont.data())) + -> decltype(__cont.data()) + { return __cont.data(); } + + /** + * @brief Return the data pointer of a const container. + * @param __cont Container. + */ + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr auto + data(const _Container& __cont) noexcept(noexcept(__cont.data())) + -> decltype(__cont.data()) + { return __cont.data(); } + + /** + * @brief Return the data pointer of an array. + * @param __array Array. + */ + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr _Tp* + data(_Tp (&__array)[_Nm]) noexcept + { return __array; } + + /** + * @brief Return the data pointer of an initializer list. + * @param __il Initializer list. + */ + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr const _Tp* + data(initializer_list<_Tp> __il) noexcept + { return __il.begin(); } +#endif // __glibcxx_nonmember_container_access + +#ifdef __glibcxx_ssize // C++ >= 20 + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr auto + ssize(const _Container& __cont) noexcept(noexcept(__cont.size())) + -> common_type_t> + { + using type = make_signed_t; + return static_cast>(__cont.size()); + } + + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr ptrdiff_t + ssize(const _Tp (&)[_Num]) noexcept + { return _Num; } +#endif // __glibcxx_ssize +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // C++11 +#endif // _GLIBCXX_RANGE_ACCESS_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@range_access.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@range_access.h.blob new file mode 100644 index 0000000..a76e0de Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@range_access.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@refwrap.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@refwrap.h new file mode 100644 index 0000000..612715e --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@refwrap.h @@ -0,0 +1,465 @@ +// Implementation of std::reference_wrapper -*- C++ -*- + +// Copyright (C) 2004-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/refwrap.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _GLIBCXX_REFWRAP_H +#define _GLIBCXX_REFWRAP_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus >= 201103L + +#include +#include +#include // for unary_function and binary_function + +#if __glibcxx_reference_wrapper >= 202403L // >= C++26 +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// @cond undocumented + + /** + * Derives from @c unary_function or @c binary_function, or perhaps + * nothing, depending on the number of arguments provided. The + * primary template is the basis case, which derives nothing. + */ + template + struct _Maybe_unary_or_binary_function { }; + +// Ignore warnings about unary_function and binary_function. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + /// Derives from @c unary_function, as appropriate. + template + struct _Maybe_unary_or_binary_function<_Res, _T1> + : std::unary_function<_T1, _Res> { }; + + /// Derives from @c binary_function, as appropriate. + template + struct _Maybe_unary_or_binary_function<_Res, _T1, _T2> + : std::binary_function<_T1, _T2, _Res> { }; + +#pragma GCC diagnostic pop + + template + struct _Mem_fn_traits; + + template + struct _Mem_fn_traits_base + { + using __result_type = _Res; + using __maybe_type + = _Maybe_unary_or_binary_function<_Res, _Class*, _ArgTypes...>; + using __arity = integral_constant; + }; + +#define _GLIBCXX_MEM_FN_TRAITS2(_CV, _REF, _LVAL, _RVAL) \ + template \ + struct _Mem_fn_traits<_Res (_Class::*)(_ArgTypes...) _CV _REF> \ + : _Mem_fn_traits_base<_Res, _CV _Class, _ArgTypes...> \ + { \ + using __vararg = false_type; \ + }; \ + template \ + struct _Mem_fn_traits<_Res (_Class::*)(_ArgTypes..., ...) _CV _REF> \ + : _Mem_fn_traits_base<_Res, _CV _Class, _ArgTypes...> \ + { \ + using __vararg = true_type; \ + }; + +#define _GLIBCXX_MEM_FN_TRAITS(_REF, _LVAL, _RVAL) \ + _GLIBCXX_MEM_FN_TRAITS2( , _REF, _LVAL, _RVAL) \ + _GLIBCXX_MEM_FN_TRAITS2(const , _REF, _LVAL, _RVAL) \ + _GLIBCXX_MEM_FN_TRAITS2(volatile , _REF, _LVAL, _RVAL) \ + _GLIBCXX_MEM_FN_TRAITS2(const volatile, _REF, _LVAL, _RVAL) + +_GLIBCXX_MEM_FN_TRAITS( , true_type, true_type) +_GLIBCXX_MEM_FN_TRAITS(&, true_type, false_type) +_GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type) + +#if __cplusplus > 201402L +_GLIBCXX_MEM_FN_TRAITS(noexcept, true_type, true_type) +_GLIBCXX_MEM_FN_TRAITS(& noexcept, true_type, false_type) +_GLIBCXX_MEM_FN_TRAITS(&& noexcept, false_type, true_type) +#endif + +#undef _GLIBCXX_MEM_FN_TRAITS +#undef _GLIBCXX_MEM_FN_TRAITS2 + + /// If we have found a result_type, extract it. + template> + struct _Maybe_get_result_type + { }; + + template + struct _Maybe_get_result_type<_Functor, + __void_t> + { typedef typename _Functor::result_type result_type; }; + + /** + * Base class for any function object that has a weak result type, as + * defined in 20.8.2 [func.require] of C++11. + */ + template + struct _Weak_result_type_impl + : _Maybe_get_result_type<_Functor> + { }; + + /// Retrieve the result type for a function type. + template + struct _Weak_result_type_impl<_Res(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + /// Retrieve the result type for a varargs function type. + template + struct _Weak_result_type_impl<_Res(_ArgTypes..., + ...) _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + /// Retrieve the result type for a function pointer. + template + struct _Weak_result_type_impl<_Res(*)(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + /// Retrieve the result type for a varargs function pointer. + template + struct + _Weak_result_type_impl<_Res(*)(_ArgTypes..., ...) _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + // Let _Weak_result_type_impl perform the real work. + template::value> + struct _Weak_result_type_memfun + : _Weak_result_type_impl<_Functor> + { }; + + // A pointer to member function has a weak result type. + template + struct _Weak_result_type_memfun<_MemFunPtr, true> + { + using result_type = typename _Mem_fn_traits<_MemFunPtr>::__result_type; + }; + + // A pointer to data member doesn't have a weak result type. + template + struct _Weak_result_type_memfun<_Func _Class::*, false> + { }; + + /** + * Strip top-level cv-qualifiers from the function object and let + * _Weak_result_type_memfun perform the real work. + */ + template + struct _Weak_result_type + : _Weak_result_type_memfun::type> + { }; + +#if __cplusplus <= 201703L + // Detect nested argument_type. + template> + struct _Refwrap_base_arg1 + { }; + + // Nested argument_type. + template + struct _Refwrap_base_arg1<_Tp, + __void_t> + { + typedef typename _Tp::argument_type argument_type; + }; + + // Detect nested first_argument_type and second_argument_type. + template> + struct _Refwrap_base_arg2 + { }; + + // Nested first_argument_type and second_argument_type. + template + struct _Refwrap_base_arg2<_Tp, + __void_t> + { + typedef typename _Tp::first_argument_type first_argument_type; + typedef typename _Tp::second_argument_type second_argument_type; + }; + + /** + * Derives from unary_function or binary_function when it + * can. Specializations handle all of the easy cases. The primary + * template determines what to do with a class type, which may + * derive from both unary_function and binary_function. + */ + template + struct _Reference_wrapper_base + : _Weak_result_type<_Tp>, _Refwrap_base_arg1<_Tp>, _Refwrap_base_arg2<_Tp> + { }; + +// Ignore warnings about unary_function and binary_function. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + // - a function type (unary) + template + struct _Reference_wrapper_base<_Res(_T1) _GLIBCXX_NOEXCEPT_QUAL> + : unary_function<_T1, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1) const> + : unary_function<_T1, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1) volatile> + : unary_function<_T1, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1) const volatile> + : unary_function<_T1, _Res> + { }; + + // - a function type (binary) + template + struct _Reference_wrapper_base<_Res(_T1, _T2) _GLIBCXX_NOEXCEPT_QUAL> + : binary_function<_T1, _T2, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1, _T2) const> + : binary_function<_T1, _T2, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1, _T2) volatile> + : binary_function<_T1, _T2, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1, _T2) const volatile> + : binary_function<_T1, _T2, _Res> + { }; + + // - a function pointer type (unary) + template + struct _Reference_wrapper_base<_Res(*)(_T1) _GLIBCXX_NOEXCEPT_QUAL> + : unary_function<_T1, _Res> + { }; + + // - a function pointer type (binary) + template + struct _Reference_wrapper_base<_Res(*)(_T1, _T2) _GLIBCXX_NOEXCEPT_QUAL> + : binary_function<_T1, _T2, _Res> + { }; + + template::value> + struct _Reference_wrapper_base_memfun + : _Reference_wrapper_base<_Tp> + { }; + + template + struct _Reference_wrapper_base_memfun<_MemFunPtr, true> + : _Mem_fn_traits<_MemFunPtr>::__maybe_type + { + using result_type = typename _Mem_fn_traits<_MemFunPtr>::__result_type; + }; +#pragma GCC diagnostic pop +#endif // ! C++20 + + /// @endcond + + /** + * @brief Primary class template for reference_wrapper. + * @ingroup functors + */ + template + class reference_wrapper +#if __cplusplus <= 201703L + // In C++20 std::reference_wrapper allows T to be incomplete, + // so checking for nested types could result in ODR violations. + : public _Reference_wrapper_base_memfun::type> +#endif + { + _Tp* _M_data; + + _GLIBCXX20_CONSTEXPR + static _Tp* _S_fun(_Tp& __r) noexcept { return std::__addressof(__r); } + + static void _S_fun(_Tp&&) = delete; + + template> + using __not_same + = typename enable_if::value>::type; + + public: + typedef _Tp type; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2993. reference_wrapper conversion from T&& + // 3041. Unnecessary decay in reference_wrapper + template, typename + = decltype(reference_wrapper::_S_fun(std::declval<_Up>()))> + _GLIBCXX20_CONSTEXPR + reference_wrapper(_Up&& __uref) + noexcept(noexcept(reference_wrapper::_S_fun(std::declval<_Up>()))) + : _M_data(reference_wrapper::_S_fun(std::forward<_Up>(__uref))) + { } + + reference_wrapper(const reference_wrapper&) = default; + + reference_wrapper& + operator=(const reference_wrapper&) = default; + + _GLIBCXX20_CONSTEXPR + operator _Tp&() const noexcept + { return this->get(); } + + _GLIBCXX20_CONSTEXPR + _Tp& + get() const noexcept + { return *_M_data; } + + template + _GLIBCXX20_CONSTEXPR + typename __invoke_result<_Tp&, _Args...>::type + operator()(_Args&&... __args) const + noexcept(__is_nothrow_invocable<_Tp&, _Args...>::value) + { +#if __cplusplus > 201703L + if constexpr (is_object_v) + static_assert(sizeof(type), "type must be complete"); +#endif + return std::__invoke(get(), std::forward<_Args>(__args)...); + } + +#if __glibcxx_reference_wrapper >= 202403L // >= C++26 + // [refwrap.comparisons], comparisons + [[nodiscard]] + friend constexpr bool + operator==(reference_wrapper __x, reference_wrapper __y) + requires requires { { __x.get() == __y.get() } -> convertible_to; } + { return __x.get() == __y.get(); } + + [[nodiscard]] + friend constexpr bool + operator==(reference_wrapper __x, const _Tp& __y) + requires requires { { __x.get() == __y } -> convertible_to; } + { return __x.get() == __y; } + + [[nodiscard]] + friend constexpr bool + operator==(reference_wrapper __x, reference_wrapper __y) + requires (!is_const_v<_Tp>) + && requires { { __x.get() == __y.get() } -> convertible_to; } + { return __x.get() == __y.get(); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 4071. reference_wrapper comparisons are not SFINAE-friendly + + [[nodiscard]] + friend constexpr auto + operator<=>(reference_wrapper __x, reference_wrapper __y) + requires requires (const _Tp __t) { + { __t < __t } -> __detail::__boolean_testable; + } + { return __detail::__synth3way(__x.get(), __y.get()); } + + [[nodiscard]] + friend constexpr auto + operator<=>(reference_wrapper __x, const _Tp& __y) + requires requires { { __y < __y } -> __detail::__boolean_testable; } + { return __detail::__synth3way(__x.get(), __y); } + + [[nodiscard]] + friend constexpr auto + operator<=>(reference_wrapper __x, reference_wrapper __y) + requires (!is_const_v<_Tp>) && requires (const _Tp __t) { + { __t < __t } -> __detail::__boolean_testable; + } + { return __detail::__synth3way(__x.get(), __y.get()); } +#endif + }; + +#if __cpp_deduction_guides + template + reference_wrapper(_Tp&) -> reference_wrapper<_Tp>; +#endif + + /// @relates reference_wrapper @{ + + /// Denotes a reference should be taken to a variable. + template + _GLIBCXX20_CONSTEXPR + inline reference_wrapper<_Tp> + ref(_Tp& __t) noexcept + { return reference_wrapper<_Tp>(__t); } + + /// Denotes a const reference should be taken to a variable. + template + _GLIBCXX20_CONSTEXPR + inline reference_wrapper + cref(const _Tp& __t) noexcept + { return reference_wrapper(__t); } + + template + void ref(const _Tp&&) = delete; + + template + void cref(const _Tp&&) = delete; + + /// std::ref overload to prevent wrapping a reference_wrapper + template + _GLIBCXX20_CONSTEXPR + inline reference_wrapper<_Tp> + ref(reference_wrapper<_Tp> __t) noexcept + { return __t; } + + /// std::cref overload to prevent wrapping a reference_wrapper + template + _GLIBCXX20_CONSTEXPR + inline reference_wrapper + cref(reference_wrapper<_Tp> __t) noexcept + { return { __t.get() }; } + + /// @} + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_REFWRAP_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@refwrap.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@refwrap.h.blob new file mode 100644 index 0000000..15975b0 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@refwrap.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@requires_hosted.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@requires_hosted.h new file mode 100644 index 0000000..86916e2 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@requires_hosted.h @@ -0,0 +1,37 @@ +// Copyright The GNU Toolchain Authors. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/requires_hosted.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{version} + */ + +#ifndef _REQUIRES_FREESTANDING_H +#define _REQUIRES_FREESTANDING_H 1 + +#include + +#if !_GLIBCXX_HOSTED +# error "This header is not available in freestanding mode." +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@requires_hosted.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@requires_hosted.h.blob new file mode 100644 index 0000000..b67c3eb Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@requires_hosted.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr.h new file mode 100644 index 0000000..a196a0f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr.h @@ -0,0 +1,1195 @@ +// shared_ptr and weak_ptr implementation -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// GCC Note: Based on files from version 1.32.0 of the Boost library. + +// shared_count.hpp +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. + +// shared_ptr.hpp +// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes. +// Copyright (C) 2001, 2002, 2003 Peter Dimov + +// weak_ptr.hpp +// Copyright (C) 2001, 2002, 2003 Peter Dimov + +// enable_shared_from_this.hpp +// Copyright (C) 2002 Peter Dimov + +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +/** @file + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _SHARED_PTR_H +#define _SHARED_PTR_H 1 + +#include // std::basic_ostream +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup pointer_abstractions + * @{ + */ + + // 20.7.2.2.11 shared_ptr I/O + + /// Write the stored pointer to an ostream. + /// @relates shared_ptr + template + inline std::basic_ostream<_Ch, _Tr>& + operator<<(std::basic_ostream<_Ch, _Tr>& __os, + const __shared_ptr<_Tp, _Lp>& __p) + { + __os << __p.get(); + return __os; + } + + template + inline _Del* + get_deleter(const __shared_ptr<_Tp, _Lp>& __p) noexcept + { +#if __cpp_rtti + return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); +#else + return 0; +#endif + } + + /// 20.7.2.2.10 shared_ptr get_deleter + + /// If `__p` has a deleter of type `_Del`, return a pointer to it. + /// @relates shared_ptr + template + inline _Del* + get_deleter(const shared_ptr<_Tp>& __p) noexcept + { +#if __cpp_rtti + return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); +#else + return 0; +#endif + } + + /// @cond undocumented + + // Constraint for overloads taking non-array types. +#if __cpp_concepts && __glibcxx_type_trait_variable_templates + template + requires (!is_array_v<_Tp>) + using _NonArray = _Tp; +#else + template + using _NonArray = __enable_if_t::value, _Tp>; +#endif + +#if __glibcxx_shared_ptr_arrays >= 201707L + // Constraint for overloads taking array types with unknown bound, U[]. +#if __cpp_concepts + template + requires is_array_v<_Tp> && (extent_v<_Tp> == 0) + using _UnboundedArray = _Tp; +#else + template + using _UnboundedArray + = __enable_if_t<__is_array_unknown_bounds<_Tp>::value, _Tp>; +#endif + + // Constraint for overloads taking array types with known bound, U[N]. +#if __cpp_concepts + template + requires (extent_v<_Tp> != 0) + using _BoundedArray = _Tp; +#else + template + using _BoundedArray + = __enable_if_t<__is_array_known_bounds<_Tp>::value, _Tp>; +#endif + +#if __glibcxx_smart_ptr_for_overwrite + // Constraint for overloads taking either non-array or bounded array, U[N]. +#if __cpp_concepts + template + requires (!is_array_v<_Tp>) || (extent_v<_Tp> != 0) + using _NotUnboundedArray = _Tp; +#else + template + using _NotUnboundedArray + = __enable_if_t::value, _Tp>; +#endif +#endif // smart_ptr_for_overwrite +#endif // shared_ptr_arrays + + /// @endcond + + /** + * @brief A smart pointer with reference-counted copy semantics. + * @headerfile memory + * @since C++11 + * + * A `shared_ptr` object is either empty or _owns_ a pointer passed + * to the constructor. Copies of a `shared_ptr` share ownership of + * the same pointer. When the last `shared_ptr` that owns the pointer + * is destroyed or reset, the owned pointer is freed (either by `delete` + * or by invoking a custom deleter that was passed to the constructor). + * + * A `shared_ptr` also stores another pointer, which is usually + * (but not always) the same pointer as it owns. The stored pointer + * can be retrieved by calling the `get()` member function. + * + * The equality and relational operators for `shared_ptr` only compare + * the stored pointer returned by `get()`, not the owned pointer. + * To test whether two `shared_ptr` objects share ownership of the same + * pointer see `std::shared_ptr::owner_before` and `std::owner_less`. + */ + template + class shared_ptr : public __shared_ptr<_Tp> + { + template + using _Constructible = typename enable_if< + is_constructible<__shared_ptr<_Tp>, _Args...>::value + >::type; + + template + using _Assignable = typename enable_if< + is_assignable<__shared_ptr<_Tp>&, _Arg>::value, shared_ptr& + >::type; + + public: + + /// The type pointed to by the stored pointer, remove_extent_t<_Tp> + using element_type = typename __shared_ptr<_Tp>::element_type; + +#ifdef __glibcxx_shared_ptr_weak_type // C++ >= 17 && HOSTED + /// The corresponding weak_ptr type for this shared_ptr + /// @since C++17 + using weak_type = weak_ptr<_Tp>; +#endif + /** + * @brief Construct an empty %shared_ptr. + * @post use_count()==0 && get()==0 + */ + constexpr shared_ptr() noexcept : __shared_ptr<_Tp>() { } + + shared_ptr(const shared_ptr&) noexcept = default; ///< Copy constructor + + /** + * @brief Construct a %shared_ptr that owns the pointer @a __p. + * @param __p A pointer that is convertible to element_type*. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @c delete @a __p is called. + */ + template> + explicit + shared_ptr(_Yp* __p) : __shared_ptr<_Tp>(__p) { } + + /** + * @brief Construct a %shared_ptr that owns the pointer @a __p + * and the deleter @a __d. + * @param __p A pointer. + * @param __d A deleter. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @a __d(__p) is called. + * + * Requirements: _Deleter's copy constructor and destructor must + * not throw + * + * __shared_ptr will release __p by calling __d(__p) + */ + template> + shared_ptr(_Yp* __p, _Deleter __d) + : __shared_ptr<_Tp>(__p, std::move(__d)) { } + + /** + * @brief Construct a %shared_ptr that owns a null pointer + * and the deleter @a __d. + * @param __p A null pointer constant. + * @param __d A deleter. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @a __d(__p) is called. + * + * Requirements: _Deleter's copy constructor and destructor must + * not throw + * + * The last owner will call __d(__p) + */ + template + shared_ptr(nullptr_t __p, _Deleter __d) + : __shared_ptr<_Tp>(__p, std::move(__d)) { } + + /** + * @brief Construct a %shared_ptr that owns the pointer @a __p + * and the deleter @a __d. + * @param __p A pointer. + * @param __d A deleter. + * @param __a An allocator. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @a __d(__p) is called. + * + * Requirements: _Deleter's copy constructor and destructor must + * not throw _Alloc's copy constructor and destructor must not + * throw. + * + * __shared_ptr will release __p by calling __d(__p) + */ + template> + shared_ptr(_Yp* __p, _Deleter __d, _Alloc __a) + : __shared_ptr<_Tp>(__p, std::move(__d), std::move(__a)) { } + + /** + * @brief Construct a %shared_ptr that owns a null pointer + * and the deleter @a __d. + * @param __p A null pointer constant. + * @param __d A deleter. + * @param __a An allocator. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @a __d(__p) is called. + * + * Requirements: _Deleter's copy constructor and destructor must + * not throw _Alloc's copy constructor and destructor must not + * throw. + * + * The last owner will call __d(__p) + */ + template + shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a) + : __shared_ptr<_Tp>(__p, std::move(__d), std::move(__a)) { } + + // Aliasing constructor + + /** + * @brief Constructs a `shared_ptr` instance that stores `__p` + * and shares ownership with `__r`. + * @param __r A `shared_ptr`. + * @param __p A pointer that will remain valid while `*__r` is valid. + * @post `get() == __p && use_count() == __r.use_count()` + * + * This can be used to construct a `shared_ptr` to a sub-object + * of an object managed by an existing `shared_ptr`. The complete + * object will remain valid while any `shared_ptr` owns it, even + * if they don't store a pointer to the complete object. + * + * @code + * shared_ptr> pii(new pair()); + * shared_ptr pi(pii, &pii->first); + * assert(pii.use_count() == 2); + * @endcode + */ + template + shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) noexcept + : __shared_ptr<_Tp>(__r, __p) { } + +#if __cplusplus > 201703L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2996. Missing rvalue overloads for shared_ptr operations + /** + * @brief Constructs a `shared_ptr` instance that stores `__p` + * and shares ownership with `__r`. + * @param __r A `shared_ptr`. + * @param __p A pointer that will remain valid while `*__r` is valid. + * @post `get() == __p && !__r.use_count() && !__r.get()` + * @since C++17 + * + * This can be used to construct a `shared_ptr` to a sub-object + * of an object managed by an existing `shared_ptr`. The complete + * object will remain valid while any `shared_ptr` owns it, even + * if they don't store a pointer to the complete object. + * + * @code + * shared_ptr> pii(new pair()); + * shared_ptr pi1(pii, &pii->first); + * assert(pii.use_count() == 2); + * shared_ptr pi2(std::move(pii), &pii->second); + * assert(pii.use_count() == 0); + * @endcode + */ + template + shared_ptr(shared_ptr<_Yp>&& __r, element_type* __p) noexcept + : __shared_ptr<_Tp>(std::move(__r), __p) { } +#endif + /** + * @brief If @a __r is empty, constructs an empty %shared_ptr; + * otherwise construct a %shared_ptr that shares ownership + * with @a __r. + * @param __r A %shared_ptr. + * @post get() == __r.get() && use_count() == __r.use_count() + */ + template&>> + shared_ptr(const shared_ptr<_Yp>& __r) noexcept + : __shared_ptr<_Tp>(__r) { } + + /** + * @brief Move-constructs a %shared_ptr instance from @a __r. + * @param __r A %shared_ptr rvalue. + * @post *this contains the old value of @a __r, @a __r is empty. + */ + shared_ptr(shared_ptr&& __r) noexcept + : __shared_ptr<_Tp>(std::move(__r)) { } + + /** + * @brief Move-constructs a %shared_ptr instance from @a __r. + * @param __r A %shared_ptr rvalue. + * @post *this contains the old value of @a __r, @a __r is empty. + */ + template>> + shared_ptr(shared_ptr<_Yp>&& __r) noexcept + : __shared_ptr<_Tp>(std::move(__r)) { } + + /** + * @brief Constructs a %shared_ptr that shares ownership with @a __r + * and stores a copy of the pointer stored in @a __r. + * @param __r A weak_ptr. + * @post use_count() == __r.use_count() + * @throw bad_weak_ptr when __r.expired(), + * in which case the constructor has no effect. + */ + template&>> + explicit shared_ptr(const weak_ptr<_Yp>& __r) + : __shared_ptr<_Tp>(__r) { } + +#if _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + template>> + shared_ptr(auto_ptr<_Yp>&& __r); +#pragma GCC diagnostic pop +#endif + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2399. shared_ptr's constructor from unique_ptr should be constrained + template>> + shared_ptr(unique_ptr<_Yp, _Del>&& __r) + : __shared_ptr<_Tp>(std::move(__r)) { } + +#if __cplusplus <= 201402L && _GLIBCXX_USE_DEPRECATED + // This non-standard constructor exists to support conversions that + // were possible in C++11 and C++14 but are ill-formed in C++17. + // If an exception is thrown this constructor has no effect. + template, __sp_array_delete>* = 0> + shared_ptr(unique_ptr<_Yp, _Del>&& __r) + : __shared_ptr<_Tp>(std::move(__r), __sp_array_delete()) { } +#endif + + /** + * @brief Construct an empty %shared_ptr. + * @post use_count() == 0 && get() == nullptr + */ + constexpr shared_ptr(nullptr_t) noexcept : shared_ptr() { } + + shared_ptr& operator=(const shared_ptr&) noexcept = default; + + template + _Assignable&> + operator=(const shared_ptr<_Yp>& __r) noexcept + { + this->__shared_ptr<_Tp>::operator=(__r); + return *this; + } + +#if _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + template + _Assignable> + operator=(auto_ptr<_Yp>&& __r) + { + this->__shared_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } +#pragma GCC diagnostic pop +#endif + + shared_ptr& + operator=(shared_ptr&& __r) noexcept + { + this->__shared_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } + + template + _Assignable> + operator=(shared_ptr<_Yp>&& __r) noexcept + { + this->__shared_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } + + template + _Assignable> + operator=(unique_ptr<_Yp, _Del>&& __r) + { + this->__shared_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } + + private: + // This constructor is non-standard, it is used by allocate_shared. + template + shared_ptr(_Sp_alloc_shared_tag<_Alloc> __tag, _Args&&... __args) + : __shared_ptr<_Tp>(__tag, std::forward<_Args>(__args)...) + { } + + template + friend shared_ptr<_NonArray<_Yp>> + allocate_shared(const _Alloc&, _Args&&...); + + template + friend shared_ptr<_NonArray<_Yp>> + make_shared(_Args&&...); + +#if __glibcxx_shared_ptr_arrays >= 201707L + // This constructor is non-standard, it is used by allocate_shared. + template*> + shared_ptr(const _Sp_counted_array_base<_Alloc>& __a, + _Init __init = nullptr) + : __shared_ptr<_Tp>(__a, __init) + { } + + template + friend shared_ptr<_UnboundedArray<_Yp>> + allocate_shared(const _Alloc&, size_t); + + template + friend shared_ptr<_UnboundedArray<_Yp>> + make_shared(size_t); + + template + friend shared_ptr<_UnboundedArray<_Yp>> + allocate_shared(const _Alloc&, size_t, const remove_extent_t<_Yp>&); + + template + friend shared_ptr<_UnboundedArray<_Yp>> + make_shared(size_t, const remove_extent_t<_Yp>&); + + template + friend shared_ptr<_BoundedArray<_Yp>> + allocate_shared(const _Alloc&); + + template + friend shared_ptr<_BoundedArray<_Yp>> + make_shared(); + + template + friend shared_ptr<_BoundedArray<_Yp>> + allocate_shared(const _Alloc&, const remove_extent_t<_Yp>&); + + template + friend shared_ptr<_BoundedArray<_Yp>> + make_shared(const remove_extent_t<_Yp>&); + +#if __glibcxx_smart_ptr_for_overwrite + template + friend shared_ptr<_NotUnboundedArray<_Yp>> + allocate_shared_for_overwrite(const _Alloc&); + + template + friend shared_ptr<_NotUnboundedArray<_Yp>> + make_shared_for_overwrite(); + + template + friend shared_ptr<_UnboundedArray<_Yp>> + allocate_shared_for_overwrite(const _Alloc&, size_t); + + template + friend shared_ptr<_UnboundedArray<_Yp>> + make_shared_for_overwrite(size_t); +#endif +#endif + + // This constructor is non-standard, it is used by weak_ptr::lock(). + shared_ptr(const weak_ptr<_Tp>& __r, std::nothrow_t) noexcept + : __shared_ptr<_Tp>(__r, std::nothrow) { } + + friend class weak_ptr<_Tp>; + }; + +#if __cpp_deduction_guides >= 201606 + template + shared_ptr(weak_ptr<_Tp>) -> shared_ptr<_Tp>; + template + shared_ptr(unique_ptr<_Tp, _Del>) -> shared_ptr<_Tp>; +#endif + + // 20.7.2.2.7 shared_ptr comparisons + + /// @relates shared_ptr @{ + + /// Equality operator for shared_ptr objects, compares the stored pointers + template + _GLIBCXX_NODISCARD inline bool + operator==(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return __a.get() == __b.get(); } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator==(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return !__a; } + +#ifdef __cpp_lib_three_way_comparison + template + inline strong_ordering + operator<=>(const shared_ptr<_Tp>& __a, + const shared_ptr<_Up>& __b) noexcept + { return compare_three_way()(__a.get(), __b.get()); } + + template + inline strong_ordering + operator<=>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { + using pointer = typename shared_ptr<_Tp>::element_type*; + return compare_three_way()(__a.get(), static_cast(nullptr)); + } +#else + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator==(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return !__a; } + + /// Inequality operator for shared_ptr objects, compares the stored pointers + template + _GLIBCXX_NODISCARD inline bool + operator!=(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return __a.get() != __b.get(); } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator!=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return (bool)__a; } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator!=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return (bool)__a; } + + /// Relational operator for shared_ptr objects, compares the stored pointers + template + _GLIBCXX_NODISCARD inline bool + operator<(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { + using _Tp_elt = typename shared_ptr<_Tp>::element_type; + using _Up_elt = typename shared_ptr<_Up>::element_type; + using _Vp = typename common_type<_Tp_elt*, _Up_elt*>::type; + return less<_Vp>()(__a.get(), __b.get()); + } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { + using _Tp_elt = typename shared_ptr<_Tp>::element_type; + return less<_Tp_elt*>()(__a.get(), nullptr); + } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { + using _Tp_elt = typename shared_ptr<_Tp>::element_type; + return less<_Tp_elt*>()(nullptr, __a.get()); + } + + /// Relational operator for shared_ptr objects, compares the stored pointers + template + _GLIBCXX_NODISCARD inline bool + operator<=(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return !(__b < __a); } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator<=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return !(nullptr < __a); } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator<=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return !(__a < nullptr); } + + /// Relational operator for shared_ptr objects, compares the stored pointers + template + _GLIBCXX_NODISCARD inline bool + operator>(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return (__b < __a); } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return nullptr < __a; } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator>(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return __a < nullptr; } + + /// Relational operator for shared_ptr objects, compares the stored pointers + template + _GLIBCXX_NODISCARD inline bool + operator>=(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return !(__a < __b); } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator>=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return !(__a < nullptr); } + + /// shared_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator>=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return !(nullptr < __a); } +#endif + + // 20.7.2.2.8 shared_ptr specialized algorithms. + + /// Swap overload for shared_ptr + template + inline void + swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) noexcept + { __a.swap(__b); } + + // 20.7.2.2.9 shared_ptr casts. + + /// Convert type of `shared_ptr`, via `static_cast` + template + inline shared_ptr<_Tp> + static_pointer_cast(const shared_ptr<_Up>& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + return _Sp(__r, static_cast(__r.get())); + } + + /// Convert type of `shared_ptr`, via `const_cast` + template + inline shared_ptr<_Tp> + const_pointer_cast(const shared_ptr<_Up>& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + return _Sp(__r, const_cast(__r.get())); + } + + /// Convert type of `shared_ptr`, via `dynamic_cast` + template + inline shared_ptr<_Tp> + dynamic_pointer_cast(const shared_ptr<_Up>& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + if (auto* __p = dynamic_cast(__r.get())) + return _Sp(__r, __p); + return _Sp(); + } + +#if __cplusplus >= 201703L + /// Convert type of `shared_ptr`, via `reinterpret_cast` + /// @since C++17 + template + inline shared_ptr<_Tp> + reinterpret_pointer_cast(const shared_ptr<_Up>& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + return _Sp(__r, reinterpret_cast(__r.get())); + } + +#if __cplusplus > 201703L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2996. Missing rvalue overloads for shared_ptr operations + + /// Convert type of `shared_ptr` rvalue, via `static_cast` + /// @since C++20 + template + inline shared_ptr<_Tp> + static_pointer_cast(shared_ptr<_Up>&& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + return _Sp(std::move(__r), + static_cast(__r.get())); + } + + /// Convert type of `shared_ptr` rvalue, via `const_cast` + /// @since C++20 + template + inline shared_ptr<_Tp> + const_pointer_cast(shared_ptr<_Up>&& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + return _Sp(std::move(__r), + const_cast(__r.get())); + } + + /// Convert type of `shared_ptr` rvalue, via `dynamic_cast` + /// @since C++20 + template + inline shared_ptr<_Tp> + dynamic_pointer_cast(shared_ptr<_Up>&& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + if (auto* __p = dynamic_cast(__r.get())) + return _Sp(std::move(__r), __p); + return _Sp(); + } + + /// Convert type of `shared_ptr` rvalue, via `reinterpret_cast` + /// @since C++20 + template + inline shared_ptr<_Tp> + reinterpret_pointer_cast(shared_ptr<_Up>&& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + return _Sp(std::move(__r), + reinterpret_cast(__r.get())); + } +#endif // C++20 +#endif // C++17 + + /// @} + + /** + * @brief A non-owning observer for a pointer owned by a shared_ptr + * @headerfile memory + * @since C++11 + * + * A weak_ptr provides a safe alternative to a raw pointer when you want + * a non-owning reference to an object that is managed by a shared_ptr. + * + * Unlike a raw pointer, a weak_ptr can be converted to a new shared_ptr + * that shares ownership with every other shared_ptr that already owns + * the pointer. In other words you can upgrade from a non-owning "weak" + * reference to an owning shared_ptr, without having access to any of + * the existing shared_ptr objects. + * + * Also unlike a raw pointer, a weak_ptr does not become "dangling" after + * the object it points to has been destroyed. Instead, a weak_ptr + * becomes _expired_ and can no longer be converted to a shared_ptr that + * owns the freed pointer, so you cannot accidentally access the pointed-to + * object after it has been destroyed. + */ + template + class weak_ptr : public __weak_ptr<_Tp> + { + template + using _Constructible = typename enable_if< + is_constructible<__weak_ptr<_Tp>, _Arg>::value + >::type; + + template + using _Assignable = typename enable_if< + is_assignable<__weak_ptr<_Tp>&, _Arg>::value, weak_ptr& + >::type; + + public: + constexpr weak_ptr() noexcept = default; + + template&>> + weak_ptr(const shared_ptr<_Yp>& __r) noexcept + : __weak_ptr<_Tp>(__r) { } + + weak_ptr(const weak_ptr&) noexcept = default; + + template&>> + weak_ptr(const weak_ptr<_Yp>& __r) noexcept + : __weak_ptr<_Tp>(__r) { } + + weak_ptr(weak_ptr&&) noexcept = default; + + template>> + weak_ptr(weak_ptr<_Yp>&& __r) noexcept + : __weak_ptr<_Tp>(std::move(__r)) { } + + weak_ptr& + operator=(const weak_ptr& __r) noexcept = default; + + template + _Assignable&> + operator=(const weak_ptr<_Yp>& __r) noexcept + { + this->__weak_ptr<_Tp>::operator=(__r); + return *this; + } + + template + _Assignable&> + operator=(const shared_ptr<_Yp>& __r) noexcept + { + this->__weak_ptr<_Tp>::operator=(__r); + return *this; + } + + weak_ptr& + operator=(weak_ptr&& __r) noexcept = default; + + template + _Assignable> + operator=(weak_ptr<_Yp>&& __r) noexcept + { + this->__weak_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } + + shared_ptr<_Tp> + lock() const noexcept + { return shared_ptr<_Tp>(*this, std::nothrow); } + }; + +#if __cpp_deduction_guides >= 201606 + template + weak_ptr(shared_ptr<_Tp>) -> weak_ptr<_Tp>; +#endif + + // 20.7.2.3.6 weak_ptr specialized algorithms. + /// Swap overload for weak_ptr + /// @relates weak_ptr + template + inline void + swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b) noexcept + { __a.swap(__b); } + + + /// Primary template owner_less + template + struct owner_less; + + /// Void specialization of owner_less compares either shared_ptr or weak_ptr + template<> + struct owner_less : _Sp_owner_less + { }; + + /// Partial specialization of owner_less for shared_ptr. + template + struct owner_less> + : public _Sp_owner_less, weak_ptr<_Tp>> + { }; + + /// Partial specialization of owner_less for weak_ptr. + template + struct owner_less> + : public _Sp_owner_less, shared_ptr<_Tp>> + { }; + + /** + * @brief Base class allowing use of the member function `shared_from_this`. + * @headerfile memory + * @since C++11 + */ + template + class enable_shared_from_this + { + protected: + constexpr enable_shared_from_this() noexcept { } + + enable_shared_from_this(const enable_shared_from_this&) noexcept { } + + enable_shared_from_this& + operator=(const enable_shared_from_this&) noexcept + { return *this; } + + ~enable_shared_from_this() { } + + public: + shared_ptr<_Tp> + shared_from_this() + { return shared_ptr<_Tp>(this->_M_weak_this); } + + shared_ptr + shared_from_this() const + { return shared_ptr(this->_M_weak_this); } + +#ifdef __glibcxx_enable_shared_from_this // C++ >= 17 && HOSTED + /** @{ + * Get a `weak_ptr` referring to the object that has `*this` as its base. + * @since C++17 + */ + weak_ptr<_Tp> + weak_from_this() noexcept + { return this->_M_weak_this; } + + weak_ptr + weak_from_this() const noexcept + { return this->_M_weak_this; } + /// @} +#endif + + private: + template + void + _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const noexcept + { _M_weak_this._M_assign(__p, __n); } + + // Found by ADL when this is an associated class. + friend const enable_shared_from_this* + __enable_shared_from_this_base(const __shared_count<>&, + const enable_shared_from_this* __p) + { return __p; } + + template + friend class __shared_ptr; + + mutable weak_ptr<_Tp> _M_weak_this; + }; + + /// @relates shared_ptr @{ + + /** + * @brief Create an object that is owned by a shared_ptr. + * @param __a An allocator. + * @param __args Arguments for the @a _Tp object's constructor. + * @return A shared_ptr that owns the newly created object. + * @throw An exception thrown from @a _Alloc::allocate or from the + * constructor of @a _Tp. + * + * A copy of @a __a will be used to allocate memory for the shared_ptr + * and the new object. + */ + template + inline shared_ptr<_NonArray<_Tp>> + allocate_shared(const _Alloc& __a, _Args&&... __args) + { + return shared_ptr<_Tp>(_Sp_alloc_shared_tag<_Alloc>{__a}, + std::forward<_Args>(__args)...); + } + + /** + * @brief Create an object that is owned by a shared_ptr. + * @param __args Arguments for the @a _Tp object's constructor. + * @return A shared_ptr that owns the newly created object. + * @throw std::bad_alloc, or an exception thrown from the + * constructor of @a _Tp. + */ + template + inline shared_ptr<_NonArray<_Tp>> + make_shared(_Args&&... __args) + { + using _Alloc = allocator; + _Alloc __a; + return shared_ptr<_Tp>(_Sp_alloc_shared_tag<_Alloc>{__a}, + std::forward<_Args>(__args)...); + } + +#if __glibcxx_shared_ptr_arrays >= 201707L + /// @cond undocumented + template> + auto + __make_shared_arr_tag(size_t __n, const _Alloc& __a = _Alloc()) noexcept + { + using _Up = remove_all_extents_t<_Tp>; + using _UpAlloc = __alloc_rebind<_Alloc, _Up>; + size_t __s = sizeof(remove_extent_t<_Tp>) / sizeof(_Up); + if (__builtin_mul_overflow(__s, __n, &__n)) + std::__throw_bad_array_new_length(); + return _Sp_counted_array_base<_UpAlloc>{_UpAlloc(__a), __n}; + } + /// @endcond + + template + inline shared_ptr<_UnboundedArray<_Tp>> + allocate_shared(const _Alloc& __a, size_t __n) + { + return shared_ptr<_Tp>(std::__make_shared_arr_tag<_Tp>(__n, __a)); + } + + template + inline shared_ptr<_UnboundedArray<_Tp>> + make_shared(size_t __n) + { + return shared_ptr<_Tp>(std::__make_shared_arr_tag<_Tp>(__n)); + } + + template + inline shared_ptr<_UnboundedArray<_Tp>> + allocate_shared(const _Alloc& __a, size_t __n, + const remove_extent_t<_Tp>& __u) + { + return shared_ptr<_Tp>(std::__make_shared_arr_tag<_Tp>(__n, __a), + std::__addressof(__u)); + } + + template + inline shared_ptr<_UnboundedArray<_Tp>> + make_shared(size_t __n, const remove_extent_t<_Tp>& __u) + { + return shared_ptr<_Tp>(std::__make_shared_arr_tag<_Tp>(__n), + std::__addressof(__u)); + } + + /// @cond undocumented + template> + auto + __make_shared_arrN_tag(const _Alloc& __a = _Alloc()) noexcept + { + using _Up = remove_all_extents_t<_Tp>; + using _UpAlloc = __alloc_rebind<_Alloc, _Up>; + size_t __n = sizeof(_Tp) / sizeof(_Up); + return _Sp_counted_array_base<_UpAlloc>{_UpAlloc(__a), __n}; + } + /// @endcond + + template + inline shared_ptr<_BoundedArray<_Tp>> + allocate_shared(const _Alloc& __a) + { + return shared_ptr<_Tp>(std::__make_shared_arrN_tag<_Tp>(__a)); + } + + template + inline shared_ptr<_BoundedArray<_Tp>> + make_shared() + { + return shared_ptr<_Tp>(std::__make_shared_arrN_tag<_Tp>()); + } + + template + inline shared_ptr<_BoundedArray<_Tp>> + allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& __u) + { + return shared_ptr<_Tp>(std::__make_shared_arrN_tag<_Tp>(__a), + std::__addressof(__u)); + } + + template + inline shared_ptr<_BoundedArray<_Tp>> + make_shared(const remove_extent_t<_Tp>& __u) + { + return shared_ptr<_Tp>(std::__make_shared_arrN_tag<_Tp>(), + std::__addressof(__u)); + } + +#if __glibcxx_smart_ptr_for_overwrite + template + inline shared_ptr<_NotUnboundedArray<_Tp>> + allocate_shared_for_overwrite(const _Alloc& __a) + { + if constexpr (is_array_v<_Tp>) + return shared_ptr<_Tp>(std::__make_shared_arrN_tag<_Tp>(__a), + _Sp_overwrite_tag{}); + else + { + // Rebind the allocator to _Sp_overwrite_tag, so that the + // relevant _Sp_counted_ptr_inplace specialization is used. + using _Alloc2 = __alloc_rebind<_Alloc, _Sp_overwrite_tag>; + _Alloc2 __a2 = __a; + return shared_ptr<_Tp>(_Sp_alloc_shared_tag<_Alloc2>{__a2}); + } + } + + template + inline shared_ptr<_NotUnboundedArray<_Tp>> + make_shared_for_overwrite() + { + if constexpr (is_array_v<_Tp>) + return shared_ptr<_Tp>(std::__make_shared_arrN_tag<_Tp>(), + _Sp_overwrite_tag{}); + else + { + using _Alloc = allocator<_Sp_overwrite_tag>; + return shared_ptr<_Tp>(_Sp_alloc_shared_tag<_Alloc>{{}}); + } + } + + template + inline shared_ptr<_UnboundedArray<_Tp>> + allocate_shared_for_overwrite(const _Alloc& __a, size_t __n) + { + return shared_ptr<_Tp>(std::__make_shared_arr_tag<_Tp>(__n, __a), + _Sp_overwrite_tag{}); + } + + template + inline shared_ptr<_UnboundedArray<_Tp>> + make_shared_for_overwrite(size_t __n) + { + return shared_ptr<_Tp>(std::__make_shared_arr_tag<_Tp>(__n), + _Sp_overwrite_tag{}); + } +#endif // smart_ptr_for_overwrite +#endif // shared_ptr_arrays + + /// std::hash specialization for shared_ptr. + template + struct hash> + : public __hash_base> + { + size_t + operator()(const shared_ptr<_Tp>& __s) const noexcept + { + return std::hash::element_type*>()(__s.get()); + } + }; + +#if __cpp_variable_templates + template + constexpr bool __is_shared_ptr = false; + template + constexpr bool __is_shared_ptr> = true; +#endif + + /// @} relates shared_ptr + /// @} group pointer_abstractions + +#if __cplusplus >= 201703L + namespace __detail::__variant + { + template struct _Never_valueless_alt; // see + + // Provide the strong exception-safety guarantee when emplacing a + // shared_ptr into a variant. + template + struct _Never_valueless_alt> + : std::true_type + { }; + + // Provide the strong exception-safety guarantee when emplacing a + // weak_ptr into a variant. + template + struct _Never_valueless_alt> + : std::true_type + { }; + } // namespace __detail::__variant +#endif // C++17 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // _SHARED_PTR_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr.h.blob new file mode 100644 index 0000000..6453dc1 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr_base.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr_base.h new file mode 100644 index 0000000..3622e02 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr_base.h @@ -0,0 +1,2268 @@ +// shared_ptr and weak_ptr implementation details -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// GCC Note: Based on files from version 1.32.0 of the Boost library. + +// shared_count.hpp +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. + +// shared_ptr.hpp +// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes. +// Copyright (C) 2001, 2002, 2003 Peter Dimov + +// weak_ptr.hpp +// Copyright (C) 2001, 2002, 2003 Peter Dimov + +// enable_shared_from_this.hpp +// Copyright (C) 2002 Peter Dimov + +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +/** @file bits/shared_ptr_base.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _SHARED_PTR_BASE_H +#define _SHARED_PTR_BASE_H 1 + +#include +#include +#include +#include +#include +#include +#include // std::less +#include +#include +#include +#include +#if __cplusplus >= 202002L +# include +# include // std::align +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + template class auto_ptr; +#pragma GCC diagnostic pop +#endif + + /** + * @brief Exception possibly thrown by @c shared_ptr. + * @ingroup exceptions + */ + class bad_weak_ptr : public std::exception + { + public: + virtual char const* what() const noexcept; + + virtual ~bad_weak_ptr() noexcept; + }; + + // Substitute for bad_weak_ptr object in the case of -fno-exceptions. + inline void + __throw_bad_weak_ptr() + { _GLIBCXX_THROW_OR_ABORT(bad_weak_ptr()); } + + using __gnu_cxx::_Lock_policy; + using __gnu_cxx::__default_lock_policy; + using __gnu_cxx::_S_single; + using __gnu_cxx::_S_mutex; + using __gnu_cxx::_S_atomic; + + // Empty helper class except when the template argument is _S_mutex. + template<_Lock_policy _Lp> + class _Mutex_base + { + protected: + // The atomic policy uses fully-fenced builtins, single doesn't care. + enum { _S_need_barriers = 0 }; + }; + + template<> + class _Mutex_base<_S_mutex> + : public __gnu_cxx::__mutex + { + protected: + // This policy is used when atomic builtins are not available. + // The replacement atomic operations might not have the necessary + // memory barriers. + enum { _S_need_barriers = 1 }; + }; + + template<_Lock_policy _Lp = __default_lock_policy> + class _Sp_counted_base + : public _Mutex_base<_Lp> + { + public: + _Sp_counted_base() noexcept + : _M_use_count(1), _M_weak_count(1) { } + + virtual + ~_Sp_counted_base() noexcept + { } + + // Called when _M_use_count drops to zero, to release the resources + // managed by *this. + virtual void + _M_dispose() noexcept = 0; + + // Called when _M_weak_count drops to zero. + virtual void + _M_destroy() noexcept + { delete this; } + + virtual void* + _M_get_deleter(const std::type_info&) noexcept = 0; + + // Increment the use count (used when the count is greater than zero). + void + _M_add_ref_copy() + { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); } + + // Increment the use count if it is non-zero, throw otherwise. + void + _M_add_ref_lock() + { + if (!_M_add_ref_lock_nothrow()) + __throw_bad_weak_ptr(); + } + + // Increment the use count if it is non-zero. + bool + _M_add_ref_lock_nothrow() noexcept; + + // Decrement the use count. + void + _M_release() noexcept; + + // Called by _M_release() when the use count reaches zero. + void + _M_release_last_use() noexcept + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count); + _M_dispose(); + // There must be a memory barrier between dispose() and destroy() + // to ensure that the effects of dispose() are observed in the + // thread that runs destroy(). + // See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html + if (_Mutex_base<_Lp>::_S_need_barriers) + { + __atomic_thread_fence (__ATOMIC_ACQ_REL); + } + + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, + -1) == 1) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); + _M_destroy(); + } + } + + // As above, but 'noinline' to reduce code size on the cold path. + __attribute__((__noinline__)) + void + _M_release_last_use_cold() noexcept + { _M_release_last_use(); } + + // Increment the weak count. + void + _M_weak_add_ref() noexcept + { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); } + + // Decrement the weak count. + void + _M_weak_release() noexcept + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); + if (_Mutex_base<_Lp>::_S_need_barriers) + { + // See _M_release(), + // destroy() must observe results of dispose() + __atomic_thread_fence (__ATOMIC_ACQ_REL); + } + _M_destroy(); + } + } + + long + _M_get_use_count() const noexcept + { + // No memory barrier is used here so there is no synchronization + // with other threads. + return __atomic_load_n(&_M_use_count, __ATOMIC_RELAXED); + } + + private: + _Sp_counted_base(_Sp_counted_base const&) = delete; + _Sp_counted_base& operator=(_Sp_counted_base const&) = delete; + + _Atomic_word _M_use_count; // #shared + _Atomic_word _M_weak_count; // #weak + (#shared != 0) + }; + + template<> + inline bool + _Sp_counted_base<_S_single>:: + _M_add_ref_lock_nothrow() noexcept + { + if (_M_use_count == 0) + return false; + ++_M_use_count; + return true; + } + + template<> + inline bool + _Sp_counted_base<_S_mutex>:: + _M_add_ref_lock_nothrow() noexcept + { + __gnu_cxx::__scoped_lock sentry(*this); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) + { + _M_use_count = 0; + return false; + } + return true; + } + + template<> + inline bool + _Sp_counted_base<_S_atomic>:: + _M_add_ref_lock_nothrow() noexcept + { + // Perform lock-free add-if-not-zero operation. + _Atomic_word __count = _M_get_use_count(); + do + { + if (__count == 0) + return false; + // Replace the current counter value with the old value + 1, as + // long as it's not changed meanwhile. + } + while (!__atomic_compare_exchange_n(&_M_use_count, &__count, __count + 1, + true, __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED)); + return true; + } + + template<> + inline void + _Sp_counted_base<_S_single>::_M_add_ref_copy() + { ++_M_use_count; } + + template<> + inline void + _Sp_counted_base<_S_single>::_M_release() noexcept + { + if (--_M_use_count == 0) + { + _M_dispose(); + if (--_M_weak_count == 0) + _M_destroy(); + } + } + + template<> + inline void + _Sp_counted_base<_S_mutex>::_M_release() noexcept + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1) + { + _M_release_last_use(); + } + } + + template<> + inline void + _Sp_counted_base<_S_atomic>::_M_release() noexcept + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count); +#if ! _GLIBCXX_TSAN + constexpr bool __lock_free + = __atomic_always_lock_free(sizeof(long long), 0) + && __atomic_always_lock_free(sizeof(_Atomic_word), 0); + constexpr bool __double_word + = sizeof(long long) == 2 * sizeof(_Atomic_word); + // The ref-count members follow the vptr, so are aligned to + // alignof(void*). + constexpr bool __aligned = __alignof(long long) <= alignof(void*); + if _GLIBCXX17_CONSTEXPR (__lock_free && __double_word && __aligned) + { + constexpr int __wordbits = __CHAR_BIT__ * sizeof(_Atomic_word); + constexpr int __shiftbits = __double_word ? __wordbits : 0; + constexpr long long __unique_ref = 1LL + (1LL << __shiftbits); + auto __both_counts = reinterpret_cast(&_M_use_count); + + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); + if (__atomic_load_n(__both_counts, __ATOMIC_ACQUIRE) == __unique_ref) + { + // Both counts are 1, so there are no weak references and + // we are releasing the last strong reference. No other + // threads can observe the effects of this _M_release() + // call (e.g. calling use_count()) without a data race. + _M_weak_count = _M_use_count = 0; + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count); + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); + _M_dispose(); + _M_destroy(); + return; + } + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1) + [[__unlikely__]] + { + _M_release_last_use_cold(); + return; + } + } + else +#endif + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1) + { + _M_release_last_use(); + } + } + + template<> + inline void + _Sp_counted_base<_S_single>::_M_weak_add_ref() noexcept + { ++_M_weak_count; } + + template<> + inline void + _Sp_counted_base<_S_single>::_M_weak_release() noexcept + { + if (--_M_weak_count == 0) + _M_destroy(); + } + + template<> + inline long + _Sp_counted_base<_S_single>::_M_get_use_count() const noexcept + { return _M_use_count; } + + + // Forward declarations. + template + class __shared_ptr; + + template + class __weak_ptr; + + template + class __enable_shared_from_this; + + template + class shared_ptr; + + template + class weak_ptr; + + template + struct owner_less; + + template + class enable_shared_from_this; + + template<_Lock_policy _Lp = __default_lock_policy> + class __weak_count; + + template<_Lock_policy _Lp = __default_lock_policy> + class __shared_count; + +#ifdef __glibcxx_atomic_shared_ptr + template + class _Sp_atomic; +#endif + + // Counted ptr with no deleter or allocator support + template + class _Sp_counted_ptr final : public _Sp_counted_base<_Lp> + { + public: + explicit + _Sp_counted_ptr(_Ptr __p) noexcept + : _M_ptr(__p) { } + + virtual void + _M_dispose() noexcept + { delete _M_ptr; } + + virtual void + _M_destroy() noexcept + { delete this; } + + virtual void* + _M_get_deleter(const std::type_info&) noexcept + { return nullptr; } + + _Sp_counted_ptr(const _Sp_counted_ptr&) = delete; + _Sp_counted_ptr& operator=(const _Sp_counted_ptr&) = delete; + + private: + _Ptr _M_ptr; + }; + + template<> + inline void + _Sp_counted_ptr::_M_dispose() noexcept { } + + template<> + inline void + _Sp_counted_ptr::_M_dispose() noexcept { } + + template<> + inline void + _Sp_counted_ptr::_M_dispose() noexcept { } + + // FIXME: once __has_cpp_attribute(__no_unique_address__)) is true for + // all supported compilers we can greatly simplify _Sp_ebo_helper. + // N.B. unconditionally applying the attribute could change layout for + // final types, which currently cannot use EBO so have a unique address. + + template + struct _Sp_ebo_helper; + + /// Specialization using EBO. + template + struct _Sp_ebo_helper<_Nm, _Tp, true> : private _Tp + { + explicit _Sp_ebo_helper(const _Tp& __tp) : _Tp(__tp) { } + explicit _Sp_ebo_helper(_Tp&& __tp) : _Tp(std::move(__tp)) { } + + static _Tp& + _S_get(_Sp_ebo_helper& __eboh) { return static_cast<_Tp&>(__eboh); } + }; + + /// Specialization not using EBO. + template + struct _Sp_ebo_helper<_Nm, _Tp, false> + { + explicit _Sp_ebo_helper(const _Tp& __tp) : _M_tp(__tp) { } + explicit _Sp_ebo_helper(_Tp&& __tp) : _M_tp(std::move(__tp)) { } + + static _Tp& + _S_get(_Sp_ebo_helper& __eboh) + { return __eboh._M_tp; } + + private: + _Tp _M_tp; + }; + + // Support for custom deleter and/or allocator + template + class _Sp_counted_deleter final : public _Sp_counted_base<_Lp> + { + class _Impl : _Sp_ebo_helper<0, _Deleter>, _Sp_ebo_helper<1, _Alloc> + { + typedef _Sp_ebo_helper<0, _Deleter> _Del_base; + typedef _Sp_ebo_helper<1, _Alloc> _Alloc_base; + + public: + _Impl(_Ptr __p, _Deleter __d, const _Alloc& __a) noexcept + : _Del_base(std::move(__d)), _Alloc_base(__a), _M_ptr(__p) + { } + + _Deleter& _M_del() noexcept { return _Del_base::_S_get(*this); } + _Alloc& _M_alloc() noexcept { return _Alloc_base::_S_get(*this); } + + _Ptr _M_ptr; + }; + + public: + using __allocator_type = __alloc_rebind<_Alloc, _Sp_counted_deleter>; + + // __d(__p) must not throw. + _Sp_counted_deleter(_Ptr __p, _Deleter __d) noexcept + : _M_impl(__p, std::move(__d), _Alloc()) { } + + // __d(__p) must not throw. + _Sp_counted_deleter(_Ptr __p, _Deleter __d, const _Alloc& __a) noexcept + : _M_impl(__p, std::move(__d), __a) { } + + ~_Sp_counted_deleter() noexcept { } + + virtual void + _M_dispose() noexcept + { _M_impl._M_del()(_M_impl._M_ptr); } + + virtual void + _M_destroy() noexcept + { + __allocator_type __a(_M_impl._M_alloc()); + __allocated_ptr<__allocator_type> __guard_ptr{ __a, this }; + this->~_Sp_counted_deleter(); + } + + virtual void* + _M_get_deleter(const type_info& __ti [[__gnu__::__unused__]]) noexcept + { +#if __cpp_rtti + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2400. shared_ptr's get_deleter() should use addressof() + return __ti == typeid(_Deleter) + ? std::__addressof(_M_impl._M_del()) + : nullptr; +#else + return nullptr; +#endif + } + + private: +#ifdef __glibcxx_out_ptr + template friend class out_ptr_t; +#endif + _Impl _M_impl; + }; + + // helpers for make_shared / allocate_shared + + struct _Sp_make_shared_tag + { + private: + template + friend class _Sp_counted_ptr_inplace; + + static const type_info& + _S_ti() noexcept _GLIBCXX_VISIBILITY(default) + { + alignas(type_info) static constexpr char __tag[sizeof(type_info)] = { }; + return reinterpret_cast(__tag); + } + + static bool _S_eq(const type_info&) noexcept; + }; + + template + struct _Sp_alloc_shared_tag + { + const _Alloc& _M_a; + }; + + template + class _Sp_counted_ptr_inplace final : public _Sp_counted_base<_Lp> + { + class _Impl : _Sp_ebo_helper<0, _Alloc> + { + typedef _Sp_ebo_helper<0, _Alloc> _A_base; + + public: + explicit _Impl(_Alloc __a) noexcept : _A_base(__a) { } + + _Alloc& _M_alloc() noexcept { return _A_base::_S_get(*this); } + + __gnu_cxx::__aligned_buffer<__remove_cv_t<_Tp>> _M_storage; + }; + + public: + using __allocator_type = __alloc_rebind<_Alloc, _Sp_counted_ptr_inplace>; + + // Alloc parameter is not a reference so doesn't alias anything in __args + template + _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args) + : _M_impl(__a) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2070. allocate_shared should use allocator_traits::construct + allocator_traits<_Alloc>::construct(__a, _M_ptr(), + std::forward<_Args>(__args)...); // might throw + } + + ~_Sp_counted_ptr_inplace() noexcept { } + + virtual void + _M_dispose() noexcept + { + allocator_traits<_Alloc>::destroy(_M_impl._M_alloc(), _M_ptr()); + } + + // Override because the allocator needs to know the dynamic type + virtual void + _M_destroy() noexcept + { + __allocator_type __a(_M_impl._M_alloc()); + __allocated_ptr<__allocator_type> __guard_ptr{ __a, this }; + this->~_Sp_counted_ptr_inplace(); + } + + private: + friend class __shared_count<_Lp>; // To be able to call _M_ptr(). + + // No longer used, but code compiled against old libstdc++ headers + // might still call it from __shared_ptr ctor to get the pointer out. + virtual void* + _M_get_deleter(const std::type_info& __ti) noexcept override + { + // Check for the fake type_info first, so we don't try to access it + // as a real type_info object. Otherwise, check if it's the real + // type_info for this class. With RTTI enabled we can check directly, + // or call a library function to do it. + if (&__ti == &_Sp_make_shared_tag::_S_ti() + || +#if __cpp_rtti + __ti == typeid(_Sp_make_shared_tag) +#else + _Sp_make_shared_tag::_S_eq(__ti) +#endif + ) + return _M_ptr(); + return nullptr; + } + + __remove_cv_t<_Tp>* + _M_ptr() noexcept { return _M_impl._M_storage._M_ptr(); } + + _Impl _M_impl; + }; + +#ifdef __glibcxx_smart_ptr_for_overwrite // C++ >= 20 && HOSTED + struct _Sp_overwrite_tag { }; + + // Partial specialization used for make_shared_for_overwrite(). + // This partial specialization is used when the allocator's value type + // is the special _Sp_overwrite_tag type. +#if __cpp_concepts + template + requires is_same_v + class _Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp> final +#else + template class _Alloc, _Lock_policy _Lp> + class _Sp_counted_ptr_inplace<_Tp, _Alloc<_Sp_overwrite_tag>, _Lp> final +#endif + : public _Sp_counted_base<_Lp> + { + [[no_unique_address]] _Alloc _M_alloc; + + union { + remove_cv_t<_Tp> _M_obj; + char _M_unused; + }; + + friend class __shared_count<_Lp>; // To be able to call _M_ptr(). + + auto _M_ptr() noexcept { return std::__addressof(_M_obj); } + + public: + using __allocator_type = __alloc_rebind<_Alloc, _Sp_counted_ptr_inplace>; + + _Sp_counted_ptr_inplace(const _Alloc& __a) + : _M_alloc(__a) + { + ::new((void*)_M_ptr()) _Tp; // default-initialized, for overwrite. + } + + ~_Sp_counted_ptr_inplace() noexcept { } + + virtual void + _M_dispose() noexcept + { + _M_obj.~_Tp(); + } + + // Override because the allocator needs to know the dynamic type + virtual void + _M_destroy() noexcept + { + using pointer = typename allocator_traits<__allocator_type>::pointer; + __allocator_type __a(_M_alloc); + auto __p = pointer_traits::pointer_to(*this); + __allocated_ptr<__allocator_type> __guard_ptr{ __a, __p }; + this->~_Sp_counted_ptr_inplace(); + } + + void* + _M_get_deleter(const std::type_info&) noexcept override + { return nullptr; } + }; +#endif // __glibcxx_smart_ptr_for_overwrite + +#if __glibcxx_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED + struct _Sp_overwrite_tag; + + // For make_shared, make_shared, allocate_shared etc. + template + struct _Sp_counted_array_base + { + [[no_unique_address]] _Alloc _M_alloc{}; + size_t _M_n = 0; + bool _M_overwrite = false; + + typename allocator_traits<_Alloc>::pointer + _M_alloc_array(size_t __tail) + { + return allocator_traits<_Alloc>::allocate(_M_alloc, _M_n + __tail); + } + + void + _M_dealloc_array(typename allocator_traits<_Alloc>::pointer __p, + size_t __tail) + { + allocator_traits<_Alloc>::deallocate(_M_alloc, __p, _M_n + __tail); + } + + // Init the array elements + template + void + _M_init(typename allocator_traits<_Alloc>::value_type* __p, + _Init __init) + { + using _Tp = remove_pointer_t<_Init>; + using _Up = typename allocator_traits<_Alloc>::value_type; + + if constexpr (is_same_v<_Init, _Sp_overwrite_tag>) + { + std::uninitialized_default_construct_n(__p, _M_n); + _M_overwrite = true; + } + else if (__init == nullptr) + std::__uninitialized_default_n_a(__p, _M_n, _M_alloc); + else if constexpr (!is_array_v<_Tp>) + std::__uninitialized_fill_n_a(__p, _M_n, *__init, _M_alloc); + else + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedefs" + struct _Iter + { + using value_type = _Up; + using difference_type = ptrdiff_t; + using pointer = const _Up*; + using reference = const _Up&; + using iterator_category = forward_iterator_tag; + + const _Up* _M_p; + size_t _M_len; + size_t _M_pos; + + _Iter& operator++() { ++_M_pos; return *this; } + _Iter operator++(int) { auto __i(*this); ++_M_pos; return __i; } + + reference operator*() const { return _M_p[_M_pos % _M_len]; } + pointer operator->() const { return _M_p + (_M_pos % _M_len); } + + bool operator==(const _Iter& __i) const + { return _M_pos == __i._M_pos; } + }; +#pragma GCC diagnostic pop + + _Iter __first{_S_first_elem(__init), sizeof(_Tp) / sizeof(_Up)}; + _Iter __last = __first; + __last._M_pos = _M_n; + std::__uninitialized_copy_a(__first, __last, __p, _M_alloc); + } + } + + protected: + // Destroy the array elements + void + _M_dispose_array(typename allocator_traits<_Alloc>::value_type* __p) + { + if (_M_overwrite) + std::destroy_n(__p, _M_n); + else + { + size_t __n = _M_n; + while (__n--) + allocator_traits<_Alloc>::destroy(_M_alloc, __p + __n); + } + } + + private: + template + static _Tp* + _S_first_elem(_Tp* __p) { return __p; } + + template + static auto + _S_first_elem(_Tp (*__p)[_Nm]) { return _S_first_elem(*__p); } + }; + + // Control block for make_shared, make_shared etc. that will be + // placed into unused memory at the end of the array. + template + class _Sp_counted_array final + : public _Sp_counted_base<_Lp>, _Sp_counted_array_base<_Alloc> + { + using pointer = typename allocator_traits<_Alloc>::pointer; + + pointer _M_alloc_ptr; + + auto _M_ptr() const noexcept { return std::to_address(_M_alloc_ptr); } + + friend class __shared_count<_Lp>; // To be able to call _M_ptr(). + + public: + _Sp_counted_array(const _Sp_counted_array_base<_Alloc>& __a, + pointer __p) noexcept + : _Sp_counted_array_base<_Alloc>(__a), _M_alloc_ptr(__p) + { } + + ~_Sp_counted_array() = default; + + virtual void + _M_dispose() noexcept + { + if (this->_M_n) + this->_M_dispose_array(_M_ptr()); + } + + // Override because the allocator needs to know the dynamic type + virtual void + _M_destroy() noexcept + { + _Sp_counted_array_base<_Alloc> __a = *this; + pointer __p = _M_alloc_ptr; + this->~_Sp_counted_array(); + __a._M_dealloc_array(__p, _S_tail()); + } + + // Returns the number of additional array elements that must be + // allocated in order to store a _Sp_counted_array at the end. + static constexpr size_t + _S_tail() + { + // The array elemenent type. + using _Tp = typename allocator_traits<_Alloc>::value_type; + + // The space needed to store a _Sp_counted_array object. + size_t __bytes = sizeof(_Sp_counted_array); + + // Add any padding needed for manual alignment within the buffer. + if constexpr (alignof(_Tp) < alignof(_Sp_counted_array)) + __bytes += alignof(_Sp_counted_array) - alignof(_Tp); + + return (__bytes + sizeof(_Tp) - 1) / sizeof(_Tp); + } + + void* + _M_get_deleter(const std::type_info&) noexcept override + { return nullptr; } + }; +#endif // __glibcxx_shared_ptr_arrays >= 201707L + + // The default deleter for shared_ptr and shared_ptr. + struct __sp_array_delete + { + template + void operator()(_Yp* __p) const { delete[] __p; } + }; + + template<_Lock_policy _Lp> + class __shared_count + { + // Prevent _Sp_alloc_shared_tag from matching the shared_ptr(P, D) ctor. + template + struct __not_alloc_shared_tag { using type = void; }; + + template + struct __not_alloc_shared_tag<_Sp_alloc_shared_tag<_Tp>> { }; + +#if __glibcxx_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED + template + struct __not_alloc_shared_tag<_Sp_counted_array_base<_Alloc>> { }; +#endif + + public: + constexpr __shared_count() noexcept : _M_pi(0) + { } + + template + explicit + __shared_count(_Ptr __p) : _M_pi(0) + { + __try + { + _M_pi = new _Sp_counted_ptr<_Ptr, _Lp>(__p); + } + __catch(...) + { + delete __p; + __throw_exception_again; + } + } + + template + __shared_count(_Ptr __p, /* is_array = */ false_type) + : __shared_count(__p) + { } + + template + __shared_count(_Ptr __p, /* is_array = */ true_type) + : __shared_count(__p, __sp_array_delete{}, allocator()) + { } + + template::type> + __shared_count(_Ptr __p, _Deleter __d) + : __shared_count(__p, std::move(__d), allocator()) + { } + + template::type> + __shared_count(_Ptr __p, _Deleter __d, _Alloc __a) : _M_pi(0) + { + typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type; + __try + { + typename _Sp_cd_type::__allocator_type __a2(__a); + auto __guard = std::__allocate_guarded(__a2); + _Sp_cd_type* __mem = __guard.get(); + ::new (__mem) _Sp_cd_type(__p, std::move(__d), std::move(__a)); + _M_pi = __mem; + __guard = nullptr; + } + __catch(...) + { + __d(__p); // Call _Deleter on __p. + __throw_exception_again; + } + } + + template + __shared_count(_Tp*& __p, _Sp_alloc_shared_tag<_Alloc> __a, + _Args&&... __args) + { + using _Tp2 = __remove_cv_t<_Tp>; + using _Sp_cp_type = _Sp_counted_ptr_inplace<_Tp2, _Alloc, _Lp>; + typename _Sp_cp_type::__allocator_type __a2(__a._M_a); + auto __guard = std::__allocate_guarded(__a2); + _Sp_cp_type* __mem = __guard.get(); + auto __pi = ::new (__mem) + _Sp_cp_type(__a._M_a, std::forward<_Args>(__args)...); + __guard = nullptr; + _M_pi = __pi; + __p = __pi->_M_ptr(); + } + +#if __glibcxx_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED + template + __shared_count(_Tp*& __p, const _Sp_counted_array_base<_Alloc>& __a, + _Init __init) + { + using _Up = remove_all_extents_t<_Tp>; + static_assert(is_same_v<_Up, typename _Alloc::value_type>); + + using _Sp_ca_type = _Sp_counted_array<_Alloc, _Lp>; + const size_t __tail = _Sp_ca_type::_S_tail(); + + struct _Guarded_ptr : _Sp_counted_array_base<_Alloc> + { + typename allocator_traits<_Alloc>::pointer _M_ptr; + + _Guarded_ptr(_Sp_counted_array_base<_Alloc> __a) + : _Sp_counted_array_base<_Alloc>(__a), + _M_ptr(this->_M_alloc_array(_Sp_ca_type::_S_tail())) + { } + + ~_Guarded_ptr() + { + if (_M_ptr) + this->_M_dealloc_array(_M_ptr, _Sp_ca_type::_S_tail()); + } + }; + + _Guarded_ptr __guard{__a}; + _Up* const __raw = std::to_address(__guard._M_ptr); + __guard._M_init(__raw, __init); // might throw + + void* __c = __raw + __a._M_n; + if constexpr (alignof(_Up) < alignof(_Sp_ca_type)) + { + size_t __space = sizeof(_Up) * __tail; + __c = std::align(alignof(_Sp_ca_type), sizeof(_Sp_ca_type), + __c, __space); + } + auto __pi = ::new(__c) _Sp_ca_type(__guard, __guard._M_ptr); + __guard._M_ptr = nullptr; + _M_pi = __pi; + __p = reinterpret_cast<_Tp*>(__raw); + } +#endif + +#if _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + // Special case for auto_ptr<_Tp> to provide the strong guarantee. + template + explicit + __shared_count(std::auto_ptr<_Tp>&& __r); +#pragma GCC diagnostic pop +#endif + + // Special case for unique_ptr<_Tp,_Del> to provide the strong guarantee. + template + explicit + __shared_count(std::unique_ptr<_Tp, _Del>&& __r) : _M_pi(0) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2415. Inconsistency between unique_ptr and shared_ptr + if (__r.get() == nullptr) + return; + + using _Ptr = typename unique_ptr<_Tp, _Del>::pointer; + using _Del2 = __conditional_t::value, + reference_wrapper::type>, + _Del>; + using _Sp_cd_type + = _Sp_counted_deleter<_Ptr, _Del2, allocator, _Lp>; + using _Alloc = allocator<_Sp_cd_type>; + using _Alloc_traits = allocator_traits<_Alloc>; + _Alloc __a; + _Sp_cd_type* __mem = _Alloc_traits::allocate(__a, 1); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3548. shared_ptr construction from unique_ptr should move + // (not copy) the deleter + _Alloc_traits::construct(__a, __mem, __r.release(), + std::forward<_Del>(__r.get_deleter())); + _M_pi = __mem; + } + + // Throw bad_weak_ptr when __r._M_get_use_count() == 0. + explicit __shared_count(const __weak_count<_Lp>& __r); + + // Does not throw if __r._M_get_use_count() == 0, caller must check. + explicit + __shared_count(const __weak_count<_Lp>& __r, std::nothrow_t) noexcept; + + ~__shared_count() noexcept + { + if (_M_pi != nullptr) + _M_pi->_M_release(); + } + + __shared_count(const __shared_count& __r) noexcept + : _M_pi(__r._M_pi) + { + if (_M_pi != nullptr) + _M_pi->_M_add_ref_copy(); + } + + __shared_count& + operator=(const __shared_count& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + if (__tmp != _M_pi) + { + if (__tmp != nullptr) + __tmp->_M_add_ref_copy(); + if (_M_pi != nullptr) + _M_pi->_M_release(); + _M_pi = __tmp; + } + return *this; + } + + void + _M_swap(__shared_count& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + __r._M_pi = _M_pi; + _M_pi = __tmp; + } + + long + _M_get_use_count() const noexcept + { return _M_pi ? _M_pi->_M_get_use_count() : 0; } + + bool + _M_unique() const noexcept + { return this->_M_get_use_count() == 1; } + + void* + _M_get_deleter(const std::type_info& __ti) const noexcept + { return _M_pi ? _M_pi->_M_get_deleter(__ti) : nullptr; } + + bool + _M_less(const __shared_count& __rhs) const noexcept + { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } + + bool + _M_less(const __weak_count<_Lp>& __rhs) const noexcept + { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } + + // Friend function injected into enclosing namespace and found by ADL + friend inline bool + operator==(const __shared_count& __a, const __shared_count& __b) noexcept + { return __a._M_pi == __b._M_pi; } + + private: + friend class __weak_count<_Lp>; +#ifdef __glibcxx_atomic_shared_ptr + template friend class _Sp_atomic; +#endif +#ifdef __glibcxx_out_ptr + template friend class out_ptr_t; +#endif + + _Sp_counted_base<_Lp>* _M_pi; + }; + + + template<_Lock_policy _Lp> + class __weak_count + { + public: + constexpr __weak_count() noexcept : _M_pi(nullptr) + { } + + __weak_count(const __shared_count<_Lp>& __r) noexcept + : _M_pi(__r._M_pi) + { + if (_M_pi != nullptr) + _M_pi->_M_weak_add_ref(); + } + + __weak_count(const __weak_count& __r) noexcept + : _M_pi(__r._M_pi) + { + if (_M_pi != nullptr) + _M_pi->_M_weak_add_ref(); + } + + __weak_count(__weak_count&& __r) noexcept + : _M_pi(__r._M_pi) + { __r._M_pi = nullptr; } + + ~__weak_count() noexcept + { + if (_M_pi != nullptr) + _M_pi->_M_weak_release(); + } + + __weak_count& + operator=(const __shared_count<_Lp>& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + if (__tmp != nullptr) + __tmp->_M_weak_add_ref(); + if (_M_pi != nullptr) + _M_pi->_M_weak_release(); + _M_pi = __tmp; + return *this; + } + + __weak_count& + operator=(const __weak_count& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + if (__tmp != nullptr) + __tmp->_M_weak_add_ref(); + if (_M_pi != nullptr) + _M_pi->_M_weak_release(); + _M_pi = __tmp; + return *this; + } + + __weak_count& + operator=(__weak_count&& __r) noexcept + { + if (_M_pi != nullptr) + _M_pi->_M_weak_release(); + _M_pi = __r._M_pi; + __r._M_pi = nullptr; + return *this; + } + + void + _M_swap(__weak_count& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + __r._M_pi = _M_pi; + _M_pi = __tmp; + } + + long + _M_get_use_count() const noexcept + { return _M_pi != nullptr ? _M_pi->_M_get_use_count() : 0; } + + bool + _M_less(const __weak_count& __rhs) const noexcept + { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } + + bool + _M_less(const __shared_count<_Lp>& __rhs) const noexcept + { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } + + // Friend function injected into enclosing namespace and found by ADL + friend inline bool + operator==(const __weak_count& __a, const __weak_count& __b) noexcept + { return __a._M_pi == __b._M_pi; } + + private: + friend class __shared_count<_Lp>; +#ifdef __glibcxx_atomic_shared_ptr + template friend class _Sp_atomic; +#endif + + _Sp_counted_base<_Lp>* _M_pi; + }; + + // Now that __weak_count is defined we can define this constructor: + template<_Lock_policy _Lp> + inline + __shared_count<_Lp>::__shared_count(const __weak_count<_Lp>& __r) + : _M_pi(__r._M_pi) + { + if (_M_pi == nullptr || !_M_pi->_M_add_ref_lock_nothrow()) + __throw_bad_weak_ptr(); + } + + // Now that __weak_count is defined we can define this constructor: + template<_Lock_policy _Lp> + inline + __shared_count<_Lp>:: + __shared_count(const __weak_count<_Lp>& __r, std::nothrow_t) noexcept + : _M_pi(__r._M_pi) + { + if (_M_pi && !_M_pi->_M_add_ref_lock_nothrow()) + _M_pi = nullptr; + } + + // Helper traits for shared_ptr of array: + + // A pointer type Y* is said to be compatible with a pointer type T* when + // either Y* is convertible to T* or Y is U[N] and T is U cv []. + template + struct __sp_compatible_with + : false_type + { }; + + template + struct __sp_compatible_with<_Yp*, _Tp*> + : is_convertible<_Yp*, _Tp*>::type + { }; + + template + struct __sp_compatible_with<_Up(*)[_Nm], _Up(*)[]> + : true_type + { }; + + template + struct __sp_compatible_with<_Up(*)[_Nm], const _Up(*)[]> + : true_type + { }; + + template + struct __sp_compatible_with<_Up(*)[_Nm], volatile _Up(*)[]> + : true_type + { }; + + template + struct __sp_compatible_with<_Up(*)[_Nm], const volatile _Up(*)[]> + : true_type + { }; + + // Test conversion from Y(*)[N] to U(*)[N] without forming invalid type Y[N]. + template + struct __sp_is_constructible_arrN + : false_type + { }; + + template + struct __sp_is_constructible_arrN<_Up, _Nm, _Yp, __void_t<_Yp[_Nm]>> + : is_convertible<_Yp(*)[_Nm], _Up(*)[_Nm]>::type + { }; + + // Test conversion from Y(*)[] to U(*)[] without forming invalid type Y[]. + template + struct __sp_is_constructible_arr + : false_type + { }; + + template + struct __sp_is_constructible_arr<_Up, _Yp, __void_t<_Yp[]>> + : is_convertible<_Yp(*)[], _Up(*)[]>::type + { }; + + // Trait to check if shared_ptr can be constructed from Y*. + template + struct __sp_is_constructible; + + // When T is U[N], Y(*)[N] shall be convertible to T*; + template + struct __sp_is_constructible<_Up[_Nm], _Yp> + : __sp_is_constructible_arrN<_Up, _Nm, _Yp>::type + { }; + + // when T is U[], Y(*)[] shall be convertible to T*; + template + struct __sp_is_constructible<_Up[], _Yp> + : __sp_is_constructible_arr<_Up, _Yp>::type + { }; + + // otherwise, Y* shall be convertible to T*. + template + struct __sp_is_constructible + : is_convertible<_Yp*, _Tp*>::type + { }; + + + template + [[__gnu__::__always_inline__]] + inline _Tp* + __shared_ptr_deref(_Tp* __p) + { + __glibcxx_assert(__p != nullptr); + return __p; + } + + // Define operator* and operator-> for shared_ptr. + template::value, bool = is_void<_Tp>::value> + class __shared_ptr_access + { + public: + using element_type = _Tp; + + element_type& + operator*() const noexcept + { return *std::__shared_ptr_deref(_M_get()); } + + element_type* + operator->() const noexcept + { + _GLIBCXX_DEBUG_PEDASSERT(_M_get() != nullptr); + return _M_get(); + } + + private: + element_type* + _M_get() const noexcept + { return static_cast*>(this)->get(); } + }; + + // Define operator-> for shared_ptr. + template + class __shared_ptr_access<_Tp, _Lp, false, true> + { + public: + using element_type = _Tp; + + element_type* + operator->() const noexcept + { + auto __ptr = static_cast*>(this)->get(); + _GLIBCXX_DEBUG_PEDASSERT(__ptr != nullptr); + return __ptr; + } + }; + + // Define operator[] for shared_ptr and shared_ptr. + template + class __shared_ptr_access<_Tp, _Lp, true, false> + { + public: + using element_type = typename remove_extent<_Tp>::type; + +#if __cplusplus <= 201402L + [[__deprecated__("shared_ptr::operator* is absent from C++17")]] + element_type& + operator*() const noexcept + { return *std::__shared_ptr_deref(_M_get()); } + + [[__deprecated__("shared_ptr::operator-> is absent from C++17")]] + element_type* + operator->() const noexcept + { + _GLIBCXX_DEBUG_PEDASSERT(_M_get() != nullptr); + return _M_get(); + } +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + element_type& + operator[](ptrdiff_t __i) const noexcept + { + if constexpr (extent<_Tp>::value) + __glibcxx_assert(__i < extent<_Tp>::value); + return std::__shared_ptr_deref(_M_get())[__i]; + } +#pragma GCC diagnostic pop + + private: + element_type* + _M_get() const noexcept + { return static_cast*>(this)->get(); } + }; + + template + class __shared_ptr + : public __shared_ptr_access<_Tp, _Lp> + { + public: + using element_type = typename remove_extent<_Tp>::type; + + private: + // Constraint for taking ownership of a pointer of type _Yp*: + template + using _SafeConv + = typename enable_if<__sp_is_constructible<_Tp, _Yp>::value>::type; + + // Constraint for construction from shared_ptr and weak_ptr: + template + using _Compatible = typename + enable_if<__sp_compatible_with<_Yp*, _Tp*>::value, _Res>::type; + + // Constraint for assignment from shared_ptr and weak_ptr: + template + using _Assignable = _Compatible<_Yp, __shared_ptr&>; + + // Constraint for construction from unique_ptr: + template::pointer> + using _UniqCompatible = __enable_if_t<__and_< + __sp_compatible_with<_Yp*, _Tp*>, + is_convertible<_Ptr, element_type*>, + is_move_constructible<_Del> + >::value, _Res>; + + // Constraint for assignment from unique_ptr: + template + using _UniqAssignable = _UniqCompatible<_Yp, _Del, __shared_ptr&>; + + public: + +#if __cplusplus > 201402L + using weak_type = __weak_ptr<_Tp, _Lp>; +#endif + + constexpr __shared_ptr() noexcept + : _M_ptr(0), _M_refcount() + { } + + template> + explicit + __shared_ptr(_Yp* __p) + : _M_ptr(__p), _M_refcount(__p, typename is_array<_Tp>::type()) + { + static_assert( !is_void<_Yp>::value, "incomplete type" ); + static_assert( sizeof(_Yp) > 0, "incomplete type" ); + _M_enable_shared_from_this_with(__p); + } + + template> + __shared_ptr(_Yp* __p, _Deleter __d) + : _M_ptr(__p), _M_refcount(__p, std::move(__d)) + { + static_assert(__is_invocable<_Deleter&, _Yp*&>::value, + "deleter expression d(p) is well-formed"); + _M_enable_shared_from_this_with(__p); + } + + template> + __shared_ptr(_Yp* __p, _Deleter __d, _Alloc __a) + : _M_ptr(__p), _M_refcount(__p, std::move(__d), std::move(__a)) + { + static_assert(__is_invocable<_Deleter&, _Yp*&>::value, + "deleter expression d(p) is well-formed"); + _M_enable_shared_from_this_with(__p); + } + + template + __shared_ptr(nullptr_t __p, _Deleter __d) + : _M_ptr(0), _M_refcount(__p, std::move(__d)) + { } + + template + __shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a) + : _M_ptr(0), _M_refcount(__p, std::move(__d), std::move(__a)) + { } + + // Aliasing constructor + template + __shared_ptr(const __shared_ptr<_Yp, _Lp>& __r, + element_type* __p) noexcept + : _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws + { } + + // Aliasing constructor + template + __shared_ptr(__shared_ptr<_Yp, _Lp>&& __r, + element_type* __p) noexcept + : _M_ptr(__p), _M_refcount() + { + _M_refcount._M_swap(__r._M_refcount); + __r._M_ptr = nullptr; + } + + __shared_ptr(const __shared_ptr&) noexcept = default; + __shared_ptr& operator=(const __shared_ptr&) noexcept = default; + ~__shared_ptr() = default; + + template> + __shared_ptr(const __shared_ptr<_Yp, _Lp>& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) + { } + + __shared_ptr(__shared_ptr&& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount() + { + _M_refcount._M_swap(__r._M_refcount); + __r._M_ptr = nullptr; + } + + template> + __shared_ptr(__shared_ptr<_Yp, _Lp>&& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount() + { + _M_refcount._M_swap(__r._M_refcount); + __r._M_ptr = nullptr; + } + + template> + explicit __shared_ptr(const __weak_ptr<_Yp, _Lp>& __r) + : _M_refcount(__r._M_refcount) // may throw + { + // It is now safe to copy __r._M_ptr, as + // _M_refcount(__r._M_refcount) did not throw. + _M_ptr = __r._M_ptr; + } + + // If an exception is thrown this constructor has no effect. + template> + __shared_ptr(unique_ptr<_Yp, _Del>&& __r) + : _M_ptr(__r.get()), _M_refcount() + { + auto __raw = std::__to_address(__r.get()); + _M_refcount = __shared_count<_Lp>(std::move(__r)); + _M_enable_shared_from_this_with(__raw); + } + +#if __cplusplus <= 201402L && _GLIBCXX_USE_DEPRECATED + protected: + // If an exception is thrown this constructor has no effect. + template>, is_array<_Tp1>, + is_convertible::pointer, _Tp*> + >::value, bool>::type = true> + __shared_ptr(unique_ptr<_Tp1, _Del>&& __r, __sp_array_delete) + : _M_ptr(__r.get()), _M_refcount() + { + auto __raw = std::__to_address(__r.get()); + _M_refcount = __shared_count<_Lp>(std::move(__r)); + _M_enable_shared_from_this_with(__raw); + } + public: +#endif + +#if _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + // Postcondition: use_count() == 1 and __r.get() == 0 + template> + __shared_ptr(auto_ptr<_Yp>&& __r); +#pragma GCC diagnostic pop +#endif + + constexpr __shared_ptr(nullptr_t) noexcept : __shared_ptr() { } + + template + _Assignable<_Yp> + operator=(const __shared_ptr<_Yp, _Lp>& __r) noexcept + { + _M_ptr = __r._M_ptr; + _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw + return *this; + } + +#if _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + template + _Assignable<_Yp> + operator=(auto_ptr<_Yp>&& __r) + { + __shared_ptr(std::move(__r)).swap(*this); + return *this; + } +#pragma GCC diagnostic pop +#endif + + __shared_ptr& + operator=(__shared_ptr&& __r) noexcept + { + __shared_ptr(std::move(__r)).swap(*this); + return *this; + } + + template + _Assignable<_Yp> + operator=(__shared_ptr<_Yp, _Lp>&& __r) noexcept + { + __shared_ptr(std::move(__r)).swap(*this); + return *this; + } + + template + _UniqAssignable<_Yp, _Del> + operator=(unique_ptr<_Yp, _Del>&& __r) + { + __shared_ptr(std::move(__r)).swap(*this); + return *this; + } + + void + reset() noexcept + { __shared_ptr().swap(*this); } + + template + _SafeConv<_Yp> + reset(_Yp* __p) // _Yp must be complete. + { + // Catch self-reset errors. + __glibcxx_assert(__p == nullptr || __p != _M_ptr); + __shared_ptr(__p).swap(*this); + } + + template + _SafeConv<_Yp> + reset(_Yp* __p, _Deleter __d) + { __shared_ptr(__p, std::move(__d)).swap(*this); } + + template + _SafeConv<_Yp> + reset(_Yp* __p, _Deleter __d, _Alloc __a) + { __shared_ptr(__p, std::move(__d), std::move(__a)).swap(*this); } + + /// Return the stored pointer. + element_type* + get() const noexcept + { return _M_ptr; } + + /// Return true if the stored pointer is not null. + explicit operator bool() const noexcept + { return _M_ptr != nullptr; } + + /// Return true if use_count() == 1. + bool + unique() const noexcept + { return _M_refcount._M_unique(); } + + /// If *this owns a pointer, return the number of owners, otherwise zero. + long + use_count() const noexcept + { return _M_refcount._M_get_use_count(); } + + /// Exchange both the owned pointer and the stored pointer. + void + swap(__shared_ptr<_Tp, _Lp>& __other) noexcept + { + std::swap(_M_ptr, __other._M_ptr); + _M_refcount._M_swap(__other._M_refcount); + } + + /** @brief Define an ordering based on ownership. + * + * This function defines a strict weak ordering between two shared_ptr + * or weak_ptr objects, such that one object is less than the other + * unless they share ownership of the same pointer, or are both empty. + * @{ + */ + template + bool + owner_before(__shared_ptr<_Tp1, _Lp> const& __rhs) const noexcept + { return _M_refcount._M_less(__rhs._M_refcount); } + + template + bool + owner_before(__weak_ptr<_Tp1, _Lp> const& __rhs) const noexcept + { return _M_refcount._M_less(__rhs._M_refcount); } + /// @} + + protected: + // This constructor is non-standard, it is used by allocate_shared. + template + __shared_ptr(_Sp_alloc_shared_tag<_Alloc> __tag, _Args&&... __args) + : _M_ptr(), _M_refcount(_M_ptr, __tag, std::forward<_Args>(__args)...) + { _M_enable_shared_from_this_with(_M_ptr); } + + template + friend __shared_ptr<_Tp1, _Lp1> + __allocate_shared(const _Alloc& __a, _Args&&... __args); + +#if __glibcxx_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED + // This constructor is non-standard, it is used by allocate_shared. + template*> + __shared_ptr(const _Sp_counted_array_base<_Alloc>& __a, + _Init __init = nullptr) + : _M_ptr(), _M_refcount(_M_ptr, __a, __init) + { } +#endif + + // This constructor is used by __weak_ptr::lock() and + // shared_ptr::shared_ptr(const weak_ptr&, std::nothrow_t). + __shared_ptr(const __weak_ptr<_Tp, _Lp>& __r, std::nothrow_t) noexcept + : _M_refcount(__r._M_refcount, std::nothrow) + { + _M_ptr = _M_refcount._M_get_use_count() ? __r._M_ptr : nullptr; + } + + friend class __weak_ptr<_Tp, _Lp>; + + private: + + template + using __esft_base_t = decltype(__enable_shared_from_this_base( + std::declval&>(), + std::declval<_Yp*>())); + + // Detect an accessible and unambiguous enable_shared_from_this base. + template + struct __has_esft_base + : false_type { }; + + template + struct __has_esft_base<_Yp, __void_t<__esft_base_t<_Yp>>> + : __not_> { }; // No enable shared_from_this for arrays + + template::type> + typename enable_if<__has_esft_base<_Yp2>::value>::type + _M_enable_shared_from_this_with(_Yp* __p) noexcept + { + if (auto __base = __enable_shared_from_this_base(_M_refcount, __p)) + __base->_M_weak_assign(const_cast<_Yp2*>(__p), _M_refcount); + } + + template::type> + typename enable_if::value>::type + _M_enable_shared_from_this_with(_Yp*) noexcept + { } + + void* + _M_get_deleter(const std::type_info& __ti) const noexcept + { return _M_refcount._M_get_deleter(__ti); } + + template friend class __shared_ptr; + template friend class __weak_ptr; + + template + friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&) noexcept; + + template + friend _Del* get_deleter(const shared_ptr<_Tp1>&) noexcept; + +#ifdef __glibcxx_atomic_shared_ptr + friend _Sp_atomic>; +#endif +#ifdef __glibcxx_out_ptr + template friend class out_ptr_t; +#endif + + element_type* _M_ptr; // Contained pointer. + __shared_count<_Lp> _M_refcount; // Reference counter. + }; + + + // 20.7.2.2.7 shared_ptr comparisons + template + inline bool + operator==(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return __a.get() == __b.get(); } + + template + inline bool + operator==(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return !__a; } + +#ifdef __cpp_lib_three_way_comparison + template + inline strong_ordering + operator<=>(const __shared_ptr<_Tp, _Lp>& __a, + const __shared_ptr<_Up, _Lp>& __b) noexcept + { return compare_three_way()(__a.get(), __b.get()); } + + template + inline strong_ordering + operator<=>(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { + using pointer = typename __shared_ptr<_Tp, _Lp>::element_type*; + return compare_three_way()(__a.get(), static_cast(nullptr)); + } +#else + template + inline bool + operator==(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return !__a; } + + template + inline bool + operator!=(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return __a.get() != __b.get(); } + + template + inline bool + operator!=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return (bool)__a; } + + template + inline bool + operator!=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return (bool)__a; } + + template + inline bool + operator<(const __shared_ptr<_Tp, _Lp>& __a, + const __shared_ptr<_Up, _Lp>& __b) noexcept + { + using _Tp_elt = typename __shared_ptr<_Tp, _Lp>::element_type; + using _Up_elt = typename __shared_ptr<_Up, _Lp>::element_type; + using _Vp = typename common_type<_Tp_elt*, _Up_elt*>::type; + return less<_Vp>()(__a.get(), __b.get()); + } + + template + inline bool + operator<(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { + using _Tp_elt = typename __shared_ptr<_Tp, _Lp>::element_type; + return less<_Tp_elt*>()(__a.get(), nullptr); + } + + template + inline bool + operator<(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { + using _Tp_elt = typename __shared_ptr<_Tp, _Lp>::element_type; + return less<_Tp_elt*>()(nullptr, __a.get()); + } + + template + inline bool + operator<=(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return !(__b < __a); } + + template + inline bool + operator<=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return !(nullptr < __a); } + + template + inline bool + operator<=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return !(__a < nullptr); } + + template + inline bool + operator>(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return (__b < __a); } + + template + inline bool + operator>(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return nullptr < __a; } + + template + inline bool + operator>(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return __a < nullptr; } + + template + inline bool + operator>=(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return !(__a < __b); } + + template + inline bool + operator>=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return !(__a < nullptr); } + + template + inline bool + operator>=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return !(nullptr < __a); } +#endif // three-way comparison + + // 20.7.2.2.8 shared_ptr specialized algorithms. + template + inline void + swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b) noexcept + { __a.swap(__b); } + + // 20.7.2.2.9 shared_ptr casts + + // The seemingly equivalent code: + // shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get())) + // will eventually result in undefined behaviour, attempting to + // delete the same object twice. + /// static_pointer_cast + template + inline __shared_ptr<_Tp, _Lp> + static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept + { + using _Sp = __shared_ptr<_Tp, _Lp>; + return _Sp(__r, static_cast(__r.get())); + } + + // The seemingly equivalent code: + // shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get())) + // will eventually result in undefined behaviour, attempting to + // delete the same object twice. + /// const_pointer_cast + template + inline __shared_ptr<_Tp, _Lp> + const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept + { + using _Sp = __shared_ptr<_Tp, _Lp>; + return _Sp(__r, const_cast(__r.get())); + } + + // The seemingly equivalent code: + // shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get())) + // will eventually result in undefined behaviour, attempting to + // delete the same object twice. + /// dynamic_pointer_cast + template + inline __shared_ptr<_Tp, _Lp> + dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept + { + using _Sp = __shared_ptr<_Tp, _Lp>; + if (auto* __p = dynamic_cast(__r.get())) + return _Sp(__r, __p); + return _Sp(); + } + +#if __cplusplus > 201402L + template + inline __shared_ptr<_Tp, _Lp> + reinterpret_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept + { + using _Sp = __shared_ptr<_Tp, _Lp>; + return _Sp(__r, reinterpret_cast(__r.get())); + } +#endif + + template + class __weak_ptr + { + template + using _Compatible = typename + enable_if<__sp_compatible_with<_Yp*, _Tp*>::value, _Res>::type; + + // Constraint for assignment from shared_ptr and weak_ptr: + template + using _Assignable = _Compatible<_Yp, __weak_ptr&>; + + public: + using element_type = typename remove_extent<_Tp>::type; + + constexpr __weak_ptr() noexcept + : _M_ptr(nullptr), _M_refcount() + { } + + __weak_ptr(const __weak_ptr&) noexcept = default; + + ~__weak_ptr() = default; + + // The "obvious" converting constructor implementation: + // + // template + // __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r) + // : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws + // { } + // + // has a serious problem. + // + // __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr) + // conversion may require access to *__r._M_ptr (virtual inheritance). + // + // It is not possible to avoid spurious access violations since + // in multithreaded programs __r._M_ptr may be invalidated at any point. + template> + __weak_ptr(const __weak_ptr<_Yp, _Lp>& __r) noexcept + : _M_refcount(__r._M_refcount) + { _M_ptr = __r.lock().get(); } + + template> + __weak_ptr(const __shared_ptr<_Yp, _Lp>& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) + { } + + __weak_ptr(__weak_ptr&& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount(std::move(__r._M_refcount)) + { __r._M_ptr = nullptr; } + + template> + __weak_ptr(__weak_ptr<_Yp, _Lp>&& __r) noexcept + : _M_ptr(__r.lock().get()), _M_refcount(std::move(__r._M_refcount)) + { __r._M_ptr = nullptr; } + + __weak_ptr& + operator=(const __weak_ptr& __r) noexcept = default; + + template + _Assignable<_Yp> + operator=(const __weak_ptr<_Yp, _Lp>& __r) noexcept + { + _M_ptr = __r.lock().get(); + _M_refcount = __r._M_refcount; + return *this; + } + + template + _Assignable<_Yp> + operator=(const __shared_ptr<_Yp, _Lp>& __r) noexcept + { + _M_ptr = __r._M_ptr; + _M_refcount = __r._M_refcount; + return *this; + } + + __weak_ptr& + operator=(__weak_ptr&& __r) noexcept + { + __weak_ptr(std::move(__r)).swap(*this); + return *this; + } + + template + _Assignable<_Yp> + operator=(__weak_ptr<_Yp, _Lp>&& __r) noexcept + { + _M_ptr = __r.lock().get(); + _M_refcount = std::move(__r._M_refcount); + __r._M_ptr = nullptr; + return *this; + } + + __shared_ptr<_Tp, _Lp> + lock() const noexcept + { return __shared_ptr<_Tp, _Lp>(*this, std::nothrow); } + + long + use_count() const noexcept + { return _M_refcount._M_get_use_count(); } + + bool + expired() const noexcept + { return _M_refcount._M_get_use_count() == 0; } + + template + bool + owner_before(const __shared_ptr<_Tp1, _Lp>& __rhs) const noexcept + { return _M_refcount._M_less(__rhs._M_refcount); } + + template + bool + owner_before(const __weak_ptr<_Tp1, _Lp>& __rhs) const noexcept + { return _M_refcount._M_less(__rhs._M_refcount); } + + void + reset() noexcept + { __weak_ptr().swap(*this); } + + void + swap(__weak_ptr& __s) noexcept + { + std::swap(_M_ptr, __s._M_ptr); + _M_refcount._M_swap(__s._M_refcount); + } + + private: + // Used by __enable_shared_from_this. + void + _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount) noexcept + { + if (use_count() == 0) + { + _M_ptr = __ptr; + _M_refcount = __refcount; + } + } + + template friend class __shared_ptr; + template friend class __weak_ptr; + friend class __enable_shared_from_this<_Tp, _Lp>; + friend class enable_shared_from_this<_Tp>; +#ifdef __glibcxx_atomic_shared_ptr + friend _Sp_atomic>; +#endif + + element_type* _M_ptr; // Contained pointer. + __weak_count<_Lp> _M_refcount; // Reference counter. + }; + + // 20.7.2.3.6 weak_ptr specialized algorithms. + template + inline void + swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b) noexcept + { __a.swap(__b); } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + template + struct _Sp_owner_less : public binary_function<_Tp, _Tp, bool> + { + bool + operator()(const _Tp& __lhs, const _Tp& __rhs) const noexcept + { return __lhs.owner_before(__rhs); } + + bool + operator()(const _Tp& __lhs, const _Tp1& __rhs) const noexcept + { return __lhs.owner_before(__rhs); } + + bool + operator()(const _Tp1& __lhs, const _Tp& __rhs) const noexcept + { return __lhs.owner_before(__rhs); } + }; +#pragma GCC diagnostic pop + + template<> + struct _Sp_owner_less + { + template + auto + operator()(const _Tp& __lhs, const _Up& __rhs) const noexcept + -> decltype(__lhs.owner_before(__rhs)) + { return __lhs.owner_before(__rhs); } + + using is_transparent = void; + }; + + template + struct owner_less<__shared_ptr<_Tp, _Lp>> + : public _Sp_owner_less<__shared_ptr<_Tp, _Lp>, __weak_ptr<_Tp, _Lp>> + { }; + + template + struct owner_less<__weak_ptr<_Tp, _Lp>> + : public _Sp_owner_less<__weak_ptr<_Tp, _Lp>, __shared_ptr<_Tp, _Lp>> + { }; + + + template + class __enable_shared_from_this + { + protected: + constexpr __enable_shared_from_this() noexcept { } + + __enable_shared_from_this(const __enable_shared_from_this&) noexcept { } + + __enable_shared_from_this& + operator=(const __enable_shared_from_this&) noexcept + { return *this; } + + ~__enable_shared_from_this() { } + + public: + __shared_ptr<_Tp, _Lp> + shared_from_this() + { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); } + + __shared_ptr + shared_from_this() const + { return __shared_ptr(this->_M_weak_this); } + +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + __weak_ptr<_Tp, _Lp> + weak_from_this() noexcept + { return this->_M_weak_this; } + + __weak_ptr + weak_from_this() const noexcept + { return this->_M_weak_this; } +#endif + + private: + template + void + _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const noexcept + { _M_weak_this._M_assign(__p, __n); } + + friend const __enable_shared_from_this* + __enable_shared_from_this_base(const __shared_count<_Lp>&, + const __enable_shared_from_this* __p) + { return __p; } + + template + friend class __shared_ptr; + + mutable __weak_ptr<_Tp, _Lp> _M_weak_this; + }; + + template + inline __shared_ptr<_Tp, _Lp> + __allocate_shared(const _Alloc& __a, _Args&&... __args) + { + static_assert(!is_array<_Tp>::value, "make_shared not supported"); + + return __shared_ptr<_Tp, _Lp>(_Sp_alloc_shared_tag<_Alloc>{__a}, + std::forward<_Args>(__args)...); + } + + template + inline __shared_ptr<_Tp, _Lp> + __make_shared(_Args&&... __args) + { + typedef typename std::remove_const<_Tp>::type _Tp_nc; + return std::__allocate_shared<_Tp, _Lp>(std::allocator<_Tp_nc>(), + std::forward<_Args>(__args)...); + } + + /// std::hash specialization for __shared_ptr. + template + struct hash<__shared_ptr<_Tp, _Lp>> + : public __hash_base> + { + size_t + operator()(const __shared_ptr<_Tp, _Lp>& __s) const noexcept + { + return hash::element_type*>()( + __s.get()); + } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // _SHARED_PTR_BASE_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr_base.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr_base.h.blob new file mode 100644 index 0000000..49f5087 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@shared_ptr_base.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@sstream.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@sstream.tcc new file mode 100644 index 0000000..36d8033 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@sstream.tcc @@ -0,0 +1,312 @@ +// String based streams -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/sstream.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{sstream} + */ + +// +// ISO C++ 14882: 27.7 String-based streams +// + +#ifndef _SSTREAM_TCC +#define _SSTREAM_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type + basic_stringbuf<_CharT, _Traits, _Alloc>:: + pbackfail(int_type __c) + { + int_type __ret = traits_type::eof(); + if (this->eback() < this->gptr()) + { + // Try to put back __c into input sequence in one of three ways. + // Order these tests done in is unspecified by the standard. + const bool __testeof = traits_type::eq_int_type(__c, __ret); + if (!__testeof) + { + const bool __testeq = traits_type::eq(traits_type:: + to_char_type(__c), + this->gptr()[-1]); + const bool __testout = this->_M_mode & ios_base::out; + if (__testeq || __testout) + { + this->gbump(-1); + if (!__testeq) + *this->gptr() = traits_type::to_char_type(__c); + __ret = __c; + } + } + else + { + this->gbump(-1); + __ret = traits_type::not_eof(__c); + } + } + return __ret; + } + + template + typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type + basic_stringbuf<_CharT, _Traits, _Alloc>:: + overflow(int_type __c) + { + const bool __testout = this->_M_mode & ios_base::out; + if (__builtin_expect(!__testout, false)) + return traits_type::eof(); + + const bool __testeof = traits_type::eq_int_type(__c, traits_type::eof()); + if (__builtin_expect(__testeof, false)) + return traits_type::not_eof(__c); + + const __size_type __capacity = _M_string.capacity(); + +#if _GLIBCXX_USE_CXX11_ABI + if (size_t(this->epptr() - this->pbase()) < __capacity) + { + // There is additional capacity in _M_string that can be used. + char_type* __base = const_cast(_M_string.data()); + _M_pbump(__base, __base + __capacity, this->pptr() - this->pbase()); + if (_M_mode & ios_base::in) + { + const __size_type __nget = this->gptr() - this->eback(); + const __size_type __eget = this->egptr() - this->eback(); + this->setg(__base, __base + __nget, __base + __eget + 1); + } + *this->pptr() = traits_type::to_char_type(__c); + this->pbump(1); + return __c; + } +#endif + + const __size_type __max_size = _M_string.max_size(); + const bool __testput = this->pptr() < this->epptr(); + if (__builtin_expect(!__testput && __capacity == __max_size, false)) + return traits_type::eof(); + + // Try to append __c into output sequence in one of two ways. + // Order these tests done in is unspecified by the standard. + const char_type __conv = traits_type::to_char_type(__c); + if (!__testput) + { + // NB: Start ostringstream buffers at 512 chars. This is an + // experimental value (pronounced "arbitrary" in some of the + // hipper English-speaking countries), and can be changed to + // suit particular needs. + // + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 169. Bad efficiency of overflow() mandated + // 432. stringbuf::overflow() makes only one write position + // available + const __size_type __opt_len = std::max(__size_type(2 * __capacity), + __size_type(512)); + const __size_type __len = std::min(__opt_len, __max_size); + __string_type __tmp(_M_string.get_allocator()); + __tmp.reserve(__len); + if (this->pbase()) + __tmp.assign(this->pbase(), this->epptr() - this->pbase()); + __tmp.push_back(__conv); + _M_string.swap(__tmp); + _M_sync(const_cast(_M_string.data()), + this->gptr() - this->eback(), this->pptr() - this->pbase()); + } + else + *this->pptr() = __conv; + this->pbump(1); + return __c; + } + + template + typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type + basic_stringbuf<_CharT, _Traits, _Alloc>:: + underflow() + { + int_type __ret = traits_type::eof(); + const bool __testin = this->_M_mode & ios_base::in; + if (__testin) + { + // Update egptr() to match the actual string end. + _M_update_egptr(); + + if (this->gptr() < this->egptr()) + __ret = traits_type::to_int_type(*this->gptr()); + } + return __ret; + } + + template + typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type + basic_stringbuf<_CharT, _Traits, _Alloc>:: + seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode) + { + pos_type __ret = pos_type(off_type(-1)); + bool __testin = (ios_base::in & this->_M_mode & __mode) != 0; + bool __testout = (ios_base::out & this->_M_mode & __mode) != 0; + const bool __testboth = __testin && __testout && __way != ios_base::cur; + __testin &= !(__mode & ios_base::out); + __testout &= !(__mode & ios_base::in); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 453. basic_stringbuf::seekoff need not always fail for an empty stream. + const char_type* __beg = __testin ? this->eback() : this->pbase(); + if ((__beg || !__off) && (__testin || __testout || __testboth)) + { + _M_update_egptr(); + + off_type __newoffi = __off; + off_type __newoffo = __newoffi; + if (__way == ios_base::cur) + { + __newoffi += this->gptr() - __beg; + __newoffo += this->pptr() - __beg; + } + else if (__way == ios_base::end) + __newoffo = __newoffi += this->egptr() - __beg; + + if ((__testin || __testboth) + && __newoffi >= 0 + && this->egptr() - __beg >= __newoffi) + { + this->setg(this->eback(), this->eback() + __newoffi, + this->egptr()); + __ret = pos_type(__newoffi); + } + if ((__testout || __testboth) + && __newoffo >= 0 + && this->egptr() - __beg >= __newoffo) + { + _M_pbump(this->pbase(), this->epptr(), __newoffo); + __ret = pos_type(__newoffo); + } + } + return __ret; + } + + template + typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type + basic_stringbuf<_CharT, _Traits, _Alloc>:: + seekpos(pos_type __sp, ios_base::openmode __mode) + { + pos_type __ret = pos_type(off_type(-1)); + const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0; + const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0; + + const char_type* __beg = __testin ? this->eback() : this->pbase(); + if ((__beg || !off_type(__sp)) && (__testin || __testout)) + { + _M_update_egptr(); + + const off_type __pos(__sp); + const bool __testpos = (0 <= __pos + && __pos <= this->egptr() - __beg); + if (__testpos) + { + if (__testin) + this->setg(this->eback(), this->eback() + __pos, + this->egptr()); + if (__testout) + _M_pbump(this->pbase(), this->epptr(), __pos); + __ret = __sp; + } + } + return __ret; + } + + template + void + basic_stringbuf<_CharT, _Traits, _Alloc>:: + _M_sync(char_type* __base, __size_type __i, __size_type __o) + { + const bool __testin = _M_mode & ios_base::in; + const bool __testout = _M_mode & ios_base::out; + char_type* __endg = __base + _M_string.size(); + char_type* __endp = __base + _M_string.capacity(); + + if (__base != _M_string.data()) + { + // setbuf: __i == size of buffer area (_M_string.size() == 0). + __endg += __i; + __i = 0; + __endp = __endg; + } + + if (__testin) + this->setg(__base, __base + __i, __endg); + if (__testout) + { + _M_pbump(__base, __endp, __o); + // egptr() always tracks the string end. When !__testin, + // for the correct functioning of the streambuf inlines + // the other get area pointers are identical. + if (!__testin) + this->setg(__endg, __endg, __endg); + } + } + + template + void + basic_stringbuf<_CharT, _Traits, _Alloc>:: + _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off) + { + this->setp(__pbeg, __pend); + while (__off > __gnu_cxx::__numeric_traits::__max) + { + this->pbump(__gnu_cxx::__numeric_traits::__max); + __off -= __gnu_cxx::__numeric_traits::__max; + } + this->pbump(__off); + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class basic_stringbuf; + extern template class basic_istringstream; + extern template class basic_ostringstream; + extern template class basic_stringstream; + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class basic_stringbuf; + extern template class basic_istringstream; + extern template class basic_ostringstream; + extern template class basic_stringstream; +#endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@sstream.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@sstream.tcc.blob new file mode 100644 index 0000000..b7a60f9 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@sstream.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@std_abs.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@std_abs.h new file mode 100644 index 0000000..35ec4d3 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@std_abs.h @@ -0,0 +1,162 @@ +// -*- C++ -*- C library enhancements header. + +// Copyright (C) 2016-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/std_abs.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{cmath, cstdlib} + */ + +#ifndef _GLIBCXX_BITS_STD_ABS_H +#define _GLIBCXX_BITS_STD_ABS_H + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" // include_next +#pragma GCC diagnostic ignored "-Wlong-long" + +#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +#include_next +#ifdef __CORRECT_ISO_CPP_MATH_H_PROTO +# include_next +#endif +#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + +#undef abs + +extern "C++" +{ +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using ::abs; + +#ifndef __CORRECT_ISO_CPP_STDLIB_H_PROTO + inline long + abs(long __i) { return __builtin_labs(__i); } +#endif + +#ifdef _GLIBCXX_USE_LONG_LONG + inline long long + abs(long long __x) { return __builtin_llabs (__x); } +#endif + +// _GLIBCXX_RESOLVE_LIB_DEFECTS +// 2192. Validity and return type of std::abs(0u) is unclear +// 2294. should declare abs(double) +// 2735. std::abs(short), std::abs(signed char) and others should return int + +#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO + inline _GLIBCXX_CONSTEXPR double + abs(double __x) + { return __builtin_fabs(__x); } + + inline _GLIBCXX_CONSTEXPR float + abs(float __x) + { return __builtin_fabsf(__x); } + + inline _GLIBCXX_CONSTEXPR long double + abs(long double __x) + { return __builtin_fabsl(__x); } +#endif + +#if defined(__GLIBCXX_TYPE_INT_N_0) + __extension__ inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_0 + abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } +#endif +#if defined(__GLIBCXX_TYPE_INT_N_1) + __extension__ inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_1 + abs(__GLIBCXX_TYPE_INT_N_1 __x) { return __x >= 0 ? __x : -__x; } +#endif +#if defined(__GLIBCXX_TYPE_INT_N_2) + __extension__ inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_2 + abs(__GLIBCXX_TYPE_INT_N_2 __x) { return __x >= 0 ? __x : -__x; } +#endif +#if defined(__GLIBCXX_TYPE_INT_N_3) + __extension__ inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_3 + abs(__GLIBCXX_TYPE_INT_N_3 __x) { return __x >= 0 ? __x : -__x; } +#endif + +#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + constexpr _Float16 + abs(_Float16 __x) + { return _Float16(__builtin_fabsf(__x)); } +#endif + +#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + constexpr _Float32 + abs(_Float32 __x) + { return __builtin_fabsf(__x); } +#endif + +#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) + constexpr _Float64 + abs(_Float64 __x) + { return __builtin_fabs(__x); } +#endif + +#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) + constexpr _Float128 + abs(_Float128 __x) + { return __builtin_fabsl(__x); } +#elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH) + constexpr _Float128 + abs(_Float128 __x) + { return __builtin_fabsf128(__x); } +#endif + +#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + constexpr __gnu_cxx::__bfloat16_t + abs(__gnu_cxx::__bfloat16_t __x) + { return __gnu_cxx::__bfloat16_t(__builtin_fabsf(__x)); } +#endif + +#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) + __extension__ inline _GLIBCXX_CONSTEXPR + __float128 + abs(__float128 __x) + { +#if defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) + return __builtin_fabsl(__x); +#elif defined(_GLIBCXX_HAVE_FLOAT128_MATH) + return __builtin_fabsf128(__x); +#else + // Assume that __builtin_signbit works for __float128. + return __builtin_signbit(__x) ? -__x : __x; +#endif + } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +} // extern "C++" + +#pragma GCC diagnostic pop + +#endif // _GLIBCXX_BITS_STD_ABS_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@std_abs.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@std_abs.h.blob new file mode 100644 index 0000000..1191986 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@std_abs.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_algobase.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_algobase.h new file mode 100644 index 0000000..4d5662c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_algobase.h @@ -0,0 +1,2304 @@ +// Core algorithmic facilities -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_algobase.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{algorithm} + */ + +#ifndef _STL_ALGOBASE_H +#define _STL_ALGOBASE_H 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // For std::swap +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus >= 201402L +# include // std::__bit_width +#endif +#if __cplusplus >= 202002L +# include +# include // std::to_address +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /* + * A constexpr wrapper for __builtin_memcmp. + * @param __num The number of elements of type _Tp (not bytes). + */ + template + _GLIBCXX14_CONSTEXPR + inline int + __memcmp(const _Tp* __first1, const _Up* __first2, size_t __num) + { +#if __cplusplus >= 201103L + static_assert(sizeof(_Tp) == sizeof(_Up), "can be compared with memcmp"); +#endif +#ifdef __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + { + for(; __num > 0; ++__first1, ++__first2, --__num) + if (*__first1 != *__first2) + return *__first1 < *__first2 ? -1 : 1; + return 0; + } + else +#endif + return __builtin_memcmp(__first1, __first2, sizeof(_Tp) * __num); + } + +#if __cplusplus < 201103L + // See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a + // nutshell, we are partially implementing the resolution of DR 187, + // when it's safe, i.e., the value_types are equal. + template + struct __iter_swap + { + template + static void + iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) + { + typedef typename iterator_traits<_ForwardIterator1>::value_type + _ValueType1; + _ValueType1 __tmp = *__a; + *__a = *__b; + *__b = __tmp; + } + }; + + template<> + struct __iter_swap + { + template + static void + iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) + { + swap(*__a, *__b); + } + }; +#endif // C++03 + + /** + * @brief Swaps the contents of two iterators. + * @ingroup mutating_algorithms + * @param __a An iterator. + * @param __b Another iterator. + * @return Nothing. + * + * This function swaps the values pointed to by two iterators, not the + * iterators themselves. + */ + template + _GLIBCXX20_CONSTEXPR + inline void + iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator1>) + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator2>) + +#if __cplusplus < 201103L + typedef typename iterator_traits<_ForwardIterator1>::value_type + _ValueType1; + typedef typename iterator_traits<_ForwardIterator2>::value_type + _ValueType2; + + __glibcxx_function_requires(_ConvertibleConcept<_ValueType1, + _ValueType2>) + __glibcxx_function_requires(_ConvertibleConcept<_ValueType2, + _ValueType1>) + + typedef typename iterator_traits<_ForwardIterator1>::reference + _ReferenceType1; + typedef typename iterator_traits<_ForwardIterator2>::reference + _ReferenceType2; + std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value + && __are_same<_ValueType1&, _ReferenceType1>::__value + && __are_same<_ValueType2&, _ReferenceType2>::__value>:: + iter_swap(__a, __b); +#else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 187. iter_swap underspecified + swap(*__a, *__b); +#endif + } + + /** + * @brief Swap the elements of two sequences. + * @ingroup mutating_algorithms + * @param __first1 A forward iterator. + * @param __last1 A forward iterator. + * @param __first2 A forward iterator. + * @return An iterator equal to @p first2+(last1-first1). + * + * Swaps each element in the range @p [first1,last1) with the + * corresponding element in the range @p [first2,(last1-first1)). + * The ranges must not overlap. + */ + template + _GLIBCXX20_CONSTEXPR + _ForwardIterator2 + swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator1>) + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator2>) + __glibcxx_requires_valid_range(__first1, __last1); + + for (; __first1 != __last1; ++__first1, (void)++__first2) + std::iter_swap(__first1, __first2); + return __first2; + } + + /** + * @brief This does what you think it does. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @return The lesser of the parameters. + * + * This is the simple classic generic implementation. It will work on + * temporary expressions, since they are only evaluated once, unlike a + * preprocessor macro. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR + inline const _Tp& + min(const _Tp& __a, const _Tp& __b) + { + // concept requirements + __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) + //return __b < __a ? __b : __a; + if (__b < __a) + return __b; + return __a; + } + + /** + * @brief This does what you think it does. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @return The greater of the parameters. + * + * This is the simple classic generic implementation. It will work on + * temporary expressions, since they are only evaluated once, unlike a + * preprocessor macro. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR + inline const _Tp& + max(const _Tp& __a, const _Tp& __b) + { + // concept requirements + __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) + //return __a < __b ? __b : __a; + if (__a < __b) + return __b; + return __a; + } + + /** + * @brief This does what you think it does. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @param __comp A @link comparison_functors comparison functor@endlink. + * @return The lesser of the parameters. + * + * This will work on temporary expressions, since they are only evaluated + * once, unlike a preprocessor macro. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR + inline const _Tp& + min(const _Tp& __a, const _Tp& __b, _Compare __comp) + { + //return __comp(__b, __a) ? __b : __a; + if (__comp(__b, __a)) + return __b; + return __a; + } + + /** + * @brief This does what you think it does. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @param __comp A @link comparison_functors comparison functor@endlink. + * @return The greater of the parameters. + * + * This will work on temporary expressions, since they are only evaluated + * once, unlike a preprocessor macro. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX14_CONSTEXPR + inline const _Tp& + max(const _Tp& __a, const _Tp& __b, _Compare __comp) + { + //return __comp(__a, __b) ? __b : __a; + if (__comp(__a, __b)) + return __b; + return __a; + } + +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + template + struct _Deque_iterator; + + struct _Bit_iterator; + +_GLIBCXX_END_NAMESPACE_CONTAINER + +#if _GLIBCXX_HOSTED + // Helpers for streambuf iterators (either istream or ostream). + // NB: avoid including , relatively large. + template + struct char_traits; + + template + class istreambuf_iterator; + + template + class ostreambuf_iterator; + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type + __copy_move_a2(_CharT*, _CharT*, + ostreambuf_iterator<_CharT, char_traits<_CharT> >); + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type + __copy_move_a2(const _CharT*, const _CharT*, + ostreambuf_iterator<_CharT, char_traits<_CharT> >); + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + _CharT*>::__type + __copy_move_a2(istreambuf_iterator<_CharT, char_traits<_CharT> >, + istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*); + + template + typename __gnu_cxx::__enable_if< + __is_char<_CharT>::__value, + _GLIBCXX_STD_C::_Deque_iterator<_CharT, _CharT&, _CharT*> >::__type + __copy_move_a2( + istreambuf_iterator<_CharT, char_traits<_CharT> >, + istreambuf_iterator<_CharT, char_traits<_CharT> >, + _GLIBCXX_STD_C::_Deque_iterator<_CharT, _CharT&, _CharT*>); +#endif // HOSTED + +#if __cpp_lib_concepts + template + concept __memcpyable_iterators + = contiguous_iterator<_OutIter> && contiguous_iterator<_InIter> + && sized_sentinel_for<_Sent, _InIter> + && requires (_OutIter __o, _InIter __i) { + requires !!__memcpyable::__value; + }; +#endif + +#if __cplusplus < 201103L + // Used by __copy_move_a2, __copy_n_a and __copy_move_backward_a2 to + // get raw pointers so that calls to __builtin_memmove will compile, + // because C++98 can't use 'if constexpr' so statements that use memmove + // with pointer arguments need to also compile for arbitrary iterator types. + template __attribute__((__always_inline__)) + inline void* __ptr_or_null(_Iter) { return 0; } + template __attribute__((__always_inline__)) + inline void* __ptr_or_null(_Tp* __p) { return (void*)__p; } +# define _GLIBCXX_TO_ADDR(P) std::__ptr_or_null(P) + // Used to advance output iterators (std::advance requires InputIterator). + template __attribute__((__always_inline__)) + inline void __ptr_advance(_Iter&, ptrdiff_t) { } + template __attribute__((__always_inline__)) + inline void __ptr_advance(_Tp*& __p, ptrdiff_t __n) { __p += __n; } +# define _GLIBCXX_ADVANCE(P, N) std::__ptr_advance(P, N) +#else + // For C++11 mode the __builtin_memmove calls are guarded by 'if constexpr' + // so we know the iterators used with memmove are guaranteed to be pointers. +# define _GLIBCXX_TO_ADDR(P) P +# define _GLIBCXX_ADVANCE(P, N) P += N +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + template + __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR + inline void + __assign_one(_OutIter& __out, _InIter& __in) + { +#if __cplusplus >= 201103L + if constexpr (_IsMove) + *__out = std::move(*__in); + else +#endif + *__out = *__in; + } + + template + _GLIBCXX20_CONSTEXPR + inline _OutIter + __copy_move_a2(_InIter __first, _Sent __last, _OutIter __result) + { + typedef __decltype(*__first) _InRef; + typedef __decltype(*__result) _OutRef; + if _GLIBCXX_CONSTEXPR (!__is_trivially_assignable(_OutRef, _InRef)) + { } /* Skip the optimizations and use the loop at the end. */ + else if (std::__is_constant_evaluated()) + { } /* Skip the optimizations and use the loop at the end. */ + else if _GLIBCXX_CONSTEXPR (__memcpyable<_OutIter, _InIter>::__value) + { + ptrdiff_t __n = std::distance(__first, __last); + if (__builtin_expect(__n > 1, true)) + { + __builtin_memmove(_GLIBCXX_TO_ADDR(__result), + _GLIBCXX_TO_ADDR(__first), + __n * sizeof(*__first)); + _GLIBCXX_ADVANCE(__result, __n); + } + else if (__n == 1) + { + std::__assign_one<_IsMove>(__result, __first); + ++__result; + } + return __result; + } +#if __cpp_lib_concepts + else if constexpr (__memcpyable_iterators<_OutIter, _InIter, _Sent>) + { + if (auto __n = __last - __first; __n > 1) [[likely]] + { + void* __dest = std::to_address(__result); + const void* __src = std::to_address(__first); + size_t __nbytes = __n * sizeof(iter_value_t<_InIter>); + // Advance the iterators and convert to pointers first. + // This gives the iterators a chance to do bounds checking. + (void) std::to_address(__result += __n); + (void) std::to_address(__first += __n); + __builtin_memmove(__dest, __src, __nbytes); + } + else if (__n == 1) + { + std::__assign_one<_IsMove>(__result, __first); + ++__result; + } + return __result; + } +#endif + + for (; __first != __last; ++__result, (void)++__first) + std::__assign_one<_IsMove>(__result, __first); + return __result; + } +#pragma GCC diagnostic pop + + template + _OI + __copy_move_a1(_GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr>, + _OI); + + template + _GLIBCXX_STD_C::_Deque_iterator<_OTp, _OTp&, _OTp*> + __copy_move_a1(_GLIBCXX_STD_C::_Deque_iterator<_ITp, _IRef, _IPtr>, + _GLIBCXX_STD_C::_Deque_iterator<_ITp, _IRef, _IPtr>, + _GLIBCXX_STD_C::_Deque_iterator<_OTp, _OTp&, _OTp*>); + + template + typename __gnu_cxx::__enable_if< + __is_random_access_iter<_II>::__value, + _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*> >::__type + __copy_move_a1(_II, _II, _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*>); + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _OI + __copy_move_a1(_II __first, _II __last, _OI __result) + { return std::__copy_move_a2<_IsMove>(__first, __last, __result); } + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _OI + __copy_move_a(_II __first, _II __last, _OI __result) + { + return std::__niter_wrap(__result, + std::__copy_move_a1<_IsMove>(std::__niter_base(__first), + std::__niter_base(__last), + std::__niter_base(__result))); + } + + template + _GLIBCXX20_CONSTEXPR + _OI + __copy_move_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&, + _OI); + + template + _GLIBCXX20_CONSTEXPR + __gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat> + __copy_move_a(_II, _II, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&); + + template + _GLIBCXX20_CONSTEXPR + ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat> + __copy_move_a(const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>&, + const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>&, + const ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>&); + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // for if-constexpr + template + _GLIBCXX20_CONSTEXPR + _OutputIterator + __copy_n_a(_InputIterator __first, _Size __n, _OutputIterator __result, + bool) + { + typedef __decltype(*__first) _InRef; + typedef __decltype(*__result) _OutRef; + if _GLIBCXX_CONSTEXPR (!__is_trivially_assignable(_OutRef, _InRef)) + { } /* Skip the optimizations and use the loop at the end. */ +#ifdef __cpp_lib_is_constant_evaluated + else if (std::is_constant_evaluated()) + { } /* Skip the optimizations and use the loop at the end. */ +#endif + else if _GLIBCXX_CONSTEXPR (__memcpyable<_OutputIterator, + _InputIterator>::__value) + { + if (__builtin_expect(__n > 1, true)) + { + __builtin_memmove(_GLIBCXX_TO_ADDR(__result), + _GLIBCXX_TO_ADDR(__first), + __n * sizeof(*__first)); + _GLIBCXX_ADVANCE(__result, __n); + } + else if (__n == 1) + *__result++ = *__first; + return __result; + } +#if __cpp_lib_concepts + else if constexpr (__memcpyable_iterators<_OutputIterator, + _InputIterator>) + { + if (__n > 1) [[likely]] + { + void* __dest = std::to_address(__result); + const void* __src = std::to_address(__first); + size_t __nbytes = __n * sizeof(iter_value_t<_InputIterator>); + // Advance the iterators and convert to pointers first. + // This gives the iterators a chance to do bounds checking. + (void) std::to_address(__result += __n); + (void) std::to_address(__first += __n); + __builtin_memmove(__dest, __src, __nbytes); + } + else if (__n == 1) + *__result++ = *__first; + return __result; + } +#endif + + if (__n > 0) + { + while (true) + { + *__result = *__first; + ++__result; + if (--__n > 0) + ++__first; + else + break; + } + } + return __result; + } +#pragma GCC diagnostic pop + +#if _GLIBCXX_HOSTED + template + typename __gnu_cxx::__enable_if< + __is_char<_CharT>::__value, _CharT*>::__type + __copy_n_a(istreambuf_iterator<_CharT, char_traits<_CharT> >, + _Size, _CharT*, bool); + + template + typename __gnu_cxx::__enable_if< + __is_char<_CharT>::__value, + _GLIBCXX_STD_C::_Deque_iterator<_CharT, _CharT&, _CharT*> >::__type + __copy_n_a(istreambuf_iterator<_CharT, char_traits<_CharT> >, _Size, + _GLIBCXX_STD_C::_Deque_iterator<_CharT, _CharT&, _CharT*>, + bool); +#endif + + /** + * @brief Copies the range [first,last) into result. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @return result + (last - first) + * + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). Result may not be contained within + * [first,last); the copy_backward function should be used instead. + * + * Note that the end of the output range is permitted to be contained + * within [first,last). + */ + template + _GLIBCXX20_CONSTEXPR + inline _OI + copy(_II __first, _II __last, _OI __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II>) + __glibcxx_function_requires(_OutputIteratorConcept<_OI, + typename iterator_traits<_II>::reference>) + __glibcxx_requires_can_increment_range(__first, __last, __result); + + return std::__copy_move_a<__is_move_iterator<_II>::__value> + (std::__miter_base(__first), std::__miter_base(__last), __result); + } + +#if __cplusplus >= 201103L + /** + * @brief Moves the range [first,last) into result. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @return result + (last - first) + * + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). Result may not be contained within + * [first,last); the move_backward function should be used instead. + * + * Note that the end of the output range is permitted to be contained + * within [first,last). + */ + template + _GLIBCXX20_CONSTEXPR + inline _OI + move(_II __first, _II __last, _OI __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II>) + __glibcxx_function_requires(_OutputIteratorConcept<_OI, + typename iterator_traits<_II>::value_type&&>) + __glibcxx_requires_can_increment_range(__first, __last, __result); + + return std::__copy_move_a(std::__miter_base(__first), + std::__miter_base(__last), __result); + } + +#define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::move(_Tp, _Up, _Vp) +#else +#define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::copy(_Tp, _Up, _Vp) +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + template + _GLIBCXX20_CONSTEXPR + inline _BI2 + __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result) + { + typedef __decltype(*__first) _InRef; + typedef __decltype(*__result) _OutRef; + if _GLIBCXX_CONSTEXPR (!__is_trivially_assignable(_OutRef, _InRef)) + { } /* Skip the optimizations and use the loop at the end. */ +#ifdef __cpp_lib_is_constant_evaluated + else if (std::is_constant_evaluated()) + { } /* Skip the optimizations and use the loop at the end. */ +#endif + else if _GLIBCXX_CONSTEXPR (__memcpyable<_BI2, _BI1>::__value) + { + ptrdiff_t __n = std::distance(__first, __last); + std::advance(__result, -__n); + if (__builtin_expect(__n > 1, true)) + { + __builtin_memmove(_GLIBCXX_TO_ADDR(__result), + _GLIBCXX_TO_ADDR(__first), + __n * sizeof(*__first)); + } + else if (__n == 1) + std::__assign_one<_IsMove>(__result, __first); + return __result; + } +#if __cpp_lib_concepts + else if constexpr (__memcpyable_iterators<_BI2, _BI1>) + { + if (auto __n = __last - __first; __n > 1) [[likely]] + { + const void* __src = std::to_address(__first); + // Advance the iterators and convert to pointers first. + // This gives the iterators a chance to do bounds checking. + (void) std::to_address(__result -= __n); + (void) std::to_address(__first += __n); + void* __dest = std::to_address(__result); + size_t __nbytes = __n * sizeof(iter_value_t<_BI1>); + __builtin_memmove(__dest, __src, __nbytes); + } + else if (__n == 1) + { + --__result; + std::__assign_one<_IsMove>(__result, __first); + } + return __result; + } +#endif + + while (__first != __last) + { + --__last; + --__result; + std::__assign_one<_IsMove>(__result, __last); + } + return __result; + } +#pragma GCC diagnostic pop + +#undef _GLIBCXX_TO_ADDR +#undef _GLIBCXX_ADVANCE + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _BI2 + __copy_move_backward_a1(_BI1 __first, _BI1 __last, _BI2 __result) + { return std::__copy_move_backward_a2<_IsMove>(__first, __last, __result); } + + template + _OI + __copy_move_backward_a1(_GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr>, + _OI); + + template + _GLIBCXX_STD_C::_Deque_iterator<_OTp, _OTp&, _OTp*> + __copy_move_backward_a1( + _GLIBCXX_STD_C::_Deque_iterator<_ITp, _IRef, _IPtr>, + _GLIBCXX_STD_C::_Deque_iterator<_ITp, _IRef, _IPtr>, + _GLIBCXX_STD_C::_Deque_iterator<_OTp, _OTp&, _OTp*>); + + template + typename __gnu_cxx::__enable_if< + __is_random_access_iter<_II>::__value, + _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*> >::__type + __copy_move_backward_a1(_II, _II, + _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*>); + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _OI + __copy_move_backward_a(_II __first, _II __last, _OI __result) + { + return std::__niter_wrap(__result, + std::__copy_move_backward_a1<_IsMove> + (std::__niter_base(__first), std::__niter_base(__last), + std::__niter_base(__result))); + } + + template + _GLIBCXX20_CONSTEXPR + _OI + __copy_move_backward_a( + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&, + _OI); + + template + _GLIBCXX20_CONSTEXPR + __gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat> + __copy_move_backward_a(_II, _II, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&); + + template + _GLIBCXX20_CONSTEXPR + ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat> + __copy_move_backward_a( + const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>&, + const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>&, + const ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>&); + + /** + * @brief Copies the range [first,last) into result. + * @ingroup mutating_algorithms + * @param __first A bidirectional iterator. + * @param __last A bidirectional iterator. + * @param __result A bidirectional iterator. + * @return result - (last - first) + * + * The function has the same effect as copy, but starts at the end of the + * range and works its way to the start, returning the start of the result. + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). + * + * Result may not be in the range (first,last]. Use copy instead. Note + * that the start of the output range may overlap [first,last). + */ + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _BI2 + copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>) + __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>) + __glibcxx_function_requires(_OutputIteratorConcept<_BI2, + typename iterator_traits<_BI1>::reference>) + __glibcxx_requires_can_decrement_range(__first, __last, __result); + + return std::__copy_move_backward_a<__is_move_iterator<_BI1>::__value> + (std::__miter_base(__first), std::__miter_base(__last), __result); + } + +#if __cplusplus >= 201103L + /** + * @brief Moves the range [first,last) into result. + * @ingroup mutating_algorithms + * @param __first A bidirectional iterator. + * @param __last A bidirectional iterator. + * @param __result A bidirectional iterator. + * @return result - (last - first) + * + * The function has the same effect as move, but starts at the end of the + * range and works its way to the start, returning the start of the result. + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). + * + * Result may not be in the range (first,last]. Use move instead. Note + * that the start of the output range may overlap [first,last). + */ + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _BI2 + move_backward(_BI1 __first, _BI1 __last, _BI2 __result) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>) + __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>) + __glibcxx_function_requires(_OutputIteratorConcept<_BI2, + typename iterator_traits<_BI1>::value_type&&>) + __glibcxx_requires_can_decrement_range(__first, __last, __result); + + return std::__copy_move_backward_a(std::__miter_base(__first), + std::__miter_base(__last), + __result); + } + +#define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::move_backward(_Tp, _Up, _Vp) +#else +#define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::copy_backward(_Tp, _Up, _Vp) +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + template + _GLIBCXX20_CONSTEXPR + inline void + __fill_a1(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __value) + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + // We can optimize this loop by moving the load from __value outside + // the loop, but only if we know that making that copy is trivial, + // and the assignment in the loop is also trivial (so that the identity + // of the operand doesn't matter). + const bool __load_outside_loop = +#if __has_builtin(__is_trivially_constructible) \ + && __has_builtin(__is_trivially_assignable) + __is_trivially_constructible(_Tp, const _Tp&) + && __is_trivially_assignable(__decltype(*__first), const _Tp&) +#else + __is_trivially_copyable(_Tp) + && __is_same(_Tp, __typeof__(*__first)) +#endif + && sizeof(_Tp) <= sizeof(long long); +#pragma GCC diagnostic pop + + // When the condition is true, we use a copy of __value, + // otherwise we just use another reference. + typedef typename __gnu_cxx::__conditional_type<__load_outside_loop, + const _Tp, + const _Tp&>::__type _Up; + _Up __val(__value); + for (; __first != __last; ++__first) + *__first = __val; + } +#pragma GCC diagnostic pop + + // Specialization: for char types we can use memset. + template + _GLIBCXX20_CONSTEXPR + inline typename + __gnu_cxx::__enable_if<__is_byte<_Up>::__value + && (__are_same<_Up, _Tp>::__value // for std::byte + || __memcpyable_integer<_Tp>::__width), + void>::__type + __fill_a1(_Up* __first, _Up* __last, const _Tp& __x) + { + // This hoists the load out of the loop and also ensures that we don't + // use memset for cases where the assignment would be ill-formed. + const _Up __val = __x; +#if __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + { + for (; __first != __last; ++__first) + *__first = __val; + return; + } +#endif + if (const size_t __len = __last - __first) + __builtin_memset(__first, static_cast(__val), __len); + } + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline void + __fill_a1(::__gnu_cxx::__normal_iterator<_Ite, _Cont> __first, + ::__gnu_cxx::__normal_iterator<_Ite, _Cont> __last, + const _Tp& __value) + { std::__fill_a1(__first.base(), __last.base(), __value); } + + template + void + __fill_a1(const _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*>&, + const _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Tp&, _Tp*>&, + const _VTp&); + + _GLIBCXX20_CONSTEXPR + void + __fill_a1(_GLIBCXX_STD_C::_Bit_iterator, _GLIBCXX_STD_C::_Bit_iterator, + const bool&); + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline void + __fill_a(_FIte __first, _FIte __last, const _Tp& __value) + { std::__fill_a1(__first, __last, __value); } + + template + _GLIBCXX20_CONSTEXPR + void + __fill_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&, + const _Tp&); + + /** + * @brief Fills the range [first,last) with copies of value. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __value A reference-to-const of arbitrary type. + * @return Nothing. + * + * This function fills a range with copies of the same value. For char + * types filling contiguous areas of memory, this becomes an inline call + * to @c memset or @c wmemset. + */ + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline void + fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_requires_valid_range(__first, __last); + + std::__fill_a(__first, __last, __value); + } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + // Used by fill_n, generate_n, etc. to convert _Size to an integral type: + inline _GLIBCXX_CONSTEXPR int + __size_to_integer(int __n) { return __n; } + inline _GLIBCXX_CONSTEXPR unsigned + __size_to_integer(unsigned __n) { return __n; } + inline _GLIBCXX_CONSTEXPR long + __size_to_integer(long __n) { return __n; } + inline _GLIBCXX_CONSTEXPR unsigned long + __size_to_integer(unsigned long __n) { return __n; } + inline _GLIBCXX_CONSTEXPR long long + __size_to_integer(long long __n) { return __n; } + inline _GLIBCXX_CONSTEXPR unsigned long long + __size_to_integer(unsigned long long __n) { return __n; } + +#if defined(__GLIBCXX_TYPE_INT_N_0) + __extension__ inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_0 + __size_to_integer(__GLIBCXX_TYPE_INT_N_0 __n) { return __n; } + __extension__ inline _GLIBCXX_CONSTEXPR unsigned __GLIBCXX_TYPE_INT_N_0 + __size_to_integer(unsigned __GLIBCXX_TYPE_INT_N_0 __n) { return __n; } +#endif +#if defined(__GLIBCXX_TYPE_INT_N_1) + __extension__ inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_1 + __size_to_integer(__GLIBCXX_TYPE_INT_N_1 __n) { return __n; } + __extension__ inline _GLIBCXX_CONSTEXPR unsigned __GLIBCXX_TYPE_INT_N_1 + __size_to_integer(unsigned __GLIBCXX_TYPE_INT_N_1 __n) { return __n; } +#endif +#if defined(__GLIBCXX_TYPE_INT_N_2) + __extension__ inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_2 + __size_to_integer(__GLIBCXX_TYPE_INT_N_2 __n) { return __n; } + __extension__ inline _GLIBCXX_CONSTEXPR unsigned __GLIBCXX_TYPE_INT_N_2 + __size_to_integer(unsigned __GLIBCXX_TYPE_INT_N_2 __n) { return __n; } +#endif +#if defined(__GLIBCXX_TYPE_INT_N_3) + __extension__ inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_3 + __size_to_integer(__GLIBCXX_TYPE_INT_N_3 __n) { return __n; } + __extension__ inline _GLIBCXX_CONSTEXPR unsigned __GLIBCXX_TYPE_INT_N_3 + __size_to_integer(unsigned __GLIBCXX_TYPE_INT_N_3 __n) { return __n; } +#endif + + inline _GLIBCXX_CONSTEXPR long long + __size_to_integer(float __n) { return (long long)__n; } + inline _GLIBCXX_CONSTEXPR long long + __size_to_integer(double __n) { return (long long)__n; } + inline _GLIBCXX_CONSTEXPR long long + __size_to_integer(long double __n) { return (long long)__n; } +#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) + __extension__ inline _GLIBCXX_CONSTEXPR long long + __size_to_integer(__float128 __n) { return (long long)__n; } +#endif +#pragma GCC diagnostic pop + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" +#pragma GCC diagnostic ignored "-Wlong-long" + template + _GLIBCXX20_CONSTEXPR + inline _OutputIterator + __fill_n_a1(_OutputIterator __first, _Size __n, const _Tp& __value) + { + // See std::__fill_a1 for explanation of this condition. + const bool __load_outside_loop = +#if __has_builtin(__is_trivially_constructible) \ + && __has_builtin(__is_trivially_assignable) + __is_trivially_constructible(_Tp, const _Tp&) + && __is_trivially_assignable(__decltype(*__first), const _Tp&) +#else + __is_trivially_copyable(_Tp) + && __is_same(_Tp, __typeof__(*__first)) +#endif + && sizeof(_Tp) <= sizeof(long long); + + // When the condition is true, we use a copy of __value, + // otherwise we just use another reference. + typedef typename __gnu_cxx::__conditional_type<__load_outside_loop, + const _Tp, + const _Tp&>::__type _Up; + _Up __val(__value); + for (; __n > 0; --__n, (void) ++__first) + *__first = __val; + return __first; + } +#pragma GCC diagnostic pop + + template + _GLIBCXX20_CONSTEXPR + ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat> + __fill_n_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first, + _Size __n, const _Tp& __value, + std::input_iterator_tag); + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _OutputIterator + __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value, + std::output_iterator_tag) + { +#if __cplusplus >= 201103L + static_assert(is_integral<_Size>{}, "fill_n must pass integral size"); +#endif + return __fill_n_a1(__first, __n, __value); + } + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _OutputIterator + __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value, + std::input_iterator_tag) + { +#if __cplusplus >= 201103L + static_assert(is_integral<_Size>{}, "fill_n must pass integral size"); +#endif + return __fill_n_a1(__first, __n, __value); + } + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _OutputIterator + __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value, + std::random_access_iterator_tag) + { +#if __cplusplus >= 201103L + static_assert(is_integral<_Size>{}, "fill_n must pass integral size"); +#endif + if (__n <= 0) + return __first; + + __glibcxx_requires_can_increment(__first, __n); + + std::__fill_a(__first, __first + __n, __value); + return __first + __n; + } + + /** + * @brief Fills the range [first,first+n) with copies of value. + * @ingroup mutating_algorithms + * @param __first An output iterator. + * @param __n The count of copies to perform. + * @param __value A reference-to-const of arbitrary type. + * @return The iterator at first+n. + * + * This function fills a range with copies of the same value. For char + * types filling contiguous areas of memory, this becomes an inline call + * to @c memset or @c wmemset. + * + * If @p __n is negative, the function does nothing. + */ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 865. More algorithms that throw away information + // DR 426. search_n(), fill_n(), and generate_n() with negative n + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _OI + fill_n(_OI __first, _Size __n, const _Tp& __value) + { + // concept requirements + __glibcxx_function_requires(_OutputIteratorConcept<_OI, const _Tp&>) + + return std::__fill_n_a(__first, std::__size_to_integer(__n), __value, + std::__iterator_category(__first)); + } + + template + struct __equal + { + template + _GLIBCXX20_CONSTEXPR + static bool + equal(_II1 __first1, _II1 __last1, _II2 __first2) + { + for (; __first1 != __last1; ++__first1, (void) ++__first2) + if (!(*__first1 == *__first2)) + return false; + return true; + } + }; + + template<> + struct __equal + { + template + _GLIBCXX20_CONSTEXPR + static bool + equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2) + { + if (const size_t __len = (__last1 - __first1)) + return !std::__memcmp(__first1, __first2, __len); + return true; + } + }; + + template + typename __gnu_cxx::__enable_if< + __is_random_access_iter<_II>::__value, bool>::__type + __equal_aux1(_GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr>, + _II); + + template + bool + __equal_aux1(_GLIBCXX_STD_C::_Deque_iterator<_Tp1, _Ref1, _Ptr1>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp1, _Ref1, _Ptr1>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp2, _Ref2, _Ptr2>); + + template + typename __gnu_cxx::__enable_if< + __is_random_access_iter<_II>::__value, bool>::__type + __equal_aux1(_II, _II, + _GLIBCXX_STD_C::_Deque_iterator<_Tp, _Ref, _Ptr>); + + template + _GLIBCXX20_CONSTEXPR + inline bool + __equal_aux1(_II1 __first1, _II1 __last1, _II2 __first2) + { + typedef typename iterator_traits<_II1>::value_type _ValueType1; + const bool __simple = ((__is_integer<_ValueType1>::__value +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer) + || __is_pointer(_ValueType1) +#endif +#if __glibcxx_byte && __glibcxx_type_trait_variable_templates + // bits/cpp_type_traits.h declares std::byte + || is_same_v<_ValueType1, byte> +#endif + ) && __memcmpable<_II1, _II2>::__value); + return std::__equal<__simple>::equal(__first1, __last1, __first2); + } + + template + __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline bool + __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2) + { + return std::__equal_aux1(std::__niter_base(__first1), + std::__niter_base(__last1), + std::__niter_base(__first2)); + } + + template + _GLIBCXX20_CONSTEXPR + bool + __equal_aux(const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>&, + const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>&, + _II2); + + template + _GLIBCXX20_CONSTEXPR + bool + __equal_aux(_II1, _II1, + const ::__gnu_debug::_Safe_iterator<_II2, _Seq2, _Cat2>&); + + template + _GLIBCXX20_CONSTEXPR + bool + __equal_aux(const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>&, + const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>&, + const ::__gnu_debug::_Safe_iterator<_II2, _Seq2, _Cat2>&); + + template + struct __lc_rai + { + template + _GLIBCXX20_CONSTEXPR + static _II1 + __newlast1(_II1, _II1 __last1, _II2, _II2) + { return __last1; } + + template + _GLIBCXX20_CONSTEXPR + static bool + __cnd2(_II __first, _II __last) + { return __first != __last; } + }; + + template<> + struct __lc_rai + { + template + _GLIBCXX20_CONSTEXPR + static _RAI1 + __newlast1(_RAI1 __first1, _RAI1 __last1, + _RAI2 __first2, _RAI2 __last2) + { + const typename iterator_traits<_RAI1>::difference_type + __diff1 = __last1 - __first1; + const typename iterator_traits<_RAI2>::difference_type + __diff2 = __last2 - __first2; + return __diff2 < __diff1 ? __first1 + __diff2 : __last1; + } + + template + static _GLIBCXX20_CONSTEXPR bool + __cnd2(_RAI, _RAI) + { return true; } + }; + + template + _GLIBCXX20_CONSTEXPR + bool + __lexicographical_compare_impl(_II1 __first1, _II1 __last1, + _II2 __first2, _II2 __last2, + _Compare __comp) + { + typedef typename iterator_traits<_II1>::iterator_category _Category1; + typedef typename iterator_traits<_II2>::iterator_category _Category2; + typedef std::__lc_rai<_Category1, _Category2> __rai_type; + + __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2); + for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2); + ++__first1, (void)++__first2) + { + if (__comp(__first1, __first2)) + return true; + if (__comp(__first2, __first1)) + return false; + } + return __first1 == __last1 && __first2 != __last2; + } + + template + struct __lexicographical_compare + { + template + _GLIBCXX20_CONSTEXPR + static bool + __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) + { + using __gnu_cxx::__ops::__iter_less_iter; + return std::__lexicographical_compare_impl(__first1, __last1, + __first2, __last2, + __iter_less_iter()); + } + + template + _GLIBCXX20_CONSTEXPR + static int + __3way(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) + { + while (__first1 != __last1) + { + if (__first2 == __last2) + return +1; + if (*__first1 < *__first2) + return -1; + if (*__first2 < *__first1) + return +1; + ++__first1; + ++__first2; + } + return int(__first2 == __last2) - 1; + } + }; + + template<> + struct __lexicographical_compare + { + template + _GLIBCXX20_CONSTEXPR + static bool + __lc(const _Tp* __first1, const _Tp* __last1, + const _Up* __first2, const _Up* __last2) + { return __3way(__first1, __last1, __first2, __last2) < 0; } + + template + _GLIBCXX20_CONSTEXPR + static ptrdiff_t + __3way(const _Tp* __first1, const _Tp* __last1, + const _Up* __first2, const _Up* __last2) + { + const size_t __len1 = __last1 - __first1; + const size_t __len2 = __last2 - __first2; + if (const size_t __len = std::min(__len1, __len2)) + if (int __result = std::__memcmp(__first1, __first2, __len)) + return __result; + return ptrdiff_t(__len1 - __len2); + } + }; + + template + _GLIBCXX20_CONSTEXPR + inline bool + __lexicographical_compare_aux1(_II1 __first1, _II1 __last1, + _II2 __first2, _II2 __last2) + { + typedef typename iterator_traits<_II1>::value_type _ValueType1; + typedef typename iterator_traits<_II2>::value_type _ValueType2; +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer) + const bool __simple = + (__is_memcmp_ordered_with<_ValueType1, _ValueType2>::__value + && __is_pointer(_II1) && __is_pointer(_II2) +#if __cplusplus > 201703L && __glibcxx_concepts + // For C++20 iterator_traits::value_type is non-volatile + // so __is_byte could be true, but we can't use memcmp with + // volatile data. + && !is_volatile_v>> + && !is_volatile_v>> +#endif + ); +#else + const bool __simple = false; +#endif + + return std::__lexicographical_compare<__simple>::__lc(__first1, __last1, + __first2, __last2); + } + + template + bool + __lexicographical_compare_aux1( + _GLIBCXX_STD_C::_Deque_iterator<_Tp1, _Ref1, _Ptr1>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp1, _Ref1, _Ptr1>, + _Tp2*, _Tp2*); + + template + bool + __lexicographical_compare_aux1(_Tp1*, _Tp1*, + _GLIBCXX_STD_C::_Deque_iterator<_Tp2, _Ref2, _Ptr2>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp2, _Ref2, _Ptr2>); + + template + bool + __lexicographical_compare_aux1( + _GLIBCXX_STD_C::_Deque_iterator<_Tp1, _Ref1, _Ptr1>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp1, _Ref1, _Ptr1>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp2, _Ref2, _Ptr2>, + _GLIBCXX_STD_C::_Deque_iterator<_Tp2, _Ref2, _Ptr2>); + + template + _GLIBCXX20_CONSTEXPR + inline bool + __lexicographical_compare_aux(_II1 __first1, _II1 __last1, + _II2 __first2, _II2 __last2) + { + return std::__lexicographical_compare_aux1(std::__niter_base(__first1), + std::__niter_base(__last1), + std::__niter_base(__first2), + std::__niter_base(__last2)); + } + + template + _GLIBCXX20_CONSTEXPR + bool + __lexicographical_compare_aux( + const ::__gnu_debug::_Safe_iterator<_Iter1, _Seq1, _Cat1>&, + const ::__gnu_debug::_Safe_iterator<_Iter1, _Seq1, _Cat1>&, + _II2, _II2); + + template + _GLIBCXX20_CONSTEXPR + bool + __lexicographical_compare_aux( + _II1, _II1, + const ::__gnu_debug::_Safe_iterator<_Iter2, _Seq2, _Cat2>&, + const ::__gnu_debug::_Safe_iterator<_Iter2, _Seq2, _Cat2>&); + + template + _GLIBCXX20_CONSTEXPR + bool + __lexicographical_compare_aux( + const ::__gnu_debug::_Safe_iterator<_Iter1, _Seq1, _Cat1>&, + const ::__gnu_debug::_Safe_iterator<_Iter1, _Seq1, _Cat1>&, + const ::__gnu_debug::_Safe_iterator<_Iter2, _Seq2, _Cat2>&, + const ::__gnu_debug::_Safe_iterator<_Iter2, _Seq2, _Cat2>&); + + template + _GLIBCXX20_CONSTEXPR + _ForwardIterator + __lower_bound(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val, _Compare __comp) + { + typedef typename iterator_traits<_ForwardIterator>::difference_type + _DistanceType; + + _DistanceType __len = std::distance(__first, __last); + + while (__len > 0) + { + _DistanceType __half = __len >> 1; + _ForwardIterator __middle = __first; + std::advance(__middle, __half); + if (__comp(__middle, __val)) + { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else + __len = __half; + } + return __first; + } + + /** + * @brief Finds the first position in which @a val could be inserted + * without changing the ordering. + * @param __first An iterator. + * @param __last Another iterator. + * @param __val The search term. + * @return An iterator pointing to the first element not less + * than @a val, or end() if every element is less than + * @a val. + * @ingroup binary_search_algorithms + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + lower_bound(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_ForwardIterator>::value_type, _Tp>) + __glibcxx_requires_partitioned_lower(__first, __last, __val); + + return std::__lower_bound(__first, __last, __val, + __gnu_cxx::__ops::__iter_less_val()); + } + + /// This is a helper function for the sort routines and for random.tcc. + // Precondition: __n > 0. + template + inline _GLIBCXX_CONSTEXPR _Tp + __lg(_Tp __n) + { +#if __cplusplus >= 201402L + return std::__bit_width(make_unsigned_t<_Tp>(__n)) - 1; +#else +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + // Use +__n so it promotes to at least int. + return (sizeof(+__n) * __CHAR_BIT__ - 1) + - (sizeof(+__n) == sizeof(long long) + ? __builtin_clzll(+__n) + : (sizeof(+__n) == sizeof(long) + ? __builtin_clzl(+__n) + : __builtin_clz(+__n))); +#pragma GCC diagnostic pop +#endif + } + +_GLIBCXX_BEGIN_NAMESPACE_ALGO + + /** + * @brief Tests a range for element-wise equality. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @return A boolean true or false. + * + * This compares the elements of two ranges using @c == and returns true or + * false depending on whether all of the corresponding elements of the + * ranges are equal. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline bool + equal(_II1 __first1, _II1 __last1, _II2 __first2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II1>) + __glibcxx_function_requires(_InputIteratorConcept<_II2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_II1>::value_type, + typename iterator_traits<_II2>::value_type>) + __glibcxx_requires_can_increment_range(__first1, __last1, __first2); + + return std::__equal_aux(__first1, __last1, __first2); + } + + /** + * @brief Tests a range for element-wise equality. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __binary_pred A binary predicate @link functors + * functor@endlink. + * @return A boolean true or false. + * + * This compares the elements of two ranges using the binary_pred + * parameter, and returns true or + * false depending on whether all of the corresponding elements of the + * ranges are equal. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline bool + equal(_IIter1 __first1, _IIter1 __last1, + _IIter2 __first2, _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_IIter1>) + __glibcxx_function_requires(_InputIteratorConcept<_IIter2>) + __glibcxx_requires_valid_range(__first1, __last1); + + for (; __first1 != __last1; ++__first1, (void)++__first2) + if (!bool(__binary_pred(*__first1, *__first2))) + return false; + return true; + } + +#if __cplusplus >= 201103L +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr + + // 4-iterator version of std::equal for use in C++11. + template + _GLIBCXX20_CONSTEXPR + inline bool + __equal4(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) + { + using _RATag = random_access_iterator_tag; + using _Cat1 = typename iterator_traits<_II1>::iterator_category; + using _Cat2 = typename iterator_traits<_II2>::iterator_category; + using _RAIters = __and_, is_same<_Cat2, _RATag>>; + if constexpr (_RAIters::value) + { + if ((__last1 - __first1) != (__last2 - __first2)) + return false; + return _GLIBCXX_STD_A::equal(__first1, __last1, __first2); + } + else + { + for (; __first1 != __last1 && __first2 != __last2; + ++__first1, (void)++__first2) + if (!(*__first1 == *__first2)) + return false; + return __first1 == __last1 && __first2 == __last2; + } + } + + // 4-iterator version of std::equal for use in C++11. + template + _GLIBCXX20_CONSTEXPR + inline bool + __equal4(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2, + _BinaryPredicate __binary_pred) + { + using _RATag = random_access_iterator_tag; + using _Cat1 = typename iterator_traits<_II1>::iterator_category; + using _Cat2 = typename iterator_traits<_II2>::iterator_category; + using _RAIters = __and_, is_same<_Cat2, _RATag>>; + if constexpr (_RAIters::value) + { + if ((__last1 - __first1) != (__last2 - __first2)) + return false; + return _GLIBCXX_STD_A::equal(__first1, __last1, __first2, + __binary_pred); + } + else + { + for (; __first1 != __last1 && __first2 != __last2; + ++__first1, (void)++__first2) + if (!bool(__binary_pred(*__first1, *__first2))) + return false; + return __first1 == __last1 && __first2 == __last2; + } + } +#pragma GCC diagnostic pop +#endif // C++11 + +#ifdef __glibcxx_robust_nonmodifying_seq_ops // C++ >= 14 + /** + * @brief Tests a range for element-wise equality. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @return A boolean true or false. + * + * This compares the elements of two ranges using @c == and returns true or + * false depending on whether all of the corresponding elements of the + * ranges are equal. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline bool + equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II1>) + __glibcxx_function_requires(_InputIteratorConcept<_II2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_II1>::value_type, + typename iterator_traits<_II2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return _GLIBCXX_STD_A::__equal4(__first1, __last1, __first2, __last2); + } + + /** + * @brief Tests a range for element-wise equality. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @param __binary_pred A binary predicate @link functors + * functor@endlink. + * @return A boolean true or false. + * + * This compares the elements of two ranges using the binary_pred + * parameter, and returns true or + * false depending on whether all of the corresponding elements of the + * ranges are equal. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline bool + equal(_IIter1 __first1, _IIter1 __last1, + _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_IIter1>) + __glibcxx_function_requires(_InputIteratorConcept<_IIter2>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return _GLIBCXX_STD_A::__equal4(__first1, __last1, __first2, __last2, + __binary_pred); + } +#endif // __glibcxx_robust_nonmodifying_seq_ops + + /** + * @brief Performs @b dictionary comparison on ranges. + * @ingroup sorting_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @return A boolean true or false. + * + * Returns true if the sequence of elements defined by the range + * [first1,last1) is lexicographically less than the sequence of elements + * defined by the range [first2,last2). Returns false otherwise. + * (Quoted from [25.3.8]/1.) If the iterators are all character pointers, + * then this is an inline call to @c memcmp. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline bool + lexicographical_compare(_II1 __first1, _II1 __last1, + _II2 __first2, _II2 __last2) + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename iterator_traits<_II1>::value_type _ValueType1; + typedef typename iterator_traits<_II2>::value_type _ValueType2; +#endif + __glibcxx_function_requires(_InputIteratorConcept<_II1>) + __glibcxx_function_requires(_InputIteratorConcept<_II2>) + __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>) + __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__lexicographical_compare_aux(__first1, __last1, + __first2, __last2); + } + + /** + * @brief Performs @b dictionary comparison on ranges. + * @ingroup sorting_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @param __comp A @link comparison_functors comparison functor@endlink. + * @return A boolean true or false. + * + * The same as the four-parameter @c lexicographical_compare, but uses the + * comp parameter instead of @c <. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline bool + lexicographical_compare(_II1 __first1, _II1 __last1, + _II2 __first2, _II2 __last2, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II1>) + __glibcxx_function_requires(_InputIteratorConcept<_II2>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__lexicographical_compare_impl + (__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + +#if __cpp_lib_three_way_comparison + // Both iterators refer to contiguous ranges of unsigned narrow characters, + // or std::byte, or big-endian unsigned integers, suitable for comparison + // using memcmp. + template + concept __memcmp_ordered_with + = (__is_memcmp_ordered_with, + iter_value_t<_Iter2>>::__value) + && contiguous_iterator<_Iter1> && contiguous_iterator<_Iter2>; + + // Return a struct with two members, initialized to the smaller of x and y + // (or x if they compare equal) and the result of the comparison x <=> y. + template + constexpr auto + __min_cmp(_Tp __x, _Tp __y) + { + struct _Res { + _Tp _M_min; + decltype(__x <=> __y) _M_cmp; + }; + auto __c = __x <=> __y; + if (__c > 0) + return _Res{__y, __c}; + return _Res{__x, __c}; + } + + /** + * @brief Performs dictionary comparison on ranges. + * @ingroup sorting_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @param __comp A @link comparison_functors comparison functor@endlink. + * @return The comparison category that `__comp(*__first1, *__first2)` + * returns. + */ + template + [[nodiscard]] constexpr auto + lexicographical_compare_three_way(_InputIter1 __first1, + _InputIter1 __last1, + _InputIter2 __first2, + _InputIter2 __last2, + _Comp __comp) + -> decltype(__comp(*__first1, *__first2)) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIter1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIter2>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + using _Cat = decltype(__comp(*__first1, *__first2)); + static_assert(same_as, _Cat>); + + if (!std::__is_constant_evaluated()) + if constexpr (same_as<_Comp, __detail::_Synth3way> + || same_as<_Comp, compare_three_way>) + if constexpr (__memcmp_ordered_with<_InputIter1, _InputIter2>) + { + const auto [__len, __lencmp] = _GLIBCXX_STD_A:: + __min_cmp(__last1 - __first1, __last2 - __first2); + if (__len) + { + const auto __blen = __len * sizeof(*__first1); + const auto __c + = __builtin_memcmp(&*__first1, &*__first2, __blen) <=> 0; + if (__c != 0) + return __c; + } + return __lencmp; + } + + while (__first1 != __last1) + { + if (__first2 == __last2) + return strong_ordering::greater; + if (auto __cmp = __comp(*__first1, *__first2); __cmp != 0) + return __cmp; + ++__first1; + ++__first2; + } + return (__first2 == __last2) <=> true; // See PR 94006 + } + + template + constexpr auto + lexicographical_compare_three_way(_InputIter1 __first1, + _InputIter1 __last1, + _InputIter2 __first2, + _InputIter2 __last2) + { + return _GLIBCXX_STD_A:: + lexicographical_compare_three_way(__first1, __last1, __first2, __last2, + compare_three_way{}); + } +#endif // three_way_comparison + + template + _GLIBCXX20_CONSTEXPR + pair<_InputIterator1, _InputIterator2> + __mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _BinaryPredicate __binary_pred) + { + while (__first1 != __last1 && __binary_pred(__first1, __first2)) + { + ++__first1; + ++__first2; + } + return pair<_InputIterator1, _InputIterator2>(__first1, __first2); + } + + /** + * @brief Finds the places in ranges which don't match. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @return A pair of iterators pointing to the first mismatch. + * + * This compares the elements of two ranges using @c == and returns a pair + * of iterators. The first iterator points into the first range, the + * second iterator points into the second range, and the elements pointed + * to by the iterators are not equal. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline pair<_InputIterator1, _InputIterator2> + mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + + return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Finds the places in ranges which don't match. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __binary_pred A binary predicate @link functors + * functor@endlink. + * @return A pair of iterators pointing to the first mismatch. + * + * This compares the elements of two ranges using the binary_pred + * parameter, and returns a pair + * of iterators. The first iterator points into the first range, the + * second iterator points into the second range, and the elements pointed + * to by the iterators are not equal. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline pair<_InputIterator1, _InputIterator2> + mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_requires_valid_range(__first1, __last1); + + return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, + __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); + } + +#if __glibcxx_robust_nonmodifying_seq_ops // C++ >= 14 + template + _GLIBCXX20_CONSTEXPR + pair<_InputIterator1, _InputIterator2> + __mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _BinaryPredicate __binary_pred) + { + while (__first1 != __last1 && __first2 != __last2 + && __binary_pred(__first1, __first2)) + { + ++__first1; + ++__first2; + } + return pair<_InputIterator1, _InputIterator2>(__first1, __first2); + } + + /** + * @brief Finds the places in ranges which don't match. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @return A pair of iterators pointing to the first mismatch. + * + * This compares the elements of two ranges using @c == and returns a pair + * of iterators. The first iterator points into the first range, the + * second iterator points into the second range, and the elements pointed + * to by the iterators are not equal. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline pair<_InputIterator1, _InputIterator2> + mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Finds the places in ranges which don't match. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @param __binary_pred A binary predicate @link functors + * functor@endlink. + * @return A pair of iterators pointing to the first mismatch. + * + * This compares the elements of two ranges using the binary_pred + * parameter, and returns a pair + * of iterators. The first iterator points into the first range, the + * second iterator points into the second range, and the elements pointed + * to by the iterators are not equal. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline pair<_InputIterator1, _InputIterator2> + mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); + } +#endif + +_GLIBCXX_END_NAMESPACE_ALGO + + // Implementation of std::find_if, also used in std::remove_if and others. + template + _GLIBCXX20_CONSTEXPR + inline _Iterator + __find_if(_Iterator __first, _Iterator __last, _Predicate __pred) + { +#pragma GCC unroll 4 + while (__first != __last && !__pred(__first)) + ++__first; + return __first; + } + + template + _GLIBCXX20_CONSTEXPR + typename iterator_traits<_InputIterator>::difference_type + __count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) + { + typename iterator_traits<_InputIterator>::difference_type __n = 0; + for (; __first != __last; ++__first) + if (__pred(__first)) + ++__n; + return __n; + } + + template + _GLIBCXX20_CONSTEXPR + _ForwardIterator + __remove_if(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred) + { + __first = std::__find_if(__first, __last, __pred); + if (__first == __last) + return __first; + _ForwardIterator __result = __first; + ++__first; + for (; __first != __last; ++__first) + if (!__pred(__first)) + { + *__result = _GLIBCXX_MOVE(*__first); + ++__result; + } + return __result; + } + + template + _GLIBCXX20_CONSTEXPR + _ForwardIterator1 + __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + _BinaryPredicate __predicate) + { + // Test for empty ranges + if (__first1 == __last1 || __first2 == __last2) + return __first1; + + // Test for a pattern of length 1. + _ForwardIterator2 __p1(__first2); + if (++__p1 == __last2) + return std::__find_if(__first1, __last1, + __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2)); + + // General case. + _ForwardIterator1 __current = __first1; + + for (;;) + { + __first1 = + std::__find_if(__first1, __last1, + __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2)); + + if (__first1 == __last1) + return __last1; + + _ForwardIterator2 __p = __p1; + __current = __first1; + if (++__current == __last1) + return __last1; + + while (__predicate(__current, __p)) + { + if (++__p == __last2) + return __first1; + if (++__current == __last1) + return __last1; + } + ++__first1; + } + return __first1; + } + +#if __cplusplus >= 201103L + template + _GLIBCXX20_CONSTEXPR + bool + __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _BinaryPredicate __pred) + { + // Efficiently compare identical prefixes: O(N) if sequences + // have the same elements in the same order. + for (; __first1 != __last1; ++__first1, (void)++__first2) + if (!__pred(__first1, __first2)) + break; + + if (__first1 == __last1) + return true; + + // Establish __last2 assuming equal ranges by iterating over the + // rest of the list. + _ForwardIterator2 __last2 = __first2; + std::advance(__last2, std::distance(__first1, __last1)); + for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan) + { + if (__scan != std::__find_if(__first1, __scan, + __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))) + continue; // We've seen this one before. + + auto __matches + = std::__count_if(__first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)); + if (0 == __matches || + std::__count_if(__scan, __last1, + __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)) + != __matches) + return false; + } + return true; + } + + /** + * @brief Checks whether a permutation of the second sequence is equal + * to the first sequence. + * @ingroup non_mutating_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @return true if there exists a permutation of the elements in the range + * [__first2, __first2 + (__last1 - __first1)), beginning with + * ForwardIterator2 begin, such that equal(__first1, __last1, begin) + * returns true; otherwise, returns false. + */ + template + _GLIBCXX20_CONSTEXPR + inline bool + is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_ForwardIterator1>::value_type, + typename iterator_traits<_ForwardIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + + return std::__is_permutation(__first1, __last1, __first2, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } +#endif // C++11 + +_GLIBCXX_BEGIN_NAMESPACE_ALGO + + /** + * @brief Search a sequence for a matching sub-sequence using a predicate. + * @ingroup non_mutating_algorithms + * @param __first1 A forward iterator. + * @param __last1 A forward iterator. + * @param __first2 A forward iterator. + * @param __last2 A forward iterator. + * @param __predicate A binary predicate. + * @return The first iterator @c i in the range + * @p [__first1,__last1-(__last2-__first2)) such that + * @p __predicate(*(i+N),*(__first2+N)) is true for each @c N in the range + * @p [0,__last2-__first2), or @p __last1 if no such iterator exists. + * + * Searches the range @p [__first1,__last1) for a sub-sequence that + * compares equal value-by-value with the sequence given by @p + * [__first2,__last2), using @p __predicate to determine equality, + * and returns an iterator to the first element of the + * sub-sequence, or @p __last1 if no such iterator exists. + * + * @see search(_ForwardIter1, _ForwardIter1, _ForwardIter2, _ForwardIter2) + */ + template + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator1 + search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + _BinaryPredicate __predicate) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIterator1>::value_type, + typename iterator_traits<_ForwardIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__search(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__predicate)); + } + +_GLIBCXX_END_NAMESPACE_ALGO +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +// NB: This file is included within many other C++ includes, as a way +// of getting the base algorithms. So, make sure that parallel bits +// come in too if requested. +#ifdef _GLIBCXX_PARALLEL +# include +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_algobase.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_algobase.h.blob new file mode 100644 index 0000000..2811774 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_algobase.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_bvector.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_bvector.h new file mode 100644 index 0000000..8cc2920 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_bvector.h @@ -0,0 +1,1841 @@ +// vector specialization -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_bvector.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{vector} + */ + +#ifndef _STL_BVECTOR_H +#define _STL_BVECTOR_H 1 + +#ifndef _GLIBCXX_ALWAYS_INLINE +#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + +#if __cplusplus >= 201103L +#include +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + typedef unsigned long _Bit_type; + enum { _S_word_bit = int(__CHAR_BIT__ * sizeof(_Bit_type)) }; + + __attribute__((__nonnull__)) + _GLIBCXX20_CONSTEXPR + void + __fill_bvector_n(_Bit_type*, size_t, bool) _GLIBCXX_NOEXCEPT; + +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + struct _Bit_reference + { + private: + template friend class vector; + friend struct _Bit_iterator; + friend struct _Bit_const_iterator; + + _GLIBCXX20_CONSTEXPR + _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { } + + _Bit_type * _M_p; + _Bit_type _M_mask; + + _GLIBCXX20_CONSTEXPR + _Bit_reference(_Bit_type * __x, _Bit_type __y) + : _M_p(__x), _M_mask(__y) { } + + public: +#if __cplusplus >= 201103L + _Bit_reference(const _Bit_reference&) = default; +#endif + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + operator bool() const _GLIBCXX_NOEXCEPT + { return !!(*_M_p & _M_mask); } + + _GLIBCXX20_CONSTEXPR + _Bit_reference& + operator=(bool __x) _GLIBCXX_NOEXCEPT + { + if (__x) + *_M_p |= _M_mask; + else + *_M_p &= ~_M_mask; + return *this; + } + +#if __cplusplus > 202002L + constexpr const _Bit_reference& + operator=(bool __x) const noexcept + { + if (__x) + *_M_p |= _M_mask; + else + *_M_p &= ~_M_mask; + return *this; + } +#endif // C++23 + + _GLIBCXX20_CONSTEXPR + _Bit_reference& + operator=(const _Bit_reference& __x) _GLIBCXX_NOEXCEPT + { return *this = bool(__x); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + bool + operator==(const _Bit_reference& __x) const + { return bool(*this) == bool(__x); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + bool + operator<(const _Bit_reference& __x) const + { return !bool(*this) && bool(__x); } + + _GLIBCXX20_CONSTEXPR + void + flip() _GLIBCXX_NOEXCEPT + { *_M_p ^= _M_mask; } + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + friend void + swap(_Bit_reference __x, _Bit_reference __y) noexcept + { + bool __tmp = __x; + __x = __y; + __y = __tmp; + } + + _GLIBCXX20_CONSTEXPR + friend void + swap(_Bit_reference __x, bool& __y) noexcept + { + bool __tmp = __x; + __x = __y; + __y = __tmp; + } + + _GLIBCXX20_CONSTEXPR + friend void + swap(bool& __x, _Bit_reference __y) noexcept + { + bool __tmp = __x; + __x = __y; + __y = __tmp; + } +#endif + }; + +// Ignore warnings about std::iterator. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + struct _Bit_iterator_base + : public std::iterator + { + _Bit_type * _M_p; + unsigned int _M_offset; + + _GLIBCXX20_CONSTEXPR _GLIBCXX_ALWAYS_INLINE + void + _M_assume_normalized() const + { +#if __has_attribute(__assume__) && !defined(_GLIBCXX_CLANG) + unsigned int __ofst = _M_offset; + __attribute__ ((__assume__ (__ofst < unsigned(_S_word_bit)))); +#endif + } + + _GLIBCXX20_CONSTEXPR + _Bit_iterator_base(_Bit_type * __x, unsigned int __y) + : _M_p(__x), _M_offset(__y) { } + + _GLIBCXX20_CONSTEXPR + void + _M_bump_up() + { + _M_assume_normalized(); + if (_M_offset++ == int(_S_word_bit) - 1) + { + _M_offset = 0; + ++_M_p; + } + } + + _GLIBCXX20_CONSTEXPR + void + _M_bump_down() + { + _M_assume_normalized(); + if (_M_offset-- == 0) + { + _M_offset = int(_S_word_bit) - 1; + --_M_p; + } + } + + _GLIBCXX20_CONSTEXPR + void + _M_incr(ptrdiff_t __i) + { + _M_assume_normalized(); + difference_type __n = __i + _M_offset; + _M_p += __n / int(_S_word_bit); + __n = __n % int(_S_word_bit); + if (__n < 0) + { + __n += int(_S_word_bit); + --_M_p; + } + _M_offset = static_cast(__n); + } + + _GLIBCXX_NODISCARD + friend _GLIBCXX20_CONSTEXPR bool + operator==(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) + { + __x._M_assume_normalized(); + __y._M_assume_normalized(); + return __x._M_p == __y._M_p && __x._M_offset == __y._M_offset; + } + +#if __cpp_lib_three_way_comparison + [[nodiscard]] + friend constexpr strong_ordering + operator<=>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) + noexcept + { + __x._M_assume_normalized(); + __y._M_assume_normalized(); + if (const auto __cmp = __x._M_p <=> __y._M_p; __cmp != 0) + return __cmp; + return __x._M_offset <=> __y._M_offset; + } +#else + _GLIBCXX_NODISCARD + friend bool + operator<(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) + { + __x._M_assume_normalized(); + __y._M_assume_normalized(); + return __x._M_p < __y._M_p + || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset); + } + + _GLIBCXX_NODISCARD + friend bool + operator!=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) + { return !(__x == __y); } + + _GLIBCXX_NODISCARD + friend bool + operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) + { return __y < __x; } + + _GLIBCXX_NODISCARD + friend bool + operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) + { return !(__y < __x); } + + _GLIBCXX_NODISCARD + friend bool + operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) + { return !(__x < __y); } +#endif // three-way comparison + + friend _GLIBCXX20_CONSTEXPR ptrdiff_t + operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) + { + __x._M_assume_normalized(); + __y._M_assume_normalized(); + return (int(_S_word_bit) * (__x._M_p - __y._M_p) + + __x._M_offset - __y._M_offset); + } + }; +#pragma GCC diagnostic pop + + struct _Bit_iterator : public _Bit_iterator_base + { + typedef _Bit_reference reference; +#if __cplusplus > 201703L + typedef void pointer; +#else + typedef _Bit_reference* pointer; +#endif + typedef _Bit_iterator iterator; + + _GLIBCXX20_CONSTEXPR + _Bit_iterator() : _Bit_iterator_base(0, 0) { } + + _GLIBCXX20_CONSTEXPR + _Bit_iterator(_Bit_type * __x, unsigned int __y) + : _Bit_iterator_base(__x, __y) { } + + _GLIBCXX20_CONSTEXPR + iterator + _M_const_cast() const + { return *this; } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + operator*() const + { + _M_assume_normalized(); + return reference(_M_p, 1UL << _M_offset); + } + + _GLIBCXX20_CONSTEXPR + iterator& + operator++() + { + _M_bump_up(); + return *this; + } + + _GLIBCXX20_CONSTEXPR + iterator + operator++(int) + { + iterator __tmp = *this; + _M_bump_up(); + return __tmp; + } + + _GLIBCXX20_CONSTEXPR + iterator& + operator--() + { + _M_bump_down(); + return *this; + } + + _GLIBCXX20_CONSTEXPR + iterator + operator--(int) + { + iterator __tmp = *this; + _M_bump_down(); + return __tmp; + } + + _GLIBCXX20_CONSTEXPR + iterator& + operator+=(difference_type __i) + { + _M_incr(__i); + return *this; + } + + _GLIBCXX20_CONSTEXPR + iterator& + operator-=(difference_type __i) + { + *this += -__i; + return *this; + } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + operator[](difference_type __i) const + { return *(*this + __i); } + + _GLIBCXX_NODISCARD + friend _GLIBCXX20_CONSTEXPR iterator + operator+(const iterator& __x, difference_type __n) + { + iterator __tmp = __x; + __tmp += __n; + return __tmp; + } + + _GLIBCXX_NODISCARD + friend _GLIBCXX20_CONSTEXPR iterator + operator+(difference_type __n, const iterator& __x) + { return __x + __n; } + + _GLIBCXX_NODISCARD + friend _GLIBCXX20_CONSTEXPR iterator + operator-(const iterator& __x, difference_type __n) + { + iterator __tmp = __x; + __tmp -= __n; + return __tmp; + } + }; + + struct _Bit_const_iterator : public _Bit_iterator_base + { + typedef bool reference; + typedef bool const_reference; +#if __cplusplus > 201703L + typedef void pointer; +#else + typedef const bool* pointer; +#endif + typedef _Bit_const_iterator const_iterator; + + _GLIBCXX20_CONSTEXPR + _Bit_const_iterator() : _Bit_iterator_base(0, 0) { } + + _GLIBCXX20_CONSTEXPR + _Bit_const_iterator(_Bit_type * __x, unsigned int __y) + : _Bit_iterator_base(__x, __y) { } + + _GLIBCXX20_CONSTEXPR + _Bit_const_iterator(const _Bit_iterator& __x) + : _Bit_iterator_base(__x._M_p, __x._M_offset) { } + + _GLIBCXX20_CONSTEXPR + _Bit_iterator + _M_const_cast() const + { return _Bit_iterator(_M_p, _M_offset); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + operator*() const + { + _M_assume_normalized(); + return _Bit_reference(_M_p, 1UL << _M_offset); + } + + _GLIBCXX20_CONSTEXPR + const_iterator& + operator++() + { + _M_bump_up(); + return *this; + } + + _GLIBCXX20_CONSTEXPR + const_iterator + operator++(int) + { + const_iterator __tmp = *this; + _M_bump_up(); + return __tmp; + } + + _GLIBCXX20_CONSTEXPR + const_iterator& + operator--() + { + _M_bump_down(); + return *this; + } + + _GLIBCXX20_CONSTEXPR + const_iterator + operator--(int) + { + const_iterator __tmp = *this; + _M_bump_down(); + return __tmp; + } + + _GLIBCXX20_CONSTEXPR + const_iterator& + operator+=(difference_type __i) + { + _M_incr(__i); + return *this; + } + + _GLIBCXX20_CONSTEXPR + const_iterator& + operator-=(difference_type __i) + { + *this += -__i; + return *this; + } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + operator[](difference_type __i) const + { return *(*this + __i); } + + _GLIBCXX_NODISCARD + friend _GLIBCXX20_CONSTEXPR const_iterator + operator+(const const_iterator& __x, difference_type __n) + { + const_iterator __tmp = __x; + __tmp += __n; + return __tmp; + } + + _GLIBCXX_NODISCARD + friend _GLIBCXX20_CONSTEXPR const_iterator + operator-(const const_iterator& __x, difference_type __n) + { + const_iterator __tmp = __x; + __tmp -= __n; + return __tmp; + } + + _GLIBCXX_NODISCARD + friend _GLIBCXX20_CONSTEXPR const_iterator + operator+(difference_type __n, const const_iterator& __x) + { return __x + __n; } + }; + + template + struct _Bvector_base + { + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_Bit_type>::other _Bit_alloc_type; + typedef typename __gnu_cxx::__alloc_traits<_Bit_alloc_type> + _Bit_alloc_traits; + typedef typename _Bit_alloc_traits::pointer _Bit_pointer; + + struct _Bvector_impl_data + { +#if !_GLIBCXX_INLINE_VERSION + _Bit_iterator _M_start; +#else + // We don't need the offset field for the start, it's always zero. + struct { + _Bit_type* _M_p; + // Allow assignment from iterators (assume offset is zero): + _GLIBCXX20_CONSTEXPR + void operator=(_Bit_iterator __it) { _M_p = __it._M_p; } + } _M_start; +#endif + _Bit_iterator _M_finish; + _Bit_pointer _M_end_of_storage; + + _GLIBCXX20_CONSTEXPR + _Bvector_impl_data() _GLIBCXX_NOEXCEPT + : _M_start(), _M_finish(), _M_end_of_storage() + { } + +#if __cplusplus >= 201103L + _Bvector_impl_data(const _Bvector_impl_data&) = default; + + _Bvector_impl_data& + operator=(const _Bvector_impl_data&) = default; + + _GLIBCXX20_CONSTEXPR + _Bvector_impl_data(_Bvector_impl_data&& __x) noexcept + : _Bvector_impl_data(__x) + { __x._M_reset(); } + + _GLIBCXX20_CONSTEXPR + void + _M_move_data(_Bvector_impl_data&& __x) noexcept + { + *this = __x; + __x._M_reset(); + } +#endif + + _GLIBCXX20_CONSTEXPR + void + _M_reset() _GLIBCXX_NOEXCEPT + { *this = _Bvector_impl_data(); } + + _GLIBCXX20_CONSTEXPR + void + _M_swap_data(_Bvector_impl_data& __x) _GLIBCXX_NOEXCEPT + { + // Do not use std::swap(_M_start, __x._M_start), etc as it loses + // information used by TBAA. + std::swap(*this, __x); + } + }; + + struct _Bvector_impl + : public _Bit_alloc_type, public _Bvector_impl_data + { + _GLIBCXX20_CONSTEXPR + _Bvector_impl() _GLIBCXX_NOEXCEPT_IF( + is_nothrow_default_constructible<_Bit_alloc_type>::value) +#if __cpp_concepts && __glibcxx_type_trait_variable_templates + requires is_default_constructible_v<_Bit_alloc_type> +#endif + : _Bit_alloc_type() + { } + + _GLIBCXX20_CONSTEXPR + _Bvector_impl(const _Bit_alloc_type& __a) _GLIBCXX_NOEXCEPT + : _Bit_alloc_type(__a) + { } + +#if __cplusplus >= 201103L + // Not defaulted, to enforce noexcept(true) even when + // !is_nothrow_move_constructible<_Bit_alloc_type>. + _GLIBCXX20_CONSTEXPR + _Bvector_impl(_Bvector_impl&& __x) noexcept + : _Bit_alloc_type(std::move(__x)), _Bvector_impl_data(std::move(__x)) + { } + + _GLIBCXX20_CONSTEXPR + _Bvector_impl(_Bit_alloc_type&& __a, _Bvector_impl&& __x) noexcept + : _Bit_alloc_type(std::move(__a)), _Bvector_impl_data(std::move(__x)) + { } +#endif + + _GLIBCXX20_CONSTEXPR + _Bit_type* + _M_end_addr() const _GLIBCXX_NOEXCEPT + { + if (this->_M_end_of_storage) + return std::__addressof(this->_M_end_of_storage[-1]) + 1; + return 0; + } + }; + + public: + typedef _Alloc allocator_type; + + _GLIBCXX20_CONSTEXPR + _Bit_alloc_type& + _M_get_Bit_allocator() _GLIBCXX_NOEXCEPT + { return this->_M_impl; } + + _GLIBCXX20_CONSTEXPR + const _Bit_alloc_type& + _M_get_Bit_allocator() const _GLIBCXX_NOEXCEPT + { return this->_M_impl; } + + _GLIBCXX20_CONSTEXPR + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_get_Bit_allocator()); } + +#if __cplusplus >= 201103L + _Bvector_base() = default; +#else + _Bvector_base() { } +#endif + + _GLIBCXX20_CONSTEXPR + _Bvector_base(const allocator_type& __a) + : _M_impl(_Bit_alloc_type(__a)) { } + +#if __cplusplus >= 201103L + _Bvector_base(_Bvector_base&&) = default; + + _GLIBCXX20_CONSTEXPR + _Bvector_base(_Bvector_base&& __x, const allocator_type& __a) noexcept + : _M_impl(_Bit_alloc_type(__a), std::move(__x._M_impl)) + { } +#endif + + _GLIBCXX20_CONSTEXPR + ~_Bvector_base() + { this->_M_deallocate(); } + + protected: + _Bvector_impl _M_impl; + + _GLIBCXX20_CONSTEXPR + _Bit_pointer + _M_allocate(size_t __n) + { + _Bit_pointer __p = _Bit_alloc_traits::allocate(_M_impl, _S_nword(__n)); +#if __cpp_lib_is_constant_evaluated && __cpp_constexpr_dynamic_alloc + if (std::is_constant_evaluated()) + { + __n = _S_nword(__n); + for (size_t __i = 0; __i < __n; ++__i) + std::construct_at(std::to_address(__p) + __i); + } +#endif + return __p; + } + + _GLIBCXX20_CONSTEXPR + void + _M_deallocate() + { + if (_M_impl._M_start._M_p) + { + const size_t __n = _M_impl._M_end_addr() - _M_impl._M_start._M_p; + _Bit_alloc_traits::deallocate(_M_impl, + _M_impl._M_end_of_storage - __n, + __n); + _M_impl._M_reset(); + } + } + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + void + _M_move_data(_Bvector_base&& __x) noexcept + { _M_impl._M_move_data(std::move(__x._M_impl)); } +#endif + + _GLIBCXX_CONSTEXPR + static size_t + _S_nword(size_t __n) + { return (__n + int(_S_word_bit) - 1) / int(_S_word_bit); } + }; + + /** + * @brief A specialization of vector for booleans which offers fixed time + * access to individual elements in any order. + * + * @ingroup sequences + * @headerfile vector + * @since C++98 + * + * @tparam _Alloc Allocator type. + * + * Note that vector does not actually meet the requirements for being + * a container. This is because the reference and pointer types are not + * really references and pointers to bool. See DR96 for details. @see + * vector for function documentation. + * + * In some terminology a %vector can be described as a dynamic + * C-style array, it offers fast and efficient access to individual + * elements in any order and saves the user from worrying about + * memory and size allocation. Subscripting ( @c [] ) access is + * also provided as with C-style arrays. + */ + template + class vector : protected _Bvector_base<_Alloc> + { + typedef _Bvector_base<_Alloc> _Base; + typedef typename _Base::_Bit_pointer _Bit_pointer; + typedef typename _Base::_Bit_alloc_traits _Bit_alloc_traits; + +#if __cplusplus >= 201103L + friend struct std::hash; +# if __cplusplus > 201703L // || defined __STRICT_ANSI__ + static_assert(is_same::value, + "std::vector must have the same value_type as its allocator"); +# endif +#endif + + public: + typedef bool value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Bit_reference reference; + typedef bool const_reference; + typedef _Bit_reference* pointer; + typedef const bool* const_pointer; + typedef _Bit_iterator iterator; + typedef _Bit_const_iterator const_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef _Alloc allocator_type; + + _GLIBCXX20_CONSTEXPR + allocator_type + get_allocator() const + { return _Base::get_allocator(); } + + protected: + using _Base::_M_allocate; + using _Base::_M_deallocate; + using _Base::_S_nword; + using _Base::_M_get_Bit_allocator; + + public: +#if __cplusplus >= 201103L + vector() = default; +#else + vector() { } +#endif + + _GLIBCXX20_CONSTEXPR + explicit + vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT + : _Base(__a) { } + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + explicit + vector(size_type __n, const allocator_type& __a = allocator_type()) + : vector(__n, false, __a) + { } + + _GLIBCXX20_CONSTEXPR + vector(size_type __n, const bool& __value, + const allocator_type& __a = allocator_type()) +#else + explicit + vector(size_type __n, const bool& __value = bool(), + const allocator_type& __a = allocator_type()) +#endif + : _Base(__a) + { + _M_initialize(__n); + _M_initialize_value(__value); + } + + _GLIBCXX20_CONSTEXPR + vector(const vector& __x) + : _Base(_Bit_alloc_traits::_S_select_on_copy(__x._M_get_Bit_allocator())) + { + const_iterator __xbegin = __x.begin(), __xend = __x.end(); + _M_initialize(__x.size()); + _M_copy_aligned(__xbegin, __xend, begin()); + } + +#if __cplusplus >= 201103L + vector(vector&&) = default; + + private: + _GLIBCXX20_CONSTEXPR + vector(vector&& __x, const allocator_type& __a, true_type) noexcept + : _Base(std::move(__x), __a) + { } + + _GLIBCXX20_CONSTEXPR + vector(vector&& __x, const allocator_type& __a, false_type) + : _Base(__a) + { + if (__x.get_allocator() == __a) + this->_M_move_data(std::move(__x)); + else + { + _M_initialize(__x.size()); + _M_copy_aligned(__x.begin(), __x.end(), begin()); + __x.clear(); + } + } + + public: + _GLIBCXX20_CONSTEXPR + vector(vector&& __x, const __type_identity_t& __a) + noexcept(_Bit_alloc_traits::_S_always_equal()) + : vector(std::move(__x), __a, + typename _Bit_alloc_traits::is_always_equal{}) + { } + + _GLIBCXX20_CONSTEXPR + vector(const vector& __x, const __type_identity_t& __a) + : _Base(__a) + { + _M_initialize(__x.size()); + _M_copy_aligned(__x.begin(), __x.end(), begin()); + } + + _GLIBCXX20_CONSTEXPR + vector(initializer_list __l, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_initialize_range(__l.begin(), __l.end(), + random_access_iterator_tag()); + } +#endif + +#if __cplusplus >= 201103L + template> + _GLIBCXX20_CONSTEXPR + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_initialize_range(__first, __last, + std::__iterator_category(__first)); + } +#else + template + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Construct a vector from a range. + * @param __rg A range of values that are convertible to `value_type`. + * @since C++23 + */ + template<__detail::__container_compatible_range _Rg> + constexpr + vector(from_range_t, _Rg&& __rg, const _Alloc& __a = _Alloc()) + : _Base(__a) + { + if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) + { + _M_initialize(size_type(ranges::distance(__rg))); + ranges::copy(__rg, begin()); + } + else + { + auto __first = ranges::begin(__rg); + const auto __last = ranges::end(__rg); + for (; __first != __last; ++__first) + emplace_back(*__first); + } + } +#endif + + _GLIBCXX20_CONSTEXPR + ~vector() _GLIBCXX_NOEXCEPT { } + + _GLIBCXX20_CONSTEXPR + vector& + operator=(const vector& __x) + { + if (&__x == this) + return *this; +#if __cplusplus >= 201103L + if (_Bit_alloc_traits::_S_propagate_on_copy_assign()) + { + if (this->_M_get_Bit_allocator() != __x._M_get_Bit_allocator()) + { + this->_M_deallocate(); + std::__alloc_on_copy(_M_get_Bit_allocator(), + __x._M_get_Bit_allocator()); + _M_initialize(__x.size()); + } + else + std::__alloc_on_copy(_M_get_Bit_allocator(), + __x._M_get_Bit_allocator()); + } +#endif + if (__x.size() > capacity()) + { + this->_M_deallocate(); + _M_initialize(__x.size()); + } + this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(), + begin()); + return *this; + } + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + vector& + operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move()) + { + if (_Bit_alloc_traits::_S_propagate_on_move_assign() + || this->_M_get_Bit_allocator() == __x._M_get_Bit_allocator()) + { + this->_M_deallocate(); + this->_M_move_data(std::move(__x)); + std::__alloc_on_move(_M_get_Bit_allocator(), + __x._M_get_Bit_allocator()); + } + else + { + if (__x.size() > capacity()) + { + this->_M_deallocate(); + _M_initialize(__x.size()); + } + this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(), + begin()); + __x.clear(); + } + return *this; + } + + _GLIBCXX20_CONSTEXPR + vector& + operator=(initializer_list __l) + { + this->assign(__l.begin(), __l.end()); + return *this; + } +#endif + + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + _GLIBCXX20_CONSTEXPR + void + assign(size_type __n, const bool& __x) + { _M_fill_assign(__n, __x); } + +#if __cplusplus >= 201103L + template> + _GLIBCXX20_CONSTEXPR + void + assign(_InputIterator __first, _InputIterator __last) + { _M_assign_aux(__first, __last, std::__iterator_category(__first)); } +#else + template + void + assign(_InputIterator __first, _InputIterator __last) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } +#endif + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + void + assign(initializer_list __l) + { _M_assign_aux(__l.begin(), __l.end(), random_access_iterator_tag()); } +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Assign a range to the vector. + * @param __rg A range of values that are convertible to `value_type`. + * @pre `__rg` and `*this` do not overlap. + * @since C++23 + */ + template<__detail::__container_compatible_range _Rg> + constexpr void + assign_range(_Rg&& __rg) + { + static_assert(assignable_from>); + if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) + { + if (auto __n = size_type(ranges::distance(__rg))) + { + reserve(__n); + this->_M_impl._M_finish + = ranges::copy(std::forward<_Rg>(__rg), begin()).out; + } + else + clear(); + } + else + { + clear(); + auto __first = ranges::begin(__rg); + const auto __last = ranges::end(__rg); + for (; __first != __last; ++__first) + emplace_back(*__first); + } + } +#endif + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(this->_M_impl._M_start._M_p, 0); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(this->_M_impl._M_start._M_p, 0); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + iterator + end() _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_finish; } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_finish; } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + [[__nodiscard__]] _GLIBCXX20_CONSTEXPR + const_iterator + cbegin() const noexcept + { return const_iterator(this->_M_impl._M_start._M_p, 0); } + + [[__nodiscard__]] _GLIBCXX20_CONSTEXPR + const_iterator + cend() const noexcept + { return this->_M_impl._M_finish; } + + [[__nodiscard__]] _GLIBCXX20_CONSTEXPR + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + [[__nodiscard__]] _GLIBCXX20_CONSTEXPR + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + size() const _GLIBCXX_NOEXCEPT + { return size_type(end() - begin()); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + max_size() const _GLIBCXX_NOEXCEPT + { + const size_type __isize = + __gnu_cxx::__numeric_traits::__max + - int(_S_word_bit) + 1; + const size_type __asize + = _Bit_alloc_traits::max_size(_M_get_Bit_allocator()); + return (__asize <= __isize / int(_S_word_bit) + ? __asize * int(_S_word_bit) : __isize); + } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + capacity() const _GLIBCXX_NOEXCEPT + { return size_type(const_iterator(this->_M_impl._M_end_addr(), 0) + - begin()); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + bool + empty() const _GLIBCXX_NOEXCEPT + { return begin() == end(); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + operator[](size_type __n) + { + __glibcxx_requires_subscript(__n); + return _Bit_reference (this->_M_impl._M_start._M_p + + __n / int(_S_word_bit), + 1UL << __n % int(_S_word_bit)); + } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + operator[](size_type __n) const + { + __glibcxx_requires_subscript(__n); + return _Bit_reference (this->_M_impl._M_start._M_p + + __n / int(_S_word_bit), + 1UL << __n % int(_S_word_bit)); + } + + protected: + _GLIBCXX20_CONSTEXPR + void + _M_range_check(size_type __n) const + { + if (__n >= this->size()) + __throw_out_of_range_fmt(__N("vector::_M_range_check: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + } + + public: + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + at(size_type __n) + { + _M_range_check(__n); + return (*this)[__n]; + } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + at(size_type __n) const + { + _M_range_check(__n); + return (*this)[__n]; + } + + _GLIBCXX20_CONSTEXPR + void + reserve(size_type __n) + { + if (__n > max_size()) + __throw_length_error(__N("vector::reserve")); + if (capacity() < __n) + _M_reallocate(__n); + } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + front() + { + __glibcxx_requires_nonempty(); + return *begin(); + } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + front() const + { + __glibcxx_requires_nonempty(); + return *begin(); + } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + back() + { + __glibcxx_requires_nonempty(); + return *(end() - 1); + } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + back() const + { + __glibcxx_requires_nonempty(); + return *(end() - 1); + } + + _GLIBCXX20_CONSTEXPR + void + push_back(bool __x) + { + if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()) + *this->_M_impl._M_finish++ = __x; + else + _M_insert_aux(end(), __x); + } + + _GLIBCXX20_CONSTEXPR + void + swap(vector& __x) _GLIBCXX_NOEXCEPT + { +#if __cplusplus >= 201103L + __glibcxx_assert(_Bit_alloc_traits::propagate_on_container_swap::value + || _M_get_Bit_allocator() == __x._M_get_Bit_allocator()); +#endif + this->_M_impl._M_swap_data(__x._M_impl); + _Bit_alloc_traits::_S_on_swap(_M_get_Bit_allocator(), + __x._M_get_Bit_allocator()); + } + + // [23.2.5]/1, third-to-last entry in synopsis listing + _GLIBCXX20_CONSTEXPR + static void + swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT + { + bool __tmp = __x; + __x = __y; + __y = __tmp; + } + + _GLIBCXX20_CONSTEXPR + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const bool& __x) +#else + insert(iterator __position, const bool& __x) +#endif + { + const difference_type __n = __position - begin(); + if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr() + && __position == end()) + *this->_M_impl._M_finish++ = __x; + else + _M_insert_aux(__position._M_const_cast(), __x); + return begin() + __n; + } + +#if _GLIBCXX_USE_DEPRECATED + _GLIBCXX_DEPRECATED_SUGGEST("insert(position, false)") + iterator + insert(const_iterator __position) + { return this->insert(__position._M_const_cast(), false); } +#endif + +#if __cplusplus >= 201103L + template> + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __position, + _InputIterator __first, _InputIterator __last) + { + difference_type __offset = __position - cbegin(); + _M_insert_range(__position._M_const_cast(), + __first, __last, + std::__iterator_category(__first)); + return begin() + __offset; + } +#else + template + void + insert(iterator __position, + _InputIterator __first, _InputIterator __last) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_insert_dispatch(__position, __first, __last, _Integral()); + } +#endif + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __position, size_type __n, const bool& __x) + { + difference_type __offset = __position - cbegin(); + _M_fill_insert(__position._M_const_cast(), __n, __x); + return begin() + __offset; + } +#else + void + insert(iterator __position, size_type __n, const bool& __x) + { _M_fill_insert(__position, __n, __x); } +#endif + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __p, initializer_list __l) + { return this->insert(__p, __l.begin(), __l.end()); } +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Insert a range into the vector. + * @param __rg A range of values that are convertible to `bool`. + * @return An iterator that points to the first new element inserted, + * or to `__pos` if `__rg` is an empty range. + * @pre `__rg` and `*this` do not overlap. + * @since C++23 + */ + template<__detail::__container_compatible_range _Rg> + constexpr iterator + insert_range(const_iterator __pos, _Rg&& __rg) + { + if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) + { + if (auto __n = size_type(ranges::distance(__rg))) + { + if (capacity() - size() >= __n) + { + std::copy_backward(__pos._M_const_cast(), end(), + this->_M_impl._M_finish + + difference_type(__n)); + ranges::copy(__rg, __pos._M_const_cast()); + this->_M_impl._M_finish += difference_type(__n); + return __pos._M_const_cast(); + } + else + { + const size_type __len = + _M_check_len(__n, "vector::insert_range"); + const iterator __begin = begin(), __end = end(); + _Bit_pointer __q = this->_M_allocate(__len); + iterator __start(std::__addressof(*__q), 0); + iterator __i = _M_copy_aligned(__begin, + __pos._M_const_cast(), + __start); + iterator __j = ranges::copy(__rg, __i).out; + iterator __finish = std::copy(__pos._M_const_cast(), + __end, __j); + this->_M_deallocate(); + this->_M_impl._M_end_of_storage = __q + _S_nword(__len); + this->_M_impl._M_start = __start; + this->_M_impl._M_finish = __finish; + return __i; + } + } + else + return __pos._M_const_cast(); + } + else + return insert_range(__pos, + vector(from_range, __rg, get_allocator())); + } + + /** + * @brief Append a range at the end of the vector. + * @since C++23 + */ + template<__detail::__container_compatible_range _Rg> + constexpr void + append_range(_Rg&& __rg) + { + // N.B. __rg may overlap with *this, so we must copy from __rg before + // existing elements or iterators referring to *this are invalidated. + // e.g. in v.append_range(views::concat(v, foo)) rg overlaps v. + if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) + { + const auto __n = size_type(ranges::distance(__rg)); + + // If there is no existing storage, there are no iterators that + // can be referring to our storage, so it's safe to allocate now. + if (capacity() == 0) + reserve(__n); + + const auto __sz = size(); + const auto __capacity = capacity(); + if ((__capacity - __sz) >= __n) + { + this->_M_impl._M_finish + = ranges::copy(std::forward<_Rg>(__rg), end()).out; + return; + } + + vector __tmp(get_allocator()); + __tmp.reserve(_M_check_len(__n, "vector::append_range")); + __tmp._M_impl._M_finish + = _M_copy_aligned(cbegin(), cend(), __tmp.begin()); + __tmp._M_impl._M_finish + = ranges::copy(std::forward<_Rg>(__rg), __tmp.end()).out; + swap(__tmp); + } + else + { + auto __first = ranges::begin(__rg); + const auto __last = ranges::end(__rg); + + // Fill up to the end of current capacity. + for (auto __free = capacity() - size(); + __first != __last && __free > 0; + ++__first, (void) --__free) + emplace_back(*__first); + + if (__first == __last) + return; + + // Copy the rest of the range to a new vector. + ranges::subrange __rest(std::move(__first), __last); + vector __tmp(from_range, __rest, get_allocator()); + insert(end(), __tmp.begin(), __tmp.end()); + } + } +#endif // containers_ranges + + _GLIBCXX20_CONSTEXPR + void + pop_back() + { --this->_M_impl._M_finish; } + + _GLIBCXX20_CONSTEXPR + iterator +#if __cplusplus >= 201103L + erase(const_iterator __position) +#else + erase(iterator __position) +#endif + { return _M_erase(__position._M_const_cast()); } + + _GLIBCXX20_CONSTEXPR + iterator +#if __cplusplus >= 201103L + erase(const_iterator __first, const_iterator __last) +#else + erase(iterator __first, iterator __last) +#endif + { return _M_erase(__first._M_const_cast(), __last._M_const_cast()); } + + _GLIBCXX20_CONSTEXPR + void + resize(size_type __new_size, bool __x = bool()) + { + if (__new_size < size()) + _M_erase_at_end(begin() + difference_type(__new_size)); + else + insert(end(), __new_size - size(), __x); + } + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + void + shrink_to_fit() + { _M_shrink_to_fit(); } +#endif + + _GLIBCXX20_CONSTEXPR + void + flip() _GLIBCXX_NOEXCEPT + { + _Bit_type * const __end = this->_M_impl._M_end_addr(); + for (_Bit_type * __p = this->_M_impl._M_start._M_p; __p != __end; ++__p) + *__p = ~*__p; + } + + _GLIBCXX20_CONSTEXPR + void + clear() _GLIBCXX_NOEXCEPT + { _M_erase_at_end(begin()); } + +#if __cplusplus >= 201103L + template +#if __cplusplus > 201402L + _GLIBCXX20_CONSTEXPR + reference +#else + void +#endif + emplace_back(_Args&&... __args) + { + push_back(bool(std::forward<_Args>(__args)...)); +#if __cplusplus > 201402L + return back(); +#endif + } + + template + _GLIBCXX20_CONSTEXPR + iterator + emplace(const_iterator __pos, _Args&&... __args) + { return insert(__pos, bool(std::forward<_Args>(__args)...)); } +#endif + + protected: + // Precondition: __first._M_offset == 0 && __result._M_offset == 0. + _GLIBCXX20_CONSTEXPR + iterator + _M_copy_aligned(const_iterator __first, const_iterator __last, + iterator __result) + { + _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p); + return std::copy(const_iterator(__last._M_p, 0), __last, + iterator(__q, 0)); + } + + _GLIBCXX20_CONSTEXPR + void + _M_initialize(size_type __n) + { + if (__n) + { + _Bit_pointer __q = this->_M_allocate(__n); + this->_M_impl._M_end_of_storage = __q + _S_nword(__n); + iterator __start = iterator(std::__addressof(*__q), 0); + this->_M_impl._M_start = __start; + this->_M_impl._M_finish = __start + difference_type(__n); + } + } + + _GLIBCXX20_CONSTEXPR + void + _M_initialize_value(bool __x) _GLIBCXX_NOEXCEPT + { + if (_Bit_type* __p = this->_M_impl._M_start._M_p) + __fill_bvector_n(__p, this->_M_impl._M_end_addr() - __p, __x); + } + + _GLIBCXX20_CONSTEXPR + void + _M_reallocate(size_type __n); + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + bool + _M_shrink_to_fit(); +#endif + +#if __cplusplus < 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) + { + _M_initialize(static_cast(__n)); + _M_initialize_value(__x); + } + + template + void + _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { _M_initialize_range(__first, __last, + std::__iterator_category(__first)); } +#endif + + template + _GLIBCXX20_CONSTEXPR + void + _M_initialize_range(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag) + { + for (; __first != __last; ++__first) + push_back(*__first); + } + + template + _GLIBCXX20_CONSTEXPR + void + _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { + const size_type __n = std::distance(__first, __last); + _M_initialize(__n); + std::copy(__first, __last, begin()); + } + +#if __cplusplus < 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign(__n, __val); } + + template + void + _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { _M_assign_aux(__first, __last, std::__iterator_category(__first)); } +#endif + + _GLIBCXX20_CONSTEXPR + void + _M_fill_assign(size_t __n, bool __x) + { + if (__n > size()) + { + _M_initialize_value(__x); + insert(end(), __n - size(), __x); + } + else + { + _M_erase_at_end(begin() + __n); + _M_initialize_value(__x); + } + } + + template + _GLIBCXX20_CONSTEXPR + void + _M_assign_aux(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag) + { + iterator __cur = begin(); + for (; __first != __last && __cur != end(); ++__cur, (void)++__first) + *__cur = *__first; + if (__first == __last) + _M_erase_at_end(__cur); + else + insert(end(), __first, __last); + } + + template + _GLIBCXX20_CONSTEXPR + void + _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { + const size_type __len = std::distance(__first, __last); + if (__len < size()) + _M_erase_at_end(std::copy(__first, __last, begin())); + else + { + _ForwardIterator __mid = __first; + std::advance(__mid, size()); + std::copy(__first, __mid, begin()); + insert(end(), __mid, __last); + } + } + +#if __cplusplus < 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, + __true_type) + { _M_fill_insert(__pos, __n, __x); } + + template + void + _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + __false_type) + { _M_insert_range(__pos, __first, __last, + std::__iterator_category(__first)); } +#endif + + _GLIBCXX20_CONSTEXPR + void + _M_fill_insert(iterator __position, size_type __n, bool __x); + + template + _GLIBCXX20_CONSTEXPR + void + _M_insert_range(iterator __pos, _InputIterator __first, + _InputIterator __last, std::input_iterator_tag) + { + for (; __first != __last; ++__first) + { + __pos = insert(__pos, *__first); + ++__pos; + } + } + + template + _GLIBCXX20_CONSTEXPR + void + _M_insert_range(iterator __position, _ForwardIterator __first, + _ForwardIterator __last, std::forward_iterator_tag); + + _GLIBCXX20_CONSTEXPR + void + _M_insert_aux(iterator __position, bool __x); + + _GLIBCXX20_CONSTEXPR + size_type + _M_check_len(size_type __n, const char* __s) const + { + if (max_size() - size() < __n) + __throw_length_error(__N(__s)); + + const size_type __len = size() + std::max(size(), __n); + return (__len < size() || __len > max_size()) ? max_size() : __len; + } + + _GLIBCXX20_CONSTEXPR + void + _M_erase_at_end(iterator __pos) + { this->_M_impl._M_finish = __pos; } + + _GLIBCXX20_CONSTEXPR + iterator + _M_erase(iterator __pos); + + _GLIBCXX20_CONSTEXPR + iterator + _M_erase(iterator __first, iterator __last); + + protected: + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 464. Suggestion for new member functions in standard containers. + // N.B. DR 464 says nothing about vector but we need something + // here due to the using-declaration in __gnu_debug::vector. + // vector class. +#if __cplusplus >= 201103L + void data() = delete; +#else + void data() { } +#endif + }; + +_GLIBCXX_END_NAMESPACE_CONTAINER + + // Fill a partial word. + _GLIBCXX20_CONSTEXPR + inline void + __fill_bvector(_Bit_type* __v, unsigned int __first, unsigned int __last, + bool __x) _GLIBCXX_NOEXCEPT + { + const _Bit_type __fmask = ~0ul << __first; + const _Bit_type __lmask = ~0ul >> (_S_word_bit - __last); + const _Bit_type __mask = __fmask & __lmask; + + if (__x) + *__v |= __mask; + else + *__v &= ~__mask; + } + + // Fill N full words, as if using memset, but usable in constant expressions. + __attribute__((__nonnull__)) + _GLIBCXX20_CONSTEXPR + inline void + __fill_bvector_n(_Bit_type* __p, size_t __n, bool __x) _GLIBCXX_NOEXCEPT + { +#if __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + { + for (size_t __i = 0; __i < __n; ++__i) + __p[__i] = __x ? ~0ul : 0ul; + return; + } +#endif + __builtin_memset(__p, __x ? ~0 : 0, __n * sizeof(_Bit_type)); + } + + + _GLIBCXX20_CONSTEXPR + inline void + __fill_a1(_GLIBCXX_STD_C::_Bit_iterator __first, + _GLIBCXX_STD_C::_Bit_iterator __last, const bool& __x) + { + if (__first._M_p != __last._M_p) + { + _Bit_type* __first_p = __first._M_p; + if (__first._M_offset != 0) + __fill_bvector(__first_p++, __first._M_offset, _S_word_bit, __x); + + __fill_bvector_n(__first_p, __last._M_p - __first_p, __x); + + if (__last._M_offset != 0) + __fill_bvector(__last._M_p, 0, __last._M_offset, __x); + } + else if (__first._M_offset != __last._M_offset) + __fill_bvector(__first._M_p, __first._M_offset, __last._M_offset, __x); + } + +#if __cplusplus >= 201103L + // DR 1182. + /// std::hash specialization for vector. + template + struct hash<_GLIBCXX_STD_C::vector> + : public __hash_base> + { + size_t + operator()(const _GLIBCXX_STD_C::vector&) const noexcept; + }; +#endif // C++11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_bvector.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_bvector.h.blob new file mode 100644 index 0000000..2a401b1 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_bvector.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_construct.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_construct.h new file mode 100644 index 0000000..3ac7571 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_construct.h @@ -0,0 +1,287 @@ +// nonstandard construct and destroy functions -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_construct.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _STL_CONSTRUCT_H +#define _STL_CONSTRUCT_H 1 + +#include +#include +#include // for iterator_traits +#include // for advance + +/* This file provides the C++17 functions std::destroy_at, std::destroy, and + * std::destroy_n, and the C++20 function std::construct_at. + * It also provides std::_Construct, std::_Destroy,and std::_Destroy_n functions + * which are defined in all standard modes and so can be used in C++98-14 code. + * The _Destroy functions will dispatch to destroy_at during constant + * evaluation, because calls to that function are intercepted by the compiler + * to allow use in constant expressions. + */ + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if __glibcxx_raw_memory_algorithms // >= C++17 + template + _GLIBCXX20_CONSTEXPR inline void + destroy_at(_Tp* __location) + { + if constexpr (__cplusplus > 201703L && is_array_v<_Tp>) + { + for (auto& __x : *__location) + std::destroy_at(std::__addressof(__x)); + } + else + __location->~_Tp(); + } + +#if __cpp_constexpr_dynamic_alloc // >= C++20 + template + requires (!is_unbounded_array_v<_Tp>) + && requires { ::new((void*)0) _Tp(std::declval<_Args>()...); } + constexpr _Tp* + construct_at(_Tp* __location, _Args&&... __args) + noexcept(noexcept(::new((void*)0) _Tp(std::declval<_Args>()...))) + { + void* __loc = __location; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3436. std::construct_at should support arrays + if constexpr (is_array_v<_Tp>) + { + static_assert(sizeof...(_Args) == 0, "std::construct_at for array " + "types must not use any arguments to initialize the " + "array"); + return ::new(__loc) _Tp[1](); + } + else + return ::new(__loc) _Tp(std::forward<_Args>(__args)...); + } +#endif // C++20 +#endif// C++17 + + /** + * Constructs an object in existing memory by invoking an allocated + * object's constructor with an initializer. + */ +#if __cplusplus >= 201103L + template + _GLIBCXX20_CONSTEXPR + inline void + _Construct(_Tp* __p, _Args&&... __args) + { +#if __cpp_constexpr_dynamic_alloc // >= C++20 + if (std::__is_constant_evaluated()) + { + // Allow std::_Construct to be used in constant expressions. + std::construct_at(__p, std::forward<_Args>(__args)...); + return; + } +#endif + ::new(static_cast(__p)) _Tp(std::forward<_Args>(__args)...); + } +#else + template + inline void + _Construct(_T1* __p, const _T2& __value) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 402. wrong new expression in [some_]allocator::construct + ::new(static_cast(__p)) _T1(__value); + } +#endif + + template + _GLIBCXX26_CONSTEXPR + inline void + _Construct_novalue(_T1* __p) + { ::new(static_cast(__p)) _T1; } + + template + _GLIBCXX20_CONSTEXPR void + _Destroy(_ForwardIterator __first, _ForwardIterator __last); + + /** + * Destroy the object pointed to by a pointer type. + */ + template + _GLIBCXX14_CONSTEXPR inline void + _Destroy(_Tp* __pointer) + { +#if __cpp_constexpr_dynamic_alloc // >= C++20 + std::destroy_at(__pointer); +#else + __pointer->~_Tp(); +#endif + } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // for if-constexpr + +#if __cplusplus < 201103L + template + struct _Destroy_aux + { + template + static _GLIBCXX20_CONSTEXPR void + __destroy(_ForwardIterator __first, _ForwardIterator __last) + { + for (; __first != __last; ++__first) + std::_Destroy(std::__addressof(*__first)); + } + + template + static _GLIBCXX20_CONSTEXPR _ForwardIterator + __destroy_n(_ForwardIterator __first, _Size __count) + { + for (; __count > 0; (void)++__first, --__count) + std::_Destroy(std::__addressof(*__first)); + return __first; + } + }; + + template<> + struct _Destroy_aux + { + template + static void + __destroy(_ForwardIterator, _ForwardIterator) { } + + template + static _ForwardIterator + __destroy_n(_ForwardIterator __first, _Size __count) + { + std::advance(__first, __count); + return __first; + } + }; +#endif + + /** + * Destroy a range of objects. If the value_type of the object has + * a trivial destructor, the compiler should optimize all of this + * away, otherwise the objects' destructors must be invoked. + */ + template + _GLIBCXX20_CONSTEXPR inline void + _Destroy(_ForwardIterator __first, _ForwardIterator __last) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _Value_type; +#if __cplusplus >= 201103L + if constexpr (!is_trivially_destructible<_Value_type>::value) + for (; __first != __last; ++__first) + std::_Destroy(std::__addressof(*__first)); +#if __cpp_constexpr_dynamic_alloc // >= C++20 + else if (std::__is_constant_evaluated()) + for (; __first != __last; ++__first) + std::destroy_at(std::__addressof(*__first)); +#endif +#else + std::_Destroy_aux<__has_trivial_destructor(_Value_type)>:: + __destroy(__first, __last); +#endif + } + + /** + * Destroy a range of objects. If the value_type of the object has + * a trivial destructor, the compiler should optimize all of this + * away, otherwise the objects' destructors must be invoked. + */ + template + _GLIBCXX20_CONSTEXPR inline _ForwardIterator + _Destroy_n(_ForwardIterator __first, _Size __count) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _Value_type; +#if __cplusplus >= 201103L + if constexpr (!is_trivially_destructible<_Value_type>::value) + for (; __count > 0; (void)++__first, --__count) + std::_Destroy(std::__addressof(*__first)); +#if __cpp_constexpr_dynamic_alloc // >= C++20 + else if (std::__is_constant_evaluated()) + for (; __count > 0; (void)++__first, --__count) + std::destroy_at(std::__addressof(*__first)); +#endif + else + std::advance(__first, __count); + return __first; +#else + return std::_Destroy_aux<__has_trivial_destructor(_Value_type)>:: + __destroy_n(__first, __count); +#endif + } +#pragma GCC diagnostic pop + +#if __glibcxx_raw_memory_algorithms // >= C++17 + template + _GLIBCXX20_CONSTEXPR inline void + destroy(_ForwardIterator __first, _ForwardIterator __last) + { + std::_Destroy(__first, __last); + } + + template + _GLIBCXX20_CONSTEXPR inline _ForwardIterator + destroy_n(_ForwardIterator __first, _Size __count) + { + return std::_Destroy_n(__first, __count); + } +#endif // C++17 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif /* _STL_CONSTRUCT_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_construct.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_construct.h.blob new file mode 100644 index 0000000..37860fa Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_construct.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_function.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_function.h new file mode 100644 index 0000000..0f7fe4e --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_function.h @@ -0,0 +1,1483 @@ +// Functor implementations -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_function.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _STL_FUNCTION_H +#define _STL_FUNCTION_H 1 + +#if __cplusplus > 201103L +#include +#endif +#if __cplusplus >= 202002L +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 20.3.1 base classes + /** @defgroup functors Function Objects + * @ingroup utilities + * + * Function objects, or _functors_, are objects with an `operator()` + * defined and accessible. They can be passed as arguments to algorithm + * templates and used in place of a function pointer. Not only is the + * resulting expressiveness of the library increased, but the generated + * code can be more efficient than what you might write by hand. When we + * refer to _functors_, then, generally we include function pointers in + * the description as well. + * + * Often, functors are only created as temporaries passed to algorithm + * calls, rather than being created as named variables. + * + * Two examples taken from the standard itself follow. To perform a + * by-element addition of two vectors `a` and `b` containing `double`, + * and put the result in `a`, use + * \code + * transform (a.begin(), a.end(), b.begin(), a.begin(), plus()); + * \endcode + * To negate every element in `a`, use + * \code + * transform(a.begin(), a.end(), a.begin(), negate()); + * \endcode + * The addition and negation functions will usually be inlined directly. + * + * An _adaptable function object_ is one which provides nested typedefs + * `result_type` and either `argument_type` (for a unary function) or + * `first_argument_type` and `second_argument_type` (for a binary function). + * Those typedefs are used by function object adaptors such as `bind2nd`. + * The standard library provides two class templates, `unary_function` and + * `binary_function`, which define those typedefs and so can be used as + * base classes of adaptable function objects. + * + * Since C++11 the use of function object adaptors has been superseded by + * more powerful tools such as lambda expressions, `function<>`, and more + * powerful type deduction (using `auto` and `decltype`). The helpers for + * defining adaptable function objects are deprecated since C++11, and no + * longer part of the standard library since C++17. However, they are still + * defined and used by libstdc++ after C++17, as a conforming extension. + * + * @{ + */ + + /** + * Helper for defining adaptable unary function objects. + * @deprecated Deprecated in C++11, no longer in the standard since C++17. + */ + template + struct unary_function + { + /// @c argument_type is the type of the argument + typedef _Arg argument_type; + + /// @c result_type is the return type + typedef _Result result_type; + } _GLIBCXX11_DEPRECATED; + + /** + * Helper for defining adaptable binary function objects. + * @deprecated Deprecated in C++11, no longer in the standard since C++17. + */ + template + struct binary_function + { + /// @c first_argument_type is the type of the first argument + typedef _Arg1 first_argument_type; + + /// @c second_argument_type is the type of the second argument + typedef _Arg2 second_argument_type; + + /// @c result_type is the return type + typedef _Result result_type; + } _GLIBCXX11_DEPRECATED; + /** @} */ + + // 20.3.2 arithmetic + + /** @defgroup arithmetic_functors Arithmetic Function Object Classes + * @ingroup functors + * + * The library provides function objects for basic arithmetic operations. + * See the documentation for @link functors function objects @endlink + * for examples of their use. + * + * @{ + */ + +#if __glibcxx_transparent_operators // C++ >= 14 + struct __is_transparent; // undefined + + template + struct plus; + + template + struct minus; + + template + struct multiplies; + + template + struct divides; + + template + struct modulus; + + template + struct negate; +#endif + +// Ignore warnings about unary_function and binary_function. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct plus : public binary_function<_Tp, _Tp, _Tp> + { + /// Returns the sum + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x + __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct minus : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x - __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct multiplies : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x * __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct divides : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x / __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct modulus : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x % __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct negate : public unary_function<_Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x) const + { return -__x; } + }; +#pragma GCC diagnostic pop + +#ifdef __glibcxx_transparent_operators // C++ >= 14 + template<> + struct plus + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) + std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) + std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) + std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct minus + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) - std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) - std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) - std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct multiplies + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) * std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) * std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) * std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct divides + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) / std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) / std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) / std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct modulus + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) % std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) % std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) % std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct negate + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t) const + noexcept(noexcept(-std::forward<_Tp>(__t))) + -> decltype(-std::forward<_Tp>(__t)) + { return -std::forward<_Tp>(__t); } + + typedef __is_transparent is_transparent; + }; +#endif + /** @} */ + + // 20.3.3 comparisons + /** @defgroup comparison_functors Comparison Classes + * @ingroup functors + * + * The library provides six wrapper functors for all the basic comparisons + * in C++, like @c <. + * + * @{ + */ +#if __glibcxx_transparent_operators // C++ >= 14 + template + struct equal_to; + + template + struct not_equal_to; + + template + struct greater; + + template + struct less; + + template + struct greater_equal; + + template + struct less_equal; +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct equal_to : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x == __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct not_equal_to : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x != __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct greater : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x > __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct less : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x < __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct greater_equal : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x >= __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct less_equal : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x <= __y; } + }; + + // Partial specialization of std::greater for pointers. + template + struct greater<_Tp*> : public binary_function<_Tp*, _Tp*, bool> + { + _GLIBCXX14_CONSTEXPR bool + operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW + { +#if __cplusplus >= 201402L + if (std::__is_constant_evaluated()) + return __x > __y; +#endif + return (__UINTPTR_TYPE__)__x > (__UINTPTR_TYPE__)__y; + } + }; + + // Partial specialization of std::less for pointers. + template + struct less<_Tp*> : public binary_function<_Tp*, _Tp*, bool> + { + _GLIBCXX14_CONSTEXPR bool + operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW + { +#if __cplusplus >= 201402L + if (std::__is_constant_evaluated()) + return __x < __y; +#endif + return (__UINTPTR_TYPE__)__x < (__UINTPTR_TYPE__)__y; + } + }; + + // Partial specialization of std::greater_equal for pointers. + template + struct greater_equal<_Tp*> : public binary_function<_Tp*, _Tp*, bool> + { + _GLIBCXX14_CONSTEXPR bool + operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW + { +#if __cplusplus >= 201402L + if (std::__is_constant_evaluated()) + return __x >= __y; +#endif + return (__UINTPTR_TYPE__)__x >= (__UINTPTR_TYPE__)__y; + } + }; + + // Partial specialization of std::less_equal for pointers. + template + struct less_equal<_Tp*> : public binary_function<_Tp*, _Tp*, bool> + { + _GLIBCXX14_CONSTEXPR bool + operator()(_Tp* __x, _Tp* __y) const _GLIBCXX_NOTHROW + { +#if __cplusplus >= 201402L + if (std::__is_constant_evaluated()) + return __x <= __y; +#endif + return (__UINTPTR_TYPE__)__x <= (__UINTPTR_TYPE__)__y; + } + }; +#pragma GCC diagnostic pop + +#ifdef __glibcxx_transparent_operators // C++ >= 14 + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct equal_to + { + template + constexpr auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) == std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct not_equal_to + { + template + constexpr auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) != std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) != std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) != std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct greater + { + template + constexpr auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) > std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) > std::forward<_Up>(__u)) + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr + if constexpr (__ptr_cmp<_Tp, _Up>) + return greater{}( + static_cast(std::forward<_Tp>(__t)), + static_cast(std::forward<_Up>(__u))); + else + return std::forward<_Tp>(__t) > std::forward<_Up>(__u); +#pragma GCC diagnostic pop + } + + template + constexpr bool + operator()(_Tp* __t, _Up* __u) const noexcept + { return greater>{}(__t, __u); } + + typedef __is_transparent is_transparent; + + private: +#if __cplusplus >= 202002L + template + static constexpr bool __ptr_cmp = requires + { + requires + ! requires + { operator>(std::declval<_Tp>(), std::declval<_Up>()); } + && ! requires + { std::declval<_Tp>().operator>(std::declval<_Up>()); } + && __detail::__not_overloaded_spaceship<_Tp, _Up> + && is_convertible_v<_Tp, const volatile void*> + && is_convertible_v<_Up, const volatile void*>; + }; +#else + // True if there is no viable operator> member function. + template + struct __not_overloaded2 : true_type { }; + + // False if we can call T.operator>(U) + template + struct __not_overloaded2<_Tp, _Up, __void_t< + decltype(std::declval<_Tp>().operator>(std::declval<_Up>()))>> + : false_type { }; + + // True if there is no overloaded operator> for these operands. + template + struct __not_overloaded : __not_overloaded2<_Tp, _Up> { }; + + // False if we can call operator>(T,U) + template + struct __not_overloaded<_Tp, _Up, __void_t< + decltype(operator>(std::declval<_Tp>(), std::declval<_Up>()))>> + : false_type { }; + + template + static constexpr bool __ptr_cmp = __and_< + __not_overloaded<_Tp, _Up>, + is_convertible<_Tp, const volatile void*>, + is_convertible<_Up, const volatile void*>>::value; +#endif + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct less + { + template + constexpr auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) < std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) < std::forward<_Up>(__u)) + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr + if constexpr (__ptr_cmp<_Tp, _Up>) + return less{}( + static_cast(std::forward<_Tp>(__t)), + static_cast(std::forward<_Up>(__u))); + else + return std::forward<_Tp>(__t) < std::forward<_Up>(__u); +#pragma GCC diagnostic pop + } + + template + constexpr bool + operator()(_Tp* __t, _Up* __u) const noexcept + { return less>{}(__t, __u); } + + typedef __is_transparent is_transparent; + + private: +#if __cplusplus >= 202002L + template + static constexpr bool __ptr_cmp = requires + { + requires + ! requires + { operator<(std::declval<_Tp>(), std::declval<_Up>()); } + && ! requires + { std::declval<_Tp>().operator<(std::declval<_Up>()); } + && __detail::__not_overloaded_spaceship<_Tp, _Up> + && is_convertible_v<_Tp, const volatile void*> + && is_convertible_v<_Up, const volatile void*>; + }; +#else + // True if there is no viable operator< member function. + template + struct __not_overloaded2 : true_type { }; + + // False if we can call T.operator<(U) + template + struct __not_overloaded2<_Tp, _Up, __void_t< + decltype(std::declval<_Tp>().operator<(std::declval<_Up>()))>> + : false_type { }; + + // True if there is no overloaded operator< for these operands. + template + struct __not_overloaded : __not_overloaded2<_Tp, _Up> { }; + + // False if we can call operator<(T,U) + template + struct __not_overloaded<_Tp, _Up, __void_t< + decltype(operator<(std::declval<_Tp>(), std::declval<_Up>()))>> + : false_type { }; + + template + static constexpr bool __ptr_cmp = __and_< + __not_overloaded<_Tp, _Up>, + is_convertible<_Tp, const volatile void*>, + is_convertible<_Up, const volatile void*>>::value; +#endif + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct greater_equal + { + template + constexpr auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) >= std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) >= std::forward<_Up>(__u)) + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr + if constexpr (__ptr_cmp<_Tp, _Up>) + return greater_equal{}( + static_cast(std::forward<_Tp>(__t)), + static_cast(std::forward<_Up>(__u))); + else + return std::forward<_Tp>(__t) >= std::forward<_Up>(__u); +#pragma GCC diagnostic pop + } + + template + constexpr bool + operator()(_Tp* __t, _Up* __u) const noexcept + { return greater_equal>{}(__t, __u); } + + typedef __is_transparent is_transparent; + + private: +#if __cplusplus >= 202002L + template + static constexpr bool __ptr_cmp = requires + { + requires + ! requires + { operator>=(std::declval<_Tp>(), std::declval<_Up>()); } + && ! requires + { std::declval<_Tp>().operator>=(std::declval<_Up>()); } + && __detail::__not_overloaded_spaceship<_Tp, _Up> + && is_convertible_v<_Tp, const volatile void*> + && is_convertible_v<_Up, const volatile void*>; + }; +#else + // True if there is no viable operator>= member function. + template + struct __not_overloaded2 : true_type { }; + + // False if we can call T.operator>=(U) + template + struct __not_overloaded2<_Tp, _Up, __void_t< + decltype(std::declval<_Tp>().operator>=(std::declval<_Up>()))>> + : false_type { }; + + // True if there is no overloaded operator>= for these operands. + template + struct __not_overloaded : __not_overloaded2<_Tp, _Up> { }; + + // False if we can call operator>=(T,U) + template + struct __not_overloaded<_Tp, _Up, __void_t< + decltype(operator>=(std::declval<_Tp>(), std::declval<_Up>()))>> + : false_type { }; + + template + static constexpr bool __ptr_cmp = __and_< + __not_overloaded<_Tp, _Up>, + is_convertible<_Tp, const volatile void*>, + is_convertible<_Up, const volatile void*>>::value; +#endif + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct less_equal + { + template + constexpr auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) <= std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) <= std::forward<_Up>(__u)) + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr + if constexpr (__ptr_cmp<_Tp, _Up>) + return less_equal{}( + static_cast(std::forward<_Tp>(__t)), + static_cast(std::forward<_Up>(__u))); + else + return std::forward<_Tp>(__t) <= std::forward<_Up>(__u); +#pragma GCC diagnostic pop + } + + template + constexpr bool + operator()(_Tp* __t, _Up* __u) const noexcept + { return less_equal>{}(__t, __u); } + + typedef __is_transparent is_transparent; + + private: +#if __cplusplus >= 202002L + template + static constexpr bool __ptr_cmp = requires + { + requires + ! requires + { operator<=(std::declval<_Tp>(), std::declval<_Up>()); } + && ! requires + { std::declval<_Tp>().operator<=(std::declval<_Up>()); } + && __detail::__not_overloaded_spaceship<_Tp, _Up> + && is_convertible_v<_Tp, const volatile void*> + && is_convertible_v<_Up, const volatile void*>; + }; +#else + // True if there is no viable operator<= member function. + template + struct __not_overloaded2 : true_type { }; + + // False if we can call T.operator<=(U) + template + struct __not_overloaded2<_Tp, _Up, __void_t< + decltype(std::declval<_Tp>().operator<=(std::declval<_Up>()))>> + : false_type { }; + + // True if there is no overloaded operator<= for these operands. + template + struct __not_overloaded : __not_overloaded2<_Tp, _Up> { }; + + // False if we can call operator<=(T,U) + template + struct __not_overloaded<_Tp, _Up, __void_t< + decltype(operator<=(std::declval<_Tp>(), std::declval<_Up>()))>> + : false_type { }; + + template + static constexpr bool __ptr_cmp = __and_< + __not_overloaded<_Tp, _Up>, + is_convertible<_Tp, const volatile void*>, + is_convertible<_Up, const volatile void*>>::value; +#endif + }; +#endif // __glibcxx_transparent_operators + /** @} */ + + // 20.3.4 logical operations + /** @defgroup logical_functors Boolean Operations Classes + * @ingroup functors + * + * The library provides function objects for the logical operations: + * `&&`, `||`, and `!`. + * + * @{ + */ +#ifdef __glibcxx_transparent_operators // C++ >= 14 + template + struct logical_and; + + template + struct logical_or; + + template + struct logical_not; +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + /// One of the @link logical_functors Boolean operations functors@endlink. + template + struct logical_and : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x && __y; } + }; + + /// One of the @link logical_functors Boolean operations functors@endlink. + template + struct logical_or : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x || __y; } + }; + + /// One of the @link logical_functors Boolean operations functors@endlink. + template + struct logical_not : public unary_function<_Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x) const + { return !__x; } + }; +#pragma GCC diagnostic pop + +#ifdef __glibcxx_transparent_operators // C++ >= 14 + /// One of the @link logical_functors Boolean operations functors@endlink. + template<> + struct logical_and + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) && std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) && std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) && std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link logical_functors Boolean operations functors@endlink. + template<> + struct logical_or + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) || std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) || std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) || std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link logical_functors Boolean operations functors@endlink. + template<> + struct logical_not + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t) const + noexcept(noexcept(!std::forward<_Tp>(__t))) + -> decltype(!std::forward<_Tp>(__t)) + { return !std::forward<_Tp>(__t); } + + typedef __is_transparent is_transparent; + }; +#endif // __glibcxx_transparent_operators + /** @} */ + +#ifdef __glibcxx_transparent_operators // C++ >= 14 + template + struct bit_and; + + template + struct bit_or; + + template + struct bit_xor; + + template + struct bit_not; +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 660. Missing Bitwise Operations. + template + struct bit_and : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x & __y; } + }; + + template + struct bit_or : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x | __y; } + }; + + template + struct bit_xor : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x ^ __y; } + }; + + template + struct bit_not : public unary_function<_Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x) const + { return ~__x; } + }; +#pragma GCC diagnostic pop + +#ifdef __glibcxx_transparent_operators // C++ >= 14 + template <> + struct bit_and + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) & std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) & std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) & std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + template <> + struct bit_or + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) | std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) | std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) | std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + template <> + struct bit_xor + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + template <> + struct bit_not + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t) const + noexcept(noexcept(~std::forward<_Tp>(__t))) + -> decltype(~std::forward<_Tp>(__t)) + { return ~std::forward<_Tp>(__t); } + + typedef __is_transparent is_transparent; + }; +#endif // C++14 + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + // 20.3.5 negators + /** @defgroup negators Negators + * @ingroup functors + * + * The function templates `not1` and `not2` are function object adaptors, + * which each take a predicate functor and wrap it in an instance of + * `unary_negate` or `binary_negate`, respectively. Those classes are + * functors whose `operator()` evaluates the wrapped predicate function + * and then returns the negation of the result. + * + * For example, given a vector of integers and a trivial predicate, + * \code + * struct IntGreaterThanThree + * : public std::unary_function + * { + * bool operator() (int x) const { return x > 3; } + * }; + * + * std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree())); + * \endcode + * The call to `find_if` will locate the first index (i) of `v` for which + * `!(v[i] > 3)` is true. + * + * The not1/unary_negate combination works on predicates taking a single + * argument. The not2/binary_negate combination works on predicates taking + * two arguments. + * + * @deprecated Deprecated in C++17, no longer in the standard since C++20. + * Use `not_fn` instead. + * + * @{ + */ + /// One of the @link negators negation functors@endlink. + template + class _GLIBCXX17_DEPRECATED unary_negate + : public unary_function + { + protected: + _Predicate _M_pred; + + public: + _GLIBCXX14_CONSTEXPR + explicit + unary_negate(const _Predicate& __x) : _M_pred(__x) { } + + _GLIBCXX14_CONSTEXPR + bool + operator()(const typename _Predicate::argument_type& __x) const + { return !_M_pred(__x); } + }; + + /// One of the @link negators negation functors@endlink. + template + _GLIBCXX17_DEPRECATED_SUGGEST("std::not_fn") + _GLIBCXX14_CONSTEXPR + inline unary_negate<_Predicate> + not1(const _Predicate& __pred) + { return unary_negate<_Predicate>(__pred); } + + /// One of the @link negators negation functors@endlink. + template + class _GLIBCXX17_DEPRECATED binary_negate + : public binary_function + { + protected: + _Predicate _M_pred; + + public: + _GLIBCXX14_CONSTEXPR + explicit + binary_negate(const _Predicate& __x) : _M_pred(__x) { } + + _GLIBCXX14_CONSTEXPR + bool + operator()(const typename _Predicate::first_argument_type& __x, + const typename _Predicate::second_argument_type& __y) const + { return !_M_pred(__x, __y); } + }; + + /// One of the @link negators negation functors@endlink. + template + _GLIBCXX17_DEPRECATED_SUGGEST("std::not_fn") + _GLIBCXX14_CONSTEXPR + inline binary_negate<_Predicate> + not2(const _Predicate& __pred) + { return binary_negate<_Predicate>(__pred); } + /** @} */ + + // 20.3.7 adaptors pointers functions + /** @defgroup pointer_adaptors Adaptors for pointers to functions + * @ingroup functors + * + * The advantage of function objects over pointers to functions is that + * the objects in the standard library declare nested typedefs describing + * their argument and result types with uniform names (e.g., `result_type` + * from the base classes `unary_function` and `binary_function`). + * Sometimes those typedefs are required, not just optional. + * + * Adaptors are provided to turn pointers to unary (single-argument) and + * binary (double-argument) functions into function objects. The + * long-winded functor `pointer_to_unary_function` is constructed with a + * function pointer `f`, and its `operator()` called with argument `x` + * returns `f(x)`. The functor `pointer_to_binary_function` does the same + * thing, but with a double-argument `f` and `operator()`. + * + * The function `ptr_fun` takes a pointer-to-function `f` and constructs + * an instance of the appropriate functor. + * + * @deprecated Deprecated in C++11, no longer in the standard since C++17. + * + * @{ + */ + /// One of the @link pointer_adaptors adaptors for function pointers@endlink. + template + class pointer_to_unary_function : public unary_function<_Arg, _Result> + { + protected: + _Result (*_M_ptr)(_Arg); + + public: + pointer_to_unary_function() { } + + explicit + pointer_to_unary_function(_Result (*__x)(_Arg)) + : _M_ptr(__x) { } + + _Result + operator()(_Arg __x) const + { return _M_ptr(__x); } + } _GLIBCXX11_DEPRECATED; + + /// One of the @link pointer_adaptors adaptors for function pointers@endlink. + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::function") + inline pointer_to_unary_function<_Arg, _Result> + ptr_fun(_Result (*__x)(_Arg)) + { return pointer_to_unary_function<_Arg, _Result>(__x); } + + /// One of the @link pointer_adaptors adaptors for function pointers@endlink. + template + class pointer_to_binary_function + : public binary_function<_Arg1, _Arg2, _Result> + { + protected: + _Result (*_M_ptr)(_Arg1, _Arg2); + + public: + pointer_to_binary_function() { } + + explicit + pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) + : _M_ptr(__x) { } + + _Result + operator()(_Arg1 __x, _Arg2 __y) const + { return _M_ptr(__x, __y); } + } _GLIBCXX11_DEPRECATED; + + /// One of the @link pointer_adaptors adaptors for function pointers@endlink. + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::function") + inline pointer_to_binary_function<_Arg1, _Arg2, _Result> + ptr_fun(_Result (*__x)(_Arg1, _Arg2)) + { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); } + /** @} */ + + template + struct _Identity + : public unary_function<_Tp, _Tp> + { + _Tp& + operator()(_Tp& __x) const + { return __x; } + + const _Tp& + operator()(const _Tp& __x) const + { return __x; } + }; + + // Partial specialization, avoids confusing errors in e.g. std::set. + template struct _Identity : _Identity<_Tp> { }; + + template + struct _Select1st + : public unary_function<_Pair, typename _Pair::first_type> + { + typename _Pair::first_type& + operator()(_Pair& __x) const + { return __x.first; } + + const typename _Pair::first_type& + operator()(const _Pair& __x) const + { return __x.first; } + +#if __cplusplus >= 201103L + template + typename _Pair2::first_type& + operator()(_Pair2& __x) const + { return __x.first; } + + template + const typename _Pair2::first_type& + operator()(const _Pair2& __x) const + { return __x.first; } +#endif + }; + + template + struct _Select2nd + : public unary_function<_Pair, typename _Pair::second_type> + { + typename _Pair::second_type& + operator()(_Pair& __x) const + { return __x.second; } + + const typename _Pair::second_type& + operator()(const _Pair& __x) const + { return __x.second; } + }; + + // 20.3.8 adaptors pointers members + /** @defgroup ptrmem_adaptors Adaptors for pointers to members + * @ingroup functors + * + * There are a total of 8 = 2^3 function objects in this family. + * (1) Member functions taking no arguments vs member functions taking + * one argument. + * (2) Call through pointer vs call through reference. + * (3) Const vs non-const member function. + * + * All of this complexity is in the function objects themselves. You can + * ignore it by using the helper function `mem_fun` and `mem_fun_ref`, + * which create whichever type of adaptor is appropriate. + * + * @deprecated Deprecated in C++11, no longer in the standard since C++17. + * Use `mem_fn` instead. + * + * @{ + */ + /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. + template + class mem_fun_t : public unary_function<_Tp*, _Ret> + { + public: + explicit + mem_fun_t(_Ret (_Tp::*__pf)()) + : _M_f(__pf) { } + + _Ret + operator()(_Tp* __p) const + { return (__p->*_M_f)(); } + + private: + _Ret (_Tp::*_M_f)(); + } _GLIBCXX11_DEPRECATED; + + /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. + template + class const_mem_fun_t : public unary_function + { + public: + explicit + const_mem_fun_t(_Ret (_Tp::*__pf)() const) + : _M_f(__pf) { } + + _Ret + operator()(const _Tp* __p) const + { return (__p->*_M_f)(); } + + private: + _Ret (_Tp::*_M_f)() const; + } _GLIBCXX11_DEPRECATED; + + /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. + template + class mem_fun_ref_t : public unary_function<_Tp, _Ret> + { + public: + explicit + mem_fun_ref_t(_Ret (_Tp::*__pf)()) + : _M_f(__pf) { } + + _Ret + operator()(_Tp& __r) const + { return (__r.*_M_f)(); } + + private: + _Ret (_Tp::*_M_f)(); + } _GLIBCXX11_DEPRECATED; + + /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. + template + class const_mem_fun_ref_t : public unary_function<_Tp, _Ret> + { + public: + explicit + const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) + : _M_f(__pf) { } + + _Ret + operator()(const _Tp& __r) const + { return (__r.*_M_f)(); } + + private: + _Ret (_Tp::*_M_f)() const; + } _GLIBCXX11_DEPRECATED; + + /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. + template + class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret> + { + public: + explicit + mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) + : _M_f(__pf) { } + + _Ret + operator()(_Tp* __p, _Arg __x) const + { return (__p->*_M_f)(__x); } + + private: + _Ret (_Tp::*_M_f)(_Arg); + } _GLIBCXX11_DEPRECATED; + + /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. + template + class const_mem_fun1_t : public binary_function + { + public: + explicit + const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) + : _M_f(__pf) { } + + _Ret + operator()(const _Tp* __p, _Arg __x) const + { return (__p->*_M_f)(__x); } + + private: + _Ret (_Tp::*_M_f)(_Arg) const; + } _GLIBCXX11_DEPRECATED; + + /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. + template + class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> + { + public: + explicit + mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) + : _M_f(__pf) { } + + _Ret + operator()(_Tp& __r, _Arg __x) const + { return (__r.*_M_f)(__x); } + + private: + _Ret (_Tp::*_M_f)(_Arg); + } _GLIBCXX11_DEPRECATED; + + /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. + template + class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> + { + public: + explicit + const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) + : _M_f(__pf) { } + + _Ret + operator()(const _Tp& __r, _Arg __x) const + { return (__r.*_M_f)(__x); } + + private: + _Ret (_Tp::*_M_f)(_Arg) const; + } _GLIBCXX11_DEPRECATED; + + // Mem_fun adaptor helper functions. There are only two: + // mem_fun and mem_fun_ref. + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn") + inline mem_fun_t<_Ret, _Tp> + mem_fun(_Ret (_Tp::*__f)()) + { return mem_fun_t<_Ret, _Tp>(__f); } + + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn") + inline const_mem_fun_t<_Ret, _Tp> + mem_fun(_Ret (_Tp::*__f)() const) + { return const_mem_fun_t<_Ret, _Tp>(__f); } + + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn") + inline mem_fun_ref_t<_Ret, _Tp> + mem_fun_ref(_Ret (_Tp::*__f)()) + { return mem_fun_ref_t<_Ret, _Tp>(__f); } + + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn") + inline const_mem_fun_ref_t<_Ret, _Tp> + mem_fun_ref(_Ret (_Tp::*__f)() const) + { return const_mem_fun_ref_t<_Ret, _Tp>(__f); } + + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn") + inline mem_fun1_t<_Ret, _Tp, _Arg> + mem_fun(_Ret (_Tp::*__f)(_Arg)) + { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } + + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn") + inline const_mem_fun1_t<_Ret, _Tp, _Arg> + mem_fun(_Ret (_Tp::*__f)(_Arg) const) + { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } + + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn") + inline mem_fun1_ref_t<_Ret, _Tp, _Arg> + mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) + { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } + + template + _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn") + inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> + mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const) + { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } +#pragma GCC diagnostic pop + + /** @} */ + +#ifdef __glibcxx_transparent_operators // C++ >= 14 + template> + struct __has_is_transparent + { }; + + template + struct __has_is_transparent<_Func, _SfinaeType, + __void_t> + { typedef void type; }; + + template + using __has_is_transparent_t + = typename __has_is_transparent<_Func, _SfinaeType>::type; + +#if __cpp_concepts + template + concept __transparent_comparator + = requires { typename _Func::is_transparent; }; +#endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED +# include +#endif + +#endif /* _STL_FUNCTION_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_function.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_function.h.blob new file mode 100644 index 0000000..f6269a2 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_function.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator.h new file mode 100644 index 0000000..9203a66 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator.h @@ -0,0 +1,3120 @@ +// Iterators -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_iterator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + * + * This file implements reverse_iterator, back_insert_iterator, + * front_insert_iterator, insert_iterator, __normal_iterator, and their + * supporting functions and overloaded operators. + */ + +#ifndef _STL_ITERATOR_H +#define _STL_ITERATOR_H 1 + +#include +#include +#include +#include +#include + +#if __cplusplus >= 201103L +# include +#endif + +#if __cplusplus >= 202002L +# include +# include +# include +# include +# include +#endif + +#if __glibcxx_tuple_like // >= C++23 +# include // for tuple_element_t +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup iterators + * @{ + */ + +#ifdef __glibcxx_concepts + /// @cond undocumented + namespace __detail + { + // Weaken iterator_category _Cat to _Limit if it is derived from that, + // otherwise use _Otherwise. + template + using __clamp_iter_cat + = __conditional_t, _Limit, _Otherwise>; + } + /// @endcond +#endif + +// Ignore warnings about std::iterator. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + // 24.4.1 Reverse iterators + /** + * Bidirectional and random access iterators have corresponding reverse + * %iterator adaptors that iterate through the data structure in the + * opposite direction. They have the same signatures as the corresponding + * iterators. The fundamental relation between a reverse %iterator and its + * corresponding %iterator @c i is established by the identity: + * @code + * &*(reverse_iterator(i)) == &*(i - 1) + * @endcode + * + * This mapping is dictated by the fact that while there is always a + * pointer past the end of an array, there might not be a valid pointer + * before the beginning of an array. [24.4.1]/1,2 + * + * Reverse iterators can be tricky and surprising at first. Their + * semantics make sense, however, and the trickiness is a side effect of + * the requirement that the iterators must be safe. + */ + template + class reverse_iterator + : public iterator::iterator_category, + typename iterator_traits<_Iterator>::value_type, + typename iterator_traits<_Iterator>::difference_type, + typename iterator_traits<_Iterator>::pointer, + typename iterator_traits<_Iterator>::reference> + { + template + friend class reverse_iterator; + +#ifdef __glibcxx_concepts + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3435. three_way_comparable_with, [...]> + template + static constexpr bool __convertible = !is_same_v<_Iter, _Iterator> + && convertible_to; +#endif + + protected: + _Iterator current; + + typedef iterator_traits<_Iterator> __traits_type; + + public: + typedef _Iterator iterator_type; + typedef typename __traits_type::pointer pointer; +#ifndef __glibcxx_concepts + typedef typename __traits_type::difference_type difference_type; + typedef typename __traits_type::reference reference; +#else + using iterator_concept + = __conditional_t, + random_access_iterator_tag, + bidirectional_iterator_tag>; + using iterator_category + = __detail::__clamp_iter_cat; + using value_type = iter_value_t<_Iterator>; + using difference_type = iter_difference_t<_Iterator>; + using reference = iter_reference_t<_Iterator>; +#endif + + /** + * The default constructor value-initializes member @p current. + * If it is a pointer, that means it is zero-initialized. + */ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 235 No specification of default ctor for reverse_iterator + // 1012. reverse_iterator default ctor should value initialize + _GLIBCXX17_CONSTEXPR + reverse_iterator() + _GLIBCXX_NOEXCEPT_IF(noexcept(_Iterator())) + : current() + { } + + /** + * This %iterator will move in the opposite direction that @p x does. + */ + explicit _GLIBCXX17_CONSTEXPR + reverse_iterator(iterator_type __x) + _GLIBCXX_NOEXCEPT_IF(noexcept(_Iterator(__x))) + : current(__x) + { } + + /** + * The copy constructor is normal. + */ + _GLIBCXX17_CONSTEXPR + reverse_iterator(const reverse_iterator& __x) + _GLIBCXX_NOEXCEPT_IF(noexcept(_Iterator(__x.current))) + : current(__x.current) + { } + +#if __cplusplus >= 201103L + reverse_iterator& operator=(const reverse_iterator&) = default; +#endif + + /** + * A %reverse_iterator across other types can be copied if the + * underlying %iterator can be converted to the type of @c current. + */ + template +#ifdef __glibcxx_concepts + requires __convertible<_Iter> +#endif + _GLIBCXX17_CONSTEXPR + reverse_iterator(const reverse_iterator<_Iter>& __x) + _GLIBCXX_NOEXCEPT_IF(noexcept(_Iterator(__x.current))) + : current(__x.current) + { } + +#if __cplusplus >= 201103L + template +# ifdef __glibcxx_concepts + requires __convertible<_Iter> + && assignable_from<_Iterator&, const _Iter&> +# endif + _GLIBCXX17_CONSTEXPR + reverse_iterator& + operator=(const reverse_iterator<_Iter>& __x) + _GLIBCXX_NOEXCEPT_IF(noexcept(current = __x.current)) + { + current = __x.current; + return *this; + } +#endif // C++11 + + /** + * @return @c current, the %iterator used for underlying work. + */ + _GLIBCXX_NODISCARD + _GLIBCXX17_CONSTEXPR iterator_type + base() const + _GLIBCXX_NOEXCEPT_IF(noexcept(_Iterator(current))) + { return current; } + + /** + * @return A reference to the value at @c --current + * + * This requires that @c --current is dereferenceable. + * + * @warning This implementation requires that for an iterator of the + * underlying iterator type, @c x, a reference obtained by + * @c *x remains valid after @c x has been modified or + * destroyed. This is a bug: http://gcc.gnu.org/PR51823 + */ + _GLIBCXX_NODISCARD + _GLIBCXX17_CONSTEXPR reference + operator*() const + { + _Iterator __tmp = current; + return *--__tmp; + } + + /** + * @return A pointer to the value at @c --current + * + * This requires that @c --current is dereferenceable. + */ + _GLIBCXX_NODISCARD + _GLIBCXX17_CONSTEXPR pointer + operator->() const +#ifdef __glibcxx_concepts + requires is_pointer_v<_Iterator> + || requires(const _Iterator __i) { __i.operator->(); } +#endif + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 1052. operator-> should also support smart pointers + _Iterator __tmp = current; + --__tmp; + return _S_to_pointer(__tmp); + } + + /** + * @return @c *this + * + * Decrements the underlying iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator& + operator++() + { + --current; + return *this; + } + + /** + * @return The original value of @c *this + * + * Decrements the underlying iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator + operator++(int) + { + reverse_iterator __tmp = *this; + --current; + return __tmp; + } + + /** + * @return @c *this + * + * Increments the underlying iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator& + operator--() + { + ++current; + return *this; + } + + /** + * @return A reverse_iterator with the previous value of @c *this + * + * Increments the underlying iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator + operator--(int) + { + reverse_iterator __tmp = *this; + ++current; + return __tmp; + } + + /** + * @return A reverse_iterator that refers to @c current - @a __n + * + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX_NODISCARD + _GLIBCXX17_CONSTEXPR reverse_iterator + operator+(difference_type __n) const + { return reverse_iterator(current - __n); } + + /** + * @return *this + * + * Moves the underlying iterator backwards @a __n steps. + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator& + operator+=(difference_type __n) + { + current -= __n; + return *this; + } + + /** + * @return A reverse_iterator that refers to @c current - @a __n + * + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX_NODISCARD + _GLIBCXX17_CONSTEXPR reverse_iterator + operator-(difference_type __n) const + { return reverse_iterator(current + __n); } + + /** + * @return *this + * + * Moves the underlying iterator forwards @a __n steps. + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator& + operator-=(difference_type __n) + { + current += __n; + return *this; + } + + /** + * @return The value at @c current - @a __n - 1 + * + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX_NODISCARD + _GLIBCXX17_CONSTEXPR reference + operator[](difference_type __n) const + { return *(*this + __n); } + +#ifdef __glibcxx_ranges + [[nodiscard]] + friend constexpr iter_rvalue_reference_t<_Iterator> + iter_move(const reverse_iterator& __i) + noexcept(is_nothrow_copy_constructible_v<_Iterator> + && noexcept(ranges::iter_move(--std::declval<_Iterator&>()))) + { + auto __tmp = __i.base(); + return ranges::iter_move(--__tmp); + } + + template _Iter2> + friend constexpr void + iter_swap(const reverse_iterator& __x, + const reverse_iterator<_Iter2>& __y) + noexcept(is_nothrow_copy_constructible_v<_Iterator> + && is_nothrow_copy_constructible_v<_Iter2> + && noexcept(ranges::iter_swap(--std::declval<_Iterator&>(), + --std::declval<_Iter2&>()))) + { + auto __xtmp = __x.base(); + auto __ytmp = __y.base(); + ranges::iter_swap(--__xtmp, --__ytmp); + } +#endif // ranges + + private: + template + static _GLIBCXX17_CONSTEXPR _Tp* + _S_to_pointer(_Tp* __p) + { return __p; } + + template + static _GLIBCXX17_CONSTEXPR pointer + _S_to_pointer(_Tp __t) + { return __t.operator->(); } + }; + + ///@{ + /** + * @param __x A %reverse_iterator. + * @param __y A %reverse_iterator. + * @return A simple bool. + * + * Reverse iterators forward comparisons to their underlying base() + * iterators. + * + */ +#ifndef __glibcxx_concepts + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator==(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return __x.base() == __y.base(); } + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator<(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return __y.base() < __x.base(); } + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator!=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return !(__x == __y); } + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator>(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return __y < __x; } + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator<=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return !(__y < __x); } + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator>=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return !(__x < __y); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 280. Comparison of reverse_iterator to const reverse_iterator. + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator==(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __x.base() == __y.base(); } + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator<(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __x.base() > __y.base(); } + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator!=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __x.base() != __y.base(); } + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator>(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __x.base() < __y.base(); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator<=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __x.base() >= __y.base(); } + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR bool + operator>=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __x.base() <= __y.base(); } +#else // C++20 + template + [[nodiscard]] + constexpr bool + operator==(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + requires requires { { __x.base() == __y.base() } -> convertible_to; } + { return __x.base() == __y.base(); } + + template + [[nodiscard]] + constexpr bool + operator!=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + requires requires { { __x.base() != __y.base() } -> convertible_to; } + { return __x.base() != __y.base(); } + + template + [[nodiscard]] + constexpr bool + operator<(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + requires requires { { __x.base() > __y.base() } -> convertible_to; } + { return __x.base() > __y.base(); } + + template + [[nodiscard]] + constexpr bool + operator>(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + requires requires { { __x.base() < __y.base() } -> convertible_to; } + { return __x.base() < __y.base(); } + + template + [[nodiscard]] + constexpr bool + operator<=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + requires requires { { __x.base() >= __y.base() } -> convertible_to; } + { return __x.base() >= __y.base(); } + + template + [[nodiscard]] + constexpr bool + operator>=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + requires requires { { __x.base() <= __y.base() } -> convertible_to; } + { return __x.base() <= __y.base(); } + + template _IteratorR> + [[nodiscard]] + constexpr compare_three_way_result_t<_IteratorL, _IteratorR> + operator<=>(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __y.base() <=> __x.base(); } + + // Additional, non-standard overloads to avoid ambiguities with greedy, + // unconstrained overloads in associated namespaces. + + template + [[nodiscard]] + constexpr bool + operator==(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + requires requires { { __x.base() == __y.base() } -> convertible_to; } + { return __x.base() == __y.base(); } + + template + [[nodiscard]] + constexpr compare_three_way_result_t<_Iterator, _Iterator> + operator<=>(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return __y.base() <=> __x.base(); } +#endif // C++20 + ///@} + +#if __cplusplus < 201103L + template + inline typename reverse_iterator<_Iterator>::difference_type + operator-(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return __y.base() - __x.base(); } + + template + inline typename reverse_iterator<_IteratorL>::difference_type + operator-(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __y.base() - __x.base(); } +#else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 685. reverse_iterator/move_iterator difference has invalid signatures + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR auto + operator-(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + -> decltype(__y.base() - __x.base()) + { return __y.base() - __x.base(); } +#endif + + template + _GLIBCXX_NODISCARD + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Iterator> + operator+(typename reverse_iterator<_Iterator>::difference_type __n, + const reverse_iterator<_Iterator>& __x) + { return reverse_iterator<_Iterator>(__x.base() - __n); } + +#if __cplusplus >= 201103L + // Same as C++14 make_reverse_iterator but used in C++11 mode too. + template + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Iterator> + __make_reverse_iterator(_Iterator __i) + { return reverse_iterator<_Iterator>(__i); } + +# ifdef __glibcxx_make_reverse_iterator // C++ >= 14 + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 2285. make_reverse_iterator + /// Generator function for reverse_iterator. + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Iterator> + make_reverse_iterator(_Iterator __i) + { return reverse_iterator<_Iterator>(__i); } + +# ifdef __glibcxx_ranges + template + requires (!sized_sentinel_for<_Iterator1, _Iterator2>) + inline constexpr bool + disable_sized_sentinel_for, + reverse_iterator<_Iterator2>> = true; +# endif // C++20 +# endif // __glibcxx_make_reverse_iterator + + template + struct __is_move_iterator > + : __is_move_iterator<_Iterator> + { }; +#endif // C++11 + + // 24.4.2.2.1 back_insert_iterator + /** + * @brief Turns assignment into insertion. + * + * These are output iterators, constructed from a container-of-T. + * Assigning a T to the iterator appends it to the container using + * push_back. + * + * Tip: Using the back_inserter function to create these iterators can + * save typing. + */ + template + class back_insert_iterator + : public iterator + { + protected: + _Container* container; + + public: + /// A nested typedef for the type of whatever container you used. + typedef _Container container_type; +#ifdef __glibcxx_ranges + using difference_type = ptrdiff_t; +#endif + + /// The only way to create this %iterator is with a container. + explicit _GLIBCXX20_CONSTEXPR + back_insert_iterator(_Container& __x) + : container(std::__addressof(__x)) { } + + /** + * @param __value An instance of whatever type + * container_type::const_reference is; presumably a + * reference-to-const T for container. + * @return This %iterator, for chained operations. + * + * This kind of %iterator doesn't really have a @a position in the + * container (you can think of the position as being permanently at + * the end, if you like). Assigning a value to the %iterator will + * always append the value to the end of the container. + */ +#if __cplusplus < 201103L + back_insert_iterator& + operator=(typename _Container::const_reference __value) + { + container->push_back(__value); + return *this; + } +#else + _GLIBCXX20_CONSTEXPR + back_insert_iterator& + operator=(const typename _Container::value_type& __value) + { + container->push_back(__value); + return *this; + } + + _GLIBCXX20_CONSTEXPR + back_insert_iterator& + operator=(typename _Container::value_type&& __value) + { + container->push_back(std::move(__value)); + return *this; + } +#endif + + /// Simply returns *this. + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + back_insert_iterator& + operator*() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + _GLIBCXX20_CONSTEXPR + back_insert_iterator& + operator++() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + _GLIBCXX20_CONSTEXPR + back_insert_iterator + operator++(int) + { return *this; } + }; + + /** + * @param __x A container of arbitrary type. + * @return An instance of back_insert_iterator working on @p __x. + * + * This wrapper function helps in creating back_insert_iterator instances. + * Typing the name of the %iterator requires knowing the precise full + * type of the container, which can be tedious and impedes generic + * programming. Using this function lets you take advantage of automatic + * template parameter deduction, making the compiler match the correct + * types for you. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline back_insert_iterator<_Container> + back_inserter(_Container& __x) + { return back_insert_iterator<_Container>(__x); } + + /** + * @brief Turns assignment into insertion. + * + * These are output iterators, constructed from a container-of-T. + * Assigning a T to the iterator prepends it to the container using + * push_front. + * + * Tip: Using the front_inserter function to create these iterators can + * save typing. + */ + template + class front_insert_iterator + : public iterator + { + protected: + _Container* container; + + public: + /// A nested typedef for the type of whatever container you used. + typedef _Container container_type; +#ifdef __glibcxx_ranges + using difference_type = ptrdiff_t; +#endif + + /// The only way to create this %iterator is with a container. + explicit _GLIBCXX20_CONSTEXPR + front_insert_iterator(_Container& __x) + : container(std::__addressof(__x)) { } + + /** + * @param __value An instance of whatever type + * container_type::const_reference is; presumably a + * reference-to-const T for container. + * @return This %iterator, for chained operations. + * + * This kind of %iterator doesn't really have a @a position in the + * container (you can think of the position as being permanently at + * the front, if you like). Assigning a value to the %iterator will + * always prepend the value to the front of the container. + */ +#if __cplusplus < 201103L + front_insert_iterator& + operator=(typename _Container::const_reference __value) + { + container->push_front(__value); + return *this; + } +#else + _GLIBCXX20_CONSTEXPR + front_insert_iterator& + operator=(const typename _Container::value_type& __value) + { + container->push_front(__value); + return *this; + } + + _GLIBCXX20_CONSTEXPR + front_insert_iterator& + operator=(typename _Container::value_type&& __value) + { + container->push_front(std::move(__value)); + return *this; + } +#endif + + /// Simply returns *this. + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + front_insert_iterator& + operator*() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + _GLIBCXX20_CONSTEXPR + front_insert_iterator& + operator++() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + _GLIBCXX20_CONSTEXPR + front_insert_iterator + operator++(int) + { return *this; } + }; + + /** + * @param __x A container of arbitrary type. + * @return An instance of front_insert_iterator working on @p x. + * + * This wrapper function helps in creating front_insert_iterator instances. + * Typing the name of the %iterator requires knowing the precise full + * type of the container, which can be tedious and impedes generic + * programming. Using this function lets you take advantage of automatic + * template parameter deduction, making the compiler match the correct + * types for you. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline front_insert_iterator<_Container> + front_inserter(_Container& __x) + { return front_insert_iterator<_Container>(__x); } + + /** + * @brief Turns assignment into insertion. + * + * These are output iterators, constructed from a container-of-T. + * Assigning a T to the iterator inserts it in the container at the + * %iterator's position, rather than overwriting the value at that + * position. + * + * (Sequences will actually insert a @e copy of the value before the + * %iterator's position.) + * + * Tip: Using the inserter function to create these iterators can + * save typing. + */ + template + class insert_iterator + : public iterator + { +#ifdef __glibcxx_ranges + using _Iter = std::__detail::__range_iter_t<_Container>; +#else + typedef typename _Container::iterator _Iter; +#endif + protected: + _Container* container; + _Iter iter; + + public: + /// A nested typedef for the type of whatever container you used. + typedef _Container container_type; + +#ifdef __glibcxx_ranges + using difference_type = ptrdiff_t; +#endif + + /** + * The only way to create this %iterator is with a container and an + * initial position (a normal %iterator into the container). + */ + _GLIBCXX20_CONSTEXPR + insert_iterator(_Container& __x, _Iter __i) + : container(std::__addressof(__x)), iter(__i) {} + + /** + * @param __value An instance of whatever type + * container_type::const_reference is; presumably a + * reference-to-const T for container. + * @return This %iterator, for chained operations. + * + * This kind of %iterator maintains its own position in the + * container. Assigning a value to the %iterator will insert the + * value into the container at the place before the %iterator. + * + * The position is maintained such that subsequent assignments will + * insert values immediately after one another. For example, + * @code + * // vector v contains A and Z + * + * insert_iterator i (v, ++v.begin()); + * i = 1; + * i = 2; + * i = 3; + * + * // vector v contains A, 1, 2, 3, and Z + * @endcode + */ +#if __cplusplus < 201103L + insert_iterator& + operator=(typename _Container::const_reference __value) + { + iter = container->insert(iter, __value); + ++iter; + return *this; + } +#else + _GLIBCXX20_CONSTEXPR + insert_iterator& + operator=(const typename _Container::value_type& __value) + { + iter = container->insert(iter, __value); + ++iter; + return *this; + } + + _GLIBCXX20_CONSTEXPR + insert_iterator& + operator=(typename _Container::value_type&& __value) + { + iter = container->insert(iter, std::move(__value)); + ++iter; + return *this; + } +#endif + + /// Simply returns *this. + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + insert_iterator& + operator*() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + _GLIBCXX20_CONSTEXPR + insert_iterator& + operator++() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + _GLIBCXX20_CONSTEXPR + insert_iterator& + operator++(int) + { return *this; } + }; + +#pragma GCC diagnostic pop + + /** + * @param __x A container of arbitrary type. + * @param __i An iterator into the container. + * @return An instance of insert_iterator working on @p __x. + * + * This wrapper function helps in creating insert_iterator instances. + * Typing the name of the %iterator requires knowing the precise full + * type of the container, which can be tedious and impedes generic + * programming. Using this function lets you take advantage of automatic + * template parameter deduction, making the compiler match the correct + * types for you. + */ +#ifdef __glibcxx_ranges + template + [[nodiscard]] + constexpr insert_iterator<_Container> + inserter(_Container& __x, std::__detail::__range_iter_t<_Container> __i) + { return insert_iterator<_Container>(__x, __i); } +#else + template + _GLIBCXX_NODISCARD + inline insert_iterator<_Container> + inserter(_Container& __x, typename _Container::iterator __i) + { return insert_iterator<_Container>(__x, __i); } +#endif + + /// @} group iterators + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // This iterator adapter is @a normal in the sense that it does not + // change the semantics of any of the operators of its iterator + // parameter. Its primary purpose is to convert an iterator that is + // not a class, e.g. a pointer, into an iterator that is a class. + // The _Container parameter exists solely so that different containers + // using this template can instantiate different types, even if the + // _Iterator parameter is the same. + template + class __normal_iterator + { + protected: + _Iterator _M_current; + + typedef std::iterator_traits<_Iterator> __traits_type; + +#if __cplusplus >= 201103L && ! defined __glibcxx_concepts + template + using __convertible_from + = std::__enable_if_t::value>; +#endif + + public: + typedef _Iterator iterator_type; + typedef typename __traits_type::iterator_category iterator_category; + typedef typename __traits_type::value_type value_type; + typedef typename __traits_type::difference_type difference_type; + typedef typename __traits_type::reference reference; + typedef typename __traits_type::pointer pointer; + +#ifdef __glibcxx_ranges + using iterator_concept = std::__detail::__iter_concept<_Iterator>; +#endif + + __attribute__((__always_inline__)) + _GLIBCXX_CONSTEXPR + __normal_iterator() _GLIBCXX_NOEXCEPT + : _M_current() { } + + __attribute__((__always_inline__)) + explicit _GLIBCXX_CONSTEXPR + __normal_iterator(const _Iterator& __i) _GLIBCXX_NOEXCEPT + : _M_current(__i) { } + + // Allow iterator to const_iterator conversion +#if __cplusplus >= 201103L +# ifdef __glibcxx_concepts + template requires std::is_convertible_v<_Iter, _Iterator> +# else + template> +# endif + [[__gnu__::__always_inline__]] + constexpr + __normal_iterator(const __normal_iterator<_Iter, _Container>& __i) + noexcept +#else + // N.B. _Container::pointer is not actually in container requirements, + // but is present in std::vector and std::basic_string. + template + __attribute__((__always_inline__)) + __normal_iterator(const __normal_iterator<_Iter, + typename __enable_if< + (std::__are_same<_Iter, typename _Container::pointer>::__value), + _Container>::__type>& __i) +#endif + : _M_current(__i.base()) { } + + // Forward iterator requirements + + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + _GLIBCXX_CONSTEXPR + reference + operator*() const _GLIBCXX_NOEXCEPT + { return *_M_current; } + + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + _GLIBCXX_CONSTEXPR + pointer + operator->() const _GLIBCXX_NOEXCEPT + { return _M_current; } + + __attribute__((__always_inline__)) + _GLIBCXX14_CONSTEXPR + __normal_iterator& + operator++() _GLIBCXX_NOEXCEPT + { + ++_M_current; + return *this; + } + + __attribute__((__always_inline__)) + _GLIBCXX14_CONSTEXPR + __normal_iterator + operator++(int) _GLIBCXX_NOEXCEPT + { return __normal_iterator(_M_current++); } + + // Bidirectional iterator requirements + + __attribute__((__always_inline__)) + _GLIBCXX14_CONSTEXPR + __normal_iterator& + operator--() _GLIBCXX_NOEXCEPT + { + --_M_current; + return *this; + } + + __attribute__((__always_inline__)) + _GLIBCXX14_CONSTEXPR + __normal_iterator + operator--(int) _GLIBCXX_NOEXCEPT + { return __normal_iterator(_M_current--); } + + // Random access iterator requirements + + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + _GLIBCXX_CONSTEXPR + reference + operator[](difference_type __n) const _GLIBCXX_NOEXCEPT + { return _M_current[__n]; } + + __attribute__((__always_inline__)) + _GLIBCXX14_CONSTEXPR + __normal_iterator& + operator+=(difference_type __n) _GLIBCXX_NOEXCEPT + { _M_current += __n; return *this; } + + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + _GLIBCXX_CONSTEXPR + __normal_iterator + operator+(difference_type __n) const _GLIBCXX_NOEXCEPT + { return __normal_iterator(_M_current + __n); } + + __attribute__((__always_inline__)) + _GLIBCXX14_CONSTEXPR + __normal_iterator& + operator-=(difference_type __n) _GLIBCXX_NOEXCEPT + { _M_current -= __n; return *this; } + + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + _GLIBCXX_CONSTEXPR + __normal_iterator + operator-(difference_type __n) const _GLIBCXX_NOEXCEPT + { return __normal_iterator(_M_current - __n); } + + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + _GLIBCXX_CONSTEXPR + const _Iterator& + base() const _GLIBCXX_NOEXCEPT + { return _M_current; } + }; + + // Note: In what follows, the left- and right-hand-side iterators are + // allowed to vary in types (conceptually in cv-qualification) so that + // comparison between cv-qualified and non-cv-qualified iterators be + // valid. However, the greedy and unfriendly operators in std::rel_ops + // will make overload resolution ambiguous (when in scope) if we don't + // provide overloads whose operands are of the same type. Can someone + // remind me what generic programming is about? -- Gaby + +#ifdef __cpp_lib_three_way_comparison + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr bool + operator==(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + noexcept(noexcept(__lhs.base() == __rhs.base())) + requires requires { + { __lhs.base() == __rhs.base() } -> std::convertible_to; + } + { return __lhs.base() == __rhs.base(); } + + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr std::__detail::__synth3way_t<_IteratorR, _IteratorL> + operator<=>(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + noexcept(noexcept(std::__detail::__synth3way(__lhs.base(), __rhs.base()))) + { return std::__detail::__synth3way(__lhs.base(), __rhs.base()); } + + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr bool + operator==(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + noexcept(noexcept(__lhs.base() == __rhs.base())) + requires requires { + { __lhs.base() == __rhs.base() } -> std::convertible_to; + } + { return __lhs.base() == __rhs.base(); } + + template + [[nodiscard, __gnu__::__always_inline__]] + constexpr std::__detail::__synth3way_t<_Iterator> + operator<=>(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + noexcept(noexcept(std::__detail::__synth3way(__lhs.base(), __rhs.base()))) + { return std::__detail::__synth3way(__lhs.base(), __rhs.base()); } +#else + // Forward iterator requirements + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator==(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() == __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator==(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() == __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() != __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator!=(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() != __rhs.base(); } + + // Random access iterator requirements + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() < __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR + inline bool + operator<(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() < __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator>(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() > __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator>(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() > __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() <= __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator<=(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() <= __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() >= __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline bool + operator>=(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() >= __rhs.base(); } +#endif // three-way comparison + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // According to the resolution of DR179 not only the various comparison + // operators but also operator- must accept mixed iterator/const_iterator + // parameters. + template +#if __cplusplus >= 201103L + // DR 685. + [[__nodiscard__, __gnu__::__always_inline__]] + constexpr auto + operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) noexcept + -> decltype(__lhs.base() - __rhs.base()) +#else + inline typename __normal_iterator<_IteratorL, _Container>::difference_type + operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) +#endif + { return __lhs.base() - __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline typename __normal_iterator<_Iterator, _Container>::difference_type + operator-(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() - __rhs.base(); } + + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) _GLIBCXX_CONSTEXPR + inline __normal_iterator<_Iterator, _Container> + operator+(typename __normal_iterator<_Iterator, _Container>::difference_type + __n, const __normal_iterator<_Iterator, _Container>& __i) + _GLIBCXX_NOEXCEPT + { return __normal_iterator<_Iterator, _Container>(__i.base() + __n); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __gnu_cxx + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if __cplusplus >= 201103L + /** + * @addtogroup iterators + * @{ + */ + +#ifdef __glibcxx_ranges + /// A sentinel adaptor for use with std::move_iterator. + template + class move_sentinel + { + public: + constexpr + move_sentinel() + noexcept(is_nothrow_default_constructible_v<_Sent>) + : _M_last() { } + + constexpr explicit + move_sentinel(_Sent __s) + noexcept(is_nothrow_move_constructible_v<_Sent>) + : _M_last(std::move(__s)) { } + + template requires convertible_to + constexpr + move_sentinel(const move_sentinel<_S2>& __s) + noexcept(is_nothrow_constructible_v<_Sent, const _S2&>) + : _M_last(__s.base()) + { } + + template requires assignable_from<_Sent&, const _S2&> + constexpr move_sentinel& + operator=(const move_sentinel<_S2>& __s) + noexcept(is_nothrow_assignable_v<_Sent, const _S2&>) + { + _M_last = __s.base(); + return *this; + } + + [[nodiscard]] + constexpr _Sent + base() const + noexcept(is_nothrow_copy_constructible_v<_Sent>) + { return _M_last; } + + private: + _Sent _M_last; + }; + + /// @cond undocumented + namespace __detail + { + template + struct __move_iter_cat + { }; + + template + requires requires { typename __iter_category_t<_Iterator>; } + struct __move_iter_cat<_Iterator> + { + using iterator_category + = __clamp_iter_cat<__iter_category_t<_Iterator>, + random_access_iterator_tag>; + }; + } + /// @endcond +#endif // ranges + + // 24.4.3 Move iterators + /** @brief An iterator adaptor that yields an rvalue reference. + * + * Class template move_iterator is an iterator adapter with the same + * behavior as the underlying iterator except that its dereference + * operator implicitly converts the value returned by the underlying + * iterator's dereference operator to an rvalue reference. Some + * generic algorithms can be called with move iterators to replace + * copying with moving. + */ + template + class move_iterator +#ifdef __glibcxx_ranges + : public __detail::__move_iter_cat<_Iterator> +#endif + { + _Iterator _M_current; + + using __traits_type = iterator_traits<_Iterator>; +#ifndef __glibcxx_ranges + using __base_ref = typename __traits_type::reference; +#endif + + template + friend class move_iterator; + +#ifdef __glibcxx_concepts // C++20 && concepts + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3435. three_way_comparable_with, [...]> + template + static constexpr bool __convertible = !is_same_v<_Iter2, _Iterator> + && convertible_to; +#endif + +#ifdef __glibcxx_ranges + static auto + _S_iter_concept() + { + if constexpr (random_access_iterator<_Iterator>) + return random_access_iterator_tag{}; + else if constexpr (bidirectional_iterator<_Iterator>) + return bidirectional_iterator_tag{}; + else if constexpr (forward_iterator<_Iterator>) + return forward_iterator_tag{}; + else + return input_iterator_tag{}; + } +#endif + + public: + using iterator_type = _Iterator; + +#ifdef __glibcxx_move_iterator_concept // C++ >= 20 && lib_concepts + using iterator_concept = decltype(_S_iter_concept()); + + // iterator_category defined in __move_iter_cat + using value_type = iter_value_t<_Iterator>; + using difference_type = iter_difference_t<_Iterator>; + using pointer = _Iterator; + using reference = iter_rvalue_reference_t<_Iterator>; +#else + typedef typename __traits_type::iterator_category iterator_category; + typedef typename __traits_type::value_type value_type; + typedef typename __traits_type::difference_type difference_type; + // NB: DR 680. + typedef _Iterator pointer; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2106. move_iterator wrapping iterators returning prvalues + using reference + = __conditional_t::value, + typename remove_reference<__base_ref>::type&&, + __base_ref>; +#endif + + _GLIBCXX17_CONSTEXPR + move_iterator() + : _M_current() { } + + explicit _GLIBCXX17_CONSTEXPR + move_iterator(iterator_type __i) + : _M_current(std::move(__i)) { } + + template +#ifdef __glibcxx_concepts + requires __convertible<_Iter> +#endif + _GLIBCXX17_CONSTEXPR + move_iterator(const move_iterator<_Iter>& __i) + : _M_current(__i._M_current) { } + + template +#ifdef __glibcxx_concepts + requires __convertible<_Iter> + && assignable_from<_Iterator&, const _Iter&> +#endif + _GLIBCXX17_CONSTEXPR + move_iterator& operator=(const move_iterator<_Iter>& __i) + { + _M_current = __i._M_current; + return *this; + } + +#if __cplusplus <= 201703L + [[__nodiscard__]] + _GLIBCXX17_CONSTEXPR iterator_type + base() const + { return _M_current; } +#else + [[nodiscard]] + constexpr const iterator_type& + base() const & noexcept + { return _M_current; } + + [[nodiscard]] + constexpr iterator_type + base() && + { return std::move(_M_current); } +#endif + + [[__nodiscard__]] + _GLIBCXX17_CONSTEXPR reference + operator*() const +#ifdef __glibcxx_ranges + { return ranges::iter_move(_M_current); } +#else + { return static_cast(*_M_current); } +#endif + + [[__nodiscard__]] + _GLIBCXX17_CONSTEXPR pointer + operator->() const + { return _M_current; } + + _GLIBCXX17_CONSTEXPR move_iterator& + operator++() + { + ++_M_current; + return *this; + } + + _GLIBCXX17_CONSTEXPR move_iterator + operator++(int) + { + move_iterator __tmp = *this; + ++_M_current; + return __tmp; + } + +#ifdef __glibcxx_concepts + constexpr void + operator++(int) requires (!forward_iterator<_Iterator>) + { ++_M_current; } +#endif + + _GLIBCXX17_CONSTEXPR move_iterator& + operator--() + { + --_M_current; + return *this; + } + + _GLIBCXX17_CONSTEXPR move_iterator + operator--(int) + { + move_iterator __tmp = *this; + --_M_current; + return __tmp; + } + + [[__nodiscard__]] + _GLIBCXX17_CONSTEXPR move_iterator + operator+(difference_type __n) const + { return move_iterator(_M_current + __n); } + + _GLIBCXX17_CONSTEXPR move_iterator& + operator+=(difference_type __n) + { + _M_current += __n; + return *this; + } + + [[__nodiscard__]] + _GLIBCXX17_CONSTEXPR move_iterator + operator-(difference_type __n) const + { return move_iterator(_M_current - __n); } + + _GLIBCXX17_CONSTEXPR move_iterator& + operator-=(difference_type __n) + { + _M_current -= __n; + return *this; + } + + [[__nodiscard__]] + _GLIBCXX17_CONSTEXPR reference + operator[](difference_type __n) const +#ifdef __glibcxx_ranges + { return ranges::iter_move(_M_current + __n); } +#else + { return std::move(_M_current[__n]); } +#endif + +#ifdef __glibcxx_ranges + template _Sent> + [[nodiscard]] + friend constexpr bool + operator==(const move_iterator& __x, const move_sentinel<_Sent>& __y) + { return __x.base() == __y.base(); } + + template _Sent> + [[nodiscard]] + friend constexpr iter_difference_t<_Iterator> + operator-(const move_sentinel<_Sent>& __x, const move_iterator& __y) + { return __x.base() - __y.base(); } + + template _Sent> + [[nodiscard]] + friend constexpr iter_difference_t<_Iterator> + operator-(const move_iterator& __x, const move_sentinel<_Sent>& __y) + { return __x.base() - __y.base(); } + + [[nodiscard]] + friend constexpr iter_rvalue_reference_t<_Iterator> + iter_move(const move_iterator& __i) + noexcept(noexcept(ranges::iter_move(__i._M_current))) + { return ranges::iter_move(__i._M_current); } + + template _Iter2> + friend constexpr void + iter_swap(const move_iterator& __x, const move_iterator<_Iter2>& __y) + noexcept(noexcept(ranges::iter_swap(__x._M_current, __y._M_current))) + { return ranges::iter_swap(__x._M_current, __y._M_current); } +#endif // C++20 + }; + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator==(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) +#ifdef __glibcxx_concepts + requires requires { { __x.base() == __y.base() } -> convertible_to; } +#endif + { return __x.base() == __y.base(); } + +#ifdef __cpp_lib_three_way_comparison + template _IteratorR> + [[__nodiscard__]] + constexpr compare_three_way_result_t<_IteratorL, _IteratorR> + operator<=>(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + { return __x.base() <=> __y.base(); } +#else + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator!=(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + { return !(__x == __y); } +#endif + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator<(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) +#ifdef __glibcxx_concepts + requires requires { { __x.base() < __y.base() } -> convertible_to; } +#endif + { return __x.base() < __y.base(); } + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator<=(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) +#ifdef __glibcxx_concepts + requires requires { { __y.base() < __x.base() } -> convertible_to; } +#endif + { return !(__y < __x); } + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator>(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) +#ifdef __glibcxx_concepts + requires requires { { __y.base() < __x.base() } -> convertible_to; } +#endif + { return __y < __x; } + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator>=(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) +#ifdef __glibcxx_concepts + requires requires { { __x.base() < __y.base() } -> convertible_to; } +#endif + { return !(__x < __y); } + + // Note: See __normal_iterator operators note from Gaby to understand + // why we have these extra overloads for some move_iterator operators. + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator==(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + // N.B. No contraints, x.base() == y.base() is always well-formed. + { return __x.base() == __y.base(); } + +#ifdef __cpp_lib_three_way_comparison + template + [[__nodiscard__]] + constexpr compare_three_way_result_t<_Iterator> + operator<=>(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return __x.base() <=> __y.base(); } +#else + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator!=(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return !(__x == __y); } + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator<(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return __x.base() < __y.base(); } + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator<=(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return !(__y < __x); } + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator>(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return __y < __x; } + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR bool + operator>=(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return !(__x < __y); } +#endif // ! C++20 + + // DR 685. + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR auto + operator-(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + -> decltype(__x.base() - __y.base()) + { return __x.base() - __y.base(); } + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR move_iterator<_Iterator> + operator+(typename move_iterator<_Iterator>::difference_type __n, + const move_iterator<_Iterator>& __x) +#ifdef __glibcxx_concepts + requires requires { { __x.base() + __n } -> same_as<_Iterator>; } +#endif + { return __x + __n; } + + template + [[__nodiscard__]] + inline _GLIBCXX17_CONSTEXPR move_iterator<_Iterator> + make_move_iterator(_Iterator __i) + { return move_iterator<_Iterator>(std::move(__i)); } + + template::value_type>::value, + _Iterator, move_iterator<_Iterator>>> + [[__nodiscard__]] + constexpr _ReturnType + __make_move_if_noexcept_iterator(_Iterator __i) + { return _ReturnType(__i); } + + // Overload for pointers that matches std::move_if_noexcept more closely, + // returning a constant iterator when we don't want to move. + template::value, + const _Tp*, move_iterator<_Tp*>>> + [[__nodiscard__]] + constexpr _ReturnType + __make_move_if_noexcept_iterator(_Tp* __i) + { return _ReturnType(__i); } + + template + struct __is_move_iterator > + { + enum { __value = 1 }; + typedef __true_type __type; + }; + +#define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter) +#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) \ + std::__make_move_if_noexcept_iterator(_Iter) +#else +#define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) (_Iter) +#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) (_Iter) +#endif // C++11 + +#ifdef __glibcxx_ranges + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3736. move_iterator missing disable_sized_sentinel_for specialization + template + requires (!sized_sentinel_for<_Iterator1, _Iterator2>) + inline constexpr bool + disable_sized_sentinel_for, + move_iterator<_Iterator2>> = true; + + // [iterators.common] Common iterators + + /// @cond undocumented + namespace __detail + { + template + concept __common_iter_has_arrow = indirectly_readable + && (requires(const _It& __it) { __it.operator->(); } + || is_reference_v> + || constructible_from, iter_reference_t<_It>>); + + template + concept __common_iter_use_postfix_proxy + = (!requires (_It& __i) { { *__i++ } -> __can_reference; }) + && constructible_from, iter_reference_t<_It>> + && move_constructible>; + } // namespace __detail + /// @endcond + + /// An iterator/sentinel adaptor for representing a non-common range. + template _Sent> + requires (!same_as<_It, _Sent>) && copyable<_It> + class common_iterator + { + template + static constexpr bool + _S_noexcept1() + { + if constexpr (is_trivially_default_constructible_v<_Tp>) + return is_nothrow_assignable_v<_Tp&, _Up>; + else + return is_nothrow_constructible_v<_Tp, _Up>; + } + + template + static constexpr bool + _S_noexcept() + { return _S_noexcept1<_It, _It2>() && _S_noexcept1<_Sent, _Sent2>(); } + + class __arrow_proxy + { + iter_value_t<_It> _M_keep; + + constexpr + __arrow_proxy(iter_reference_t<_It>&& __x) + : _M_keep(std::move(__x)) { } + + friend class common_iterator; + + public: + constexpr const iter_value_t<_It>* + operator->() const noexcept + { return std::__addressof(_M_keep); } + }; + + class __postfix_proxy + { + iter_value_t<_It> _M_keep; + + constexpr + __postfix_proxy(iter_reference_t<_It>&& __x) + : _M_keep(std::forward>(__x)) { } + + friend class common_iterator; + + public: + constexpr const iter_value_t<_It>& + operator*() const noexcept + { return _M_keep; } + }; + + public: + constexpr + common_iterator() + noexcept(is_nothrow_default_constructible_v<_It>) + requires default_initializable<_It> + : _M_it(), _M_index(0) + { } + + constexpr + common_iterator(_It __i) + noexcept(is_nothrow_move_constructible_v<_It>) + : _M_it(std::move(__i)), _M_index(0) + { } + + constexpr + common_iterator(_Sent __s) + noexcept(is_nothrow_move_constructible_v<_Sent>) + : _M_sent(std::move(__s)), _M_index(1) + { } + + template + requires convertible_to + && convertible_to + constexpr + common_iterator(const common_iterator<_It2, _Sent2>& __x) + noexcept(_S_noexcept()) + : _M_valueless(), _M_index(__x._M_index) + { + __glibcxx_assert(__x._M_has_value()); + if (_M_index == 0) + { + if constexpr (is_trivially_default_constructible_v<_It>) + _M_it = std::move(__x._M_it); + else + std::construct_at(std::__addressof(_M_it), __x._M_it); + } + else if (_M_index == 1) + { + if constexpr (is_trivially_default_constructible_v<_Sent>) + _M_sent = std::move(__x._M_sent); + else + std::construct_at(std::__addressof(_M_sent), __x._M_sent); + } + } + + common_iterator(const common_iterator&) = default; + + constexpr + common_iterator(const common_iterator& __x) + noexcept(_S_noexcept()) + requires (!is_trivially_copyable_v<_It> || !is_trivially_copyable_v<_Sent>) + : _M_valueless(), _M_index(__x._M_index) + { + if (_M_index == 0) + { + if constexpr (is_trivially_default_constructible_v<_It>) + _M_it = __x._M_it; + else + std::construct_at(std::__addressof(_M_it), __x._M_it); + } + else if (_M_index == 1) + { + if constexpr (is_trivially_default_constructible_v<_Sent>) + _M_sent = __x._M_sent; + else + std::construct_at(std::__addressof(_M_sent), __x._M_sent); + } + } + + common_iterator(common_iterator&&) = default; + + constexpr + common_iterator(common_iterator&& __x) + noexcept(_S_noexcept<_It, _Sent>()) + requires (!is_trivially_copyable_v<_It> || !is_trivially_copyable_v<_Sent>) + : _M_valueless(), _M_index(__x._M_index) + { + if (_M_index == 0) + { + if constexpr (is_trivially_default_constructible_v<_It>) + _M_it = std::move(__x._M_it); + else + std::construct_at(std::__addressof(_M_it), std::move(__x._M_it)); + } + else if (_M_index == 1) + { + if constexpr (is_trivially_default_constructible_v<_Sent>) + _M_sent = std::move(__x._M_sent); + else + std::construct_at(std::__addressof(_M_sent), + std::move(__x._M_sent)); + } + } + + constexpr common_iterator& + operator=(const common_iterator&) = default; + + constexpr common_iterator& + operator=(const common_iterator& __x) + noexcept(is_nothrow_copy_assignable_v<_It> + && is_nothrow_copy_assignable_v<_Sent> + && is_nothrow_copy_constructible_v<_It> + && is_nothrow_copy_constructible_v<_Sent>) + requires (!is_trivially_copy_assignable_v<_It> + || !is_trivially_copy_assignable_v<_Sent>) + { + _M_assign(__x); + return *this; + } + + constexpr common_iterator& + operator=(common_iterator&&) = default; + + constexpr common_iterator& + operator=(common_iterator&& __x) + noexcept(is_nothrow_move_assignable_v<_It> + && is_nothrow_move_assignable_v<_Sent> + && is_nothrow_move_constructible_v<_It> + && is_nothrow_move_constructible_v<_Sent>) + requires (!is_trivially_move_assignable_v<_It> + || !is_trivially_move_assignable_v<_Sent>) + { + _M_assign(std::move(__x)); + return *this; + } + + template + requires convertible_to + && convertible_to + && assignable_from<_It&, const _It2&> + && assignable_from<_Sent&, const _Sent2&> + constexpr common_iterator& + operator=(const common_iterator<_It2, _Sent2>& __x) + noexcept(is_nothrow_constructible_v<_It, const _It2&> + && is_nothrow_constructible_v<_Sent, const _Sent2&> + && is_nothrow_assignable_v<_It&, const _It2&> + && is_nothrow_assignable_v<_Sent&, const _Sent2&>) + { + __glibcxx_assert(__x._M_has_value()); + _M_assign(__x); + return *this; + } + +#if __cpp_concepts >= 202002L // Constrained special member functions + ~common_iterator() = default; + + constexpr + ~common_iterator() + requires (!is_trivially_destructible_v<_It> + || !is_trivially_destructible_v<_Sent>) +#else + constexpr + ~common_iterator() +#endif + { + if (_M_index == 0) + _M_it.~_It(); + else if (_M_index == 1) + _M_sent.~_Sent(); + } + + [[nodiscard]] + constexpr decltype(auto) + operator*() + { + __glibcxx_assert(_M_index == 0); + return *_M_it; + } + + [[nodiscard]] + constexpr decltype(auto) + operator*() const requires __detail::__dereferenceable + { + __glibcxx_assert(_M_index == 0); + return *_M_it; + } + + [[nodiscard]] + constexpr auto + operator->() const requires __detail::__common_iter_has_arrow<_It> + { + __glibcxx_assert(_M_index == 0); + if constexpr (is_pointer_v<_It> || requires { _M_it.operator->(); }) + return _M_it; + else if constexpr (is_reference_v>) + { + auto&& __tmp = *_M_it; + return std::__addressof(__tmp); + } + else + return __arrow_proxy{*_M_it}; + } + + constexpr common_iterator& + operator++() + { + __glibcxx_assert(_M_index == 0); + ++_M_it; + return *this; + } + + constexpr decltype(auto) + operator++(int) + { + __glibcxx_assert(_M_index == 0); + if constexpr (forward_iterator<_It>) + { + common_iterator __tmp = *this; + ++*this; + return __tmp; + } + else if constexpr (!__detail::__common_iter_use_postfix_proxy<_It>) + return _M_it++; + else + { + __postfix_proxy __p(**this); + ++*this; + return __p; + } + } + + template _Sent2> + requires sentinel_for<_Sent, _It2> + friend constexpr bool + operator== [[nodiscard]] (const common_iterator& __x, + const common_iterator<_It2, _Sent2>& __y) + { + switch(__x._M_index << 2 | __y._M_index) + { + case 0b0000: + case 0b0101: + return true; + case 0b0001: + return __x._M_it == __y._M_sent; + case 0b0100: + return __x._M_sent == __y._M_it; + default: + __glibcxx_assert(__x._M_has_value()); + __glibcxx_assert(__y._M_has_value()); + __builtin_unreachable(); + } + } + + template _Sent2> + requires sentinel_for<_Sent, _It2> && equality_comparable_with<_It, _It2> + friend constexpr bool + operator== [[nodiscard]] (const common_iterator& __x, + const common_iterator<_It2, _Sent2>& __y) + { + switch(__x._M_index << 2 | __y._M_index) + { + case 0b0101: + return true; + case 0b0000: + return __x._M_it == __y._M_it; + case 0b0001: + return __x._M_it == __y._M_sent; + case 0b0100: + return __x._M_sent == __y._M_it; + default: + __glibcxx_assert(__x._M_has_value()); + __glibcxx_assert(__y._M_has_value()); + __builtin_unreachable(); + } + } + + template _It2, sized_sentinel_for<_It> _Sent2> + requires sized_sentinel_for<_Sent, _It2> + friend constexpr iter_difference_t<_It2> + operator- [[nodiscard]] (const common_iterator& __x, + const common_iterator<_It2, _Sent2>& __y) + { + switch(__x._M_index << 2 | __y._M_index) + { + case 0b0101: + return 0; + case 0b0000: + return __x._M_it - __y._M_it; + case 0b0001: + return __x._M_it - __y._M_sent; + case 0b0100: + return __x._M_sent - __y._M_it; + default: + __glibcxx_assert(__x._M_has_value()); + __glibcxx_assert(__y._M_has_value()); + __builtin_unreachable(); + } + } + + [[nodiscard]] + friend constexpr iter_rvalue_reference_t<_It> + iter_move(const common_iterator& __i) + noexcept(noexcept(ranges::iter_move(std::declval()))) + requires input_iterator<_It> + { + __glibcxx_assert(__i._M_index == 0); + return ranges::iter_move(__i._M_it); + } + + template _It2, typename _Sent2> + friend constexpr void + iter_swap(const common_iterator& __x, + const common_iterator<_It2, _Sent2>& __y) + noexcept(noexcept(ranges::iter_swap(std::declval(), + std::declval()))) + { + __glibcxx_assert(__x._M_index == 0); + __glibcxx_assert(__y._M_index == 0); + return ranges::iter_swap(__x._M_it, __y._M_it); + } + + private: + template _Sent2> + requires (!same_as<_It2, _Sent2>) && copyable<_It2> + friend class common_iterator; + + constexpr bool + _M_has_value() const noexcept { return _M_index != _S_valueless; } + + template + constexpr void + _M_assign(_CIt&& __x) + { + if (_M_index == __x._M_index) + { + if (_M_index == 0) + _M_it = std::forward<_CIt>(__x)._M_it; + else if (_M_index == 1) + _M_sent = std::forward<_CIt>(__x)._M_sent; + } + else + { + if (_M_index == 0) + _M_it.~_It(); + else if (_M_index == 1) + _M_sent.~_Sent(); + _M_index = _S_valueless; + + if (__x._M_index == 0) + std::construct_at(std::__addressof(_M_it), + std::forward<_CIt>(__x)._M_it); + else if (__x._M_index == 1) + std::construct_at(std::__addressof(_M_sent), + std::forward<_CIt>(__x)._M_sent); + _M_index = __x._M_index; + } + } + + union + { + _It _M_it; + _Sent _M_sent; + unsigned char _M_valueless; + }; + unsigned char _M_index; // 0 == _M_it, 1 == _M_sent, 2 == valueless + + static constexpr unsigned char _S_valueless{2}; + }; + + template + struct incrementable_traits> + { + using difference_type = iter_difference_t<_It>; + }; + + template + struct iterator_traits> + { + private: + template + struct __ptr + { + using type = void; + }; + + template + requires __detail::__common_iter_has_arrow<_Iter> + struct __ptr<_Iter> + { + using _CIter = common_iterator<_Iter, _Sent>; + using type = decltype(std::declval().operator->()); + }; + + static auto + _S_iter_cat() + { + if constexpr (requires { requires derived_from<__iter_category_t<_It>, + forward_iterator_tag>; }) + return forward_iterator_tag{}; + else + return input_iterator_tag{}; + } + + public: + using iterator_concept = __conditional_t, + forward_iterator_tag, + input_iterator_tag>; + using iterator_category = decltype(_S_iter_cat()); + using value_type = iter_value_t<_It>; + using difference_type = iter_difference_t<_It>; + using pointer = typename __ptr<_It>::type; + using reference = iter_reference_t<_It>; + }; + + // [iterators.counted] Counted iterators + + /// @cond undocumented + namespace __detail + { + template + struct __counted_iter_value_type + { }; + + template + struct __counted_iter_value_type<_It> + { using value_type = iter_value_t<_It>; }; + + template + struct __counted_iter_concept + { }; + + template + requires requires { typename _It::iterator_concept; } + struct __counted_iter_concept<_It> + { using iterator_concept = typename _It::iterator_concept; }; + + template + struct __counted_iter_cat + { }; + + template + requires requires { typename _It::iterator_category; } + struct __counted_iter_cat<_It> + { using iterator_category = typename _It::iterator_category; }; + } + /// @endcond + + /// An iterator adaptor that keeps track of the distance to the end. + template + class counted_iterator + : public __detail::__counted_iter_value_type<_It>, + public __detail::__counted_iter_concept<_It>, + public __detail::__counted_iter_cat<_It> + { + public: + using iterator_type = _It; + // value_type defined in __counted_iter_value_type + using difference_type = iter_difference_t<_It>; + // iterator_concept defined in __counted_iter_concept + // iterator_category defined in __counted_iter_cat + + constexpr counted_iterator() requires default_initializable<_It> = default; + + constexpr + counted_iterator(_It __i, iter_difference_t<_It> __n) + : _M_current(std::move(__i)), _M_length(__n) + { __glibcxx_assert(__n >= 0); } + + template + requires convertible_to + constexpr + counted_iterator(const counted_iterator<_It2>& __x) + : _M_current(__x._M_current), _M_length(__x._M_length) + { } + + template + requires assignable_from<_It&, const _It2&> + constexpr counted_iterator& + operator=(const counted_iterator<_It2>& __x) + { + _M_current = __x._M_current; + _M_length = __x._M_length; + return *this; + } + + [[nodiscard]] + constexpr const _It& + base() const & noexcept + { return _M_current; } + + [[nodiscard]] + constexpr _It + base() && + noexcept(is_nothrow_move_constructible_v<_It>) + { return std::move(_M_current); } + + [[nodiscard]] + constexpr iter_difference_t<_It> + count() const noexcept { return _M_length; } + + [[nodiscard]] + constexpr decltype(auto) + operator*() + noexcept(noexcept(*_M_current)) + { + __glibcxx_assert( _M_length > 0 ); + return *_M_current; + } + + [[nodiscard]] + constexpr decltype(auto) + operator*() const + noexcept(noexcept(*_M_current)) + requires __detail::__dereferenceable + { + __glibcxx_assert( _M_length > 0 ); + return *_M_current; + } + + [[nodiscard]] + constexpr auto + operator->() const noexcept + requires contiguous_iterator<_It> + { return std::to_address(_M_current); } + + constexpr counted_iterator& + operator++() + { + __glibcxx_assert(_M_length > 0); + ++_M_current; + --_M_length; + return *this; + } + + constexpr decltype(auto) + operator++(int) + { + __glibcxx_assert(_M_length > 0); + --_M_length; + __try + { + return _M_current++; + } __catch(...) { + ++_M_length; + __throw_exception_again; + } + } + + constexpr counted_iterator + operator++(int) requires forward_iterator<_It> + { + auto __tmp = *this; + ++*this; + return __tmp; + } + + constexpr counted_iterator& + operator--() requires bidirectional_iterator<_It> + { + --_M_current; + ++_M_length; + return *this; + } + + constexpr counted_iterator + operator--(int) requires bidirectional_iterator<_It> + { + auto __tmp = *this; + --*this; + return __tmp; + } + + [[nodiscard]] + constexpr counted_iterator + operator+(iter_difference_t<_It> __n) const + requires random_access_iterator<_It> + { return counted_iterator(_M_current + __n, _M_length - __n); } + + [[nodiscard]] + friend constexpr counted_iterator + operator+(iter_difference_t<_It> __n, const counted_iterator& __x) + requires random_access_iterator<_It> + { return __x + __n; } + + constexpr counted_iterator& + operator+=(iter_difference_t<_It> __n) + requires random_access_iterator<_It> + { + __glibcxx_assert(__n <= _M_length); + _M_current += __n; + _M_length -= __n; + return *this; + } + + [[nodiscard]] + constexpr counted_iterator + operator-(iter_difference_t<_It> __n) const + requires random_access_iterator<_It> + { return counted_iterator(_M_current - __n, _M_length + __n); } + + template _It2> + [[nodiscard]] + friend constexpr iter_difference_t<_It2> + operator-(const counted_iterator& __x, + const counted_iterator<_It2>& __y) + { return __y._M_length - __x._M_length; } + + [[nodiscard]] + friend constexpr iter_difference_t<_It> + operator-(const counted_iterator& __x, default_sentinel_t) + { return -__x._M_length; } + + [[nodiscard]] + friend constexpr iter_difference_t<_It> + operator-(default_sentinel_t, const counted_iterator& __y) + { return __y._M_length; } + + constexpr counted_iterator& + operator-=(iter_difference_t<_It> __n) + requires random_access_iterator<_It> + { + __glibcxx_assert(-__n <= _M_length); + _M_current -= __n; + _M_length += __n; + return *this; + } + + [[nodiscard]] + constexpr decltype(auto) + operator[](iter_difference_t<_It> __n) const + noexcept(noexcept(_M_current[__n])) + requires random_access_iterator<_It> + { + __glibcxx_assert(__n < _M_length); + return _M_current[__n]; + } + + template _It2> + [[nodiscard]] + friend constexpr bool + operator==(const counted_iterator& __x, + const counted_iterator<_It2>& __y) + { return __x._M_length == __y._M_length; } + + [[nodiscard]] + friend constexpr bool + operator==(const counted_iterator& __x, default_sentinel_t) + { return __x._M_length == 0; } + + template _It2> + [[nodiscard]] + friend constexpr strong_ordering + operator<=>(const counted_iterator& __x, + const counted_iterator<_It2>& __y) + { return __y._M_length <=> __x._M_length; } + + [[nodiscard]] + friend constexpr iter_rvalue_reference_t<_It> + iter_move(const counted_iterator& __i) + noexcept(noexcept(ranges::iter_move(__i._M_current))) + requires input_iterator<_It> + { + __glibcxx_assert( __i._M_length > 0 ); + return ranges::iter_move(__i._M_current); + } + + template _It2> + friend constexpr void + iter_swap(const counted_iterator& __x, + const counted_iterator<_It2>& __y) + noexcept(noexcept(ranges::iter_swap(__x._M_current, __y._M_current))) + { + __glibcxx_assert( __x._M_length > 0 && __y._M_length > 0 ); + ranges::iter_swap(__x._M_current, __y._M_current); + } + + private: + template friend class counted_iterator; + + _It _M_current = _It(); + iter_difference_t<_It> _M_length = 0; + }; + + template + requires same_as<__detail::__iter_traits<_It>, iterator_traits<_It>> + struct iterator_traits> : iterator_traits<_It> + { + using pointer = __conditional_t, + add_pointer_t>, + void>; + }; + +#ifdef __glibcxx_ranges_as_const // >= C++23 + template + using iter_const_reference_t + = common_reference_t&&, iter_reference_t<_It>>; + + template class basic_const_iterator; + + namespace __detail + { + template + concept __constant_iterator = input_iterator<_It> + && same_as, iter_reference_t<_It>>; + + template + inline constexpr bool __is_const_iterator = false; + + template + inline constexpr bool __is_const_iterator> = true; + + template + concept __not_a_const_iterator = !__is_const_iterator<_Tp>; + + template + using __iter_const_rvalue_reference_t + = common_reference_t&&, iter_rvalue_reference_t<_It>>; + + template + struct __basic_const_iterator_iter_cat + { }; + + template + struct __basic_const_iterator_iter_cat<_It> + { using iterator_category = __iter_category_t<_It>; }; + } // namespace detail + + template + using const_iterator + = __conditional_t<__detail::__constant_iterator<_It>, _It, basic_const_iterator<_It>>; + + namespace __detail + { + template + struct __const_sentinel + { using type = _Sent; }; + + template + struct __const_sentinel<_Sent> + { using type = const_iterator<_Sent>; }; + } // namespace __detail + + template + using const_sentinel = typename __detail::__const_sentinel<_Sent>::type; + + template + class basic_const_iterator + : public __detail::__basic_const_iterator_iter_cat<_It> + { + _It _M_current = _It(); + using __reference = iter_const_reference_t<_It>; + using __rvalue_reference = __detail::__iter_const_rvalue_reference_t<_It>; + + static auto + _S_iter_concept() + { + if constexpr (contiguous_iterator<_It>) + return contiguous_iterator_tag{}; + else if constexpr (random_access_iterator<_It>) + return random_access_iterator_tag{}; + else if constexpr (bidirectional_iterator<_It>) + return bidirectional_iterator_tag{}; + else if constexpr (forward_iterator<_It>) + return forward_iterator_tag{}; + else + return input_iterator_tag{}; + } + + template friend class basic_const_iterator; + + public: + using iterator_concept = decltype(_S_iter_concept()); + using value_type = iter_value_t<_It>; + using difference_type = iter_difference_t<_It>; + + basic_const_iterator() requires default_initializable<_It> = default; + + constexpr + basic_const_iterator(_It __current) + noexcept(is_nothrow_move_constructible_v<_It>) + : _M_current(std::move(__current)) + { } + + template _It2> + constexpr + basic_const_iterator(basic_const_iterator<_It2> __current) + noexcept(is_nothrow_constructible_v<_It, _It2>) + : _M_current(std::move(__current._M_current)) + { } + + template<__detail::__different_from _Tp> + requires convertible_to<_Tp, _It> + constexpr + basic_const_iterator(_Tp&& __current) + noexcept(is_nothrow_constructible_v<_It, _Tp>) + : _M_current(std::forward<_Tp>(__current)) + { } + + constexpr const _It& + base() const & noexcept + { return _M_current; } + + constexpr _It + base() && + noexcept(is_nothrow_move_constructible_v<_It>) + { return std::move(_M_current); } + + constexpr __reference + operator*() const + noexcept(noexcept(static_cast<__reference>(*_M_current))) + { return static_cast<__reference>(*_M_current); } + + constexpr const auto* + operator->() const + noexcept(contiguous_iterator<_It> || noexcept(*_M_current)) + requires is_lvalue_reference_v> + && same_as>, value_type> + { + if constexpr (contiguous_iterator<_It>) + return std::to_address(_M_current); + else + return std::__addressof(*_M_current); + } + + constexpr basic_const_iterator& + operator++() + noexcept(noexcept(++_M_current)) + { + ++_M_current; + return *this; + } + + constexpr void + operator++(int) + noexcept(noexcept(++_M_current)) + { ++_M_current; } + + constexpr basic_const_iterator + operator++(int) + noexcept(noexcept(++*this) && is_nothrow_copy_constructible_v) + requires forward_iterator<_It> + { + auto __tmp = *this; + ++*this; + return __tmp; + } + + constexpr basic_const_iterator& + operator--() + noexcept(noexcept(--_M_current)) + requires bidirectional_iterator<_It> + { + --_M_current; + return *this; + } + + constexpr basic_const_iterator + operator--(int) + noexcept(noexcept(--*this) && is_nothrow_copy_constructible_v) + requires bidirectional_iterator<_It> + { + auto __tmp = *this; + --*this; + return __tmp; + } + + constexpr basic_const_iterator& + operator+=(difference_type __n) + noexcept(noexcept(_M_current += __n)) + requires random_access_iterator<_It> + { + _M_current += __n; + return *this; + } + + constexpr basic_const_iterator& + operator-=(difference_type __n) + noexcept(noexcept(_M_current -= __n)) + requires random_access_iterator<_It> + { + _M_current -= __n; + return *this; + } + + constexpr __reference + operator[](difference_type __n) const + noexcept(noexcept(static_cast<__reference>(_M_current[__n]))) + requires random_access_iterator<_It> + { return static_cast<__reference>(_M_current[__n]); } + + template _Sent> + constexpr bool + operator==(const _Sent& __s) const + noexcept(noexcept(_M_current == __s)) + { return _M_current == __s; } + + template<__detail::__not_a_const_iterator _CIt> + requires __detail::__constant_iterator<_CIt> && convertible_to<_It, _CIt> + constexpr + operator _CIt() const& + { return _M_current; } + + template<__detail::__not_a_const_iterator _CIt> + requires __detail::__constant_iterator<_CIt> && convertible_to<_It, _CIt> + constexpr + operator _CIt() && + { return std::move(_M_current); } + + constexpr bool + operator<(const basic_const_iterator& __y) const + noexcept(noexcept(_M_current < __y._M_current)) + requires random_access_iterator<_It> + { return _M_current < __y._M_current; } + + constexpr bool + operator>(const basic_const_iterator& __y) const + noexcept(noexcept(_M_current > __y._M_current)) + requires random_access_iterator<_It> + { return _M_current > __y._M_current; } + + constexpr bool + operator<=(const basic_const_iterator& __y) const + noexcept(noexcept(_M_current <= __y._M_current)) + requires random_access_iterator<_It> + { return _M_current <= __y._M_current; } + + constexpr bool + operator>=(const basic_const_iterator& __y) const + noexcept(noexcept(_M_current >= __y._M_current)) + requires random_access_iterator<_It> + { return _M_current >= __y._M_current; } + + constexpr auto + operator<=>(const basic_const_iterator& __y) const + noexcept(noexcept(_M_current <=> __y._M_current)) + requires random_access_iterator<_It> && three_way_comparable<_It> + { return _M_current <=> __y._M_current; } + + template<__detail::__different_from _It2> + constexpr bool + operator<(const _It2& __y) const + noexcept(noexcept(_M_current < __y)) + requires random_access_iterator<_It> && totally_ordered_with<_It, _It2> + { return _M_current < __y; } + + template<__detail::__different_from _It2> + constexpr bool + operator>(const _It2& __y) const + noexcept(noexcept(_M_current > __y)) + requires random_access_iterator<_It> && totally_ordered_with<_It, _It2> + { return _M_current > __y; } + + template<__detail::__different_from _It2> + constexpr bool + operator<=(const _It2& __y) const + noexcept(noexcept(_M_current <= __y)) + requires random_access_iterator<_It> && totally_ordered_with<_It, _It2> + { return _M_current <= __y; } + + template<__detail::__different_from _It2> + constexpr bool + operator>=(const _It2& __y) const + noexcept(noexcept(_M_current >= __y)) + requires random_access_iterator<_It> && totally_ordered_with<_It, _It2> + { return _M_current >= __y; } + + template<__detail::__different_from _It2> + constexpr auto + operator<=>(const _It2& __y) const + noexcept(noexcept(_M_current <=> __y)) + requires random_access_iterator<_It> && totally_ordered_with<_It, _It2> + && three_way_comparable_with<_It, _It2> + { return _M_current <=> __y; } + + template<__detail::__not_a_const_iterator _It2, same_as<_It> _It3> + friend constexpr bool + operator<(const _It2& __x, const basic_const_iterator<_It3>& __y) + noexcept(noexcept(__x < __y._M_current)) + requires random_access_iterator<_It> && totally_ordered_with<_It, _It2> + { return __x < __y._M_current; } + + template<__detail::__not_a_const_iterator _It2, same_as<_It> _It3> + friend constexpr bool + operator>(const _It2& __x, const basic_const_iterator<_It3>& __y) + noexcept(noexcept(__x > __y._M_current)) + requires random_access_iterator<_It> && totally_ordered_with<_It, _It2> + { return __x > __y._M_current; } + + template<__detail::__not_a_const_iterator _It2, same_as<_It> _It3> + friend constexpr bool + operator<=(const _It2& __x, const basic_const_iterator<_It3>& __y) + noexcept(noexcept(__x <= __y._M_current)) + requires random_access_iterator<_It> && totally_ordered_with<_It, _It2> + { return __x <= __y._M_current; } + + template<__detail::__not_a_const_iterator _It2, same_as<_It> _It3> + friend constexpr bool + operator>=(const _It2& __x, const basic_const_iterator<_It3>& __y) + noexcept(noexcept(__x >= __y._M_current)) + requires random_access_iterator<_It> && totally_ordered_with<_It, _It2> + { return __x >= __y._M_current; } + + friend constexpr basic_const_iterator + operator+(const basic_const_iterator& __i, difference_type __n) + noexcept(noexcept(basic_const_iterator(__i._M_current + __n))) + requires random_access_iterator<_It> + { return basic_const_iterator(__i._M_current + __n); } + + friend constexpr basic_const_iterator + operator+(difference_type __n, const basic_const_iterator& __i) + noexcept(noexcept(basic_const_iterator(__i._M_current + __n))) + requires random_access_iterator<_It> + { return basic_const_iterator(__i._M_current + __n); } + + friend constexpr basic_const_iterator + operator-(const basic_const_iterator& __i, difference_type __n) + noexcept(noexcept(basic_const_iterator(__i._M_current - __n))) + requires random_access_iterator<_It> + { return basic_const_iterator(__i._M_current - __n); } + + template _Sent> + constexpr difference_type + operator-(const _Sent& __y) const + noexcept(noexcept(_M_current - __y)) + { return _M_current - __y; } + + template<__detail::__not_a_const_iterator _Sent, same_as<_It> _It2> + requires sized_sentinel_for<_Sent, _It> + friend constexpr difference_type + operator-(const _Sent& __x, const basic_const_iterator<_It2>& __y) + noexcept(noexcept(__x - __y._M_current)) + { return __x - __y._M_current; } + + friend constexpr __rvalue_reference + iter_move(const basic_const_iterator& __i) + noexcept(noexcept(static_cast<__rvalue_reference>(ranges::iter_move(__i._M_current)))) + { return static_cast<__rvalue_reference>(ranges::iter_move(__i._M_current)); } + }; + + template _Up> + requires input_iterator> + struct common_type, _Up> + { using type = basic_const_iterator>; }; + + template _Up> + requires input_iterator> + struct common_type<_Up, basic_const_iterator<_Tp>> + { using type = basic_const_iterator>; }; + + template _Up> + requires input_iterator> + struct common_type, basic_const_iterator<_Up>> + { using type = basic_const_iterator>; }; + + template + constexpr const_iterator<_It> + make_const_iterator(_It __it) + noexcept(is_nothrow_convertible_v<_It, const_iterator<_It>>) + { return __it; } + + template + constexpr const_sentinel<_Sent> + make_const_sentinel(_Sent __s) + noexcept(is_nothrow_convertible_v<_Sent, const_sentinel<_Sent>>) + { return __s; } +#endif // C++23 ranges_as_const +#endif // C++20 ranges + + /// @} group iterators + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +namespace __gnu_debug +{ + template + class _Safe_iterator; +} + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + /// @cond undocumented + + // Unwrap a __normal_iterator to get the underlying iterator + // (usually a pointer). See uses in std::copy, std::fill, etc. + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _Iterator + __niter_base(__gnu_cxx::__normal_iterator<_Iterator, _Container> __it) + _GLIBCXX_NOEXCEPT_IF(std::is_nothrow_copy_constructible<_Iterator>::value) + { return __it.base(); } + + // Fallback implementation used for iterators that can't be unwrapped. + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _Iterator + __niter_base(_Iterator __it) + _GLIBCXX_NOEXCEPT_IF(std::is_nothrow_copy_constructible<_Iterator>::value) + { return __it; } + + // Overload for _Safe_iterator needs to be declared before uses of + // std::__niter_base because we call it qualified so isn't found by ADL. +#if __cplusplus < 201103L + template + _Ite + __niter_base(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, + std::random_access_iterator_tag>&); + + template + _Ite + __niter_base(const ::__gnu_debug::_Safe_iterator< + ::__gnu_cxx::__normal_iterator<_Ite, _Cont>, _Seq, + std::random_access_iterator_tag>&); +#else + template + _GLIBCXX20_CONSTEXPR + decltype(std::__niter_base(std::declval<_Ite>())) + __niter_base(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, + std::random_access_iterator_tag>&) + noexcept(std::is_nothrow_copy_constructible<_Ite>::value); +#endif + +#if __cplusplus >= 201103L + template + _GLIBCXX20_CONSTEXPR + inline auto + __niter_base(reverse_iterator<_Iterator> __it) + -> decltype(__make_reverse_iterator(__niter_base(__it.base()))) + { return __make_reverse_iterator(__niter_base(__it.base())); } + + template + _GLIBCXX20_CONSTEXPR + inline auto + __niter_base(move_iterator<_Iterator> __it) + -> decltype(make_move_iterator(__niter_base(__it.base()))) + { return make_move_iterator(__niter_base(__it.base())); } + + template + _GLIBCXX20_CONSTEXPR + inline auto + __miter_base(reverse_iterator<_Iterator> __it) + -> decltype(__make_reverse_iterator(__miter_base(__it.base()))) + { return __make_reverse_iterator(__miter_base(__it.base())); } + + template + _GLIBCXX20_CONSTEXPR + inline auto + __miter_base(move_iterator<_Iterator> __it) + -> decltype(__miter_base(__it.base())) + { return __miter_base(__it.base()); } +#endif + + // Reverse the __niter_base transformation to get a __normal_iterator + // back again (this assumes that __normal_iterator is only used to wrap + // random access iterators, like pointers). + // All overloads of std::__niter_base must be declared before this. + template + _GLIBCXX_NODISCARD + _GLIBCXX20_CONSTEXPR + inline _From + __niter_wrap(_From __from, _To __res) + { return __from + (std::__niter_base(__res) - std::__niter_base(__from)); } + + // No need to wrap, iterator already has the right type. + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + _GLIBCXX20_CONSTEXPR + inline _Iterator + __niter_wrap(const _Iterator&, _Iterator __res) + { return __res; } + + /// @endcond + +#if __cpp_deduction_guides >= 201606 + // These helper traits are used for deduction guides + // of associative containers. + template + using __iter_key_t = remove_const_t< +#ifdef __glibcxx_tuple_like // >= C++23 + tuple_element_t<0, typename iterator_traits<_InputIterator>::value_type>>; +#else + typename iterator_traits<_InputIterator>::value_type::first_type>; +#endif + + template + using __iter_val_t +#ifdef __glibcxx_tuple_like // >= C++23 + = tuple_element_t<1, typename iterator_traits<_InputIterator>::value_type>; +#else + = typename iterator_traits<_InputIterator>::value_type::second_type; +#endif + + template + struct pair; + + template + using __iter_to_alloc_t + = pair, __iter_val_t<_InputIterator>>; +#endif // __cpp_deduction_guides + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#ifdef _GLIBCXX_DEBUG +# include +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator.h.blob new file mode 100644 index 0000000..dbe038a Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_funcs.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_funcs.h new file mode 100644 index 0000000..637159f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_funcs.h @@ -0,0 +1,261 @@ +// Functions used by iterators -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_iterator_base_funcs.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + * + * This file contains all of the general iterator-related utility + * functions, such as distance() and advance(). + */ + +#ifndef _STL_ITERATOR_BASE_FUNCS_H +#define _STL_ITERATOR_BASE_FUNCS_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + // Forward declaration for the overloads of __distance. + template struct _List_iterator; + template struct _List_const_iterator; +_GLIBCXX_END_NAMESPACE_CONTAINER + + template + inline _GLIBCXX14_CONSTEXPR + typename iterator_traits<_InputIterator>::difference_type + __distance(_InputIterator __first, _InputIterator __last, + input_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + + typename iterator_traits<_InputIterator>::difference_type __n = 0; + while (__first != __last) + { + ++__first; + ++__n; + } + return __n; + } + + template + __attribute__((__always_inline__)) + inline _GLIBCXX14_CONSTEXPR + typename iterator_traits<_RandomAccessIterator>::difference_type + __distance(_RandomAccessIterator __first, _RandomAccessIterator __last, + random_access_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_RandomAccessIteratorConcept< + _RandomAccessIterator>) + return __last - __first; + } + +#if _GLIBCXX_USE_CXX11_ABI + // Forward declaration because of the qualified call in distance. + template + ptrdiff_t + __distance(_GLIBCXX_STD_C::_List_iterator<_Tp>, + _GLIBCXX_STD_C::_List_iterator<_Tp>, + input_iterator_tag); + + template + ptrdiff_t + __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp>, + _GLIBCXX_STD_C::_List_const_iterator<_Tp>, + input_iterator_tag); +#endif + +#if __cplusplus >= 201103L + // Give better error if std::distance called with a non-Cpp17InputIterator. + template + void + __distance(_OutputIterator, _OutputIterator, output_iterator_tag) = delete; +#endif + + /** + * @brief A generalization of pointer arithmetic. + * @param __first An input iterator. + * @param __last An input iterator. + * @return The distance between them. + * + * Returns @c n such that __first + n == __last. This requires + * that @p __last must be reachable from @p __first. Note that @c + * n may be negative. + * + * For random access iterators, this uses their @c + and @c - operations + * and are constant time. For other %iterator classes they are linear time. + */ + template + _GLIBCXX_NODISCARD __attribute__((__always_inline__)) + inline _GLIBCXX17_CONSTEXPR + typename iterator_traits<_InputIterator>::difference_type + distance(_InputIterator __first, _InputIterator __last) + { + // concept requirements -- taken care of in __distance + return std::__distance(__first, __last, + std::__iterator_category(__first)); + } + + template + inline _GLIBCXX14_CONSTEXPR void + __advance(_InputIterator& __i, _Distance __n, input_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_assert(__n >= 0); + while (__n--) + ++__i; + } + + template + inline _GLIBCXX14_CONSTEXPR void + __advance(_BidirectionalIterator& __i, _Distance __n, + bidirectional_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) + if (__n > 0) + while (__n--) + ++__i; + else + while (__n++) + --__i; + } + + template + inline _GLIBCXX14_CONSTEXPR void + __advance(_RandomAccessIterator& __i, _Distance __n, + random_access_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_RandomAccessIteratorConcept< + _RandomAccessIterator>) + if (__builtin_constant_p(__n) && __n == 1) + ++__i; + else if (__builtin_constant_p(__n) && __n == -1) + --__i; + else + __i += __n; + } + +#if __cplusplus >= 201103L + // Give better error if std::advance called with a non-Cpp17InputIterator. + template + void + __advance(_OutputIterator&, _Distance, output_iterator_tag) = delete; +#endif + + /** + * @brief A generalization of pointer arithmetic. + * @param __i An input iterator. + * @param __n The @a delta by which to change @p __i. + * @return Nothing. + * + * This increments @p i by @p n. For bidirectional and random access + * iterators, @p __n may be negative, in which case @p __i is decremented. + * + * For random access iterators, this uses their @c + and @c - operations + * and are constant time. For other %iterator classes they are linear time. + */ + template + __attribute__((__always_inline__)) + inline _GLIBCXX17_CONSTEXPR void + advance(_InputIterator& __i, _Distance __n) + { + // concept requirements -- taken care of in __advance + typename iterator_traits<_InputIterator>::difference_type __d = __n; + std::__advance(__i, __d, std::__iterator_category(__i)); + } + +#if __cplusplus >= 201103L + + template + _GLIBCXX_NODISCARD [[__gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR _InputIterator + next(_InputIterator __x, typename + iterator_traits<_InputIterator>::difference_type __n = 1) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + std::advance(__x, __n); + return __x; + } + + template + _GLIBCXX_NODISCARD [[__gnu__::__always_inline__]] + inline _GLIBCXX17_CONSTEXPR _BidirectionalIterator + prev(_BidirectionalIterator __x, typename + iterator_traits<_BidirectionalIterator>::difference_type __n = 1) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) + std::advance(__x, -__n); + return __x; + } + +#endif // C++11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _STL_ITERATOR_BASE_FUNCS_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_funcs.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_funcs.h.blob new file mode 100644 index 0000000..eef2a41 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_funcs.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_types.h new file mode 100644 index 0000000..a67d7bd --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_types.h @@ -0,0 +1,289 @@ +// Types used in iterator implementation -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_iterator_base_types.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + * + * This file contains all of the general iterator-related utility types, + * such as iterator_traits and struct iterator. + */ + +#ifndef _STL_ITERATOR_BASE_TYPES_H +#define _STL_ITERATOR_BASE_TYPES_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#if __cplusplus >= 201103L +# include // For __void_t, is_convertible +#endif + +#if __cplusplus > 201703L && __cpp_concepts >= 201907L +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup iterators Iterators + * Abstractions for uniform iterating through various underlying types. + */ + ///@{ + + /** + * @defgroup iterator_tags Iterator Tags + * These are empty types, used to distinguish different iterators. The + * distinction is not made by what they contain, but simply by what they + * are. Different underlying algorithms can then be used based on the + * different operations supported by different iterator types. + */ + ///@{ + /// Marking input iterators. + struct input_iterator_tag { }; + + /// Marking output iterators. + struct output_iterator_tag { }; + + /// Forward iterators support a superset of input iterator operations. + struct forward_iterator_tag : public input_iterator_tag { }; + + /// Bidirectional iterators support a superset of forward iterator + /// operations. + struct bidirectional_iterator_tag : public forward_iterator_tag { }; + + /// Random-access iterators support a superset of bidirectional + /// iterator operations. + struct random_access_iterator_tag : public bidirectional_iterator_tag { }; + +#if __cplusplus > 201703L + /// Contiguous iterators point to objects stored contiguously in memory. + struct contiguous_iterator_tag : public random_access_iterator_tag { }; +#endif + ///@} + + /** + * @brief Common %iterator class. + * + * This class does nothing but define nested typedefs. %Iterator classes + * can inherit from this class to save some work. The typedefs are then + * used in specializations and overloading. + * + * In particular, there are no default implementations of requirements + * such as @c operator++ and the like. (How could there be?) + */ + template + struct _GLIBCXX17_DEPRECATED iterator + { + /// One of the @link iterator_tags tag types@endlink. + typedef _Category iterator_category; + /// The type "pointed to" by the iterator. + typedef _Tp value_type; + /// Distance between iterators is represented as this type. + typedef _Distance difference_type; + /// This type represents a pointer-to-value_type. + typedef _Pointer pointer; + /// This type represents a reference-to-value_type. + typedef _Reference reference; + }; + + /** + * @brief Traits class for iterators. + * + * This class does nothing but define nested typedefs. The general + * version simply @a forwards the nested typedefs from the Iterator + * argument. Specialized versions for pointers and pointers-to-const + * provide tighter, more correct semantics. + */ + template + struct iterator_traits; + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2408. SFINAE-friendly common_type/iterator_traits is missing in C++14 + template> + struct __iterator_traits { }; + +#if ! __cpp_lib_concepts + + template + struct __iterator_traits<_Iterator, + __void_t> + { + typedef typename _Iterator::iterator_category iterator_category; + typedef typename _Iterator::value_type value_type; + typedef typename _Iterator::difference_type difference_type; + typedef typename _Iterator::pointer pointer; + typedef typename _Iterator::reference reference; + }; +#endif // ! concepts + + template + struct iterator_traits + : public __iterator_traits<_Iterator> { }; + +#else // ! C++11 + template + struct iterator_traits + { + typedef typename _Iterator::iterator_category iterator_category; + typedef typename _Iterator::value_type value_type; + typedef typename _Iterator::difference_type difference_type; + typedef typename _Iterator::pointer pointer; + typedef typename _Iterator::reference reference; + }; +#endif // C++11 + +#if __cplusplus > 201703L + /// Partial specialization for object pointer types. + template +#if __cpp_concepts >= 201907L + requires is_object_v<_Tp> +#endif + struct iterator_traits<_Tp*> + { + using iterator_concept = contiguous_iterator_tag; + using iterator_category = random_access_iterator_tag; + using value_type = remove_cv_t<_Tp>; + using difference_type = ptrdiff_t; + using pointer = _Tp*; + using reference = _Tp&; + }; +#else + /// Partial specialization for pointer types. + template + struct iterator_traits<_Tp*> + { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef _Tp& reference; + }; + + /// Partial specialization for const pointer types. + template + struct iterator_traits + { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; + }; +#endif + + /** + * This function is not a part of the C++ standard but is syntactic + * sugar for internal library use only. + */ + template + __attribute__((__always_inline__)) + inline _GLIBCXX_CONSTEXPR + typename iterator_traits<_Iter>::iterator_category + __iterator_category(const _Iter&) + { return typename iterator_traits<_Iter>::iterator_category(); } + + ///@} + +#if __cplusplus >= 201103L + template + using __iter_category_t + = typename iterator_traits<_Iter>::iterator_category; + + template + using _RequireInputIter = + __enable_if_t, + input_iterator_tag>::value>; + +#if __cpp_concepts + template + concept __has_input_iter_cat + = is_convertible_v<__iter_category_t<_InIter>, input_iterator_tag>; +#endif + + template> + struct __is_random_access_iter + : is_base_of + { + typedef is_base_of _Base; + enum { __value = _Base::value }; + }; +#else + template, + typename _Cat = typename _Traits::iterator_category> + struct __is_random_access_iter + { enum { __value = __is_base_of(random_access_iterator_tag, _Cat) }; }; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if __glibcxx_algorithm_default_value_type // C++ >= 26 +# define _GLIBCXX26_DEF_VAL_T(T) = T +# define _GLIBCXX26_ALGO_DEF_VAL_T(_Iterator) \ + = typename iterator_traits<_Iterator>::value_type +#else +# define _GLIBCXX26_DEF_VAL_T(T) +# define _GLIBCXX26_ALGO_DEF_VAL_T(_Iterator) +#endif + +#endif /* _STL_ITERATOR_BASE_TYPES_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_types.h.blob new file mode 100644 index 0000000..7952e96 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_iterator_base_types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_pair.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_pair.h new file mode 100644 index 0000000..85894fa --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_pair.h @@ -0,0 +1,1368 @@ +// Pair implementation -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_pair.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{utility} + */ + +#ifndef _STL_PAIR_H +#define _STL_PAIR_H 1 + +#if __cplusplus >= 201103L +# include // for std::__decay_and_strip +# include // for std::move / std::forward, and std::swap +# include // for std::tuple_element, std::tuple_size +#endif +#if __cplusplus >= 202002L +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup utilities + * @{ + */ + +#if __cplusplus >= 201103L + /// Tag type for piecewise construction of std::pair objects. + struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; + + /// Tag for piecewise construction of std::pair objects. + _GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct = + piecewise_construct_t(); + + /// @cond undocumented + + // Forward declarations. + template + struct pair; + + template + class tuple; + + // Declarations of std::array and its std::get overloads, so that + // std::tuple_cat can use them if is included before . + // We also declare the other std::get overloads here so that they're + // visible to the P2165R4 tuple-like constructors of pair and tuple. + template + struct array; + + template + struct _Index_tuple; + + template + class complex; + + template + constexpr typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type& + get(pair<_Tp1, _Tp2>& __in) noexcept; + + template + constexpr typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type&& + get(pair<_Tp1, _Tp2>&& __in) noexcept; + + template + constexpr const typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type& + get(const pair<_Tp1, _Tp2>& __in) noexcept; + + template + constexpr const typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type&& + get(const pair<_Tp1, _Tp2>&& __in) noexcept; + + template + constexpr __tuple_element_t<__i, tuple<_Elements...>>& + get(tuple<_Elements...>& __t) noexcept; + + template + constexpr const __tuple_element_t<__i, tuple<_Elements...>>& + get(const tuple<_Elements...>& __t) noexcept; + + template + constexpr __tuple_element_t<__i, tuple<_Elements...>>&& + get(tuple<_Elements...>&& __t) noexcept; + + template + constexpr const __tuple_element_t<__i, tuple<_Elements...>>&& + get(const tuple<_Elements...>&& __t) noexcept; + + template + constexpr _Tp& + get(array<_Tp, _Nm>&) noexcept; + + template + constexpr _Tp&& + get(array<_Tp, _Nm>&&) noexcept; + + template + constexpr const _Tp& + get(const array<_Tp, _Nm>&) noexcept; + + template + constexpr const _Tp&& + get(const array<_Tp, _Nm>&&) noexcept; + +#if __glibcxx_tuple_like >= 202311 // >= C++26 + template + constexpr _Tp& + get(complex<_Tp>&) noexcept; + template + constexpr _Tp&& + get(complex<_Tp>&&) noexcept; + template + constexpr const _Tp& + get(const complex<_Tp>&) noexcept; + template + constexpr const _Tp&& + get(const complex<_Tp>&&) noexcept; +#endif + +#if ! __cpp_lib_concepts + // Concept utility functions, reused in conditionally-explicit + // constructors. + // See PR 70437, don't look at is_constructible or + // is_convertible if the types are the same to + // avoid querying those properties for incomplete types. + template + struct _PCC + { + template + static constexpr bool _ConstructiblePair() + { + return __and_, + is_constructible<_T2, const _U2&>>::value; + } + + template + static constexpr bool _ImplicitlyConvertiblePair() + { + return __and_, + is_convertible>::value; + } + + template + static constexpr bool _MoveConstructiblePair() + { + return __and_, + is_constructible<_T2, _U2&&>>::value; + } + + template + static constexpr bool _ImplicitlyMoveConvertiblePair() + { + return __and_, + is_convertible<_U2&&, _T2>>::value; + } + }; + + template + struct _PCC + { + template + static constexpr bool _ConstructiblePair() + { + return false; + } + + template + static constexpr bool _ImplicitlyConvertiblePair() + { + return false; + } + + template + static constexpr bool _MoveConstructiblePair() + { + return false; + } + + template + static constexpr bool _ImplicitlyMoveConvertiblePair() + { + return false; + } + }; +#endif // lib concepts +#endif // C++11 + +#if __glibcxx_tuple_like // >= C++23 + template + inline constexpr bool __is_tuple_v = false; + + template + inline constexpr bool __is_tuple_v> = true; + + // TODO: Reuse __is_tuple_like from ? + template + inline constexpr bool __is_tuple_like_v = false; + + template + inline constexpr bool __is_tuple_like_v> = true; + + template + inline constexpr bool __is_tuple_like_v> = true; + + template + inline constexpr bool __is_tuple_like_v> = true; + + // __is_tuple_like_v is defined in . + + template + concept __tuple_like = __is_tuple_like_v>; + + template + concept __pair_like = __tuple_like<_Tp> && tuple_size_v> == 2; + + template + concept __eligible_tuple_like + = __detail::__different_from<_Tp, _Tuple> && __tuple_like<_Tp> + && (tuple_size_v> == tuple_size_v<_Tuple>) + && !ranges::__detail::__is_subrange>; + + template + concept __eligible_pair_like + = __detail::__different_from<_Tp, _Pair> && __pair_like<_Tp> + && !ranges::__detail::__is_subrange>; +#endif // C++23 + + template class __pair_base + { +#if __cplusplus >= 201103L && ! __cpp_lib_concepts + template friend struct pair; + __pair_base() = default; + ~__pair_base() = default; + __pair_base(const __pair_base&) = default; + __pair_base& operator=(const __pair_base&) = delete; +#endif // C++11 + }; + + /// @endcond + + /** + * @brief Struct holding two objects of arbitrary type. + * + * @tparam _T1 Type of first object. + * @tparam _T2 Type of second object. + * + * + * + * @headerfile utility + */ + template + struct pair + : public __pair_base<_T1, _T2> + { + typedef _T1 first_type; ///< The type of the `first` member + typedef _T2 second_type; ///< The type of the `second` member + + _T1 first; ///< The first member + _T2 second; ///< The second member + +#if __cplusplus >= 201103L + constexpr pair(const pair&) = default; ///< Copy constructor + constexpr pair(pair&&) = default; ///< Move constructor + + template + _GLIBCXX20_CONSTEXPR + pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); + + /// Swap the first members and then the second members. + _GLIBCXX20_CONSTEXPR void + swap(pair& __p) + noexcept(__and_<__is_nothrow_swappable<_T1>, + __is_nothrow_swappable<_T2>>::value) + { + using std::swap; + swap(first, __p.first); + swap(second, __p.second); + } + +#if __glibcxx_ranges_zip // >= C++23 + // As an extension, we constrain the const swap member function in order + // to continue accepting explicit instantiation of pairs whose elements + // are not all const swappable. Without this constraint, such an + // explicit instantiation would also instantiate the ill-formed body of + // this function and yield a hard error. This constraint shouldn't + // affect the behavior of valid programs. + constexpr void + swap(const pair& __p) const + noexcept(__and_v<__is_nothrow_swappable, + __is_nothrow_swappable>) + requires is_swappable_v && is_swappable_v + { + using std::swap; + swap(first, __p.first); + swap(second, __p.second); + } +#endif // C++23 + + private: + template + _GLIBCXX20_CONSTEXPR + pair(tuple<_Args1...>&, tuple<_Args2...>&, + _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>); + public: + +#if __cpp_lib_concepts + // C++20 implementation using concepts, explicit(bool), fully constexpr. + + /// Default constructor + constexpr + explicit(__not_<__and_<__is_implicitly_default_constructible<_T1>, + __is_implicitly_default_constructible<_T2>>>()) + pair() + noexcept(is_nothrow_default_constructible_v<_T1> + && is_nothrow_default_constructible_v<_T2>) + requires is_default_constructible_v<_T1> + && is_default_constructible_v<_T2> + : first(), second() + { } + + private: + + /// @cond undocumented + template + static constexpr bool + _S_constructible() + { + if constexpr (is_constructible_v<_T1, _U1>) + return is_constructible_v<_T2, _U2>; + return false; + } + + template + static constexpr bool + _S_nothrow_constructible() + { + if constexpr (is_nothrow_constructible_v<_T1, _U1>) + return is_nothrow_constructible_v<_T2, _U2>; + return false; + } + + template + static constexpr bool + _S_convertible() + { + if constexpr (is_convertible_v<_U1, _T1>) + return is_convertible_v<_U2, _T2>; + return false; + } + + // True if construction from _U1 and _U2 would create a dangling ref. + template + static constexpr bool + _S_dangles() + { +#if __has_builtin(__reference_constructs_from_temporary) + if constexpr (__reference_constructs_from_temporary(_T1, _U1&&)) + return true; + else + return __reference_constructs_from_temporary(_T2, _U2&&); +#else + return false; +#endif + } + +#if __glibcxx_tuple_like // >= C++23 + template + static constexpr bool + _S_constructible_from_pair_like() + { + return _S_constructible(std::declval<_UPair>())), + decltype(std::get<1>(std::declval<_UPair>()))>(); + } + + template + static constexpr bool + _S_convertible_from_pair_like() + { + return _S_convertible(std::declval<_UPair>())), + decltype(std::get<1>(std::declval<_UPair>()))>(); + } + + template + static constexpr bool + _S_dangles_from_pair_like() + { + return _S_dangles(std::declval<_UPair>())), + decltype(std::get<1>(std::declval<_UPair>()))>(); + } +#endif // C++23 + /// @endcond + + public: + + /// Constructor accepting lvalues of `first_type` and `second_type` + constexpr explicit(!_S_convertible()) + pair(const type_identity_t<_T1>& __x, const _T2& __y) + noexcept(_S_nothrow_constructible()) + requires (_S_constructible()) + : first(__x), second(__y) + { } + + /// Constructor accepting two values of arbitrary types +#if __cplusplus > 202002L + template +#else + template +#endif + requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>()) + constexpr explicit(!_S_convertible<_U1, _U2>()) + pair(_U1&& __x, _U2&& __y) + noexcept(_S_nothrow_constructible<_U1, _U2>()) + : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) + { } + +#if __cplusplus > 202002L + template +#else + template +#endif + requires (_S_constructible<_U1, _U2>()) && (_S_dangles<_U1, _U2>()) + constexpr explicit(!_S_convertible<_U1, _U2>()) + pair(_U1&&, _U2&&) = delete; + + /// Converting constructor from a const `pair` lvalue + template + requires (_S_constructible()) + && (!_S_dangles<_U1, _U2>()) + constexpr explicit(!_S_convertible()) + pair(const pair<_U1, _U2>& __p) + noexcept(_S_nothrow_constructible()) + : first(__p.first), second(__p.second) + { } + + template + requires (_S_constructible()) + && (_S_dangles()) + constexpr explicit(!_S_convertible()) + pair(const pair<_U1, _U2>&) = delete; + + /// Converting constructor from a non-const `pair` rvalue + template + requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>()) + constexpr explicit(!_S_convertible<_U1, _U2>()) + pair(pair<_U1, _U2>&& __p) + noexcept(_S_nothrow_constructible<_U1, _U2>()) + : first(std::forward<_U1>(__p.first)), + second(std::forward<_U2>(__p.second)) + { } + + template + requires (_S_constructible<_U1, _U2>()) && (_S_dangles<_U1, _U2>()) + constexpr explicit(!_S_convertible<_U1, _U2>()) + pair(pair<_U1, _U2>&&) = delete; + +#if __glibcxx_ranges_zip // >= C++23 + /// Converting constructor from a non-const `pair` lvalue + template + requires (_S_constructible<_U1&, _U2&>()) && (!_S_dangles<_U1&, _U2&>()) + constexpr explicit(!_S_convertible<_U1&, _U2&>()) + pair(pair<_U1, _U2>& __p) + noexcept(_S_nothrow_constructible<_U1&, _U2&>()) + : first(__p.first), second(__p.second) + { } + + template + requires (_S_constructible<_U1&, _U2&>()) && (_S_dangles<_U1&, _U2&>()) + constexpr explicit(!_S_convertible<_U1&, _U2&>()) + pair(pair<_U1, _U2>&) = delete; + + /// Converting constructor from a const `pair` rvalue + template + requires (_S_constructible()) + && (!_S_dangles()) + constexpr explicit(!_S_convertible()) + pair(const pair<_U1, _U2>&& __p) + noexcept(_S_nothrow_constructible()) + : first(std::forward(__p.first)), + second(std::forward(__p.second)) + { } + + template + requires (_S_constructible()) + && (_S_dangles()) + constexpr explicit(!_S_convertible()) + pair(const pair<_U1, _U2>&&) = delete; +#endif // C++23 + +#if __glibcxx_tuple_like // >= C++23 + template<__eligible_pair_like _UPair> + requires (_S_constructible_from_pair_like<_UPair>()) + && (!_S_dangles_from_pair_like<_UPair>()) + constexpr explicit(!_S_convertible_from_pair_like<_UPair>()) + pair(_UPair&& __p) + : first(std::get<0>(std::forward<_UPair>(__p))), + second(std::get<1>(std::forward<_UPair>(__p))) + { } + + template<__eligible_pair_like _UPair> + requires (_S_constructible_from_pair_like<_UPair>()) + && (_S_dangles_from_pair_like<_UPair>()) + constexpr explicit(!_S_convertible_from_pair_like<_UPair>()) + pair(_UPair&&) = delete; +#endif // C++23 + + private: + /// @cond undocumented + template + static constexpr bool + _S_assignable() + { + if constexpr (is_assignable_v<_T1&, _U1>) + return is_assignable_v<_T2&, _U2>; + return false; + } + + template + static constexpr bool + _S_const_assignable() + { + if constexpr (is_assignable_v) + return is_assignable_v; + return false; + } + + template + static constexpr bool + _S_nothrow_assignable() + { + if constexpr (is_nothrow_assignable_v<_T1&, _U1>) + return is_nothrow_assignable_v<_T2&, _U2>; + return false; + } + +#if __glibcxx_tuple_like // >= C++23 + template + static constexpr bool + _S_assignable_from_tuple_like() + { + return _S_assignable(std::declval<_UPair>())), + decltype(std::get<1>(std::declval<_UPair>()))>(); + } + + template + static constexpr bool + _S_const_assignable_from_tuple_like() + { + return _S_const_assignable(std::declval<_UPair>())), + decltype(std::get<1>(std::declval<_UPair>()))>(); + } +#endif // C++23 + /// @endcond + + public: + + pair& operator=(const pair&) = delete; + + /// Copy assignment operator + constexpr pair& + operator=(const pair& __p) + noexcept(_S_nothrow_assignable()) + requires (_S_assignable()) + { + first = __p.first; + second = __p.second; + return *this; + } + + /// Move assignment operator + constexpr pair& + operator=(pair&& __p) + noexcept(_S_nothrow_assignable<_T1, _T2>()) + requires (_S_assignable<_T1, _T2>()) + { + first = std::forward(__p.first); + second = std::forward(__p.second); + return *this; + } + + /// Converting assignment from a const `pair` lvalue + template + constexpr pair& + operator=(const pair<_U1, _U2>& __p) + noexcept(_S_nothrow_assignable()) + requires (_S_assignable()) + { + first = __p.first; + second = __p.second; + return *this; + } + + /// Converting assignment from a non-const `pair` rvalue + template + constexpr pair& + operator=(pair<_U1, _U2>&& __p) + noexcept(_S_nothrow_assignable<_U1, _U2>()) + requires (_S_assignable<_U1, _U2>()) + { + first = std::forward<_U1>(__p.first); + second = std::forward<_U2>(__p.second); + return *this; + } + +#if __glibcxx_ranges_zip // >= C++23 + /// Copy assignment operator (const) + constexpr const pair& + operator=(const pair& __p) const + requires (_S_const_assignable()) + { + first = __p.first; + second = __p.second; + return *this; + } + + /// Move assignment operator (const) + constexpr const pair& + operator=(pair&& __p) const + requires (_S_const_assignable()) + { + first = std::forward(__p.first); + second = std::forward(__p.second); + return *this; + } + + /// Converting assignment from a const `pair` lvalue + template + constexpr const pair& + operator=(const pair<_U1, _U2>& __p) const + requires (_S_const_assignable()) + { + first = __p.first; + second = __p.second; + return *this; + } + + /// Converting assignment from a non-const `pair` rvalue + template + constexpr const pair& + operator=(pair<_U1, _U2>&& __p) const + requires (_S_const_assignable<_U1, _U2>()) + { + first = std::forward<_U1>(__p.first); + second = std::forward<_U2>(__p.second); + return *this; + } +#endif // C++23 + +#if __glibcxx_tuple_like // >= C++23 + template<__eligible_pair_like _UPair> + requires (_S_assignable_from_tuple_like<_UPair>()) + constexpr pair& + operator=(_UPair&& __p) + { + first = std::get<0>(std::forward<_UPair>(__p)); + second = std::get<1>(std::forward<_UPair>(__p)); + return *this; + } + + template<__eligible_pair_like _UPair> + requires (_S_const_assignable_from_tuple_like<_UPair>()) + constexpr const pair& + operator=(_UPair&& __p) const + { + first = std::get<0>(std::forward<_UPair>(__p)); + second = std::get<1>(std::forward<_UPair>(__p)); + return *this; + } +#endif // C++23 + +#else // !__cpp_lib_concepts + // C++11/14/17 implementation using enable_if, partially constexpr. + + /// @cond undocumented + // Error if construction from _U1 and _U2 would create a dangling ref. +#if __has_builtin(__reference_constructs_from_temporary) \ + && defined _GLIBCXX_DEBUG +# define __glibcxx_no_dangling_refs(_U1, _U2) \ + static_assert(!__reference_constructs_from_temporary(_T1, _U1) \ + && !__reference_constructs_from_temporary(_T2, _U2), \ + "std::pair constructor creates a dangling reference") +#else +# define __glibcxx_no_dangling_refs(_U1, _U2) +#endif + /// @endcond + + /** The default constructor creates @c first and @c second using their + * respective default constructors. */ + template , + __is_implicitly_default_constructible<_U2>> + ::value, bool>::type = true> + constexpr pair() + : first(), second() { } + + template , + is_default_constructible<_U2>, + __not_< + __and_<__is_implicitly_default_constructible<_U1>, + __is_implicitly_default_constructible<_U2>>>> + ::value, bool>::type = false> + explicit constexpr pair() + : first(), second() { } + + // Shortcut for constraining the templates that don't take pairs. + /// @cond undocumented + using _PCCP = _PCC; + /// @endcond + + /// Construct from two const lvalues, allowing implicit conversions. + template() + && _PCCP::template + _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(const _T1& __a, const _T2& __b) + : first(__a), second(__b) { } + + /// Construct from two const lvalues, disallowing implicit conversions. + template() + && !_PCCP::template + _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(const _T1& __a, const _T2& __b) + : first(__a), second(__b) { } + + // Shortcut for constraining the templates that take pairs. + /// @cond undocumented + template + using _PCCFP = _PCC::value + || !is_same<_T2, _U2>::value, + _T1, _T2>; + /// @endcond + + template::template + _ConstructiblePair<_U1, _U2>() + && _PCCFP<_U1, _U2>::template + _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + + template::template + _ConstructiblePair<_U1, _U2>() + && !_PCCFP<_U1, _U2>::template + _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + +#if _GLIBCXX_USE_DEPRECATED +#if defined(__DEPRECATED) +# define _GLIBCXX_DEPRECATED_PAIR_CTOR \ + __attribute__ ((__deprecated__ ("use 'nullptr' instead of '0' to " \ + "initialize std::pair of move-only " \ + "type and pointer"))) +#else +# define _GLIBCXX_DEPRECATED_PAIR_CTOR +#endif + + private: + /// @cond undocumented + + // A type which can be constructed from literal zero, but not nullptr + struct __zero_as_null_pointer_constant + { + __zero_as_null_pointer_constant(int __zero_as_null_pointer_constant::*) + { } + template::value>> + __zero_as_null_pointer_constant(_Tp) = delete; + }; + /// @endcond + public: + + // Deprecated extensions to DR 811. + // These allow construction from an rvalue and a literal zero, + // in cases where the standard says the zero should be deduced as int + template>, + is_pointer<_T2>, + is_constructible<_T1, _U1>, + __not_>, + is_convertible<_U1, _T1>>::value, + bool> = true> + _GLIBCXX_DEPRECATED_PAIR_CTOR + constexpr + pair(_U1&& __x, __zero_as_null_pointer_constant, ...) + : first(std::forward<_U1>(__x)), second(nullptr) + { __glibcxx_no_dangling_refs(_U1&&, std::nullptr_t); } + + template>, + is_pointer<_T2>, + is_constructible<_T1, _U1>, + __not_>, + __not_>>::value, + bool> = false> + _GLIBCXX_DEPRECATED_PAIR_CTOR + explicit constexpr + pair(_U1&& __x, __zero_as_null_pointer_constant, ...) + : first(std::forward<_U1>(__x)), second(nullptr) + { __glibcxx_no_dangling_refs(_U1&&, std::nullptr_t); } + + template, + __not_>, + is_constructible<_T2, _U2>, + __not_>, + is_convertible<_U2, _T2>>::value, + bool> = true> + _GLIBCXX_DEPRECATED_PAIR_CTOR + constexpr + pair(__zero_as_null_pointer_constant, _U2&& __y, ...) + : first(nullptr), second(std::forward<_U2>(__y)) + { __glibcxx_no_dangling_refs(std::nullptr_t, _U2&&); } + + template, + __not_>, + is_constructible<_T2, _U2>, + __not_>, + __not_>>::value, + bool> = false> + _GLIBCXX_DEPRECATED_PAIR_CTOR + explicit constexpr + pair(__zero_as_null_pointer_constant, _U2&& __y, ...) + : first(nullptr), second(std::forward<_U2>(__y)) + { __glibcxx_no_dangling_refs(std::nullptr_t, _U2&&); } +#undef _GLIBCXX_DEPRECATED_PAIR_CTOR +#endif + + template() + && _PCCP::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(_U1&& __x, _U2&& __y) + : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template() + && !_PCCP::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(_U1&& __x, _U2&& __y) + : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + + template::template + _MoveConstructiblePair<_U1, _U2>() + && _PCCFP<_U1, _U2>::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(pair<_U1, _U2>&& __p) + : first(std::forward<_U1>(__p.first)), + second(std::forward<_U2>(__p.second)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template::template + _MoveConstructiblePair<_U1, _U2>() + && !_PCCFP<_U1, _U2>::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(pair<_U1, _U2>&& __p) + : first(std::forward<_U1>(__p.first)), + second(std::forward<_U2>(__p.second)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + +#undef __glibcxx_no_dangling_refs + + pair& + operator=(__conditional_t<__and_, + is_copy_assignable<_T2>>::value, + const pair&, const __nonesuch&> __p) + { + first = __p.first; + second = __p.second; + return *this; + } + + pair& + operator=(__conditional_t<__and_, + is_move_assignable<_T2>>::value, + pair&&, __nonesuch&&> __p) + noexcept(__and_, + is_nothrow_move_assignable<_T2>>::value) + { + first = std::forward(__p.first); + second = std::forward(__p.second); + return *this; + } + + template + typename enable_if<__and_, + is_assignable<_T2&, const _U2&>>::value, + pair&>::type + operator=(const pair<_U1, _U2>& __p) + { + first = __p.first; + second = __p.second; + return *this; + } + + template + typename enable_if<__and_, + is_assignable<_T2&, _U2&&>>::value, + pair&>::type + operator=(pair<_U1, _U2>&& __p) + { + first = std::forward<_U1>(__p.first); + second = std::forward<_U2>(__p.second); + return *this; + } +#endif // lib concepts +#else + // C++03 implementation + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 265. std::pair::pair() effects overly restrictive + /** The default constructor creates @c first and @c second using their + * respective default constructors. */ + pair() : first(), second() { } + + /// Two objects may be passed to a `pair` constructor to be copied. + pair(const _T1& __a, const _T2& __b) + : first(__a), second(__b) { } + + /// Templated constructor to convert from other pairs. + template + pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) + { +#if __has_builtin(__reference_constructs_from_temporary) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedefs" + typedef int _DanglingCheck1[ + __reference_constructs_from_temporary(_T1, const _U1&) ? -1 : 1 + ]; + typedef int _DanglingCheck2[ + __reference_constructs_from_temporary(_T2, const _U2&) ? -1 : 1 + ]; +#pragma GCC diagnostic pop +#endif + } +#endif // C++11 + }; + + /// @relates pair @{ + +#if __cpp_deduction_guides >= 201606 + template pair(_T1, _T2) -> pair<_T1, _T2>; +#endif + +#if __cpp_lib_three_way_comparison + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3865. Sorting a range of pairs + + /// Two pairs are equal iff their members are equal. + template + [[nodiscard]] + constexpr bool + operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) + requires requires { + { __x.first == __y.first } -> __detail::__boolean_testable; + { __x.second == __y.second } -> __detail::__boolean_testable; + } + { return __x.first == __y.first && __x.second == __y.second; } + + /** Defines a lexicographical order for pairs. + * + * For two pairs of comparable types, `P` is ordered before `Q` if + * `P.first` is less than `Q.first`, or if `P.first` and `Q.first` + * are equivalent (neither is less than the other) and `P.second` is + * less than `Q.second`. + */ + template + [[nodiscard]] + constexpr common_comparison_category_t<__detail::__synth3way_t<_T1, _U1>, + __detail::__synth3way_t<_T2, _U2>> + operator<=>(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) + { + if (auto __c = __detail::__synth3way(__x.first, __y.first); __c != 0) + return __c; + return __detail::__synth3way(__x.second, __y.second); + } +#else + /// Two pairs of the same type are equal iff their members are equal. + template + _GLIBCXX_NODISCARD + inline _GLIBCXX_CONSTEXPR bool + operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return __x.first == __y.first && __x.second == __y.second; } + + /** Defines a lexicographical order for pairs. + * + * For two pairs of the same type, `P` is ordered before `Q` if + * `P.first` is less than `Q.first`, or if `P.first` and `Q.first` + * are equivalent (neither is less than the other) and `P.second` is less + * than `Q.second`. + */ + template + _GLIBCXX_NODISCARD + inline _GLIBCXX_CONSTEXPR bool + operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return __x.first < __y.first + || (!(__y.first < __x.first) && __x.second < __y.second); } + + /// Uses @c operator== to find the result. + template + _GLIBCXX_NODISCARD + inline _GLIBCXX_CONSTEXPR bool + operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return !(__x == __y); } + + /// Uses @c operator< to find the result. + template + _GLIBCXX_NODISCARD + inline _GLIBCXX_CONSTEXPR bool + operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return __y < __x; } + + /// Uses @c operator< to find the result. + template + _GLIBCXX_NODISCARD + inline _GLIBCXX_CONSTEXPR bool + operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return !(__y < __x); } + + /// Uses @c operator< to find the result. + template + _GLIBCXX_NODISCARD + inline _GLIBCXX_CONSTEXPR bool + operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return !(__x < __y); } +#endif // !(three_way_comparison && concepts) + +#if __cplusplus >= 201103L + /** Swap overload for pairs. Calls std::pair::swap(). + * + * @note This std::swap overload is not declared in C++03 mode, + * which has performance implications, e.g. see https://gcc.gnu.org/PR38466 + */ + template + _GLIBCXX20_CONSTEXPR inline +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + // Constrained free swap overload, see p0185r1 + typename enable_if<__and_<__is_swappable<_T1>, + __is_swappable<_T2>>::value>::type +#else + void +#endif + swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +#if __glibcxx_ranges_zip // >= C++23 + template + requires is_swappable_v && is_swappable_v + constexpr void + swap(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } +#endif // C++23 + +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + template + typename enable_if, + __is_swappable<_T2>>::value>::type + swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; +#endif +#endif // __cplusplus >= 201103L + + /// @} relates pair + + /** + * @brief A convenience wrapper for creating a pair from two objects. + * @param __x The first object. + * @param __y The second object. + * @return A newly-constructed pair<> object of the appropriate type. + * + * The C++98 standard says the objects are passed by reference-to-const, + * but C++03 says they are passed by value (this was LWG issue #181). + * + * Since C++11 they have been passed by forwarding reference and then + * forwarded to the new members of the pair. To create a pair with a + * member of reference type, pass a `reference_wrapper` to this function. + */ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 181. make_pair() unintended behavior +#if __cplusplus >= 201103L + // NB: DR 706. + template + constexpr pair::__type, + typename __decay_and_strip<_T2>::__type> + make_pair(_T1&& __x, _T2&& __y) + { + typedef typename __decay_and_strip<_T1>::__type __ds_type1; + typedef typename __decay_and_strip<_T2>::__type __ds_type2; + typedef pair<__ds_type1, __ds_type2> __pair_type; + return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y)); + } +#else + template + inline pair<_T1, _T2> + make_pair(_T1 __x, _T2 __y) + { return pair<_T1, _T2>(__x, __y); } +#endif + + /// @} + +#if __cplusplus >= 201103L + // Various functions which give std::pair a tuple-like interface. + + /// @cond undocumented + template + struct __is_tuple_like_impl> : true_type + { }; + /// @endcond + + /// Partial specialization for std::pair + template + struct tuple_size> + : public integral_constant { }; + + /// Partial specialization for std::pair + template + struct tuple_element<0, pair<_Tp1, _Tp2>> + { typedef _Tp1 type; }; + + /// Partial specialization for std::pair + template + struct tuple_element<1, pair<_Tp1, _Tp2>> + { typedef _Tp2 type; }; + +#if __cplusplus >= 201703L + template + inline constexpr size_t tuple_size_v> = 2; + + template + inline constexpr size_t tuple_size_v> = 2; +#endif + +#if __cplusplus >= 201103L +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++14-extensions" // variable templates +#pragma GCC diagnostic ignored "-Wc++17-extensions" // inline variables + template + inline constexpr bool __is_pair = false; + + template + inline constexpr bool __is_pair> = true; +#pragma GCC diagnostic pop +#endif + + /// @cond undocumented + template + struct __pair_get; + + template<> + struct __pair_get<0> + { + template + static constexpr _Tp1& + __get(pair<_Tp1, _Tp2>& __pair) noexcept + { return __pair.first; } + + template + static constexpr _Tp1&& + __move_get(pair<_Tp1, _Tp2>&& __pair) noexcept + { return std::forward<_Tp1>(__pair.first); } + + template + static constexpr const _Tp1& + __const_get(const pair<_Tp1, _Tp2>& __pair) noexcept + { return __pair.first; } + + template + static constexpr const _Tp1&& + __const_move_get(const pair<_Tp1, _Tp2>&& __pair) noexcept + { return std::forward(__pair.first); } + }; + + template<> + struct __pair_get<1> + { + template + static constexpr _Tp2& + __get(pair<_Tp1, _Tp2>& __pair) noexcept + { return __pair.second; } + + template + static constexpr _Tp2&& + __move_get(pair<_Tp1, _Tp2>&& __pair) noexcept + { return std::forward<_Tp2>(__pair.second); } + + template + static constexpr const _Tp2& + __const_get(const pair<_Tp1, _Tp2>& __pair) noexcept + { return __pair.second; } + + template + static constexpr const _Tp2&& + __const_move_get(const pair<_Tp1, _Tp2>&& __pair) noexcept + { return std::forward(__pair.second); } + }; + /// @endcond + + /** @{ + * std::get overloads for accessing members of std::pair + */ + + template + constexpr typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type& + get(pair<_Tp1, _Tp2>& __in) noexcept + { return __pair_get<_Int>::__get(__in); } + + template + constexpr typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type&& + get(pair<_Tp1, _Tp2>&& __in) noexcept + { return __pair_get<_Int>::__move_get(std::move(__in)); } + + template + constexpr const typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type& + get(const pair<_Tp1, _Tp2>& __in) noexcept + { return __pair_get<_Int>::__const_get(__in); } + + template + constexpr const typename tuple_element<_Int, pair<_Tp1, _Tp2>>::type&& + get(const pair<_Tp1, _Tp2>&& __in) noexcept + { return __pair_get<_Int>::__const_move_get(std::move(__in)); } + + +#ifdef __glibcxx_tuples_by_type // C++ >= 14 + template + constexpr _Tp& + get(pair<_Tp, _Up>& __p) noexcept + { return __p.first; } + + template + constexpr const _Tp& + get(const pair<_Tp, _Up>& __p) noexcept + { return __p.first; } + + template + constexpr _Tp&& + get(pair<_Tp, _Up>&& __p) noexcept + { return std::forward<_Tp>(__p.first); } + + template + constexpr const _Tp&& + get(const pair<_Tp, _Up>&& __p) noexcept + { return std::forward(__p.first); } + + template + constexpr _Tp& + get(pair<_Up, _Tp>& __p) noexcept + { return __p.second; } + + template + constexpr const _Tp& + get(const pair<_Up, _Tp>& __p) noexcept + { return __p.second; } + + template + constexpr _Tp&& + get(pair<_Up, _Tp>&& __p) noexcept + { return std::forward<_Tp>(__p.second); } + + template + constexpr const _Tp&& + get(const pair<_Up, _Tp>&& __p) noexcept + { return std::forward(__p.second); } +#endif // __glibcxx_tuples_by_type + + +#if __glibcxx_ranges_zip // >= C++23 + template class _TQual, template class _UQual> + requires requires { typename pair, _UQual<_U1>>, + common_reference_t<_TQual<_T2>, _UQual<_U2>>>; } + struct basic_common_reference, pair<_U1, _U2>, _TQual, _UQual> + { + using type = pair, _UQual<_U1>>, + common_reference_t<_TQual<_T2>, _UQual<_U2>>>; + }; + + template + requires requires { typename pair, common_type_t<_T2, _U2>>; } + struct common_type, pair<_U1, _U2>> + { using type = pair, common_type_t<_T2, _U2>>; }; +#endif // C++23 + + /// @} +#endif // C++11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif /* _STL_PAIR_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_pair.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_pair.h.blob new file mode 100644 index 0000000..d1946b1 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_pair.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_uninitialized.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_uninitialized.h new file mode 100644 index 0000000..d90e6aa --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_uninitialized.h @@ -0,0 +1,1372 @@ +// Raw memory manipulators -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_uninitialized.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _STL_UNINITIALIZED_H +#define _STL_UNINITIALIZED_H 1 + +#if __cplusplus >= 201103L +# include +# include // to_address +# include // pair +# include // fill, fill_n +#endif + +#include // __is_pointer +#include // distance, advance +#include // __niter_base +#include // __alloc_traits + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** @addtogroup memory + * @{ + */ + + /// @cond undocumented + + template + struct _UninitDestroyGuard + { + _GLIBCXX20_CONSTEXPR + explicit + _UninitDestroyGuard(_ForwardIterator& __first, _Alloc& __a) + : _M_first(__first), _M_cur(__builtin_addressof(__first)), _M_alloc(__a) + { } + + _GLIBCXX20_CONSTEXPR + ~_UninitDestroyGuard() + { + if (__builtin_expect(_M_cur != 0, 0)) + std::_Destroy(_M_first, *_M_cur, _M_alloc); + } + + _GLIBCXX20_CONSTEXPR + void release() { _M_cur = 0; } + + private: + _ForwardIterator const _M_first; + _ForwardIterator* _M_cur; + _Alloc& _M_alloc; + + _UninitDestroyGuard(const _UninitDestroyGuard&); + }; + + template + struct _UninitDestroyGuard<_ForwardIterator, void> + { + _GLIBCXX20_CONSTEXPR + explicit + _UninitDestroyGuard(_ForwardIterator& __first) + : _M_first(__first), _M_cur(__builtin_addressof(__first)) + { } + + _GLIBCXX20_CONSTEXPR + ~_UninitDestroyGuard() + { + if (__builtin_expect(_M_cur != 0, 0)) + std::_Destroy(_M_first, *_M_cur); + } + + _GLIBCXX20_CONSTEXPR + void release() { _M_cur = 0; } + + _ForwardIterator const _M_first; + _ForwardIterator* _M_cur; + + private: + _UninitDestroyGuard(const _UninitDestroyGuard&); + }; + + // This is the default implementation of std::uninitialized_copy. + // This can be used with C++20 iterators and non-common ranges. + template + _GLIBCXX20_CONSTEXPR + _ForwardIterator + __do_uninit_copy(_InputIterator __first, _Sentinel __last, + _ForwardIterator __result) + { + _UninitDestroyGuard<_ForwardIterator> __guard(__result); + for (; __first != __last; ++__first, (void)++__result) + std::_Construct(std::__addressof(*__result), *__first); + __guard.release(); + return __result; + } + +#if __cplusplus < 201103L + + // True if we can unwrap _Iter to get a pointer by using std::__niter_base. + template + struct __unwrappable_niter + { enum { __value = false }; }; + + template + struct __unwrappable_niter<_Iter, _Tp*> + { enum { __value = true }; }; + + // Use template specialization for C++98 when 'if constexpr' can't be used. + template + struct __uninitialized_copy + { + template + static _ForwardIterator + __uninit_copy(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { return std::__do_uninit_copy(__first, __last, __result); } + }; + + template<> + struct __uninitialized_copy + { + // Overload for generic iterators. + template + static _ForwardIterator + __uninit_copy(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { + if (__unwrappable_niter<_InputIterator>::__value + && __unwrappable_niter<_ForwardIterator>::__value) + { + __uninit_copy(std::__niter_base(__first), + std::__niter_base(__last), + std::__niter_base(__result)); + std::advance(__result, std::distance(__first, __last)); + return __result; + } + else + return std::__do_uninit_copy(__first, __last, __result); + } + + // Overload for pointers. + template + static _Up* + __uninit_copy(_Tp* __first, _Tp* __last, _Up* __result) + { + // Ensure that we don't successfully memcpy in cases that should be + // ill-formed because is_constructible<_Up, _Tp&> is false. + typedef __typeof__(static_cast<_Up>(*__first)) __check + __attribute__((__unused__)); + + const ptrdiff_t __n = __last - __first; + if (__builtin_expect(__n > 0, true)) + { + __builtin_memcpy(__result, __first, __n * sizeof(_Tp)); + __result += __n; + } + return __result; + } + }; +#endif + /// @endcond + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + /** + * @brief Copies the range [first,last) into result. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result A forward iterator. + * @return __result + (__last - __first) + * + * Like std::copy, but does not require an initialized output range. + */ + template + _GLIBCXX26_CONSTEXPR + inline _ForwardIterator + uninitialized_copy(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { + // We can use memcpy to copy the ranges under these conditions: + // + // _ForwardIterator and _InputIterator are both contiguous iterators, + // so that we can turn them into pointers to pass to memcpy. + // Before C++20 we can't detect all contiguous iterators, so we only + // handle built-in pointers and __normal_iterator types. + // + // The value types of both iterators are trivially-copyable types, + // so that memcpy is not undefined and can begin the lifetime of + // new objects in the output range. + // + // Finally, memcpy from the source type, S, to the destination type, D, + // must give the same value as initialization of D from S would give. + // We require is_trivially_constructible to be true, but that is + // not sufficient. Some cases of trivial initialization are not just a + // bitwise copy, even when sizeof(D) == sizeof(S), + // e.g. bit_cast(1.0f) != 1u because the corresponding bits + // of the value representations do not have the same meaning. + // We cannot tell when this condition is true in general, + // so we rely on the __memcpyable trait. + +#if __cplusplus >= 201103L + using _Dest = decltype(std::__niter_base(__result)); + using _Src = decltype(std::__niter_base(__first)); + using _ValT = typename iterator_traits<_ForwardIterator>::value_type; + +#if __glibcxx_raw_memory_algorithms >= 202411L // >= C++26 + if consteval { + return std::__do_uninit_copy(__first, __last, __result); + } +#endif + if constexpr (!__is_trivially_constructible(_ValT, decltype(*__first))) + return std::__do_uninit_copy(__first, __last, __result); + else if constexpr (__memcpyable<_Dest, _Src>::__value) + { + ptrdiff_t __n = __last - __first; + if (__n > 0) [[__likely__]] + { + using _ValT = typename remove_pointer<_Src>::type; + __builtin_memcpy(std::__niter_base(__result), + std::__niter_base(__first), + __n * sizeof(_ValT)); + __result += __n; + } + return __result; + } +#if __cpp_lib_concepts + else if constexpr (contiguous_iterator<_ForwardIterator> + && contiguous_iterator<_InputIterator>) + { + using _DestPtr = decltype(std::to_address(__result)); + using _SrcPtr = decltype(std::to_address(__first)); + if constexpr (__memcpyable<_DestPtr, _SrcPtr>::__value) + { + if (auto __n = __last - __first; __n > 0) [[likely]] + { + void* __dest = std::to_address(__result); + const void* __src = std::to_address(__first); + size_t __nbytes = __n * sizeof(remove_pointer_t<_DestPtr>); + __builtin_memcpy(__dest, __src, __nbytes); + __result += __n; + } + return __result; + } + else + return std::__do_uninit_copy(__first, __last, __result); + } +#endif + else + return std::__do_uninit_copy(__first, __last, __result); +#else // C++98 + typedef typename iterator_traits<_InputIterator>::value_type + _ValueType1; + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType2; + + const bool __can_memcpy + = __memcpyable<_ValueType1*, _ValueType2*>::__value + && __is_trivially_constructible(_ValueType2, __decltype(*__first)); + + return __uninitialized_copy<__can_memcpy>:: + __uninit_copy(__first, __last, __result); +#endif + } +#pragma GCC diagnostic pop + + /// @cond undocumented + + // This is the default implementation of std::uninitialized_fill. + template + _GLIBCXX20_CONSTEXPR void + __do_uninit_fill(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x) + { + _UninitDestroyGuard<_ForwardIterator> __guard(__first); + for (; __first != __last; ++__first) + std::_Construct(std::__addressof(*__first), __x); + __guard.release(); + } + +#if __cplusplus < 201103L + // Use template specialization for C++98 when 'if constexpr' can't be used. + template + struct __uninitialized_fill + { + template + static void + __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x) + { std::__do_uninit_fill(__first, __last, __x); } + }; + + template<> + struct __uninitialized_fill + { + // Overload for generic iterators. + template + static void + __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x) + { + if (__unwrappable_niter<_ForwardIterator>::__value) + __uninit_fill(std::__niter_base(__first), + std::__niter_base(__last), + __x); + else + std::__do_uninit_fill(__first, __last, __x); + } + + // Overload for pointers. + template + static void + __uninit_fill(_Up* __first, _Up* __last, const _Tp& __x) + { + // Ensure that we don't successfully memset in cases that should be + // ill-formed because is_constructible<_Up, const _Tp&> is false. + typedef __typeof__(static_cast<_Up>(__x)) __check + __attribute__((__unused__)); + + if (__first != __last) + __builtin_memset(__first, (unsigned char)__x, __last - __first); + } + }; +#endif + /// @endcond + + /** + * @brief Copies the value x into the range [first,last). + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __x The source value. + * @return Nothing. + * + * Like std::fill, but does not require an initialized output range. + */ + template + _GLIBCXX26_CONSTEXPR + inline void + uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x) + { + // We would like to use memset to optimize this loop when possible. + // As for std::uninitialized_copy, the optimization requires + // contiguous iterators and trivially copyable value types, + // with the additional requirement that sizeof(_Tp) == 1 because + // memset only writes single bytes. + + // FIXME: We could additionally enable this for 1-byte enums. + // Maybe any 1-byte Val if is_trivially_constructible? + + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + +#if __cplusplus >= 201103L +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" +#if __glibcxx_raw_memory_algorithms >= 202411L // >= C++26 + if consteval { + return std::__do_uninit_fill(__first, __last, __x); + } +#endif + if constexpr (__is_byte<_ValueType>::__value) + if constexpr (is_same<_ValueType, _Tp>::value + || is_integral<_Tp>::value) + { + using _BasePtr = decltype(std::__niter_base(__first)); + if constexpr (is_pointer<_BasePtr>::value) + { + void* __dest = std::__niter_base(__first); + ptrdiff_t __n = __last - __first; + if (__n > 0) [[__likely__]] + __builtin_memset(__dest, (unsigned char)__x, __n); + return; + } +#if __cpp_lib_concepts + else if constexpr (contiguous_iterator<_ForwardIterator>) + { + auto __dest = std::to_address(__first); + auto __n = __last - __first; + if (__n > 0) [[__likely__]] + __builtin_memset(__dest, (unsigned char)__x, __n); + return; + } +#endif + } + std::__do_uninit_fill(__first, __last, __x); +#pragma GCC diagnostic pop +#else // C++98 + const bool __can_memset = __is_byte<_ValueType>::__value + && __is_integer<_Tp>::__value; + + __uninitialized_fill<__can_memset>::__uninit_fill(__first, __last, __x); +#endif + } + + /// @cond undocumented + + // This is the default implementation of std::uninitialized_fill_n. + template + _GLIBCXX20_CONSTEXPR + _ForwardIterator + __do_uninit_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) + { + _UninitDestroyGuard<_ForwardIterator> __guard(__first); +#if __cplusplus >= 201103L +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + if constexpr (is_integral<_Size>::value) + // Loop will never terminate if __n is negative. + __glibcxx_assert(__n >= 0); + else if constexpr (is_floating_point<_Size>::value) + // Loop will never terminate if __n is not an integer. + __glibcxx_assert(__n >= 0 && static_cast(__n) == __n); +#pragma GCC diagnostic pop +#endif + for (; __n--; ++__first) + std::_Construct(std::__addressof(*__first), __x); + __guard.release(); + return __first; + } + +#if __cplusplus < 201103L + // Use template specialization for C++98 when 'if constexpr' can't be used. + template + struct __uninitialized_fill_n + { + template + static _ForwardIterator + __uninit_fill_n(_ForwardIterator __first, _Size __n, + const _Tp& __x) + { return std::__do_uninit_fill_n(__first, __n, __x); } + }; + + template<> + struct __uninitialized_fill_n + { + // Overload for generic iterators. + template + static _ForwardIterator + __uninit_fill_n(_ForwardIterator __first, _Size __n, + const _Tp& __x) + { + if (__unwrappable_niter<_ForwardIterator>::__value) + { + _ForwardIterator __last = __first; + std::advance(__last, __n); + __uninitialized_fill::__uninit_fill(__first, __last, __x); + return __last; + } + else + return std::__do_uninit_fill_n(__first, __n, __x); + } + }; +#endif + /// @endcond + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 1339. uninitialized_fill_n should return the end of its range + /** + * @brief Copies the value x into the range [first,first+n). + * @param __first A forward iterator. + * @param __n The number of copies to make. + * @param __x The source value. + * @return __first + __n. + * + * Like std::fill_n, but does not require an initialized output range. + */ + template + _GLIBCXX26_CONSTEXPR + inline _ForwardIterator + uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) + { + // See uninitialized_fill conditions. We also require _Size to be + // an integer. The standard only requires _Size to be decrementable + // and contextually convertible to bool, so don't assume first+n works. + + // FIXME: We could additionally enable this for 1-byte enums. + + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + +#if __cplusplus >= 201103L +#if __glibcxx_raw_memory_algorithms >= 202411L // >= C++26 + if consteval { + return std::__do_uninit_fill_n(__first, __n, __x); + } +#endif + if constexpr (__is_byte<_ValueType>::__value) + if constexpr (is_integral<_Tp>::value) + if constexpr (is_integral<_Size>::value) + { + using _BasePtr = decltype(std::__niter_base(__first)); + if constexpr (is_pointer<_BasePtr>::value) + { + void* __dest = std::__niter_base(__first); + if (__n > 0) [[__likely__]] + { + __builtin_memset(__dest, (unsigned char)__x, __n); + __first += __n; + } + return __first; + } +#if __cpp_lib_concepts + else if constexpr (contiguous_iterator<_ForwardIterator>) + { + auto __dest = std::to_address(__first); + if (__n > 0) [[__likely__]] + { + __builtin_memset(__dest, (unsigned char)__x, __n); + __first += __n; + } + return __first; + } +#endif + } + return std::__do_uninit_fill_n(__first, __n, __x); +#else // C++98 + const bool __can_memset = __is_byte<_ValueType>::__value + && __is_integer<_Tp>::__value + && __is_integer<_Size>::__value; + + return __uninitialized_fill_n<__can_memset>:: + __uninit_fill_n(__first, __n, __x); +#endif + } +#pragma GCC diagnostic pop + + /// @cond undocumented + + // Extensions: versions of uninitialized_copy, uninitialized_fill, + // and uninitialized_fill_n that take an allocator parameter. + // We dispatch back to the standard versions when we're given the + // default allocator. For nondefault allocators we do not use + // any of the POD optimizations. + + template + _GLIBCXX20_CONSTEXPR + _ForwardIterator + __uninitialized_copy_a(_InputIterator __first, _Sentinel __last, + _ForwardIterator __result, _Allocator& __alloc) + { + _UninitDestroyGuard<_ForwardIterator, _Allocator> + __guard(__result, __alloc); + + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __first != __last; ++__first, (void)++__result) + __traits::construct(__alloc, std::__addressof(*__result), *__first); + __guard.release(); + return __result; + } + +#if _GLIBCXX_HOSTED + template + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + __uninitialized_copy_a(_InputIterator __first, _Sentinel __last, + _ForwardIterator __result, allocator<_Tp>&) + { +#ifdef __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + return std::__do_uninit_copy(std::move(__first), __last, __result); +#endif + +#ifdef __glibcxx_ranges + if constexpr (!is_same_v<_InputIterator, _Sentinel>) + { + // Convert to a common range if possible, to benefit from memcpy + // optimizations that std::uninitialized_copy might use. + if constexpr (sized_sentinel_for<_Sentinel, _InputIterator> + && random_access_iterator<_InputIterator>) + return std::uninitialized_copy(__first, + __first + (__last - __first), + __result); + else // Just use default implementation. + return std::__do_uninit_copy(std::move(__first), __last, __result); + } + else + return std::uninitialized_copy(std::move(__first), __last, __result); +#else + return std::uninitialized_copy(__first, __last, __result); +#endif + } +#endif + + template + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + __uninitialized_move_a(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result, _Allocator& __alloc) + { + return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__last), + __result, __alloc); + } + + template + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + __uninitialized_move_if_noexcept_a(_InputIterator __first, + _InputIterator __last, + _ForwardIterator __result, + _Allocator& __alloc) + { + return std::__uninitialized_copy_a + (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc); + } + + template + _GLIBCXX20_CONSTEXPR + void + __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x, _Allocator& __alloc) + { + _UninitDestroyGuard<_ForwardIterator, _Allocator> + __guard(__first, __alloc); + + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __first != __last; ++__first) + __traits::construct(__alloc, std::__addressof(*__first), __x); + + __guard.release(); + } + +#if _GLIBCXX_HOSTED + template + _GLIBCXX20_CONSTEXPR + inline void + __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x, allocator<_Tp2>&) + { +#ifdef __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + return std::__do_uninit_fill(__first, __last, __x); +#endif + std::uninitialized_fill(__first, __last, __x); + } +#endif + + template + _GLIBCXX20_CONSTEXPR + _ForwardIterator + __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, + const _Tp& __x, _Allocator& __alloc) + { + _UninitDestroyGuard<_ForwardIterator, _Allocator> + __guard(__first, __alloc); + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __n > 0; --__n, (void) ++__first) + __traits::construct(__alloc, std::__addressof(*__first), __x); + __guard.release(); + return __first; + } + +#if _GLIBCXX_HOSTED + template + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, + const _Tp& __x, allocator<_Tp2>&) + { +#ifdef __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + return std::__do_uninit_fill_n(__first, __n, __x); +#endif + return std::uninitialized_fill_n(__first, __n, __x); + } +#endif + + // Extensions: __uninitialized_copy_move, __uninitialized_move_copy, + // __uninitialized_fill_move, __uninitialized_move_fill. + // All of these algorithms take a user-supplied allocator, which is used + // for construction and destruction. + + // __uninitialized_copy_move + // Copies [first1, last1) into [result, result + (last1 - first1)), and + // move [first2, last2) into + // [result, result + (last1 - first1) + (last2 - first2)). + template + inline _ForwardIterator + __uninitialized_copy_move(_InputIterator1 __first1, + _InputIterator1 __last1, + _InputIterator2 __first2, + _InputIterator2 __last2, + _ForwardIterator __result, + _Allocator& __alloc) + { + _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1, + __result, __alloc); + _UninitDestroyGuard<_ForwardIterator, _Allocator> __guard(__result, + __alloc); + __result = __mid; // Everything up to __mid is now guarded. + __result = std::__uninitialized_move_a(__first2, __last2, __mid, __alloc); + __guard.release(); + return __result; + } + + // __uninitialized_move_copy + // Moves [first1, last1) into [result, result + (last1 - first1)), and + // copies [first2, last2) into + // [result, result + (last1 - first1) + (last2 - first2)). + template + inline _ForwardIterator + __uninitialized_move_copy(_InputIterator1 __first1, + _InputIterator1 __last1, + _InputIterator2 __first2, + _InputIterator2 __last2, + _ForwardIterator __result, + _Allocator& __alloc) + { + _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1, + __result, __alloc); + _UninitDestroyGuard<_ForwardIterator, _Allocator> __guard(__result, + __alloc); + __result = __mid; // Everything up to __mid is now guarded. + __result = std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc); + __guard.release(); + return __result; + } + + // __uninitialized_fill_move + // Fills [result, mid) with x, and moves [first, last) into + // [mid, mid + (last - first)). + template + inline _ForwardIterator + __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid, + const _Tp& __x, _InputIterator __first, + _InputIterator __last, _Allocator& __alloc) + { + std::__uninitialized_fill_a(__result, __mid, __x, __alloc); + _UninitDestroyGuard<_ForwardIterator, _Allocator> __guard(__result, + __alloc); + __result = __mid; // Everything up to __mid is now guarded. + __result = std::__uninitialized_move_a(__first, __last, __mid, __alloc); + __guard.release(); + return __result; + } + + // __uninitialized_move_fill + // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and + // fills [first2 + (last1 - first1), last2) with x. + template + inline void + __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1, + _ForwardIterator __first2, + _ForwardIterator __last2, const _Tp& __x, + _Allocator& __alloc) + { + _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1, + __first2, + __alloc); + _UninitDestroyGuard<_ForwardIterator, _Allocator> __guard(__first2, + __alloc); + __first2 = __mid2; // Everything up to __mid2 is now guarded. + std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc); + __guard.release(); + } + + /// @endcond + +#if __cplusplus >= 201103L + /// @cond undocumented + + // Extensions: __uninitialized_default, __uninitialized_default_n, + // __uninitialized_default_a, __uninitialized_default_n_a. + + template + struct __uninitialized_default_1 + { + template + _GLIBCXX26_CONSTEXPR + static void + __uninit_default(_ForwardIterator __first, _ForwardIterator __last) + { + _UninitDestroyGuard<_ForwardIterator> __guard(__first); + for (; __first != __last; ++__first) + std::_Construct(std::__addressof(*__first)); + __guard.release(); + } + }; + + template<> + struct __uninitialized_default_1 + { + template + _GLIBCXX26_CONSTEXPR + static void + __uninit_default(_ForwardIterator __first, _ForwardIterator __last) + { + if (__first == __last) + return; + + typename iterator_traits<_ForwardIterator>::value_type* __val + = std::__addressof(*__first); + std::_Construct(__val); + if (++__first != __last) + std::fill(__first, __last, *__val); + } + }; + + template + struct __uninitialized_default_n_1 + { + template + _GLIBCXX20_CONSTEXPR + static _ForwardIterator + __uninit_default_n(_ForwardIterator __first, _Size __n) + { + _UninitDestroyGuard<_ForwardIterator> __guard(__first); + for (; __n > 0; --__n, (void) ++__first) + std::_Construct(std::__addressof(*__first)); + __guard.release(); + return __first; + } + }; + + template<> + struct __uninitialized_default_n_1 + { + template + _GLIBCXX20_CONSTEXPR + static _ForwardIterator + __uninit_default_n(_ForwardIterator __first, _Size __n) + { + if (__n > 0) + { + typename iterator_traits<_ForwardIterator>::value_type* __val + = std::__addressof(*__first); + std::_Construct(__val); + ++__first; + __first = std::fill_n(__first, __n - 1, *__val); + } + return __first; + } + }; + + // __uninitialized_default + // Fills [first, last) with value-initialized value_types. + template + _GLIBCXX20_CONSTEXPR + inline void + __uninitialized_default(_ForwardIterator __first, + _ForwardIterator __last) + { +#ifdef __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + return __uninitialized_default_1:: + __uninit_default(__first, __last); +#endif + + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + // trivial types can have deleted assignment + const bool __assignable = is_copy_assignable<_ValueType>::value; + + std::__uninitialized_default_1<__is_trivial(_ValueType) + && __assignable>:: + __uninit_default(__first, __last); + } + + // __uninitialized_default_n + // Fills [first, first + n) with value-initialized value_types. + template + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + __uninitialized_default_n(_ForwardIterator __first, _Size __n) + { +#ifdef __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + return __uninitialized_default_n_1:: + __uninit_default_n(__first, __n); +#endif + + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + // See uninitialized_fill_n for the conditions for using std::fill_n. + constexpr bool __can_fill + = __and_, is_copy_assignable<_ValueType>>::value; + + return __uninitialized_default_n_1<__is_trivial(_ValueType) + && __can_fill>:: + __uninit_default_n(__first, __n); + } + + + // __uninitialized_default_a + // Fills [first, last) with value_types constructed by the allocator + // alloc, with no arguments passed to the construct call. + template + void + __uninitialized_default_a(_ForwardIterator __first, + _ForwardIterator __last, + _Allocator& __alloc) + { + _UninitDestroyGuard<_ForwardIterator, _Allocator> __guard(__first, + __alloc); + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __first != __last; ++__first) + __traits::construct(__alloc, std::__addressof(*__first)); + __guard.release(); + } + +#if _GLIBCXX_HOSTED + template + inline void + __uninitialized_default_a(_ForwardIterator __first, + _ForwardIterator __last, + allocator<_Tp>&) + { std::__uninitialized_default(__first, __last); } +#endif + + // __uninitialized_default_n_a + // Fills [first, first + n) with value_types constructed by the allocator + // alloc, with no arguments passed to the construct call. + template + _GLIBCXX20_CONSTEXPR _ForwardIterator + __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, + _Allocator& __alloc) + { + _UninitDestroyGuard<_ForwardIterator, _Allocator> __guard(__first, + __alloc); + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __n > 0; --__n, (void) ++__first) + __traits::construct(__alloc, std::__addressof(*__first)); + __guard.release(); + return __first; + } + +#if _GLIBCXX_HOSTED + // __uninitialized_default_n_a specialization for std::allocator, + // which ignores the allocator and value-initializes the elements. + template + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, + allocator<_Tp>&) + { return std::__uninitialized_default_n(__first, __n); } +#endif + + template + struct __uninitialized_default_novalue_1 + { + template + _GLIBCXX26_CONSTEXPR + static void + __uninit_default_novalue(_ForwardIterator __first, + _ForwardIterator __last) + { + _UninitDestroyGuard<_ForwardIterator> __guard(__first); + for (; __first != __last; ++__first) + std::_Construct_novalue(std::__addressof(*__first)); + __guard.release(); + } + }; + + template<> + struct __uninitialized_default_novalue_1 + { + template + _GLIBCXX26_CONSTEXPR + static void + __uninit_default_novalue(_ForwardIterator, _ForwardIterator) + { + } + }; + + template + struct __uninitialized_default_novalue_n_1 + { + template + _GLIBCXX26_CONSTEXPR + static _ForwardIterator + __uninit_default_novalue_n(_ForwardIterator __first, _Size __n) + { + _UninitDestroyGuard<_ForwardIterator> __guard(__first); + for (; __n > 0; --__n, (void) ++__first) + std::_Construct_novalue(std::__addressof(*__first)); + __guard.release(); + return __first; + } + }; + + template<> + struct __uninitialized_default_novalue_n_1 + { + template + _GLIBCXX26_CONSTEXPR + static _ForwardIterator + __uninit_default_novalue_n(_ForwardIterator __first, _Size __n) + { return std::next(__first, __n); } + }; + + // __uninitialized_default_novalue + // Fills [first, last) with default-initialized value_types. + template + _GLIBCXX26_CONSTEXPR + inline void + __uninitialized_default_novalue(_ForwardIterator __first, + _ForwardIterator __last) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + + std::__uninitialized_default_novalue_1< + is_trivially_default_constructible<_ValueType>::value>:: + __uninit_default_novalue(__first, __last); + } + + // __uninitialized_default_novalue_n + // Fills [first, first + n) with default-initialized value_types. + template + _GLIBCXX26_CONSTEXPR + inline _ForwardIterator + __uninitialized_default_novalue_n(_ForwardIterator __first, _Size __n) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + + return __uninitialized_default_novalue_n_1< + is_trivially_default_constructible<_ValueType>::value>:: + __uninit_default_novalue_n(__first, __n); + } + + template + _GLIBCXX26_CONSTEXPR + _ForwardIterator + __uninitialized_copy_n(_InputIterator __first, _Size __n, + _ForwardIterator __result, input_iterator_tag) + { + _UninitDestroyGuard<_ForwardIterator> __guard(__result); + for (; __n > 0; --__n, (void) ++__first, ++__result) + std::_Construct(std::__addressof(*__result), *__first); + __guard.release(); + return __result; + } + + template + _GLIBCXX26_CONSTEXPR + inline _ForwardIterator + __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n, + _ForwardIterator __result, + random_access_iterator_tag) + { return std::uninitialized_copy(__first, __first + __n, __result); } + + template + _GLIBCXX26_CONSTEXPR + pair<_InputIterator, _ForwardIterator> + __uninitialized_copy_n_pair(_InputIterator __first, _Size __n, + _ForwardIterator __result, input_iterator_tag) + { + _UninitDestroyGuard<_ForwardIterator> __guard(__result); + for (; __n > 0; --__n, (void) ++__first, ++__result) + std::_Construct(std::__addressof(*__result), *__first); + __guard.release(); + return {__first, __result}; + } + + template + _GLIBCXX26_CONSTEXPR + inline pair<_RandomAccessIterator, _ForwardIterator> + __uninitialized_copy_n_pair(_RandomAccessIterator __first, _Size __n, + _ForwardIterator __result, + random_access_iterator_tag) + { + auto __second_res = uninitialized_copy(__first, __first + __n, __result); + auto __first_res = std::next(__first, __n); + return {__first_res, __second_res}; + } + + /// @endcond + + /** + * @brief Copies the range [first,first+n) into result. + * @param __first An input iterator. + * @param __n The number of elements to copy. + * @param __result An output iterator. + * @return __result + __n + * @since C++11 + * + * Like copy_n(), but does not require an initialized output range. + */ + template + _GLIBCXX26_CONSTEXPR + inline _ForwardIterator + uninitialized_copy_n(_InputIterator __first, _Size __n, + _ForwardIterator __result) + { return std::__uninitialized_copy_n(__first, __n, __result, + std::__iterator_category(__first)); } + + /// @cond undocumented + template + _GLIBCXX26_CONSTEXPR + inline pair<_InputIterator, _ForwardIterator> + __uninitialized_copy_n_pair(_InputIterator __first, _Size __n, + _ForwardIterator __result) + { + return + std::__uninitialized_copy_n_pair(__first, __n, __result, + std::__iterator_category(__first)); + } + /// @endcond +#endif + +#ifdef __glibcxx_raw_memory_algorithms // C++ >= 17 + /** + * @brief Default-initializes objects in the range [first,last). + * @param __first A forward iterator. + * @param __last A forward iterator. + * @since C++17 + */ + template + _GLIBCXX26_CONSTEXPR + inline void + uninitialized_default_construct(_ForwardIterator __first, + _ForwardIterator __last) + { + std::__uninitialized_default_novalue(__first, __last); + } + + /** + * @brief Default-initializes objects in the range [first,first+count). + * @param __first A forward iterator. + * @param __count The number of objects to construct. + * @return __first + __count + * @since C++17 + */ + template + _GLIBCXX26_CONSTEXPR + inline _ForwardIterator + uninitialized_default_construct_n(_ForwardIterator __first, _Size __count) + { + return std::__uninitialized_default_novalue_n(__first, __count); + } + + /** + * @brief Value-initializes objects in the range [first,last). + * @param __first A forward iterator. + * @param __last A forward iterator. + * @since C++17 + */ + template + _GLIBCXX26_CONSTEXPR + inline void + uninitialized_value_construct(_ForwardIterator __first, + _ForwardIterator __last) + { + return std::__uninitialized_default(__first, __last); + } + + /** + * @brief Value-initializes objects in the range [first,first+count). + * @param __first A forward iterator. + * @param __count The number of objects to construct. + * @return __result + __count + * @since C++17 + */ + template + _GLIBCXX26_CONSTEXPR + inline _ForwardIterator + uninitialized_value_construct_n(_ForwardIterator __first, _Size __count) + { + return std::__uninitialized_default_n(__first, __count); + } + + /** + * @brief Move-construct from the range [first,last) into result. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @return __result + (__first - __last) + * @since C++17 + */ + template + _GLIBCXX26_CONSTEXPR + inline _ForwardIterator + uninitialized_move(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { + return std::uninitialized_copy + (_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__last), __result); + } + + /** + * @brief Move-construct from the range [first,first+count) into result. + * @param __first An input iterator. + * @param __count The number of objects to initialize. + * @param __result An output iterator. + * @return __result + __count + * @since C++17 + */ + template + _GLIBCXX26_CONSTEXPR + inline pair<_InputIterator, _ForwardIterator> + uninitialized_move_n(_InputIterator __first, _Size __count, + _ForwardIterator __result) + { + auto __res = std::__uninitialized_copy_n_pair + (_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + __count, __result); + return {__res.first.base(), __res.second}; + } +#endif // __glibcxx_raw_memory_algorithms + +#if __cplusplus >= 201103L + /// @cond undocumented + + template + _GLIBCXX20_CONSTEXPR + inline void + __relocate_object_a(_Tp* __restrict __dest, _Up* __restrict __orig, + _Allocator& __alloc) + noexcept(noexcept(std::allocator_traits<_Allocator>::construct(__alloc, + __dest, std::move(*__orig))) + && noexcept(std::allocator_traits<_Allocator>::destroy( + __alloc, std::__addressof(*__orig)))) + { + typedef std::allocator_traits<_Allocator> __traits; + __traits::construct(__alloc, __dest, std::move(*__orig)); + __traits::destroy(__alloc, std::__addressof(*__orig)); + } + + // This class may be specialized for specific types. + // Also known as is_trivially_relocatable. + template + struct __is_bitwise_relocatable + : __bool_constant<__is_trivial(_Tp)> + { }; + + template + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + __relocate_a_1(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result, _Allocator& __alloc) + noexcept(noexcept(std::__relocate_object_a(std::addressof(*__result), + std::addressof(*__first), + __alloc))) + { + typedef typename iterator_traits<_InputIterator>::value_type + _ValueType; + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType2; + static_assert(std::is_same<_ValueType, _ValueType2>::value, + "relocation is only possible for values of the same type"); + _ForwardIterator __cur = __result; + for (; __first != __last; ++__first, (void)++__cur) + std::__relocate_object_a(std::__addressof(*__cur), + std::__addressof(*__first), __alloc); + return __cur; + } + +#if _GLIBCXX_HOSTED + template + _GLIBCXX20_CONSTEXPR + inline __enable_if_t::value, _Tp*> + __relocate_a_1(_Tp* __first, _Tp* __last, + _Tp* __result, + [[__maybe_unused__]] allocator<_Up>& __alloc) noexcept + { + ptrdiff_t __count = __last - __first; + if (__count > 0) + { +#ifdef __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + { + // Can't use memcpy. Wrap the pointer so that __relocate_a_1 + // resolves to the non-trivial overload above. + __gnu_cxx::__normal_iterator<_Tp*, void> __out(__result); + __out = std::__relocate_a_1(__first, __last, __out, __alloc); + return __out.base(); + } +#endif + __builtin_memcpy(__result, __first, __count * sizeof(_Tp)); + } + return __result + __count; + } +#endif + + template + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + __relocate_a(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result, _Allocator& __alloc) + noexcept(noexcept(__relocate_a_1(std::__niter_base(__first), + std::__niter_base(__last), + std::__niter_base(__result), __alloc))) + { + return std::__relocate_a_1(std::__niter_base(__first), + std::__niter_base(__last), + std::__niter_base(__result), __alloc); + } + + /// @endcond +#endif // C++11 + + /// @} group memory + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _STL_UNINITIALIZED_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_uninitialized.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_uninitialized.h.blob new file mode 100644 index 0000000..98d0a7e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_uninitialized.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_vector.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_vector.h new file mode 100644 index 0000000..b74274a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_vector.h @@ -0,0 +1,2438 @@ +// Vector implementation -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_vector.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{vector} + */ + +#ifndef _STL_VECTOR_H +#define _STL_VECTOR_H 1 + +#include +#include +#include +#if __cplusplus >= 201103L +#include +#endif +#if __cplusplus >= 202002L +# include +#endif +#if __glibcxx_concepts // C++ >= C++20 +# include // ranges::distance +#endif +#if __glibcxx_containers_ranges // C++ >= 23 +# include // ranges::copy +# include // ranges::subrange +#endif + +#include + +#if _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR +extern "C" void +__sanitizer_annotate_contiguous_container(const void*, const void*, + const void*, const void*); +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + /// See bits/stl_deque.h's _Deque_base for an explanation. + template + struct _Vector_base + { + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_Tp>::other _Tp_alloc_type; + typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer + pointer; + + struct _Vector_impl_data + { + pointer _M_start; + pointer _M_finish; + pointer _M_end_of_storage; + + _GLIBCXX20_CONSTEXPR + _Vector_impl_data() _GLIBCXX_NOEXCEPT + : _M_start(), _M_finish(), _M_end_of_storage() + { } + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + _Vector_impl_data(_Vector_impl_data&& __x) noexcept + : _M_start(__x._M_start), _M_finish(__x._M_finish), + _M_end_of_storage(__x._M_end_of_storage) + { __x._M_start = __x._M_finish = __x._M_end_of_storage = pointer(); } +#endif + + _GLIBCXX20_CONSTEXPR + void + _M_copy_data(_Vector_impl_data const& __x) _GLIBCXX_NOEXCEPT + { + _M_start = __x._M_start; + _M_finish = __x._M_finish; + _M_end_of_storage = __x._M_end_of_storage; + } + + _GLIBCXX20_CONSTEXPR + void + _M_swap_data(_Vector_impl_data& __x) _GLIBCXX_NOEXCEPT + { + // Do not use std::swap(_M_start, __x._M_start), etc as it loses + // information used by TBAA. + _Vector_impl_data __tmp; + __tmp._M_copy_data(*this); + _M_copy_data(__x); + __x._M_copy_data(__tmp); + } + }; + + struct _Vector_impl + : public _Tp_alloc_type, public _Vector_impl_data + { + _GLIBCXX20_CONSTEXPR + _Vector_impl() _GLIBCXX_NOEXCEPT_IF( + is_nothrow_default_constructible<_Tp_alloc_type>::value) +#if __cpp_lib_concepts + requires is_default_constructible_v<_Tp_alloc_type> +#endif + : _Tp_alloc_type() + { } + + _GLIBCXX20_CONSTEXPR + _Vector_impl(_Tp_alloc_type const& __a) _GLIBCXX_NOEXCEPT + : _Tp_alloc_type(__a) + { } + +#if __cplusplus >= 201103L + // Not defaulted, to enforce noexcept(true) even when + // !is_nothrow_move_constructible<_Tp_alloc_type>. + _GLIBCXX20_CONSTEXPR + _Vector_impl(_Vector_impl&& __x) noexcept + : _Tp_alloc_type(std::move(__x)), _Vector_impl_data(std::move(__x)) + { } + + _GLIBCXX20_CONSTEXPR + _Vector_impl(_Tp_alloc_type&& __a) noexcept + : _Tp_alloc_type(std::move(__a)) + { } + + _GLIBCXX20_CONSTEXPR + _Vector_impl(_Tp_alloc_type&& __a, _Vector_impl&& __rv) noexcept + : _Tp_alloc_type(std::move(__a)), _Vector_impl_data(std::move(__rv)) + { } +#endif + +#if _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR + template + struct _Asan + { + typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type> + ::size_type size_type; + + static _GLIBCXX20_CONSTEXPR void + _S_shrink(_Vector_impl&, size_type) { } + static _GLIBCXX20_CONSTEXPR void + _S_on_dealloc(_Vector_impl&) { } + + typedef _Vector_impl& _Reinit; + + struct _Grow + { + _GLIBCXX20_CONSTEXPR _Grow(_Vector_impl&, size_type) { } + _GLIBCXX20_CONSTEXPR void _M_grew(size_type) { } + }; + }; + + // Enable ASan annotations for memory obtained from std::allocator. + template + struct _Asan > + { + typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type> + ::size_type size_type; + + // Adjust ASan annotation for [_M_start, _M_end_of_storage) to + // mark end of valid region as __curr instead of __prev. + static _GLIBCXX20_CONSTEXPR void + _S_adjust(_Vector_impl& __impl, pointer __prev, pointer __curr) + { +#if __cpp_lib_is_constant_evaluated + if (std::is_constant_evaluated()) + return; +#endif + __sanitizer_annotate_contiguous_container(__impl._M_start, + __impl._M_end_of_storage, __prev, __curr); + } + + static _GLIBCXX20_CONSTEXPR void + _S_grow(_Vector_impl& __impl, size_type __n) + { _S_adjust(__impl, __impl._M_finish, __impl._M_finish + __n); } + + static _GLIBCXX20_CONSTEXPR void + _S_shrink(_Vector_impl& __impl, size_type __n) + { _S_adjust(__impl, __impl._M_finish + __n, __impl._M_finish); } + + static _GLIBCXX20_CONSTEXPR void + _S_on_dealloc(_Vector_impl& __impl) + { + if (__impl._M_start) + _S_adjust(__impl, __impl._M_finish, __impl._M_end_of_storage); + } + + // Used on reallocation to tell ASan unused capacity is invalid. + struct _Reinit + { + explicit _GLIBCXX20_CONSTEXPR + _Reinit(_Vector_impl& __impl) : _M_impl(__impl) + { + // Mark unused capacity as valid again before deallocating it. + _S_on_dealloc(_M_impl); + } + + _GLIBCXX20_CONSTEXPR + ~_Reinit() + { + // Mark unused capacity as invalid after reallocation. + if (_M_impl._M_start) + _S_adjust(_M_impl, _M_impl._M_end_of_storage, + _M_impl._M_finish); + } + + _Vector_impl& _M_impl; + +#if __cplusplus >= 201103L + _Reinit(const _Reinit&) = delete; + _Reinit& operator=(const _Reinit&) = delete; +#endif + }; + + // Tell ASan when unused capacity is initialized to be valid. + struct _Grow + { + _GLIBCXX20_CONSTEXPR + _Grow(_Vector_impl& __impl, size_type __n) + : _M_impl(__impl), _M_n(__n) + { _S_grow(_M_impl, __n); } + + _GLIBCXX20_CONSTEXPR + ~_Grow() { if (_M_n) _S_shrink(_M_impl, _M_n); } + + _GLIBCXX20_CONSTEXPR + void _M_grew(size_type __n) { _M_n -= __n; } + +#if __cplusplus >= 201103L + _Grow(const _Grow&) = delete; + _Grow& operator=(const _Grow&) = delete; +#endif + private: + _Vector_impl& _M_impl; + size_type _M_n; + }; + }; + +#define _GLIBCXX_ASAN_ANNOTATE_REINIT \ + typename _Base::_Vector_impl::template _Asan<>::_Reinit const \ + __attribute__((__unused__)) __reinit_guard(this->_M_impl) +#define _GLIBCXX_ASAN_ANNOTATE_GROW(n) \ + typename _Base::_Vector_impl::template _Asan<>::_Grow \ + __attribute__((__unused__)) __grow_guard(this->_M_impl, (n)) +#define _GLIBCXX_ASAN_ANNOTATE_GREW(n) __grow_guard._M_grew(n) +#define _GLIBCXX_ASAN_ANNOTATE_SHRINK(n) \ + _Base::_Vector_impl::template _Asan<>::_S_shrink(this->_M_impl, n) +#define _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC \ + _Base::_Vector_impl::template _Asan<>::_S_on_dealloc(this->_M_impl) +#else // ! (_GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR) +#define _GLIBCXX_ASAN_ANNOTATE_REINIT +#define _GLIBCXX_ASAN_ANNOTATE_GROW(n) +#define _GLIBCXX_ASAN_ANNOTATE_GREW(n) +#define _GLIBCXX_ASAN_ANNOTATE_SHRINK(n) +#define _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC +#endif // _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR + }; + + public: + typedef _Alloc allocator_type; + + _GLIBCXX20_CONSTEXPR + _Tp_alloc_type& + _M_get_Tp_allocator() _GLIBCXX_NOEXCEPT + { return this->_M_impl; } + + _GLIBCXX20_CONSTEXPR + const _Tp_alloc_type& + _M_get_Tp_allocator() const _GLIBCXX_NOEXCEPT + { return this->_M_impl; } + + _GLIBCXX20_CONSTEXPR + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_get_Tp_allocator()); } + +#if __cplusplus >= 201103L + _Vector_base() = default; +#else + _Vector_base() { } +#endif + + _GLIBCXX20_CONSTEXPR + _Vector_base(const allocator_type& __a) _GLIBCXX_NOEXCEPT + : _M_impl(__a) { } + + // Kept for ABI compatibility. +#if !_GLIBCXX_INLINE_VERSION + _GLIBCXX20_CONSTEXPR + _Vector_base(size_t __n) + : _M_impl() + { _M_create_storage(__n); } +#endif + + _GLIBCXX20_CONSTEXPR + _Vector_base(size_t __n, const allocator_type& __a) + : _M_impl(__a) + { _M_create_storage(__n); } + +#if __cplusplus >= 201103L + _Vector_base(_Vector_base&&) = default; + + // Kept for ABI compatibility. +# if !_GLIBCXX_INLINE_VERSION + _GLIBCXX20_CONSTEXPR + _Vector_base(_Tp_alloc_type&& __a) noexcept + : _M_impl(std::move(__a)) { } + + _GLIBCXX20_CONSTEXPR + _Vector_base(_Vector_base&& __x, const allocator_type& __a) + : _M_impl(__a) + { + if (__x.get_allocator() == __a) + this->_M_impl._M_swap_data(__x._M_impl); + else + { + size_t __n = __x._M_impl._M_finish - __x._M_impl._M_start; + _M_create_storage(__n); + } + } +# endif + + _GLIBCXX20_CONSTEXPR + _Vector_base(const allocator_type& __a, _Vector_base&& __x) + : _M_impl(_Tp_alloc_type(__a), std::move(__x._M_impl)) + { } +#endif + + _GLIBCXX20_CONSTEXPR + ~_Vector_base() _GLIBCXX_NOEXCEPT + { + _M_deallocate(_M_impl._M_start, + _M_impl._M_end_of_storage - _M_impl._M_start); + } + + public: + _Vector_impl _M_impl; + + _GLIBCXX20_CONSTEXPR + pointer + _M_allocate(size_t __n) + { + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Tr; + return __n != 0 ? _Tr::allocate(_M_impl, __n) : pointer(); + } + + _GLIBCXX20_CONSTEXPR + void + _M_deallocate(pointer __p, size_t __n) + { + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Tr; + if (__p) + _Tr::deallocate(_M_impl, __p, __n); + } + + protected: + + _GLIBCXX20_CONSTEXPR + void + _M_create_storage(size_t __n) + { + this->_M_impl._M_start = this->_M_allocate(__n); + this->_M_impl._M_finish = this->_M_impl._M_start; + this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; + } + +#if __glibcxx_containers_ranges // C++ >= 23 + // Called by insert_range, and indirectly by assign_range, append_range. + // Initializes new elements in storage at __ptr and updates __ptr to + // point after the last new element. + // Provides strong exception safety guarantee. + // Requires [ptr, ptr+distance(rg)) is a valid range. + template + constexpr void + _M_append_range_to(_Rg&& __rg, pointer& __ptr) + { + __ptr = std::__uninitialized_copy_a(ranges::begin(__rg), + ranges::end(__rg), + __ptr, _M_get_Tp_allocator()); + } + + // Called by assign_range, append_range, insert_range. + // Requires capacity() >= size()+distance(rg). + template + constexpr void + _M_append_range(_Rg&& __rg) + { _M_append_range_to(std::forward<_Rg>(__rg), _M_impl._M_finish); } +#endif + }; + + /** + * @brief A standard container which offers fixed time access to + * individual elements in any order. + * + * @ingroup sequences + * @headerfile vector + * @since C++98 + * + * @tparam _Tp Type of element. + * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. + * + * Meets the requirements of a container, a + * reversible container, and a + * sequence, including the + * optional sequence requirements with the + * %exception of @c push_front and @c pop_front. + * + * In some terminology a %vector can be described as a dynamic + * C-style array, it offers fast and efficient access to individual + * elements in any order and saves the user from worrying about + * memory and size allocation. Subscripting ( @c [] ) access is + * also provided as with C-style arrays. + */ + template > + class vector : protected _Vector_base<_Tp, _Alloc> + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // Concept requirements. + typedef typename _Alloc::value_type _Alloc_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Tp, _SGIAssignableConcept) +# endif + __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) +#endif + +#if __cplusplus >= 201103L + static_assert(is_same::type, _Tp>::value, + "std::vector must have a non-const, non-volatile value_type"); +# if __cplusplus > 201703L || defined __STRICT_ANSI__ + static_assert(is_same::value, + "std::vector must have the same value_type as its allocator"); +# endif +#endif + + typedef _Vector_base<_Tp, _Alloc> _Base; + typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; + + public: + typedef _Tp value_type; + typedef typename _Base::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + typedef __gnu_cxx::__normal_iterator iterator; + typedef __gnu_cxx::__normal_iterator + const_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Alloc allocator_type; + + private: +#if __cplusplus >= 201103L + static constexpr bool + _S_nothrow_relocate(true_type) + { + return noexcept(std::__relocate_a(std::declval(), + std::declval(), + std::declval(), + std::declval<_Tp_alloc_type&>())); + } + + static constexpr bool + _S_nothrow_relocate(false_type) + { return false; } + + static constexpr bool + _S_use_relocate() + { + // Instantiating std::__relocate_a might cause an error outside the + // immediate context (in __relocate_object_a's noexcept-specifier), + // so only do it if we know the type can be move-inserted into *this. + return _S_nothrow_relocate(__is_move_insertable<_Tp_alloc_type>{}); + } + + static pointer + _S_do_relocate(pointer __first, pointer __last, pointer __result, + _Tp_alloc_type& __alloc, true_type) noexcept + { + return std::__relocate_a(__first, __last, __result, __alloc); + } + + static pointer + _S_do_relocate(pointer, pointer, pointer __result, + _Tp_alloc_type&, false_type) noexcept + { return __result; } + + static _GLIBCXX20_CONSTEXPR pointer + _S_relocate(pointer __first, pointer __last, pointer __result, + _Tp_alloc_type& __alloc) noexcept + { +#if __cpp_if_constexpr + // All callers have already checked _S_use_relocate() so just do it. + return std::__relocate_a(__first, __last, __result, __alloc); +#else + using __do_it = __bool_constant<_S_use_relocate()>; + return _S_do_relocate(__first, __last, __result, __alloc, __do_it{}); +#endif + } +#endif // C++11 + + protected: + using _Base::_M_allocate; + using _Base::_M_deallocate; + using _Base::_M_impl; + using _Base::_M_get_Tp_allocator; + + public: + // [23.2.4.1] construct/copy/destroy + // (assign() and get_allocator() are also listed in this section) + + /** + * @brief Creates a %vector with no elements. + */ +#if __cplusplus >= 201103L + vector() = default; +#else + vector() { } +#endif + + /** + * @brief Creates a %vector with no elements. + * @param __a An allocator object. + */ + explicit + _GLIBCXX20_CONSTEXPR + vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT + : _Base(__a) { } + +#if __cplusplus >= 201103L + /** + * @brief Creates a %vector with default constructed elements. + * @param __n The number of elements to initially create. + * @param __a An allocator. + * + * This constructor fills the %vector with @a __n default + * constructed elements. + */ + explicit + _GLIBCXX20_CONSTEXPR + vector(size_type __n, const allocator_type& __a = allocator_type()) + : _Base(_S_check_init_len(__n, __a), __a) + { _M_default_initialize(__n); } + + /** + * @brief Creates a %vector with copies of an exemplar element. + * @param __n The number of elements to initially create. + * @param __value An element to copy. + * @param __a An allocator. + * + * This constructor fills the %vector with @a __n copies of @a __value. + */ + _GLIBCXX20_CONSTEXPR + vector(size_type __n, const value_type& __value, + const allocator_type& __a = allocator_type()) + : _Base(_S_check_init_len(__n, __a), __a) + { _M_fill_initialize(__n, __value); } +#else + /** + * @brief Creates a %vector with copies of an exemplar element. + * @param __n The number of elements to initially create. + * @param __value An element to copy. + * @param __a An allocator. + * + * This constructor fills the %vector with @a __n copies of @a __value. + */ + explicit + vector(size_type __n, const value_type& __value = value_type(), + const allocator_type& __a = allocator_type()) + : _Base(_S_check_init_len(__n, __a), __a) + { _M_fill_initialize(__n, __value); } +#endif + + /** + * @brief %Vector copy constructor. + * @param __x A %vector of identical element and allocator types. + * + * All the elements of @a __x are copied, but any unused capacity in + * @a __x will not be copied + * (i.e. capacity() == size() in the new %vector). + * + * The newly-created %vector uses a copy of the allocator object used + * by @a __x (unless the allocator traits dictate a different object). + */ + _GLIBCXX20_CONSTEXPR + vector(const vector& __x) + : _Base(__x.size(), + _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator())) + { + this->_M_impl._M_finish = + std::__uninitialized_copy_a(__x.begin(), __x.end(), + this->_M_impl._M_start, + _M_get_Tp_allocator()); + } + +#if __cplusplus >= 201103L + /** + * @brief %Vector move constructor. + * + * The newly-created %vector contains the exact contents of the + * moved instance. + * The contents of the moved instance are a valid, but unspecified + * %vector. + */ + vector(vector&&) noexcept = default; + + /// Copy constructor with alternative allocator + _GLIBCXX20_CONSTEXPR + vector(const vector& __x, const __type_identity_t& __a) + : _Base(__x.size(), __a) + { + this->_M_impl._M_finish = + std::__uninitialized_copy_a(__x.begin(), __x.end(), + this->_M_impl._M_start, + _M_get_Tp_allocator()); + } + + private: + _GLIBCXX20_CONSTEXPR + vector(vector&& __rv, const allocator_type& __m, true_type) noexcept + : _Base(__m, std::move(__rv)) + { } + + _GLIBCXX20_CONSTEXPR + vector(vector&& __rv, const allocator_type& __m, false_type) + : _Base(__m) + { + if (__rv.get_allocator() == __m) + this->_M_impl._M_swap_data(__rv._M_impl); + else if (!__rv.empty()) + { + this->_M_create_storage(__rv.size()); + this->_M_impl._M_finish = + std::__uninitialized_move_a(__rv.begin(), __rv.end(), + this->_M_impl._M_start, + _M_get_Tp_allocator()); + __rv.clear(); + } + } + + public: + /// Move constructor with alternative allocator + _GLIBCXX20_CONSTEXPR + vector(vector&& __rv, const __type_identity_t& __m) + noexcept( noexcept( + vector(std::declval(), std::declval(), + std::declval())) ) + : vector(std::move(__rv), __m, typename _Alloc_traits::is_always_equal{}) + { } + + /** + * @brief Builds a %vector from an initializer list. + * @param __l An initializer_list. + * @param __a An allocator. + * + * Create a %vector consisting of copies of the elements in the + * initializer_list @a __l. + * + * This will call the element type's copy constructor N times + * (where N is @a __l.size()) and do no memory reallocation. + */ + _GLIBCXX20_CONSTEXPR + vector(initializer_list __l, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_range_initialize_n(__l.begin(), __l.end(), __l.size()); + } +#endif + + /** + * @brief Builds a %vector from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __a An allocator. + * + * Create a %vector consisting of copies of the elements from + * [first,last). + * + * If the iterators are forward, bidirectional, or + * random-access, then this will call the elements' copy + * constructor N times (where N is distance(first,last)) and do + * no memory reallocation. But if only input iterators are + * used, then this will do at most 2N calls to the copy + * constructor, and logN memory reallocations. + */ +#if __cplusplus >= 201103L + template> + _GLIBCXX20_CONSTEXPR + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { +#if __glibcxx_concepts // C++ >= C++20 + if constexpr (sized_sentinel_for<_InputIterator, _InputIterator> + || forward_iterator<_InputIterator>) + { + const auto __n + = static_cast(ranges::distance(__first, __last)); + _M_range_initialize_n(__first, __last, __n); + return; + } + else +#endif + _M_range_initialize(__first, __last, + std::__iterator_category(__first)); + } +#else + template + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Construct a vector from a range. + * @param __rg A range of values that are convertible to `bool`. + * @since C++23 + */ + template<__detail::__container_compatible_range<_Tp> _Rg> + constexpr + vector(from_range_t, _Rg&& __rg, const _Alloc& __a = _Alloc()) + : vector(__a) + { + if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) + { + const auto __n = static_cast(ranges::distance(__rg)); + _M_range_initialize_n(ranges::begin(__rg), ranges::end(__rg), + __n); + } + else + { + auto __first = ranges::begin(__rg); + const auto __last = ranges::end(__rg); + for (; __first != __last; ++__first) + emplace_back(*__first); + } + } +#endif + + /** + * The dtor only erases the elements, and note that if the + * elements themselves are pointers, the pointed-to memory is + * not touched in any way. Managing the pointer is the user's + * responsibility. + */ + _GLIBCXX20_CONSTEXPR + ~vector() _GLIBCXX_NOEXCEPT + { + std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, + _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_BEFORE_DEALLOC; + } + + /** + * @brief %Vector assignment operator. + * @param __x A %vector of identical element and allocator types. + * + * All the elements of @a __x are copied, but any unused capacity in + * @a __x will not be copied. + * + * Whether the allocator is copied depends on the allocator traits. + */ + _GLIBCXX20_CONSTEXPR + vector& + operator=(const vector& __x); + +#if __cplusplus >= 201103L + /** + * @brief %Vector move assignment operator. + * @param __x A %vector of identical element and allocator types. + * + * The contents of @a __x are moved into this %vector (without copying, + * if the allocators permit it). + * Afterwards @a __x is a valid, but unspecified %vector. + * + * Whether the allocator is moved depends on the allocator traits. + */ + _GLIBCXX20_CONSTEXPR + vector& + operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) + { + constexpr bool __move_storage = + _Alloc_traits::_S_propagate_on_move_assign() + || _Alloc_traits::_S_always_equal(); + _M_move_assign(std::move(__x), __bool_constant<__move_storage>()); + return *this; + } + + /** + * @brief %Vector list assignment operator. + * @param __l An initializer_list. + * + * This function fills a %vector with copies of the elements in the + * initializer list @a __l. + * + * Note that the assignment completely changes the %vector and + * that the resulting %vector's size is the same as the number + * of elements assigned. + */ + _GLIBCXX20_CONSTEXPR + vector& + operator=(initializer_list __l) + { + this->_M_assign_aux(__l.begin(), __l.end(), + random_access_iterator_tag()); + return *this; + } +#endif + + /** + * @brief Assigns a given value to a %vector. + * @param __n Number of elements to be assigned. + * @param __val Value to be assigned. + * + * This function fills a %vector with @a __n copies of the given + * value. Note that the assignment completely changes the + * %vector and that the resulting %vector's size is the same as + * the number of elements assigned. + */ + _GLIBCXX20_CONSTEXPR + void + assign(size_type __n, const value_type& __val) + { _M_fill_assign(__n, __val); } + + /** + * @brief Assigns a range to a %vector. + * @param __first An input iterator. + * @param __last An input iterator. + * + * This function fills a %vector with copies of the elements in the + * range [__first,__last). + * + * Note that the assignment completely changes the %vector and + * that the resulting %vector's size is the same as the number + * of elements assigned. + */ +#if __cplusplus >= 201103L + template> + _GLIBCXX20_CONSTEXPR + void + assign(_InputIterator __first, _InputIterator __last) + { _M_assign_aux(__first, __last, std::__iterator_category(__first)); } +#else + template + void + assign(_InputIterator __first, _InputIterator __last) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Assigns an initializer list to a %vector. + * @param __l An initializer_list. + * + * This function fills a %vector with copies of the elements in the + * initializer list @a __l. + * + * Note that the assignment completely changes the %vector and + * that the resulting %vector's size is the same as the number + * of elements assigned. + */ + _GLIBCXX20_CONSTEXPR + void + assign(initializer_list __l) + { + this->_M_assign_aux(__l.begin(), __l.end(), + random_access_iterator_tag()); + } +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Assign a range to the vector. + * @param __rg A range of values that are convertible to `value_type`. + * @pre `__rg` and `*this` do not overlap. + * @since C++23 + */ + template<__detail::__container_compatible_range<_Tp> _Rg> + constexpr void + assign_range(_Rg&& __rg) + { + static_assert(assignable_from<_Tp&, ranges::range_reference_t<_Rg>>); + + if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) + { + const auto __n = size_type(ranges::distance(__rg)); + if (__n <= size()) + { + auto __res = ranges::copy(__rg, this->_M_impl._M_start); + _M_erase_at_end(__res.out); + return; + } + + reserve(__n); + auto __first = ranges::copy_n(ranges::begin(__rg), size(), + this->_M_impl._M_start).in; + [[maybe_unused]] const auto __diff = __n - size(); + _GLIBCXX_ASAN_ANNOTATE_GROW(__diff); + _Base::_M_append_range(ranges::subrange(std::move(__first), + ranges::end(__rg))); + _GLIBCXX_ASAN_ANNOTATE_GREW(__diff); + } + else // input_range<_Rg> && !sized_range<_Rg> + { + auto __first = ranges::begin(__rg); + const auto __last = ranges::end(__rg); + pointer __ptr = this->_M_impl._M_start; + pointer const __end = this->_M_impl._M_finish; + + while (__ptr < __end && __first != __last) + { + *__ptr = *__first; + ++__ptr; + ++__first; + } + + if (__first == __last) + _M_erase_at_end(__ptr); + else + { + do + emplace_back(*__first); + while (++__first != __last); + } + } + } +#endif // containers_ranges + + /// Get a copy of the memory allocation object. + using _Base::get_allocator; + + // iterators + /** + * Returns a read/write iterator that points to the first + * element in the %vector. Iteration is done in ordinary + * element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(this->_M_impl._M_start); } + + /** + * Returns a read-only (constant) iterator that points to the + * first element in the %vector. Iteration is done in ordinary + * element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(this->_M_impl._M_start); } + + /** + * Returns a read/write iterator that points one past the last + * element in the %vector. Iteration is done in ordinary + * element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(this->_M_impl._M_finish); } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %vector. Iteration is done in + * ordinary element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(this->_M_impl._M_finish); } + + /** + * Returns a read/write reverse iterator that points to the + * last element in the %vector. Iteration is done in reverse + * element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %vector. Iteration is done in + * reverse element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + /** + * Returns a read/write reverse iterator that points to one + * before the first element in the %vector. Iteration is done + * in reverse element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first element in the %vector. Iteration + * is done in reverse element order. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the + * first element in the %vector. Iteration is done in ordinary + * element order. + */ + [[__nodiscard__]] _GLIBCXX20_CONSTEXPR + const_iterator + cbegin() const noexcept + { return const_iterator(this->_M_impl._M_start); } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %vector. Iteration is done in + * ordinary element order. + */ + [[__nodiscard__]] _GLIBCXX20_CONSTEXPR + const_iterator + cend() const noexcept + { return const_iterator(this->_M_impl._M_finish); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %vector. Iteration is done in + * reverse element order. + */ + [[__nodiscard__]] _GLIBCXX20_CONSTEXPR + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first element in the %vector. Iteration + * is done in reverse element order. + */ + [[__nodiscard__]] _GLIBCXX20_CONSTEXPR + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // [23.2.4.2] capacity + /** Returns the number of elements in the %vector. */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + size() const _GLIBCXX_NOEXCEPT + { + ptrdiff_t __dif = this->_M_impl._M_finish - this->_M_impl._M_start; + if (__dif < 0) + __builtin_unreachable (); + return size_type(__dif); + } + + /** Returns the size() of the largest possible %vector. */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _S_max_size(_M_get_Tp_allocator()); } + +#if __cplusplus >= 201103L + /** + * @brief Resizes the %vector to the specified number of elements. + * @param __new_size Number of elements the %vector should contain. + * + * This function will %resize the %vector to the specified + * number of elements. If the number is smaller than the + * %vector's current size the %vector is truncated, otherwise + * default constructed elements are appended. + */ + _GLIBCXX20_CONSTEXPR + void + resize(size_type __new_size) + { + if (__new_size > size()) + _M_default_append(__new_size - size()); + else if (__new_size < size()) + _M_erase_at_end(this->_M_impl._M_start + __new_size); + } + + /** + * @brief Resizes the %vector to the specified number of elements. + * @param __new_size Number of elements the %vector should contain. + * @param __x Data with which new elements should be populated. + * + * This function will %resize the %vector to the specified + * number of elements. If the number is smaller than the + * %vector's current size the %vector is truncated, otherwise + * the %vector is extended and new elements are populated with + * given data. + */ + _GLIBCXX20_CONSTEXPR + void + resize(size_type __new_size, const value_type& __x) + { + if (__new_size > size()) + _M_fill_append(__new_size - size(), __x); + else if (__new_size < size()) + _M_erase_at_end(this->_M_impl._M_start + __new_size); + } +#else + /** + * @brief Resizes the %vector to the specified number of elements. + * @param __new_size Number of elements the %vector should contain. + * @param __x Data with which new elements should be populated. + * + * This function will %resize the %vector to the specified + * number of elements. If the number is smaller than the + * %vector's current size the %vector is truncated, otherwise + * the %vector is extended and new elements are populated with + * given data. + */ + _GLIBCXX20_CONSTEXPR + void + resize(size_type __new_size, value_type __x = value_type()) + { + if (__new_size > size()) + _M_fill_append(__new_size - size(), __x); + else if (__new_size < size()) + _M_erase_at_end(this->_M_impl._M_start + __new_size); + } +#endif + +#if __cplusplus >= 201103L + /** A non-binding request to reduce capacity() to size(). */ + _GLIBCXX20_CONSTEXPR + void + shrink_to_fit() + { _M_shrink_to_fit(); } +#endif + + /** + * Returns the total number of elements that the %vector can + * hold before needing to allocate more memory. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + size_type + capacity() const _GLIBCXX_NOEXCEPT + { + ptrdiff_t __dif = this->_M_impl._M_end_of_storage + - this->_M_impl._M_start; + if (__dif < 0) + __builtin_unreachable (); + return size_type(__dif); + } + + /** + * Returns true if the %vector is empty. (Thus begin() would + * equal end().) + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + bool + empty() const _GLIBCXX_NOEXCEPT + { return begin() == end(); } + + /** + * @brief Attempt to preallocate enough memory for specified number of + * elements. + * @param __n Number of elements required. + * @throw std::length_error If @a n exceeds @c max_size(). + * + * This function attempts to reserve enough memory for the + * %vector to hold the specified number of elements. If the + * number requested is more than max_size(), length_error is + * thrown. + * + * The advantage of this function is that if optimal code is a + * necessity and the user can determine the number of elements + * that will be required, the user can reserve the memory in + * %advance, and thus prevent a possible reallocation of memory + * and copying of %vector data. + */ + _GLIBCXX20_CONSTEXPR + void + reserve(size_type __n); + + // element access + /** + * @brief Subscript access to the data contained in the %vector. + * @param __n The index of the element for which data should be + * accessed. + * @return Read/write reference to data. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + operator[](size_type __n) _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_subscript(__n); + return *(this->_M_impl._M_start + __n); + } + + /** + * @brief Subscript access to the data contained in the %vector. + * @param __n The index of the element for which data should be + * accessed. + * @return Read-only (constant) reference to data. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + operator[](size_type __n) const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_subscript(__n); + return *(this->_M_impl._M_start + __n); + } + + protected: + /// Safety check used only from at(). + _GLIBCXX20_CONSTEXPR + void + _M_range_check(size_type __n) const + { + if (__n >= this->size()) + __throw_out_of_range_fmt(__N("vector::_M_range_check: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + } + + public: + /** + * @brief Provides access to the data contained in the %vector. + * @param __n The index of the element for which data should be + * accessed. + * @return Read/write reference to data. + * @throw std::out_of_range If @a __n is an invalid index. + * + * This function provides for safer data access. The parameter + * is first checked that it is in the range of the vector. The + * function throws out_of_range if the check fails. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + at(size_type __n) + { + _M_range_check(__n); + return (*this)[__n]; + } + + /** + * @brief Provides access to the data contained in the %vector. + * @param __n The index of the element for which data should be + * accessed. + * @return Read-only (constant) reference to data. + * @throw std::out_of_range If @a __n is an invalid index. + * + * This function provides for safer data access. The parameter + * is first checked that it is in the range of the vector. The + * function throws out_of_range if the check fails. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + at(size_type __n) const + { + _M_range_check(__n); + return (*this)[__n]; + } + + /** + * Returns a read/write reference to the data at the first + * element of the %vector. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + front() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *begin(); + } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %vector. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + front() const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *begin(); + } + + /** + * Returns a read/write reference to the data at the last + * element of the %vector. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + reference + back() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *(end() - 1); + } + + /** + * Returns a read-only (constant) reference to the data at the + * last element of the %vector. + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const_reference + back() const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *(end() - 1); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 464. Suggestion for new member functions in standard containers. + // data access + /** + * Returns a pointer such that [data(), data() + size()) is a valid + * range. For a non-empty %vector, data() == &front(). + */ + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + _Tp* + data() _GLIBCXX_NOEXCEPT + { return _M_data_ptr(this->_M_impl._M_start); } + + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + const _Tp* + data() const _GLIBCXX_NOEXCEPT + { return _M_data_ptr(this->_M_impl._M_start); } + + // [23.2.4.3] modifiers + /** + * @brief Add data to the end of the %vector. + * @param __x Data to be added. + * + * This is a typical stack operation. The function creates an + * element at the end of the %vector and assigns the given data + * to it. Due to the nature of a %vector this operation can be + * done in constant time if the %vector has preallocated space + * available. + */ + _GLIBCXX20_CONSTEXPR + void + push_back(const value_type& __x) + { + if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(1); + _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, + __x); + ++this->_M_impl._M_finish; + _GLIBCXX_ASAN_ANNOTATE_GREW(1); + } + else + _M_realloc_append(__x); + } + +#if __cplusplus >= 201103L + _GLIBCXX20_CONSTEXPR + void + push_back(value_type&& __x) + { emplace_back(std::move(__x)); } + + template +#if __cplusplus > 201402L + _GLIBCXX20_CONSTEXPR + reference +#else + void +#endif + emplace_back(_Args&&... __args); +#endif + + /** + * @brief Removes last element. + * + * This is a typical stack operation. It shrinks the %vector by one. + * + * Note that no data is returned, and if the last element's + * data is needed, it should be retrieved before pop_back() is + * called. + */ + _GLIBCXX20_CONSTEXPR + void + pop_back() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + --this->_M_impl._M_finish; + _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish); + _GLIBCXX_ASAN_ANNOTATE_SHRINK(1); + } + +#if __cplusplus >= 201103L + /** + * @brief Inserts an object in %vector before specified iterator. + * @param __position A const_iterator into the %vector. + * @param __args Arguments. + * @return An iterator that points to the inserted data. + * + * This function will insert an object of type T constructed + * with T(std::forward(args)...) before the specified location. + * Note that this kind of operation could be expensive for a %vector + * and if it is frequently used the user should consider using + * std::list. + */ + template + _GLIBCXX20_CONSTEXPR + iterator + emplace(const_iterator __position, _Args&&... __args) + { return _M_emplace_aux(__position, std::forward<_Args>(__args)...); } + + /** + * @brief Inserts given value into %vector before specified iterator. + * @param __position A const_iterator into the %vector. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given value before + * the specified location. Note that this kind of operation + * could be expensive for a %vector and if it is frequently + * used the user should consider using std::list. + */ + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __position, const value_type& __x); +#else + /** + * @brief Inserts given value into %vector before specified iterator. + * @param __position An iterator into the %vector. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given value before + * the specified location. Note that this kind of operation + * could be expensive for a %vector and if it is frequently + * used the user should consider using std::list. + */ + iterator + insert(iterator __position, const value_type& __x); +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts given rvalue into %vector before specified iterator. + * @param __position A const_iterator into the %vector. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given rvalue before + * the specified location. Note that this kind of operation + * could be expensive for a %vector and if it is frequently + * used the user should consider using std::list. + */ + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __position, value_type&& __x) + { return _M_insert_rval(__position, std::move(__x)); } + + /** + * @brief Inserts an initializer_list into the %vector. + * @param __position An iterator into the %vector. + * @param __l An initializer_list. + * + * This function will insert copies of the data in the + * initializer_list @a l into the %vector before the location + * specified by @a position. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __position, initializer_list __l) + { + auto __offset = __position - cbegin(); + _M_range_insert(begin() + __offset, __l.begin(), __l.end(), + std::random_access_iterator_tag()); + return begin() + __offset; + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts a number of copies of given data into the %vector. + * @param __position A const_iterator into the %vector. + * @param __n Number of elements to be inserted. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a specified number of copies of + * the given data before the location specified by @a position. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __position, size_type __n, const value_type& __x) + { + difference_type __offset = __position - cbegin(); + _M_fill_insert(begin() + __offset, __n, __x); + return begin() + __offset; + } +#else + /** + * @brief Inserts a number of copies of given data into the %vector. + * @param __position An iterator into the %vector. + * @param __n Number of elements to be inserted. + * @param __x Data to be inserted. + * + * This function will insert a specified number of copies of + * the given data before the location specified by @a position. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + void + insert(iterator __position, size_type __n, const value_type& __x) + { _M_fill_insert(__position, __n, __x); } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts a range into the %vector. + * @param __position A const_iterator into the %vector. + * @param __first An input iterator. + * @param __last An input iterator. + * @return An iterator that points to the inserted data. + * + * This function will insert copies of the data in the range + * [__first,__last) into the %vector before the location specified + * by @a pos. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + template> + _GLIBCXX20_CONSTEXPR + iterator + insert(const_iterator __position, _InputIterator __first, + _InputIterator __last) + { + difference_type __offset = __position - cbegin(); + _M_range_insert(begin() + __offset, __first, __last, + std::__iterator_category(__first)); + return begin() + __offset; + } +#else + /** + * @brief Inserts a range into the %vector. + * @param __position An iterator into the %vector. + * @param __first An input iterator. + * @param __last An input iterator. + * + * This function will insert copies of the data in the range + * [__first,__last) into the %vector before the location specified + * by @a pos. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + template + void + insert(iterator __position, _InputIterator __first, + _InputIterator __last) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_insert_dispatch(__position, __first, __last, _Integral()); + } +#endif + +#if __glibcxx_containers_ranges // C++ >= 23 + /** + * @brief Insert a range into the vector. + * @param __rg A range of values that are convertible to `value_type`. + * @return An iterator that points to the first new element inserted, + * or to `__pos` if `__rg` is an empty range. + * @pre `__rg` and `*this` do not overlap. + * @since C++23 + */ + template<__detail::__container_compatible_range<_Tp> _Rg> + constexpr iterator + insert_range(const_iterator __pos, _Rg&& __rg); + + /** + * @brief Append a range at the end of the vector. + * @param __rg A range of values that are convertible to `value_type`. + * @since C++23 + */ + template<__detail::__container_compatible_range<_Tp> _Rg> + constexpr void + append_range(_Rg&& __rg) + { + // N.B. __rg may overlap with *this, so we must copy from __rg before + // existing elements or iterators referring to *this are invalidated. + // e.g. in v.append_range(views::concat(v, foo)) rg overlaps v. + if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>) + { + const auto __n = size_type(ranges::distance(__rg)); + + // If there is no existing storage, there are no iterators that + // can be referring to our storage, so it's safe to allocate now. + if (capacity() == 0) + reserve(__n); + + const auto __sz = size(); + const auto __capacity = capacity(); + if ((__capacity - __sz) >= __n) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + _Base::_M_append_range(__rg); + _GLIBCXX_ASAN_ANNOTATE_GREW(__n); + return; + } + + const size_type __len = _M_check_len(__n, "vector::append_range"); + + pointer __old_start = this->_M_impl._M_start; + pointer __old_finish = this->_M_impl._M_finish; + + allocator_type& __a = _M_get_Tp_allocator(); + const pointer __start = this->_M_allocate(__len); + const pointer __mid = __start + __sz; + const pointer __back = __mid + __n; + _Guard_alloc __guard(__start, __len, *this); + std::__uninitialized_copy_a(ranges::begin(__rg), + ranges::end(__rg), + __mid, __a); + + if constexpr (_S_use_relocate()) + _S_relocate(__old_start, __old_finish, __start, __a); + else + { + // RAII type to destroy initialized elements. + struct _Guard_elts + { + pointer _M_first, _M_last; // Elements to destroy + _Tp_alloc_type& _M_alloc; + + constexpr + _Guard_elts(pointer __f, pointer __l, _Tp_alloc_type& __a) + : _M_first(__f), _M_last(__l), _M_alloc(__a) + { } + + constexpr + ~_Guard_elts() + { std::_Destroy(_M_first, _M_last, _M_alloc); } + + _Guard_elts(_Guard_elts&&) = delete; + }; + _Guard_elts __guard_elts{__mid, __back, __a}; + + std::__uninitialized_move_a(__old_start, __old_finish, + __start, __a); + + // Let old elements get destroyed by __guard_elts: + __guard_elts._M_first = __old_start; + __guard_elts._M_last = __old_finish; + } + + // Now give ownership of old storage to __guard: + __guard._M_storage = __old_start; + __guard._M_len = __capacity; + // Finally, take ownership of new storage: + this->_M_impl._M_start = __start; + this->_M_impl._M_finish = __back; + this->_M_impl._M_end_of_storage = __start + __len; + } + else + { + auto __first = ranges::begin(__rg); + const auto __last = ranges::end(__rg); + + // Fill up to the end of current capacity. + for (auto __free = capacity() - size(); + __first != __last && __free > 0; + ++__first, (void) --__free) + emplace_back(*__first); + + if (__first == __last) + return; + + // Copy the rest of the range to a new vector. + vector __tmp(_M_get_Tp_allocator()); + for (; __first != __last; ++__first) + __tmp.emplace_back(*__first); + reserve(_M_check_len(__tmp.size(), "vector::append_range")); + ranges::subrange __r(std::make_move_iterator(__tmp.begin()), + std::make_move_iterator(__tmp.end())); + append_range(__r); // This will take the fast path above. + } + } +#endif // containers_ranges + + /** + * @brief Remove element at given position. + * @param __position Iterator pointing to element to be erased. + * @return An iterator pointing to the next element (or end()). + * + * This function will erase the element at the given position and thus + * shorten the %vector by one. + * + * Note This operation could be expensive and if it is + * frequently used the user should consider using std::list. + * The user is also cautioned that this function only erases + * the element, and that if the element is itself a pointer, + * the pointed-to memory is not touched in any way. Managing + * the pointer is the user's responsibility. + */ + _GLIBCXX20_CONSTEXPR + iterator +#if __cplusplus >= 201103L + erase(const_iterator __position) + { return _M_erase(begin() + (__position - cbegin())); } +#else + erase(iterator __position) + { return _M_erase(__position); } +#endif + + /** + * @brief Remove a range of elements. + * @param __first Iterator pointing to the first element to be erased. + * @param __last Iterator pointing to one past the last element to be + * erased. + * @return An iterator pointing to the element pointed to by @a __last + * prior to erasing (or end()). + * + * This function will erase the elements in the range + * [__first,__last) and shorten the %vector accordingly. + * + * Note This operation could be expensive and if it is + * frequently used the user should consider using std::list. + * The user is also cautioned that this function only erases + * the elements, and that if the elements themselves are + * pointers, the pointed-to memory is not touched in any way. + * Managing the pointer is the user's responsibility. + */ + _GLIBCXX20_CONSTEXPR + iterator +#if __cplusplus >= 201103L + erase(const_iterator __first, const_iterator __last) + { + const auto __beg = begin(); + const auto __cbeg = cbegin(); + return _M_erase(__beg + (__first - __cbeg), __beg + (__last - __cbeg)); + } +#else + erase(iterator __first, iterator __last) + { return _M_erase(__first, __last); } +#endif + + /** + * @brief Swaps data with another %vector. + * @param __x A %vector of the same element and allocator types. + * + * This exchanges the elements between two vectors in constant time. + * (Three pointers, so it should be quite fast.) + * Note that the global std::swap() function is specialized such that + * std::swap(v1,v2) will feed to this function. + * + * Whether the allocators are swapped depends on the allocator traits. + */ + _GLIBCXX20_CONSTEXPR + void + swap(vector& __x) _GLIBCXX_NOEXCEPT + { +#if __cplusplus >= 201103L + __glibcxx_assert(_Alloc_traits::propagate_on_container_swap::value + || _M_get_Tp_allocator() == __x._M_get_Tp_allocator()); +#endif + this->_M_impl._M_swap_data(__x._M_impl); + _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(), + __x._M_get_Tp_allocator()); + } + + /** + * Erases all the elements. Note that this function only erases the + * elements, and that if the elements themselves are pointers, the + * pointed-to memory is not touched in any way. Managing the pointer is + * the user's responsibility. + */ + _GLIBCXX20_CONSTEXPR + void + clear() _GLIBCXX_NOEXCEPT + { _M_erase_at_end(this->_M_impl._M_start); } + + private: + // RAII guard for allocated storage. + struct _Guard_alloc + { + pointer _M_storage; // Storage to deallocate + size_type _M_len; + _Base& _M_vect; + + _GLIBCXX20_CONSTEXPR + _Guard_alloc(pointer __s, size_type __l, _Base& __vect) + : _M_storage(__s), _M_len(__l), _M_vect(__vect) + { } + + _GLIBCXX20_CONSTEXPR + ~_Guard_alloc() + { + if (_M_storage) + _M_vect._M_deallocate(_M_storage, _M_len); + } + + _GLIBCXX20_CONSTEXPR + pointer + _M_release() + { + pointer __res = _M_storage; + _M_storage = pointer(); + return __res; + } + + private: + _Guard_alloc(const _Guard_alloc&); + }; + + protected: + /** + * Memory expansion handler. Uses the member allocation function to + * obtain @a n bytes of memory, and then copies [first,last) into it. + */ + template + _GLIBCXX20_CONSTEXPR + pointer + _M_allocate_and_copy(size_type __n, + _ForwardIterator __first, _ForwardIterator __last) + { + _Guard_alloc __guard(this->_M_allocate(__n), __n, *this); + std::__uninitialized_copy_a + (__first, __last, __guard._M_storage, _M_get_Tp_allocator()); + return __guard._M_release(); + } + + + // Internal constructor functions follow. + + // Called by the range constructor to implement [23.1.1]/9 + +#if __cplusplus < 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_initialize_dispatch(_Integer __int_n, _Integer __value, __true_type) + { + const size_type __n = static_cast(__int_n); + pointer __start = + _M_allocate(_S_check_init_len(__n, _M_get_Tp_allocator())); + this->_M_impl._M_start = __start; + this->_M_impl._M_end_of_storage = __start + __n; + _M_fill_initialize(__n, __value); + } + + // Called by the range constructor to implement [23.1.1]/9 + template + void + _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { + _M_range_initialize(__first, __last, + std::__iterator_category(__first)); + } +#endif + + // Called by the second initialize_dispatch above + template + _GLIBCXX20_CONSTEXPR + void + _M_range_initialize(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag) + { + __try { + for (; __first != __last; ++__first) +#if __cplusplus >= 201103L + emplace_back(*__first); +#else + push_back(*__first); +#endif + } __catch(...) { + clear(); + __throw_exception_again; + } + } + + // Called by the second initialize_dispatch above + template + _GLIBCXX20_CONSTEXPR + void + _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { + _M_range_initialize_n(__first, __last, + std::distance(__first, __last)); + } + + template + _GLIBCXX20_CONSTEXPR + void + _M_range_initialize_n(_Iterator __first, _Sentinel __last, + size_type __n) + { + pointer __start = + this->_M_allocate(_S_check_init_len(__n, _M_get_Tp_allocator())); + this->_M_impl._M_start = this->_M_impl._M_finish = __start; + this->_M_impl._M_end_of_storage = __start + __n; + this->_M_impl._M_finish + = std::__uninitialized_copy_a(_GLIBCXX_MOVE(__first), __last, + __start, _M_get_Tp_allocator()); + } + + // Called by the first initialize_dispatch above and by the + // vector(n,value,a) constructor. + _GLIBCXX20_CONSTEXPR + void + _M_fill_initialize(size_type __n, const value_type& __value) + { + this->_M_impl._M_finish = + std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value, + _M_get_Tp_allocator()); + } + +#if __cplusplus >= 201103L + // Called by the vector(n) constructor. + _GLIBCXX20_CONSTEXPR + void + _M_default_initialize(size_type __n) + { + this->_M_impl._M_finish = + std::__uninitialized_default_n_a(this->_M_impl._M_start, __n, + _M_get_Tp_allocator()); + } +#endif + + // Internal assign functions follow. The *_aux functions do the actual + // assignment work for the range versions. + + // Called by the range assign to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + _GLIBCXX20_CONSTEXPR + void + _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign(__n, __val); } + + // Called by the range assign to implement [23.1.1]/9 + template + _GLIBCXX20_CONSTEXPR + void + _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { _M_assign_aux(__first, __last, std::__iterator_category(__first)); } + + // Called by the second assign_dispatch above + template + _GLIBCXX20_CONSTEXPR + void + _M_assign_aux(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag); + + // Called by the second assign_dispatch above + template + _GLIBCXX20_CONSTEXPR + void + _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag); + + // Called by assign(n,t), and the range assign when it turns out + // to be the same thing. + _GLIBCXX20_CONSTEXPR + void + _M_fill_assign(size_type __n, const value_type& __val); + + // Internal insert functions follow. + + // Called by the range insert to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + _GLIBCXX20_CONSTEXPR + void + _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, + __true_type) + { _M_fill_insert(__pos, __n, __val); } + + // Called by the range insert to implement [23.1.1]/9 + template + _GLIBCXX20_CONSTEXPR + void + _M_insert_dispatch(iterator __pos, _InputIterator __first, + _InputIterator __last, __false_type) + { + _M_range_insert(__pos, __first, __last, + std::__iterator_category(__first)); + } + + // Called by the second insert_dispatch above + template + _GLIBCXX20_CONSTEXPR + void + _M_range_insert(iterator __pos, _InputIterator __first, + _InputIterator __last, std::input_iterator_tag); + + // Called by the second insert_dispatch above + template + _GLIBCXX20_CONSTEXPR + void + _M_range_insert(iterator __pos, _ForwardIterator __first, + _ForwardIterator __last, std::forward_iterator_tag); + + // Called by insert(p,n,x), and the range insert when it turns out to be + // the same thing. + _GLIBCXX20_CONSTEXPR + void + _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); + + // Called by resize(n,x), and the _M_fill_insert(end(), n, x) + _GLIBCXX20_CONSTEXPR + void + _M_fill_append(size_type __n, const value_type& __x); + +#if __cplusplus >= 201103L + // Called by resize(n). + _GLIBCXX20_CONSTEXPR + void + _M_default_append(size_type __n); + + _GLIBCXX20_CONSTEXPR + bool + _M_shrink_to_fit(); +#endif + +#if __cplusplus < 201103L + // Called by insert(p,x) + void + _M_insert_aux(iterator __position, const value_type& __x); + + void + _M_realloc_insert(iterator __position, const value_type& __x); + + void + _M_realloc_append(const value_type& __x); +#else + // A value_type object constructed with _Alloc_traits::construct() + // and destroyed with _Alloc_traits::destroy(). + struct _Temporary_value + { + template + _GLIBCXX20_CONSTEXPR explicit + _Temporary_value(vector* __vec, _Args&&... __args) : _M_this(__vec) + { + _Alloc_traits::construct(_M_this->_M_impl, _M_ptr(), + std::forward<_Args>(__args)...); + } + + _GLIBCXX20_CONSTEXPR + ~_Temporary_value() + { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); } + + _GLIBCXX20_CONSTEXPR value_type& + _M_val() noexcept { return _M_storage._M_val; } + + private: + _GLIBCXX20_CONSTEXPR _Tp* + _M_ptr() noexcept { return std::__addressof(_M_storage._M_val); } + + union _Storage + { + constexpr _Storage() : _M_byte() { } + _GLIBCXX20_CONSTEXPR ~_Storage() { } + _Storage& operator=(const _Storage&) = delete; + unsigned char _M_byte; + _Tp _M_val; + }; + + vector* _M_this; + _Storage _M_storage; + }; + + // Called by insert(p,x) and other functions when insertion needs to + // reallocate or move existing elements. _Arg is either _Tp& or _Tp. + template + _GLIBCXX20_CONSTEXPR + void + _M_insert_aux(iterator __position, _Arg&& __arg); + + template + _GLIBCXX20_CONSTEXPR + void + _M_realloc_insert(iterator __position, _Args&&... __args); + + template + _GLIBCXX20_CONSTEXPR + void + _M_realloc_append(_Args&&... __args); + + // Either move-construct at the end, or forward to _M_insert_aux. + _GLIBCXX20_CONSTEXPR + iterator + _M_insert_rval(const_iterator __position, value_type&& __v); + + // Try to emplace at the end, otherwise forward to _M_insert_aux. + template + _GLIBCXX20_CONSTEXPR + iterator + _M_emplace_aux(const_iterator __position, _Args&&... __args); + + // Emplacing an rvalue of the correct type can use _M_insert_rval. + _GLIBCXX20_CONSTEXPR + iterator + _M_emplace_aux(const_iterator __position, value_type&& __v) + { return _M_insert_rval(__position, std::move(__v)); } +#endif + + // Called by _M_fill_insert, _M_insert_aux etc. + _GLIBCXX20_CONSTEXPR + size_type + _M_check_len(size_type __n, const char* __s) const + { + if (max_size() - size() < __n) + __throw_length_error(__N(__s)); + + const size_type __len = size() + (std::max)(size(), __n); + return (__len < size() || __len > max_size()) ? max_size() : __len; + } + + // Called by constructors to check initial size. + static _GLIBCXX20_CONSTEXPR size_type + _S_check_init_len(size_type __n, const allocator_type& __a) + { + if (__n > _S_max_size(_Tp_alloc_type(__a))) + __throw_length_error( + __N("cannot create std::vector larger than max_size()")); + return __n; + } + + static _GLIBCXX20_CONSTEXPR size_type + _S_max_size(const _Tp_alloc_type& __a) _GLIBCXX_NOEXCEPT + { + // std::distance(begin(), end()) cannot be greater than PTRDIFF_MAX, + // and realistically we can't store more than PTRDIFF_MAX/sizeof(T) + // (even if std::allocator_traits::max_size says we can). + const size_t __diffmax + = __gnu_cxx::__numeric_traits::__max / sizeof(_Tp); + const size_t __allocmax = _Alloc_traits::max_size(__a); + return (std::min)(__diffmax, __allocmax); + } + + // Internal erase functions follow. + + // Called by erase(q1,q2), clear(), resize(), _M_fill_assign, + // _M_assign_aux. + _GLIBCXX20_CONSTEXPR + void + _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT + { + if (size_type __n = this->_M_impl._M_finish - __pos) + { + std::_Destroy(__pos, this->_M_impl._M_finish, + _M_get_Tp_allocator()); + this->_M_impl._M_finish = __pos; + _GLIBCXX_ASAN_ANNOTATE_SHRINK(__n); + } + } + + _GLIBCXX20_CONSTEXPR + iterator + _M_erase(iterator __position); + + _GLIBCXX20_CONSTEXPR + iterator + _M_erase(iterator __first, iterator __last); + +#if __cplusplus >= 201103L + private: + // Constant-time move assignment when source object's memory can be + // moved, either because the source's allocator will move too + // or because the allocators are equal. + _GLIBCXX20_CONSTEXPR + void + _M_move_assign(vector&& __x, true_type) noexcept + { + vector __tmp(get_allocator()); + this->_M_impl._M_swap_data(__x._M_impl); + __tmp._M_impl._M_swap_data(__x._M_impl); + std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); + } + + // Do move assignment when it might not be possible to move source + // object's memory, resulting in a linear-time operation. + _GLIBCXX20_CONSTEXPR + void + _M_move_assign(vector&& __x, false_type) + { + if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator()) + _M_move_assign(std::move(__x), true_type()); + else + { + // The rvalue's allocator cannot be moved and is not equal, + // so we need to individually move each element. + this->_M_assign_aux(std::make_move_iterator(__x.begin()), + std::make_move_iterator(__x.end()), + std::random_access_iterator_tag()); + __x.clear(); + } + } +#endif + + template + _GLIBCXX20_CONSTEXPR + _Up* + _M_data_ptr(_Up* __ptr) const _GLIBCXX_NOEXCEPT + { return __ptr; } + +#if __cplusplus >= 201103L + template + _GLIBCXX20_CONSTEXPR + typename std::pointer_traits<_Ptr>::element_type* + _M_data_ptr(_Ptr __ptr) const + { return empty() ? nullptr : std::__to_address(__ptr); } +#else + template + value_type* + _M_data_ptr(_Ptr __ptr) const + { return empty() ? (value_type*)0 : __ptr.operator->(); } +#endif + }; + +#if __cpp_deduction_guides >= 201606 + template::value_type, + typename _Allocator = allocator<_ValT>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireAllocator<_Allocator>> + vector(_InputIterator, _InputIterator, _Allocator = _Allocator()) + -> vector<_ValT, _Allocator>; + +#if __glibcxx_containers_ranges // C++ >= 23 + template>> + vector(from_range_t, _Rg&&, _Alloc = _Alloc()) + -> vector, _Alloc>; +#endif +#endif + + /** + * @brief Vector equality comparison. + * @param __x A %vector. + * @param __y A %vector of the same type as @a __x. + * @return True iff the size and elements of the vectors are equal. + * + * This is an equivalence relation. It is linear in the size of the + * vectors. Vectors are considered equivalent if their sizes are equal, + * and if corresponding elements compare equal. + */ + template + _GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR + inline bool + operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return (__x.size() == __y.size() + && std::equal(__x.begin(), __x.end(), __y.begin())); } + +#if __cpp_lib_three_way_comparison // >= C++20 + /** + * @brief Vector ordering relation. + * @param __x A `vector`. + * @param __y A `vector` of the same type as `__x`. + * @return A value indicating whether `__x` is less than, equal to, + * greater than, or incomparable with `__y`. + * + * See `std::lexicographical_compare_three_way()` for how the determination + * is made. This operator is used to synthesize relational operators like + * `<` and `>=` etc. + */ + template + [[nodiscard]] + constexpr __detail::__synth3way_t<_Tp> + operator<=>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { + return std::lexicographical_compare_three_way(__x.begin(), __x.end(), + __y.begin(), __y.end(), + __detail::__synth3way); + } +#else + /** + * @brief Vector ordering relation. + * @param __x A %vector. + * @param __y A %vector of the same type as @a __x. + * @return True iff @a __x is lexicographically less than @a __y. + * + * This is a total ordering relation. It is linear in the size of the + * vectors. The elements must be comparable with @c <. + * + * See std::lexicographical_compare() for how the determination is made. + */ + template + _GLIBCXX_NODISCARD inline bool + operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return std::lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); } + + /// Based on operator== + template + _GLIBCXX_NODISCARD inline bool + operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return !(__x == __y); } + + /// Based on operator< + template + _GLIBCXX_NODISCARD inline bool + operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return __y < __x; } + + /// Based on operator< + template + _GLIBCXX_NODISCARD inline bool + operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return !(__y < __x); } + + /// Based on operator< + template + _GLIBCXX_NODISCARD inline bool + operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return !(__x < __y); } +#endif // three-way comparison + + /// See std::vector::swap(). + template + _GLIBCXX20_CONSTEXPR + inline void + swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +_GLIBCXX_END_NAMESPACE_CONTAINER + +#if __cplusplus >= 201703L + namespace __detail::__variant + { + template struct _Never_valueless_alt; // see + + // Provide the strong exception-safety guarantee when emplacing a + // vector into a variant, but only if move assignment cannot throw. + template + struct _Never_valueless_alt<_GLIBCXX_STD_C::vector<_Tp, _Alloc>> + : std::is_nothrow_move_assignable<_GLIBCXX_STD_C::vector<_Tp, _Alloc>> + { }; + } // namespace __detail::__variant +#endif // C++17 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif /* _STL_VECTOR_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_vector.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_vector.h.blob new file mode 100644 index 0000000..4126ead Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stl_vector.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf.tcc new file mode 100644 index 0000000..ff12d46 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf.tcc @@ -0,0 +1,175 @@ +// Stream buffer classes -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/streambuf.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{streambuf} + */ + +// +// ISO C++ 14882: 27.5 Stream buffers +// + +#ifndef _STREAMBUF_TCC +#define _STREAMBUF_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // extern template + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + streamsize + basic_streambuf<_CharT, _Traits>:: + xsgetn(char_type* __s, streamsize __n) + { + streamsize __ret = 0; + while (__ret < __n) + { + const streamsize __buf_len = this->egptr() - this->gptr(); + if (__buf_len) + { + const streamsize __remaining = __n - __ret; + const streamsize __len = std::min(__buf_len, __remaining); + traits_type::copy(__s, this->gptr(), __len); + __ret += __len; + __s += __len; + this->__safe_gbump(__len); + } + + if (__ret < __n) + { + const int_type __c = this->uflow(); + if (!traits_type::eq_int_type(__c, traits_type::eof())) + { + traits_type::assign(*__s++, traits_type::to_char_type(__c)); + ++__ret; + } + else + break; + } + } + return __ret; + } + + template + streamsize + basic_streambuf<_CharT, _Traits>:: + xsputn(const char_type* __s, streamsize __n) + { + streamsize __ret = 0; + while (__ret < __n) + { + const streamsize __buf_len = this->epptr() - this->pptr(); + if (__buf_len) + { + const streamsize __remaining = __n - __ret; + const streamsize __len = std::min(__buf_len, __remaining); + traits_type::copy(this->pptr(), __s, __len); + __ret += __len; + __s += __len; + this->__safe_pbump(__len); + } + + if (__ret < __n) + { + int_type __c = this->overflow(traits_type::to_int_type(*__s)); + if (!traits_type::eq_int_type(__c, traits_type::eof())) + { + ++__ret; + ++__s; + } + else + break; + } + } + return __ret; + } + + // Conceivably, this could be used to implement buffer-to-buffer + // copies, if this was ever desired in an un-ambiguous way by the + // standard. + template + streamsize + __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>* __sbin, + basic_streambuf<_CharT, _Traits>* __sbout, + bool& __ineof) + { + streamsize __ret = 0; + __ineof = true; + typename _Traits::int_type __c = __sbin->sgetc(); + while (!_Traits::eq_int_type(__c, _Traits::eof())) + { + __c = __sbout->sputc(_Traits::to_char_type(__c)); + if (_Traits::eq_int_type(__c, _Traits::eof())) + { + __ineof = false; + break; + } + ++__ret; + __c = __sbin->snextc(); + } + return __ret; + } + + template + inline streamsize + __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin, + basic_streambuf<_CharT, _Traits>* __sbout) + { + bool __ineof; + return __copy_streambufs_eof(__sbin, __sbout, __ineof); + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class basic_streambuf; + + extern template + streamsize + __copy_streambufs(basic_streambuf*, + basic_streambuf*); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class basic_streambuf; + + extern template + streamsize + __copy_streambufs(basic_streambuf*, + basic_streambuf*); +#endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#pragma GCC diagnostic pop +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf.tcc.blob new file mode 100644 index 0000000..c7822ed Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf_iterator.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf_iterator.h new file mode 100644 index 0000000..d426e55 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf_iterator.h @@ -0,0 +1,522 @@ +// Streambuf iterators + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/streambuf_iterator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ + +#ifndef _STREAMBUF_ITERATOR_H +#define _STREAMBUF_ITERATOR_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup iterators + * @{ + */ + +// Ignore warnings about std::iterator. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + // 24.5.3 Template class istreambuf_iterator + /// Provides input iterator semantics for streambufs. + template + class istreambuf_iterator + : public iterator + { + public: + // Types: + ///@{ + /// Public typedefs +#if __cplusplus < 201103L + typedef _CharT& reference; // Changed to _CharT by LWG 445 +#elif __cplusplus > 201703L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3188. istreambuf_iterator::pointer should not be unspecified + using pointer = void; +#endif + + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename _Traits::int_type int_type; + typedef basic_streambuf<_CharT, _Traits> streambuf_type; + typedef basic_istream<_CharT, _Traits> istream_type; + ///@} + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + ostreambuf_iterator<_CharT2> >::__type + copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, + ostreambuf_iterator<_CharT2>); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + _CharT2*>::__type + __copy_move_a2(istreambuf_iterator<_CharT2>, + istreambuf_iterator<_CharT2>, _CharT2*); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + _CharT2*>::__type + __copy_n_a(istreambuf_iterator<_CharT2>, _Size, _CharT2*, bool); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + istreambuf_iterator<_CharT2> >::__type + find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, + const _CharT2&); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + void>::__type + advance(istreambuf_iterator<_CharT2>&, _Distance); + + private: + // 24.5.3 istreambuf_iterator + // p 1 + // If the end of stream is reached (streambuf_type::sgetc() + // returns traits_type::eof()), the iterator becomes equal to + // the "end of stream" iterator value. + // NB: This implementation assumes the "end of stream" value + // is EOF, or -1. + mutable streambuf_type* _M_sbuf; + int_type _M_c; + + public: + /// Construct end of input stream iterator. + _GLIBCXX_CONSTEXPR istreambuf_iterator() _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(0), _M_c(traits_type::eof()) { } + +#if __cplusplus > 201703L && __cpp_lib_concepts + constexpr istreambuf_iterator(default_sentinel_t) noexcept + : istreambuf_iterator() { } +#endif + +#if __cplusplus >= 201103L + istreambuf_iterator(const istreambuf_iterator&) noexcept = default; + + ~istreambuf_iterator() = default; +#endif + + /// Construct start of input stream iterator. + istreambuf_iterator(istream_type& __s) _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(__s.rdbuf()), _M_c(traits_type::eof()) { } + + /// Construct start of streambuf iterator. + istreambuf_iterator(streambuf_type* __s) _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(__s), _M_c(traits_type::eof()) { } + +#if __cplusplus >= 201103L + istreambuf_iterator& + operator=(const istreambuf_iterator&) noexcept = default; +#endif + + /// Return the current character pointed to by iterator. This returns + /// streambuf.sgetc(). It cannot be assigned. NB: The result of + /// operator*() on an end of stream is undefined. + _GLIBCXX_NODISCARD + char_type + operator*() const + { + int_type __c = _M_get(); + +#ifdef _GLIBCXX_DEBUG_PEDANTIC + // Dereferencing a past-the-end istreambuf_iterator is a + // libstdc++ extension + __glibcxx_requires_cond(!_S_is_eof(__c), + _M_message(__gnu_debug::__msg_deref_istreambuf) + ._M_iterator(*this)); +#endif + return traits_type::to_char_type(__c); + } + + /// Advance the iterator. Calls streambuf.sbumpc(). + istreambuf_iterator& + operator++() + { + __glibcxx_requires_cond(_M_sbuf && + (!_S_is_eof(_M_c) || !_S_is_eof(_M_sbuf->sgetc())), + _M_message(__gnu_debug::__msg_inc_istreambuf) + ._M_iterator(*this)); + + _M_sbuf->sbumpc(); + _M_c = traits_type::eof(); + return *this; + } + + /// Advance the iterator. Calls streambuf.sbumpc(). + istreambuf_iterator + operator++(int) + { + __glibcxx_requires_cond(_M_sbuf && + (!_S_is_eof(_M_c) || !_S_is_eof(_M_sbuf->sgetc())), + _M_message(__gnu_debug::__msg_inc_istreambuf) + ._M_iterator(*this)); + + istreambuf_iterator __old = *this; + __old._M_c = _M_sbuf->sbumpc(); + _M_c = traits_type::eof(); + return __old; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 110 istreambuf_iterator::equal not const + // NB: there is also number 111 (NAD) relevant to this function. + /// Return true both iterators are end or both are not end. + _GLIBCXX_NODISCARD + bool + equal(const istreambuf_iterator& __b) const + { return _M_at_eof() == __b._M_at_eof(); } + + private: + int_type + _M_get() const + { + int_type __ret = _M_c; + if (_M_sbuf && _S_is_eof(__ret) && _S_is_eof(__ret = _M_sbuf->sgetc())) + _M_sbuf = 0; + return __ret; + } + + bool + _M_at_eof() const + { return _S_is_eof(_M_get()); } + + static bool + _S_is_eof(int_type __c) + { + const int_type __eof = traits_type::eof(); + return traits_type::eq_int_type(__c, __eof); + } + +#if __cplusplus > 201703L && __cpp_lib_concepts + [[nodiscard]] + friend bool + operator==(const istreambuf_iterator& __i, default_sentinel_t) + { return __i._M_at_eof(); } +#endif + }; + + template + _GLIBCXX_NODISCARD + inline bool + operator==(const istreambuf_iterator<_CharT, _Traits>& __a, + const istreambuf_iterator<_CharT, _Traits>& __b) + { return __a.equal(__b); } + +#if __cpp_impl_three_way_comparison < 201907L + template + _GLIBCXX_NODISCARD + inline bool + operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, + const istreambuf_iterator<_CharT, _Traits>& __b) + { return !__a.equal(__b); } +#endif + + /// Provides output iterator semantics for streambufs. + template + class ostreambuf_iterator + : public iterator + { + public: + // Types: + ///@{ + /// Public typedefs +#if __cplusplus > 201703L + using difference_type = ptrdiff_t; +#endif + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_streambuf<_CharT, _Traits> streambuf_type; + typedef basic_ostream<_CharT, _Traits> ostream_type; + ///@} + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + ostreambuf_iterator<_CharT2> >::__type + copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, + ostreambuf_iterator<_CharT2>); + + private: + streambuf_type* _M_sbuf; + bool _M_failed; + + public: + +#if __cplusplus > 201703L + constexpr + ostreambuf_iterator() noexcept + : _M_sbuf(nullptr), _M_failed(true) { } +#endif + + /// Construct output iterator from ostream. + ostreambuf_iterator(ostream_type& __s) _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(__s.rdbuf()), _M_failed(!_M_sbuf) { } + + /// Construct output iterator from streambuf. + ostreambuf_iterator(streambuf_type* __s) _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(__s), _M_failed(!_M_sbuf) { } + + /// Write character to streambuf. Calls streambuf.sputc(). + ostreambuf_iterator& + operator=(_CharT __c) + { + if (!_M_failed && + _Traits::eq_int_type(_M_sbuf->sputc(__c), _Traits::eof())) + _M_failed = true; + return *this; + } + + /// Return *this. + _GLIBCXX_NODISCARD + ostreambuf_iterator& + operator*() + { return *this; } + + /// Return *this. + ostreambuf_iterator& + operator++(int) + { return *this; } + + /// Return *this. + ostreambuf_iterator& + operator++() + { return *this; } + + /// Return true if previous operator=() failed. + _GLIBCXX_NODISCARD + bool + failed() const _GLIBCXX_USE_NOEXCEPT + { return _M_failed; } + + ostreambuf_iterator& + _M_put(const _CharT* __ws, streamsize __len) + { + if (__builtin_expect(!_M_failed, true) + && __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len, + false)) + _M_failed = true; + return *this; + } + }; +#pragma GCC diagnostic pop + + // Overloads for streambuf iterators. + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type + copy(istreambuf_iterator<_CharT> __first, + istreambuf_iterator<_CharT> __last, + ostreambuf_iterator<_CharT> __result) + { + if (__first._M_sbuf && !__last._M_sbuf && !__result._M_failed) + { + bool __ineof; + __copy_streambufs_eof(__first._M_sbuf, __result._M_sbuf, __ineof); + if (!__ineof) + __result._M_failed = true; + } + return __result; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type + __copy_move_a2(_CharT* __first, _CharT* __last, + ostreambuf_iterator<_CharT> __result) + { + const streamsize __num = __last - __first; + if (__num > 0) + __result._M_put(__first, __num); + return __result; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type + __copy_move_a2(const _CharT* __first, const _CharT* __last, + ostreambuf_iterator<_CharT> __result) + { + const streamsize __num = __last - __first; + if (__num > 0) + __result._M_put(__first, __num); + return __result; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + _CharT*>::__type + __copy_move_a2(istreambuf_iterator<_CharT> __first, + istreambuf_iterator<_CharT> __last, _CharT* __result) + { + typedef istreambuf_iterator<_CharT> __is_iterator_type; + typedef typename __is_iterator_type::traits_type traits_type; + typedef typename __is_iterator_type::streambuf_type streambuf_type; + typedef typename traits_type::int_type int_type; + + if (__first._M_sbuf && !__last._M_sbuf) + { + streambuf_type* __sb = __first._M_sbuf; + int_type __c = __sb->sgetc(); + while (!traits_type::eq_int_type(__c, traits_type::eof())) + { + const streamsize __n = __sb->egptr() - __sb->gptr(); + if (__n > 1) + { + traits_type::copy(__result, __sb->gptr(), __n); + __sb->__safe_gbump(__n); + __result += __n; + __c = __sb->underflow(); + } + else + { + *__result++ = traits_type::to_char_type(__c); + __c = __sb->snextc(); + } + } + } + return __result; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + _CharT*>::__type + __copy_n_a(istreambuf_iterator<_CharT> __it, _Size __n, _CharT* __result, + bool __strict __attribute__((__unused__))) + { + if (__n == 0) + return __result; + + __glibcxx_requires_cond(__it._M_sbuf, + _M_message(__gnu_debug::__msg_inc_istreambuf) + ._M_iterator(__it)); + _CharT* __beg = __result; + __result += __it._M_sbuf->sgetn(__beg, __n); + __glibcxx_requires_cond(!__strict || __result - __beg == __n, + _M_message(__gnu_debug::__msg_inc_istreambuf) + ._M_iterator(__it)); + return __result; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + istreambuf_iterator<_CharT> >::__type + find(istreambuf_iterator<_CharT> __first, + istreambuf_iterator<_CharT> __last, const _CharT& __val) + { + typedef istreambuf_iterator<_CharT> __is_iterator_type; + typedef typename __is_iterator_type::traits_type traits_type; + typedef typename __is_iterator_type::streambuf_type streambuf_type; + typedef typename traits_type::int_type int_type; + const int_type __eof = traits_type::eof(); + + if (__first._M_sbuf && !__last._M_sbuf) + { + const int_type __ival = traits_type::to_int_type(__val); + streambuf_type* __sb = __first._M_sbuf; + int_type __c = __sb->sgetc(); + while (!traits_type::eq_int_type(__c, __eof) + && !traits_type::eq_int_type(__c, __ival)) + { + streamsize __n = __sb->egptr() - __sb->gptr(); + if (__n > 1) + { + const _CharT* __p = traits_type::find(__sb->gptr(), + __n, __val); + if (__p) + __n = __p - __sb->gptr(); + __sb->__safe_gbump(__n); + __c = __sb->sgetc(); + } + else + __c = __sb->snextc(); + } + + __first._M_c = __eof; + } + + return __first; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + void>::__type + advance(istreambuf_iterator<_CharT>& __i, _Distance __n) + { + if (__n == 0) + return; + + __glibcxx_assert(__n > 0); + __glibcxx_requires_cond(!__i._M_at_eof(), + _M_message(__gnu_debug::__msg_inc_istreambuf) + ._M_iterator(__i)); + + typedef istreambuf_iterator<_CharT> __is_iterator_type; + typedef typename __is_iterator_type::traits_type traits_type; + typedef typename __is_iterator_type::streambuf_type streambuf_type; + typedef typename traits_type::int_type int_type; + const int_type __eof = traits_type::eof(); + + streambuf_type* __sb = __i._M_sbuf; + while (__n > 0) + { + streamsize __size = __sb->egptr() - __sb->gptr(); + if (__size > __n) + { + __sb->__safe_gbump(__n); + break; + } + + __sb->__safe_gbump(__size); + __n -= __size; + if (traits_type::eq_int_type(__sb->underflow(), __eof)) + { + __glibcxx_requires_cond(__n == 0, + _M_message(__gnu_debug::__msg_inc_istreambuf) + ._M_iterator(__i)); + break; + } + } + + __i._M_c = __eof; + } + +/// @} group iterators + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf_iterator.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf_iterator.h.blob new file mode 100644 index 0000000..aecc959 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@streambuf_iterator.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@string_view.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@string_view.tcc new file mode 100644 index 0000000..54fc204 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@string_view.tcc @@ -0,0 +1,243 @@ +// Components for manipulating non-owning sequences of characters -*- C++ -*- + +// Copyright (C) 2013-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/string_view.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{string_view} + */ + +// +// N3762 basic_string_view library +// + +#ifndef _GLIBCXX_STRING_VIEW_TCC +#define _GLIBCXX_STRING_VIEW_TCC 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus >= 201703L + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + find(const _CharT* __str, size_type __pos, size_type __n) const noexcept + { + __glibcxx_requires_string_len(__str, __n); + + if (__n == 0) + return __pos <= _M_len ? __pos : npos; + if (__pos >= _M_len) + return npos; + + const _CharT __elem0 = __str[0]; + const _CharT* __first = _M_str + __pos; + const _CharT* const __last = _M_str + _M_len; + size_type __len = _M_len - __pos; + + while (__len >= __n) + { + // Find the first occurrence of __elem0: + __first = traits_type::find(__first, __len - __n + 1, __elem0); + if (!__first) + return npos; + // Compare the full strings from the first occurrence of __elem0. + // We already know that __first[0] == __s[0] but compare them again + // anyway because __s is probably aligned, which helps memcmp. + if (traits_type::compare(__first, __str, __n) == 0) + return __first - _M_str; + __len = __last - ++__first; + } + return npos; + } + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + find(_CharT __c, size_type __pos) const noexcept + { + size_type __ret = npos; + if (__pos < this->_M_len) + { + const size_type __n = this->_M_len - __pos; + const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c); + if (__p) + __ret = __p - this->_M_str; + } + return __ret; + } + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept + { + __glibcxx_requires_string_len(__str, __n); + + if (__n <= this->_M_len) + { + __pos = std::min(size_type(this->_M_len - __n), __pos); + do + { + if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0) + return __pos; + } + while (__pos-- > 0); + } + return npos; + } + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + rfind(_CharT __c, size_type __pos) const noexcept + { + size_type __size = this->_M_len; + if (__size > 0) + { + if (--__size > __pos) + __size = __pos; + for (++__size; __size-- > 0; ) + if (traits_type::eq(this->_M_str[__size], __c)) + return __size; + } + return npos; + } + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + find_first_of(const _CharT* __str, size_type __pos, + size_type __n) const noexcept + { + __glibcxx_requires_string_len(__str, __n); + for (; __n && __pos < this->_M_len; ++__pos) + { + const _CharT* __p = traits_type::find(__str, __n, + this->_M_str[__pos]); + if (__p) + return __pos; + } + return npos; + } + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + find_last_of(const _CharT* __str, size_type __pos, + size_type __n) const noexcept + { + __glibcxx_requires_string_len(__str, __n); + size_type __size = this->size(); + if (__size && __n) + { + if (--__size > __pos) + __size = __pos; + do + { + if (traits_type::find(__str, __n, this->_M_str[__size])) + return __size; + } + while (__size-- != 0); + } + return npos; + } + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + find_first_not_of(const _CharT* __str, size_type __pos, + size_type __n) const noexcept + { + __glibcxx_requires_string_len(__str, __n); + for (; __pos < this->_M_len; ++__pos) + if (!traits_type::find(__str, __n, this->_M_str[__pos])) + return __pos; + return npos; + } + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + find_first_not_of(_CharT __c, size_type __pos) const noexcept + { + for (; __pos < this->_M_len; ++__pos) + if (!traits_type::eq(this->_M_str[__pos], __c)) + return __pos; + return npos; + } + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + find_last_not_of(const _CharT* __str, size_type __pos, + size_type __n) const noexcept + { + __glibcxx_requires_string_len(__str, __n); + size_type __size = this->_M_len; + if (__size) + { + if (--__size > __pos) + __size = __pos; + do + { + if (!traits_type::find(__str, __n, this->_M_str[__size])) + return __size; + } + while (__size--); + } + return npos; + } + + template + constexpr typename basic_string_view<_CharT, _Traits>::size_type + basic_string_view<_CharT, _Traits>:: + find_last_not_of(_CharT __c, size_type __pos) const noexcept + { + size_type __size = this->_M_len; + if (__size) + { + if (--__size > __pos) + __size = __pos; + do + { + if (!traits_type::eq(this->_M_str[__size], __c)) + return __size; + } + while (__size--); + } + return npos; + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // __cplusplus <= 201402L + +#endif // _GLIBCXX_STRING_VIEW_TCC diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@string_view.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@string_view.tcc.blob new file mode 100644 index 0000000..371e82f Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@string_view.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stringfwd.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stringfwd.h new file mode 100644 index 0000000..21fe7a3 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stringfwd.h @@ -0,0 +1,102 @@ +// Forward declarations -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/stringfwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{string} + */ + +// +// ISO C++ 14882: 21 Strings library +// + +#ifndef _STRINGFWD_H +#define _STRINGFWD_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup strings Strings + * + * @{ + */ + + template + struct char_traits; + + template<> struct char_traits; + + template<> struct char_traits; + +#ifdef _GLIBCXX_USE_CHAR8_T + template<> struct char_traits; +#endif + +#if __cplusplus >= 201103L + template<> struct char_traits; + template<> struct char_traits; +#endif + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + template, + typename _Alloc = allocator<_CharT> > + class basic_string; + +_GLIBCXX_END_NAMESPACE_CXX11 + + /// A string of @c char + typedef basic_string string; + + /// A string of @c wchar_t + typedef basic_string wstring; + +#ifdef _GLIBCXX_USE_CHAR8_T + /// A string of @c char8_t + typedef basic_string u8string; +#endif + +#if __cplusplus >= 201103L + /// A string of @c char16_t + typedef basic_string u16string; + + /// A string of @c char32_t + typedef basic_string u32string; +#endif + + /** @} */ + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // _STRINGFWD_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stringfwd.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stringfwd.h.blob new file mode 100644 index 0000000..e4c7023 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@stringfwd.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@unique_ptr.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@unique_ptr.h new file mode 100644 index 0000000..cf8ee65 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@unique_ptr.h @@ -0,0 +1,1191 @@ +// unique_ptr implementation -*- C++ -*- + +// Copyright (C) 2008-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/unique_ptr.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _UNIQUE_PTR_H +#define _UNIQUE_PTR_H 1 + +#include +#include +#include +#include +#include +#include +#if __cplusplus >= 202002L +# include +# if _GLIBCXX_HOSTED +# include +# endif +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup pointer_abstractions + * @{ + */ + +#if _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + template class auto_ptr; +#pragma GCC diagnostic pop +#endif + + /** Primary template of default_delete, used by unique_ptr for single objects + * + * @headerfile memory + * @since C++11 + */ + template + struct default_delete + { + /// Default constructor + constexpr default_delete() noexcept = default; + + /** @brief Converting constructor. + * + * Allows conversion from a deleter for objects of another type, `_Up`, + * only if `_Up*` is convertible to `_Tp*`. + */ + template>> + _GLIBCXX23_CONSTEXPR + default_delete(const default_delete<_Up>&) noexcept { } + + /// Calls `delete __ptr` + _GLIBCXX23_CONSTEXPR + void + operator()(_Tp* __ptr) const + { + static_assert(!is_void<_Tp>::value, + "can't delete pointer to incomplete type"); + static_assert(sizeof(_Tp)>0, + "can't delete pointer to incomplete type"); + delete __ptr; + } + }; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 740 - omit specialization for array objects with a compile time length + + /** Specialization of default_delete for arrays, used by `unique_ptr` + * + * @headerfile memory + * @since C++11 + */ + template + struct default_delete<_Tp[]> + { + public: + /// Default constructor + constexpr default_delete() noexcept = default; + + /** @brief Converting constructor. + * + * Allows conversion from a deleter for arrays of another type, such as + * a const-qualified version of `_Tp`. + * + * Conversions from types derived from `_Tp` are not allowed because + * it is undefined to `delete[]` an array of derived types through a + * pointer to the base type. + */ + template>> + _GLIBCXX23_CONSTEXPR + default_delete(const default_delete<_Up[]>&) noexcept { } + + /// Calls `delete[] __ptr` + template + _GLIBCXX23_CONSTEXPR + typename enable_if::value>::type + operator()(_Up* __ptr) const + { + static_assert(sizeof(_Tp)>0, + "can't delete pointer to incomplete type"); + delete [] __ptr; + } + }; + + /// @cond undocumented + + // Manages the pointer and deleter of a unique_ptr + template + class __uniq_ptr_impl + { + template + struct _Ptr + { + using type = _Up*; + }; + + template + struct + _Ptr<_Up, _Ep, __void_t::type::pointer>> + { + using type = typename remove_reference<_Ep>::type::pointer; + }; + + public: + using _DeleterConstraint = enable_if< + __and_<__not_>, + is_default_constructible<_Dp>>::value>; + + using pointer = typename _Ptr<_Tp, _Dp>::type; + + static_assert( !is_rvalue_reference<_Dp>::value, + "unique_ptr's deleter type must be a function object type" + " or an lvalue reference type" ); + + __uniq_ptr_impl() = default; + _GLIBCXX23_CONSTEXPR + __uniq_ptr_impl(pointer __p) : _M_t() { _M_ptr() = __p; } + + template + _GLIBCXX23_CONSTEXPR + __uniq_ptr_impl(pointer __p, _Del&& __d) + : _M_t(__p, std::forward<_Del>(__d)) { } + + _GLIBCXX23_CONSTEXPR + __uniq_ptr_impl(__uniq_ptr_impl&& __u) noexcept + : _M_t(std::move(__u._M_t)) + { __u._M_ptr() = nullptr; } + + _GLIBCXX23_CONSTEXPR + __uniq_ptr_impl& operator=(__uniq_ptr_impl&& __u) noexcept + { + reset(__u.release()); + _M_deleter() = std::forward<_Dp>(__u._M_deleter()); + return *this; + } + + _GLIBCXX23_CONSTEXPR + pointer& _M_ptr() noexcept { return std::get<0>(_M_t); } + _GLIBCXX23_CONSTEXPR + pointer _M_ptr() const noexcept { return std::get<0>(_M_t); } + _GLIBCXX23_CONSTEXPR + _Dp& _M_deleter() noexcept { return std::get<1>(_M_t); } + _GLIBCXX23_CONSTEXPR + const _Dp& _M_deleter() const noexcept { return std::get<1>(_M_t); } + + _GLIBCXX23_CONSTEXPR + void reset(pointer __p) noexcept + { + const pointer __old_p = _M_ptr(); + _M_ptr() = __p; + if (__old_p) + _M_deleter()(__old_p); + } + + _GLIBCXX23_CONSTEXPR + pointer release() noexcept + { + pointer __p = _M_ptr(); + _M_ptr() = nullptr; + return __p; + } + + _GLIBCXX23_CONSTEXPR + void + swap(__uniq_ptr_impl& __rhs) noexcept + { + using std::swap; + swap(this->_M_ptr(), __rhs._M_ptr()); + swap(this->_M_deleter(), __rhs._M_deleter()); + } + + private: + tuple _M_t; + }; + + // Defines move construction + assignment as either defaulted or deleted. + template ::value, + bool = is_move_assignable<_Dp>::value> + struct __uniq_ptr_data : __uniq_ptr_impl<_Tp, _Dp> + { + using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl; + __uniq_ptr_data(__uniq_ptr_data&&) = default; + __uniq_ptr_data& operator=(__uniq_ptr_data&&) = default; + }; + + template + struct __uniq_ptr_data<_Tp, _Dp, true, false> : __uniq_ptr_impl<_Tp, _Dp> + { + using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl; + __uniq_ptr_data(__uniq_ptr_data&&) = default; + __uniq_ptr_data& operator=(__uniq_ptr_data&&) = delete; + }; + + template + struct __uniq_ptr_data<_Tp, _Dp, false, true> : __uniq_ptr_impl<_Tp, _Dp> + { + using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl; + __uniq_ptr_data(__uniq_ptr_data&&) = delete; + __uniq_ptr_data& operator=(__uniq_ptr_data&&) = default; + }; + + template + struct __uniq_ptr_data<_Tp, _Dp, false, false> : __uniq_ptr_impl<_Tp, _Dp> + { + using __uniq_ptr_impl<_Tp, _Dp>::__uniq_ptr_impl; + __uniq_ptr_data(__uniq_ptr_data&&) = delete; + __uniq_ptr_data& operator=(__uniq_ptr_data&&) = delete; + }; + /// @endcond + + // 20.7.1.2 unique_ptr for single objects. + + /// A move-only smart pointer that manages unique ownership of a resource. + /// @headerfile memory + /// @since C++11 + template > + class unique_ptr + { + template + using _DeleterConstraint = + typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type; + + __uniq_ptr_data<_Tp, _Dp> _M_t; + + public: + using pointer = typename __uniq_ptr_impl<_Tp, _Dp>::pointer; + using element_type = _Tp; + using deleter_type = _Dp; + + private: + // helper template for detecting a safe conversion from another + // unique_ptr + template + using __safe_conversion_up = __and_< + is_convertible::pointer, pointer>, + __not_> + >; + + public: + // Constructors. + + /// Default constructor, creates a unique_ptr that owns nothing. + template> + constexpr unique_ptr() noexcept + : _M_t() + { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an object of @c element_type + * + * The deleter will be value-initialized. + */ + template> + _GLIBCXX23_CONSTEXPR + explicit + unique_ptr(pointer __p) noexcept + : _M_t(__p) + { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an object of @c element_type + * @param __d A reference to a deleter. + * + * The deleter will be initialized with @p __d + */ + template>> + _GLIBCXX23_CONSTEXPR + unique_ptr(pointer __p, const deleter_type& __d) noexcept + : _M_t(__p, __d) { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an object of @c element_type + * @param __d An rvalue reference to a (non-reference) deleter. + * + * The deleter will be initialized with @p std::move(__d) + */ + template>> + _GLIBCXX23_CONSTEXPR + unique_ptr(pointer __p, + __enable_if_t::value, + _Del&&> __d) noexcept + : _M_t(__p, std::move(__d)) + { } + + template::type> + _GLIBCXX23_CONSTEXPR + unique_ptr(pointer, + __enable_if_t::value, + _DelUnref&&>) = delete; + + /// Creates a unique_ptr that owns nothing. + template> + constexpr unique_ptr(nullptr_t) noexcept + : _M_t() + { } + + // Move constructors. + + /// Move constructor. + unique_ptr(unique_ptr&&) = default; + + /** @brief Converting constructor from another type + * + * Requires that the pointer owned by @p __u is convertible to the + * type of pointer owned by this object, @p __u does not own an array, + * and @p __u has a compatible deleter type. + */ + template, + __conditional_t::value, + is_same<_Ep, _Dp>, + is_convertible<_Ep, _Dp>>>> + _GLIBCXX23_CONSTEXPR + unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept + : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter())) + { } + +#if _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + /// Converting constructor from @c auto_ptr + template, + is_same<_Dp, default_delete<_Tp>>>> + unique_ptr(auto_ptr<_Up>&& __u) noexcept; +#pragma GCC diagnostic pop +#endif + + /// Destructor, invokes the deleter if the stored pointer is not null. +#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc + constexpr +#endif + ~unique_ptr() noexcept + { + static_assert(__is_invocable::value, + "unique_ptr's deleter must be invocable with a pointer"); + auto& __ptr = _M_t._M_ptr(); + if (__ptr != nullptr) + get_deleter()(std::move(__ptr)); + __ptr = pointer(); + } + + // Assignment. + + /** @brief Move assignment operator. + * + * Invokes the deleter if this object owns a pointer. + */ + unique_ptr& operator=(unique_ptr&&) = default; + + /** @brief Assignment from another type. + * + * @param __u The object to transfer ownership from, which owns a + * convertible pointer to a non-array object. + * + * Invokes the deleter if this object owns a pointer. + */ + template + _GLIBCXX23_CONSTEXPR + typename enable_if< __and_< + __safe_conversion_up<_Up, _Ep>, + is_assignable + >::value, + unique_ptr&>::type + operator=(unique_ptr<_Up, _Ep>&& __u) noexcept + { + reset(__u.release()); + get_deleter() = std::forward<_Ep>(__u.get_deleter()); + return *this; + } + + /// Reset the %unique_ptr to empty, invoking the deleter if necessary. + _GLIBCXX23_CONSTEXPR + unique_ptr& + operator=(nullptr_t) noexcept + { + reset(); + return *this; + } + + // Observers. + + /// Dereference the stored pointer. + _GLIBCXX23_CONSTEXPR + typename add_lvalue_reference::type + operator*() const noexcept(noexcept(*std::declval())) + { +#if _GLIBCXX_USE_BUILTIN_TRAIT(__reference_converts_from_temporary) + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 4148. unique_ptr::operator* should not allow dangling references + using _ResT = typename add_lvalue_reference::type; + using _DerefT = decltype(*get()); + static_assert(!__reference_converts_from_temporary(_ResT, _DerefT), + "operator* must not return a dangling reference"); +#endif + __glibcxx_assert(get() != pointer()); + return *get(); + } + + /// Return the stored pointer. + _GLIBCXX23_CONSTEXPR + pointer + operator->() const noexcept + { + _GLIBCXX_DEBUG_PEDASSERT(get() != pointer()); + return get(); + } + + /// Return the stored pointer. + _GLIBCXX23_CONSTEXPR + pointer + get() const noexcept + { return _M_t._M_ptr(); } + + /// Return a reference to the stored deleter. + _GLIBCXX23_CONSTEXPR + deleter_type& + get_deleter() noexcept + { return _M_t._M_deleter(); } + + /// Return a reference to the stored deleter. + _GLIBCXX23_CONSTEXPR + const deleter_type& + get_deleter() const noexcept + { return _M_t._M_deleter(); } + + /// Return @c true if the stored pointer is not null. + _GLIBCXX23_CONSTEXPR + explicit operator bool() const noexcept + { return get() == pointer() ? false : true; } + + // Modifiers. + + /// Release ownership of any stored pointer. + _GLIBCXX23_CONSTEXPR + pointer + release() noexcept + { return _M_t.release(); } + + /** @brief Replace the stored pointer. + * + * @param __p The new pointer to store. + * + * The deleter will be invoked if a pointer is already owned. + */ + _GLIBCXX23_CONSTEXPR + void + reset(pointer __p = pointer()) noexcept + { + static_assert(__is_invocable::value, + "unique_ptr's deleter must be invocable with a pointer"); + _M_t.reset(std::move(__p)); + } + + /// Exchange the pointer and deleter with another object. + _GLIBCXX23_CONSTEXPR + void + swap(unique_ptr& __u) noexcept + { + static_assert(__is_swappable<_Dp>::value, "deleter must be swappable"); + _M_t.swap(__u._M_t); + } + + // Disable copy from lvalue. + unique_ptr(const unique_ptr&) = delete; + unique_ptr& operator=(const unique_ptr&) = delete; + + private: +#ifdef __glibcxx_out_ptr + template + friend class out_ptr_t; + template + friend class inout_ptr_t; +#endif + }; + + // 20.7.1.3 unique_ptr for array objects with a runtime length + // [unique.ptr.runtime] + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 740 - omit specialization for array objects with a compile time length + + /// A move-only smart pointer that manages unique ownership of an array. + /// @headerfile memory + /// @since C++11 + template + class unique_ptr<_Tp[], _Dp> + { + template + using _DeleterConstraint = + typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type; + + __uniq_ptr_data<_Tp, _Dp> _M_t; + + // like is_base_of<_Tp, _Up> but false if unqualified types are the same + template + using __is_derived_Tp + = __and_< is_base_of<_Tp, _Up>, + __not_, __remove_cv_t<_Up>>> >; + + public: + using pointer = typename __uniq_ptr_impl<_Tp, _Dp>::pointer; + using element_type = _Tp; + using deleter_type = _Dp; + + // helper template for detecting a safe conversion from another + // unique_ptr + template, + typename _UP_pointer = typename _UPtr::pointer, + typename _UP_element_type = typename _UPtr::element_type> + using __safe_conversion_up = __and_< + is_array<_Up>, + is_same, + is_same<_UP_pointer, _UP_element_type*>, + is_convertible<_UP_element_type(*)[], element_type(*)[]> + >; + + // helper template for detecting a safe conversion from a raw pointer + template + using __safe_conversion_raw = __and_< + __or_<__or_, + is_same<_Up, nullptr_t>>, + __and_, + is_same, + is_convertible< + typename remove_pointer<_Up>::type(*)[], + element_type(*)[]> + > + > + >; + + // Constructors. + + /// Default constructor, creates a unique_ptr that owns nothing. + template> + constexpr unique_ptr() noexcept + : _M_t() + { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an array of a type safely convertible + * to an array of @c element_type + * + * The deleter will be value-initialized. + */ + template, + typename = typename enable_if< + __safe_conversion_raw<_Up>::value, bool>::type> + _GLIBCXX23_CONSTEXPR + explicit + unique_ptr(_Up __p) noexcept + : _M_t(__p) + { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an array of a type safely convertible + * to an array of @c element_type + * @param __d A reference to a deleter. + * + * The deleter will be initialized with @p __d + */ + template, + is_copy_constructible<_Del>>> + _GLIBCXX23_CONSTEXPR + unique_ptr(_Up __p, const deleter_type& __d) noexcept + : _M_t(__p, __d) { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an array of a type safely convertible + * to an array of @c element_type + * @param __d A reference to a deleter. + * + * The deleter will be initialized with @p std::move(__d) + */ + template, + is_move_constructible<_Del>>> + _GLIBCXX23_CONSTEXPR + unique_ptr(_Up __p, + __enable_if_t::value, + _Del&&> __d) noexcept + : _M_t(std::move(__p), std::move(__d)) + { } + + template::type, + typename = _Require<__safe_conversion_raw<_Up>>> + unique_ptr(_Up, + __enable_if_t::value, + _DelUnref&&>) = delete; + + /// Move constructor. + unique_ptr(unique_ptr&&) = default; + + /// Creates a unique_ptr that owns nothing. + template> + constexpr unique_ptr(nullptr_t) noexcept + : _M_t() + { } + + template, + __conditional_t::value, + is_same<_Ep, _Dp>, + is_convertible<_Ep, _Dp>>>> + _GLIBCXX23_CONSTEXPR + unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept + : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter())) + { } + + /// Destructor, invokes the deleter if the stored pointer is not null. +#if __cplusplus > 202002L && __cpp_constexpr_dynamic_alloc + constexpr +#endif + ~unique_ptr() + { + auto& __ptr = _M_t._M_ptr(); + if (__ptr != nullptr) + get_deleter()(__ptr); + __ptr = pointer(); + } + + // Assignment. + + /** @brief Move assignment operator. + * + * Invokes the deleter if this object owns a pointer. + */ + unique_ptr& + operator=(unique_ptr&&) = default; + + /** @brief Assignment from another type. + * + * @param __u The object to transfer ownership from, which owns a + * convertible pointer to an array object. + * + * Invokes the deleter if this object owns a pointer. + */ + template + _GLIBCXX23_CONSTEXPR + typename + enable_if<__and_<__safe_conversion_up<_Up, _Ep>, + is_assignable + >::value, + unique_ptr&>::type + operator=(unique_ptr<_Up, _Ep>&& __u) noexcept + { + reset(__u.release()); + get_deleter() = std::forward<_Ep>(__u.get_deleter()); + return *this; + } + + /// Reset the %unique_ptr to empty, invoking the deleter if necessary. + _GLIBCXX23_CONSTEXPR + unique_ptr& + operator=(nullptr_t) noexcept + { + reset(); + return *this; + } + + // Observers. + + /// Access an element of owned array. + _GLIBCXX23_CONSTEXPR + typename std::add_lvalue_reference::type + operator[](size_t __i) const + { + __glibcxx_assert(get() != pointer()); + return get()[__i]; + } + + /// Return the stored pointer. + _GLIBCXX23_CONSTEXPR + pointer + get() const noexcept + { return _M_t._M_ptr(); } + + /// Return a reference to the stored deleter. + _GLIBCXX23_CONSTEXPR + deleter_type& + get_deleter() noexcept + { return _M_t._M_deleter(); } + + /// Return a reference to the stored deleter. + _GLIBCXX23_CONSTEXPR + const deleter_type& + get_deleter() const noexcept + { return _M_t._M_deleter(); } + + /// Return @c true if the stored pointer is not null. + _GLIBCXX23_CONSTEXPR + explicit operator bool() const noexcept + { return get() == pointer() ? false : true; } + + // Modifiers. + + /// Release ownership of any stored pointer. + _GLIBCXX23_CONSTEXPR + pointer + release() noexcept + { return _M_t.release(); } + + /** @brief Replace the stored pointer. + * + * @param __p The new pointer to store. + * + * The deleter will be invoked if a pointer is already owned. + */ + template , + __and_, + is_pointer<_Up>, + is_convertible< + typename remove_pointer<_Up>::type(*)[], + element_type(*)[] + > + > + > + >> + _GLIBCXX23_CONSTEXPR + void + reset(_Up __p) noexcept + { _M_t.reset(std::move(__p)); } + + _GLIBCXX23_CONSTEXPR + void reset(nullptr_t = nullptr) noexcept + { reset(pointer()); } + + /// Exchange the pointer and deleter with another object. + _GLIBCXX23_CONSTEXPR + void + swap(unique_ptr& __u) noexcept + { + static_assert(__is_swappable<_Dp>::value, "deleter must be swappable"); + _M_t.swap(__u._M_t); + } + + // Disable copy from lvalue. + unique_ptr(const unique_ptr&) = delete; + unique_ptr& operator=(const unique_ptr&) = delete; + + private: +#ifdef __glibcxx_out_ptr + template friend class out_ptr_t; + template friend class inout_ptr_t; +#endif + }; + + /// @{ + /// @relates unique_ptr + + /// Swap overload for unique_ptr + template + inline +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + // Constrained free swap overload, see p0185r1 + _GLIBCXX23_CONSTEXPR + typename enable_if<__is_swappable<_Dp>::value>::type +#else + void +#endif + swap(unique_ptr<_Tp, _Dp>& __x, + unique_ptr<_Tp, _Dp>& __y) noexcept + { __x.swap(__y); } + +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + template + typename enable_if::value>::type + swap(unique_ptr<_Tp, _Dp>&, + unique_ptr<_Tp, _Dp>&) = delete; +#endif + + /// Equality operator for unique_ptr objects, compares the owned pointers + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator==(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return __x.get() == __y.get(); } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator==(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept + { return !__x; } + +#ifndef __cpp_lib_three_way_comparison + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD + inline bool + operator==(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept + { return !__x; } + + /// Inequality operator for unique_ptr objects, compares the owned pointers + template + _GLIBCXX_NODISCARD + inline bool + operator!=(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return __x.get() != __y.get(); } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD + inline bool + operator!=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept + { return (bool)__x; } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD + inline bool + operator!=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept + { return (bool)__x; } +#endif // three way comparison + + /// Relational operator for unique_ptr objects, compares the owned pointers + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator<(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { + typedef typename + std::common_type::pointer, + typename unique_ptr<_Up, _Ep>::pointer>::type _CT; + return std::less<_CT>()(__x.get(), __y.get()); + } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator<(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) + { + return std::less::pointer>()(__x.get(), + nullptr); + } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator<(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) + { + return std::less::pointer>()(nullptr, + __x.get()); + } + + /// Relational operator for unique_ptr objects, compares the owned pointers + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator<=(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return !(__y < __x); } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator<=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) + { return !(nullptr < __x); } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator<=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) + { return !(__x < nullptr); } + + /// Relational operator for unique_ptr objects, compares the owned pointers + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator>(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return (__y < __x); } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator>(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) + { + return std::less::pointer>()(nullptr, + __x.get()); + } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator>(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) + { + return std::less::pointer>()(__x.get(), + nullptr); + } + + /// Relational operator for unique_ptr objects, compares the owned pointers + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator>=(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return !(__x < __y); } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD _GLIBCXX23_CONSTEXPR + inline bool + operator>=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) + { return !(__x < nullptr); } + + /// unique_ptr comparison with nullptr + template + _GLIBCXX_NODISCARD inline bool + operator>=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) + { return !(nullptr < __x); } + +#ifdef __cpp_lib_three_way_comparison + template + requires three_way_comparable_with::pointer, + typename unique_ptr<_Up, _Ep>::pointer> + _GLIBCXX23_CONSTEXPR + inline + compare_three_way_result_t::pointer, + typename unique_ptr<_Up, _Ep>::pointer> + operator<=>(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return compare_three_way()(__x.get(), __y.get()); } + + template + requires three_way_comparable::pointer> + _GLIBCXX23_CONSTEXPR + inline + compare_three_way_result_t::pointer> + operator<=>(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) + { + using pointer = typename unique_ptr<_Tp, _Dp>::pointer; + return compare_three_way()(__x.get(), static_cast(nullptr)); + } +#endif + /// @} relates unique_ptr + + /// @cond undocumented + template + struct __uniq_ptr_hash + : public __hash_base +#if ! _GLIBCXX_INLINE_VERSION + , private __hash_empty_base<_Ptr> +#endif + { + size_t + operator()(const _Up& __u) const + noexcept(noexcept(std::declval>()(std::declval<_Ptr>()))) + { return hash<_Ptr>()(__u.get()); } + }; + + template + using __uniq_ptr_hash_base + = __conditional_t<__is_hash_enabled_for, + __uniq_ptr_hash<_Up>, + __hash_not_enabled>; + /// @endcond + + /// std::hash specialization for unique_ptr. + template + struct hash> + : public __uniq_ptr_hash_base> + { }; + +#ifdef __glibcxx_make_unique // C++ >= 14 && HOSTED + /// @cond undocumented +namespace __detail +{ + template + struct _MakeUniq + { typedef unique_ptr<_Tp> __single_object; }; + + template + struct _MakeUniq<_Tp[]> + { typedef unique_ptr<_Tp[]> __array; }; + + template + struct _MakeUniq<_Tp[_Bound]> + { struct __invalid_type { }; }; + + template + using __unique_ptr_t = typename _MakeUniq<_Tp>::__single_object; + template + using __unique_ptr_array_t = typename _MakeUniq<_Tp>::__array; + template + using __invalid_make_unique_t = typename _MakeUniq<_Tp>::__invalid_type; +} + /// @endcond + + /** Create an object owned by a `unique_ptr`. + * @tparam _Tp A non-array object type. + * @param __args Constructor arguments for the new object. + * @returns A `unique_ptr<_Tp>` that owns the new object. + * @since C++14 + * @relates unique_ptr + */ + template + _GLIBCXX23_CONSTEXPR + inline __detail::__unique_ptr_t<_Tp> + make_unique(_Args&&... __args) + { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); } + + /** Create an array owned by a `unique_ptr`. + * @tparam _Tp An array type of unknown bound, such as `U[]`. + * @param __num The number of elements of type `U` in the new array. + * @returns A `unique_ptr` that owns the new array. + * @since C++14 + * @relates unique_ptr + * + * The array elements are value-initialized. + */ + template + _GLIBCXX23_CONSTEXPR + inline __detail::__unique_ptr_array_t<_Tp> + make_unique(size_t __num) + { return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__num]()); } + + /** Disable std::make_unique for arrays of known bound. + * @tparam _Tp An array type of known bound, such as `U[N]`. + * @since C++14 + * @relates unique_ptr + */ + template + __detail::__invalid_make_unique_t<_Tp> + make_unique(_Args&&...) = delete; + +#if __cplusplus > 201703L + /** Create a default-initialied object owned by a `unique_ptr`. + * @tparam _Tp A non-array object type. + * @returns A `unique_ptr<_Tp>` that owns the new object. + * @since C++20 + * @relates unique_ptr + */ + template + _GLIBCXX23_CONSTEXPR + inline __detail::__unique_ptr_t<_Tp> + make_unique_for_overwrite() + { return unique_ptr<_Tp>(new _Tp); } + + /** Create a default-initialized array owned by a `unique_ptr`. + * @tparam _Tp An array type of unknown bound, such as `U[]`. + * @param __num The number of elements of type `U` in the new array. + * @returns A `unique_ptr` that owns the new array. + * @since C++20 + * @relates unique_ptr + */ + template + _GLIBCXX23_CONSTEXPR + inline __detail::__unique_ptr_array_t<_Tp> + make_unique_for_overwrite(size_t __num) + { return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__num]); } + + /** Disable std::make_unique_for_overwrite for arrays of known bound. + * @tparam _Tp An array type of known bound, such as `U[N]`. + * @since C++20 + * @relates unique_ptr + */ + template + __detail::__invalid_make_unique_t<_Tp> + make_unique_for_overwrite(_Args&&...) = delete; +#endif // C++20 + +#endif // C++14 && HOSTED + +#if __cplusplus > 201703L && __cpp_concepts && _GLIBCXX_HOSTED + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2948. unique_ptr does not define operator<< for stream output + /// Stream output operator for unique_ptr + /// @relates unique_ptr + /// @since C++20 + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, + const unique_ptr<_Tp, _Dp>& __p) + requires requires { __os << __p.get(); } + { + __os << __p.get(); + return __os; + } +#endif // C++20 && HOSTED + +#if __cpp_variable_templates + template + constexpr bool __is_unique_ptr = false; + template + constexpr bool __is_unique_ptr> = true; +#endif + + /// @} group pointer_abstractions + +#if __cplusplus >= 201703L + namespace __detail::__variant + { + template struct _Never_valueless_alt; // see + + // Provide the strong exception-safety guarantee when emplacing a + // unique_ptr into a variant. + template + struct _Never_valueless_alt> + : std::true_type + { }; + } // namespace __detail::__variant +#endif // C++17 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _UNIQUE_PTR_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@unique_ptr.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@unique_ptr.h.blob new file mode 100644 index 0000000..e14ec28 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@unique_ptr.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator.h new file mode 100644 index 0000000..8f4f10a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator.h @@ -0,0 +1,207 @@ +// Uses-allocator Construction -*- C++ -*- + +// Copyright (C) 2010-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/uses_allocator_args.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _USES_ALLOCATOR_H +#define _USES_ALLOCATOR_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +/// @cond undocumented + + // This is used for std::experimental::erased_type from Library Fundamentals. + struct __erased_type { }; + + // This also supports the "type-erased allocator" protocol from the + // Library Fundamentals TS, where allocator_type is erased_type. + // The second condition will always be false for types not using the TS. + template + using __is_erased_or_convertible + = __or_, is_same<_Tp, __erased_type>>; + + /// [allocator.tag] + struct allocator_arg_t { explicit allocator_arg_t() = default; }; + + _GLIBCXX17_INLINE constexpr allocator_arg_t allocator_arg = + allocator_arg_t(); + + template> + struct __uses_allocator_helper + : false_type { }; + + template + struct __uses_allocator_helper<_Tp, _Alloc, + __void_t> + : __is_erased_or_convertible<_Alloc, typename _Tp::allocator_type>::type + { }; + + /// [allocator.uses.trait] + template + struct uses_allocator + : __uses_allocator_helper<_Tp, _Alloc>::type + { }; + + struct __uses_alloc_base { }; + + struct __uses_alloc0 : __uses_alloc_base + { + struct _Sink { void _GLIBCXX20_CONSTEXPR operator=(const void*) { } } _M_a; + }; + + template + struct __uses_alloc1 : __uses_alloc_base { const _Alloc* _M_a; }; + + template + struct __uses_alloc2 : __uses_alloc_base { const _Alloc* _M_a; }; + + template + struct __uses_alloc; + + template + struct __uses_alloc + : __conditional_t< + is_constructible<_Tp, allocator_arg_t, const _Alloc&, _Args...>::value, + __uses_alloc1<_Alloc>, + __uses_alloc2<_Alloc>> + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2586. Wrong value category used in scoped_allocator_adaptor::construct + static_assert(__or_< + is_constructible<_Tp, allocator_arg_t, const _Alloc&, _Args...>, + is_constructible<_Tp, _Args..., const _Alloc&>>::value, + "construction with an allocator must be possible" + " if uses_allocator is true"); + }; + + template + struct __uses_alloc + : __uses_alloc0 { }; + + template + using __uses_alloc_t = + __uses_alloc::value, _Tp, _Alloc, _Args...>; + + template + _GLIBCXX20_CONSTEXPR + inline __uses_alloc_t<_Tp, _Alloc, _Args...> + __use_alloc(const _Alloc& __a) + { + __uses_alloc_t<_Tp, _Alloc, _Args...> __ret; + __ret._M_a = std::__addressof(__a); + return __ret; + } + + template + void + __use_alloc(const _Alloc&&) = delete; + +#if __cplusplus > 201402L + template + inline constexpr bool uses_allocator_v = + uses_allocator<_Tp, _Alloc>::value; +#endif // C++17 + +#if __cpp_concepts + template + concept __allocator_for = (uses_allocator_v<_Ts, _Alloc> && ...); +#endif + + template class _Predicate, + typename _Tp, typename _Alloc, typename... _Args> + struct __is_uses_allocator_predicate + : __conditional_t::value, + __or_<_Predicate<_Tp, allocator_arg_t, _Alloc, _Args...>, + _Predicate<_Tp, _Args..., _Alloc>>, + _Predicate<_Tp, _Args...>> { }; + + template + struct __is_uses_allocator_constructible + : __is_uses_allocator_predicate + { }; + +#if __cplusplus >= 201402L + template + _GLIBCXX17_INLINE constexpr bool __is_uses_allocator_constructible_v = + __is_uses_allocator_constructible<_Tp, _Alloc, _Args...>::value; +#endif // C++14 + + template + struct __is_nothrow_uses_allocator_constructible + : __is_uses_allocator_predicate + { }; + + +#if __cplusplus >= 201402L + template + _GLIBCXX17_INLINE constexpr bool + __is_nothrow_uses_allocator_constructible_v = + __is_nothrow_uses_allocator_constructible<_Tp, _Alloc, _Args...>::value; +#endif // C++14 + + template + void __uses_allocator_construct_impl(__uses_alloc0, _Tp* __ptr, + _Args&&... __args) + { ::new ((void*)__ptr) _Tp(std::forward<_Args>(__args)...); } + + template + void __uses_allocator_construct_impl(__uses_alloc1<_Alloc> __a, _Tp* __ptr, + _Args&&... __args) + { + ::new ((void*)__ptr) _Tp(allocator_arg, *__a._M_a, + std::forward<_Args>(__args)...); + } + + template + void __uses_allocator_construct_impl(__uses_alloc2<_Alloc> __a, _Tp* __ptr, + _Args&&... __args) + { ::new ((void*)__ptr) _Tp(std::forward<_Args>(__args)..., *__a._M_a); } + + template + void __uses_allocator_construct(const _Alloc& __a, _Tp* __ptr, + _Args&&... __args) + { + std::__uses_allocator_construct_impl( + std::__use_alloc<_Tp, _Alloc, _Args...>(__a), __ptr, + std::forward<_Args>(__args)...); + } + +/// @endcond +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator.h.blob new file mode 100644 index 0000000..c4c4378 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator_args.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator_args.h new file mode 100644 index 0000000..44fe349 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator_args.h @@ -0,0 +1,250 @@ +// Utility functions for uses-allocator construction -*- C++ -*- + +// Copyright (C) 2019-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/uses_allocator_args.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _USES_ALLOCATOR_ARGS +#define _USES_ALLOCATOR_ARGS 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#ifdef __glibcxx_make_obj_using_allocator // C++ >= 20 && concepts +#include // for placement operator new +#include // for tuple, make_tuple, make_from_tuple +#include // construct_at +#include // pair + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + concept _Std_pair = __is_pair>; + +/** @addtogroup allocators + * @{ + */ + template + constexpr auto + uses_allocator_construction_args(const _Alloc& __a, + _Args&&... __args) noexcept + requires (! _Std_pair<_Tp>) + { + if constexpr (uses_allocator_v, _Alloc>) + { + if constexpr (is_constructible_v<_Tp, allocator_arg_t, + const _Alloc&, _Args...>) + { + return tuple( + allocator_arg, __a, std::forward<_Args>(__args)...); + } + else + { + static_assert(is_constructible_v<_Tp, _Args..., const _Alloc&>, + "construction with an allocator must be possible" + " if uses_allocator is true"); + + return tuple<_Args&&..., const _Alloc&>( + std::forward<_Args>(__args)..., __a); + } + } + else + { + static_assert(is_constructible_v<_Tp, _Args...>); + + return tuple<_Args&&...>(std::forward<_Args>(__args)...); + } + } + + template<_Std_pair _Tp, typename _Alloc, typename _Tuple1, typename _Tuple2> + constexpr auto + uses_allocator_construction_args(const _Alloc& __a, piecewise_construct_t, + _Tuple1&& __x, _Tuple2&& __y) noexcept; + + template<_Std_pair _Tp, typename _Alloc> + constexpr auto + uses_allocator_construction_args(const _Alloc&) noexcept; + + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc&, _Up&&, _Vp&&) noexcept; + + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc&, + const pair<_Up, _Vp>&) noexcept; + + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc&, pair<_Up, _Vp>&&) noexcept; + +#if __cplusplus > 202002L + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc&, + pair<_Up, _Vp>&) noexcept; + + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc&, const pair<_Up, _Vp>&&) noexcept; +#endif // C++23 + + template<_Std_pair _Tp, typename _Alloc, typename _Tuple1, typename _Tuple2> + constexpr auto + uses_allocator_construction_args(const _Alloc& __a, piecewise_construct_t, + _Tuple1&& __x, _Tuple2&& __y) noexcept + { + using _Tp1 = typename _Tp::first_type; + using _Tp2 = typename _Tp::second_type; + + return std::make_tuple(piecewise_construct, + std::apply([&__a](auto&&... __args1) { + return std::uses_allocator_construction_args<_Tp1>( + __a, std::forward(__args1)...); + }, std::forward<_Tuple1>(__x)), + std::apply([&__a](auto&&... __args2) { + return std::uses_allocator_construction_args<_Tp2>( + __a, std::forward(__args2)...); + }, std::forward<_Tuple2>(__y))); + } + + template<_Std_pair _Tp, typename _Alloc> + constexpr auto + uses_allocator_construction_args(const _Alloc& __a) noexcept + { + using _Tp1 = typename _Tp::first_type; + using _Tp2 = typename _Tp::second_type; + + return std::make_tuple(piecewise_construct, + std::uses_allocator_construction_args<_Tp1>(__a), + std::uses_allocator_construction_args<_Tp2>(__a)); + } + + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc& __a, _Up&& __u, _Vp&& __v) + noexcept + { + using _Tp1 = typename _Tp::first_type; + using _Tp2 = typename _Tp::second_type; + + return std::make_tuple(piecewise_construct, + std::uses_allocator_construction_args<_Tp1>(__a, + std::forward<_Up>(__u)), + std::uses_allocator_construction_args<_Tp2>(__a, + std::forward<_Vp>(__v))); + } + + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc& __a, + const pair<_Up, _Vp>& __pr) noexcept + { + using _Tp1 = typename _Tp::first_type; + using _Tp2 = typename _Tp::second_type; + + return std::make_tuple(piecewise_construct, + std::uses_allocator_construction_args<_Tp1>(__a, __pr.first), + std::uses_allocator_construction_args<_Tp2>(__a, __pr.second)); + } + + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc& __a, + pair<_Up, _Vp>&& __pr) noexcept + { + using _Tp1 = typename _Tp::first_type; + using _Tp2 = typename _Tp::second_type; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3527. uses_allocator_construction_args handles rvalue pairs + // of rvalue references incorrectly + return std::make_tuple(piecewise_construct, + std::uses_allocator_construction_args<_Tp1>(__a, + std::get<0>(std::move(__pr))), + std::uses_allocator_construction_args<_Tp2>(__a, + std::get<1>(std::move(__pr)))); + } + +#if __cplusplus > 202002L + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc& __a, + pair<_Up, _Vp>& __pr) noexcept + { + using _Tp1 = typename _Tp::first_type; + using _Tp2 = typename _Tp::second_type; + + return std::make_tuple(piecewise_construct, + std::uses_allocator_construction_args<_Tp1>(__a, __pr.first), + std::uses_allocator_construction_args<_Tp2>(__a, __pr.second)); + } + + template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp> + constexpr auto + uses_allocator_construction_args(const _Alloc& __a, + const pair<_Up, _Vp>&& __pr) noexcept + { + using _Tp1 = typename _Tp::first_type; + using _Tp2 = typename _Tp::second_type; + + return std::make_tuple(piecewise_construct, + std::uses_allocator_construction_args<_Tp1>(__a, + std::get<0>(std::move(__pr))), + std::uses_allocator_construction_args<_Tp2>(__a, + std::get<1>(std::move(__pr)))); + } +#endif // C++23 + + template + constexpr _Tp + make_obj_using_allocator(const _Alloc& __a, _Args&&... __args) + { + return std::make_from_tuple<_Tp>( + std::uses_allocator_construction_args<_Tp>(__a, + std::forward<_Args>(__args)...)); + } + + template + constexpr _Tp* + uninitialized_construct_using_allocator(_Tp* __p, const _Alloc& __a, + _Args&&... __args) + { + return std::apply([&](auto&&... __xs) { + return std::construct_at(__p, std::forward(__xs)...); + }, std::uses_allocator_construction_args<_Tp>(__a, + std::forward<_Args>(__args)...)); + } +/// @} +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // __glibcxx_make_obj_using_allocator +#endif // _USES_ALLOCATOR_ARGS diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator_args.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator_args.h.blob new file mode 100644 index 0000000..74401b2 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@uses_allocator_args.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@utility.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@utility.h new file mode 100644 index 0000000..6fa6b67 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@utility.h @@ -0,0 +1,323 @@ +// Utilities used throughout the library -*- C++ -*- + +// Copyright (C) 2004-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/utility.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{utility} + * + * This file contains the parts of `` needed by other headers, + * so they don't need to include the whole of ``. + */ + +#ifndef _GLIBCXX_UTILITY_H +#define _GLIBCXX_UTILITY_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus >= 201103L + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// Finds the size of a given tuple type. + template + struct tuple_size; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2313. tuple_size should always derive from integral_constant + // 2770. tuple_size specialization is not SFINAE compatible + + template::type, + typename = typename enable_if::value>::type, + size_t = tuple_size<_Tp>::value> + using __enable_if_has_tuple_size = _Tp; + + template + struct tuple_size> + : public tuple_size<_Tp> { }; + + template + struct tuple_size> + : public tuple_size<_Tp> { }; + + template + struct tuple_size> + : public tuple_size<_Tp> { }; + +#if __cplusplus >= 201703L + template + inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value; +#endif + + /// Gives the type of the ith element of a given tuple type. + template + struct tuple_element; + + // Duplicate of C++14's tuple_element_t for internal use in C++11 mode + template + using __tuple_element_t = typename tuple_element<__i, _Tp>::type; + + template + struct tuple_element<__i, const _Tp> + { + using type = const __tuple_element_t<__i, _Tp>; + }; + + template + struct tuple_element<__i, volatile _Tp> + { + using type = volatile __tuple_element_t<__i, _Tp>; + }; + + template + struct tuple_element<__i, const volatile _Tp> + { + using type = const volatile __tuple_element_t<__i, _Tp>; + }; + +#if __cplusplus >= 201402L + + // Return the index of _Tp in _Types, if it occurs exactly once. + // Otherwise, return sizeof...(_Types). + template + constexpr size_t + __find_uniq_type_in_pack() + { + constexpr size_t __sz = sizeof...(_Types); + constexpr bool __found[__sz] = { __is_same(_Tp, _Types) ... }; + size_t __n = __sz; + for (size_t __i = 0; __i < __sz; ++__i) + { + if (__found[__i]) + { + if (__n < __sz) // more than one _Tp found + return __sz; + __n = __i; + } + } + return __n; + } +#endif // C++14 + +// The standard says this macro and alias template should be in but we +// define them here, to be available in , and too. +// _GLIBCXX_RESOLVE_LIB_DEFECTS +// 3378. tuple_size_v/tuple_element_t should be available when +// tuple_size/tuple_element are +#ifdef __glibcxx_tuple_element_t // C++ >= 14 + template + using tuple_element_t = typename tuple_element<__i, _Tp>::type; +#endif + + // Stores a tuple of indices. Used by tuple and pair, and by bind() to + // extract the elements in a tuple. + template struct _Index_tuple { }; + + // Builds an _Index_tuple<0, 1, 2, ..., _Num-1>. + template + struct _Build_index_tuple + { +#if __has_builtin(__make_integer_seq) + template + using _IdxTuple = _Index_tuple<_Indices...>; + + // Clang defines __make_integer_seq for this purpose. + using __type = __make_integer_seq<_IdxTuple, size_t, _Num>; +#else + // For GCC and other compilers, use __integer_pack instead. + using __type = _Index_tuple<__integer_pack(_Num)...>; +#endif + }; + +#ifdef __glibcxx_integer_sequence // C++ >= 14 + + /// Class template integer_sequence + template + struct integer_sequence + { +#if __cplusplus >= 202002L + static_assert(is_integral_v<_Tp>); +#endif + typedef _Tp value_type; + static constexpr size_t size() noexcept { return sizeof...(_Idx); } + }; + + /// Alias template make_integer_sequence + template + using make_integer_sequence +#if __has_builtin(__make_integer_seq) + = __make_integer_seq; +#else + = integer_sequence<_Tp, __integer_pack(_Num)...>; +#endif + + /// Alias template index_sequence + template + using index_sequence = integer_sequence; + + /// Alias template make_index_sequence + template + using make_index_sequence = make_integer_sequence; + + /// Alias template index_sequence_for + template + using index_sequence_for = make_index_sequence; +#endif // __glibcxx_integer_sequence + +#if __cplusplus >= 201703L + + struct in_place_t { + explicit in_place_t() = default; + }; + + inline constexpr in_place_t in_place{}; + + template struct in_place_type_t + { + explicit in_place_type_t() = default; + }; + + template + inline constexpr in_place_type_t<_Tp> in_place_type{}; + + template struct in_place_index_t + { + explicit in_place_index_t() = default; + }; + + template + inline constexpr in_place_index_t<_Idx> in_place_index{}; + + template + inline constexpr bool __is_in_place_type_v = false; + + template + inline constexpr bool __is_in_place_type_v> = true; + + template + inline constexpr bool __is_in_place_index_v = false; + + template + inline constexpr bool __is_in_place_index_v> = true; + +#endif // C++17 + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__type_pack_element) + template + struct _Nth_type + { using type = __type_pack_element<_Np, _Types...>; }; +#else + template + struct _Nth_type + { }; + + template + struct _Nth_type<0, _Tp0, _Rest...> + { using type = _Tp0; }; + + template + struct _Nth_type<1, _Tp0, _Tp1, _Rest...> + { using type = _Tp1; }; + + template + struct _Nth_type<2, _Tp0, _Tp1, _Tp2, _Rest...> + { using type = _Tp2; }; + + template +#if __cpp_concepts + requires (_Np >= 3) +#endif + struct _Nth_type<_Np, _Tp0, _Tp1, _Tp2, _Rest...> + : _Nth_type<_Np - 3, _Rest...> + { }; + +#if ! __cpp_concepts // Need additional specializations to avoid ambiguities. + template + struct _Nth_type<0, _Tp0, _Tp1, _Tp2, _Rest...> + { using type = _Tp0; }; + + template + struct _Nth_type<1, _Tp0, _Tp1, _Tp2, _Rest...> + { using type = _Tp1; }; +#endif +#endif + +#if __glibcxx_ranges + namespace ranges::__detail + { + template + inline constexpr bool __is_subrange = false; + } // namespace __detail +#endif + + // A class (and instance) which can be used in 'tie' when an element + // of a tuple is not required. + struct _Swallow_assign + { + template + constexpr const _Swallow_assign& + operator=(const _Tp&) const noexcept + { return *this; } + }; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2773. Making std::ignore constexpr + /** Used with `std::tie` to ignore an element of a tuple + * + * When using `std::tie` to assign the elements of a tuple to variables, + * unwanted elements can be ignored by using `std::ignore`. For example: + * + * ``` + * int x, y; + * std::tie(x, std::ignore, y) = std::make_tuple(1, 2, 3); + * ``` + * + * This assignment will perform `x=1; std::ignore=2; y=3;` which results + * in the second element being ignored. + * + * @since C++11 + */ + _GLIBCXX17_INLINE constexpr _Swallow_assign ignore{}; + +#if __glibcxx_flat_map || __glibcxx_flat_set // >= C++23 + struct sorted_unique_t { explicit sorted_unique_t() = default; }; + inline constexpr sorted_unique_t sorted_unique{}; + + struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; }; + inline constexpr sorted_equivalent_t sorted_equivalent{}; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // C++11 +#endif /* _GLIBCXX_UTILITY_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@utility.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@utility.h.blob new file mode 100644 index 0000000..a483cec Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@utility.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@vector.tcc b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@vector.tcc new file mode 100644 index 0000000..9fd4b00 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@vector.tcc @@ -0,0 +1,1380 @@ +// Vector implementation (out of line) -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/vector.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{vector} + */ + +#ifndef _VECTOR_TCC +#define _VECTOR_TCC 1 + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + reserve(size_type __n) + { + if (__n > this->max_size()) + __throw_length_error(__N("vector::reserve")); + if (this->capacity() < __n) + { + const size_type __old_size = size(); + pointer __tmp; +#if __cplusplus >= 201103L + if _GLIBCXX17_CONSTEXPR (_S_use_relocate()) + { + __tmp = this->_M_allocate(__n); + _S_relocate(this->_M_impl._M_start, this->_M_impl._M_finish, + __tmp, _M_get_Tp_allocator()); + } + else +#endif + { + __tmp = _M_allocate_and_copy(__n, + _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(this->_M_impl._M_start), + _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(this->_M_impl._M_finish)); + std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, + _M_get_Tp_allocator()); + } + _GLIBCXX_ASAN_ANNOTATE_REINIT; + _M_deallocate(this->_M_impl._M_start, + this->_M_impl._M_end_of_storage + - this->_M_impl._M_start); + this->_M_impl._M_start = __tmp; + this->_M_impl._M_finish = __tmp + __old_size; + this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; + } + } + +#if __cplusplus >= 201103L + template + template +#if __cplusplus > 201402L + _GLIBCXX20_CONSTEXPR + typename vector<_Tp, _Alloc>::reference +#else + void +#endif + vector<_Tp, _Alloc>:: + emplace_back(_Args&&... __args) + { + if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(1); + _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, + std::forward<_Args>(__args)...); + ++this->_M_impl._M_finish; + _GLIBCXX_ASAN_ANNOTATE_GREW(1); + } + else + _M_realloc_append(std::forward<_Args>(__args)...); +#if __cplusplus > 201402L + return back(); +#endif + } +#endif + + template + _GLIBCXX20_CONSTEXPR + typename vector<_Tp, _Alloc>::iterator + vector<_Tp, _Alloc>:: +#if __cplusplus >= 201103L + insert(const_iterator __position, const value_type& __x) +#else + insert(iterator __position, const value_type& __x) +#endif + { + const size_type __n = __position - begin(); + if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) + { + __glibcxx_assert(__position != const_iterator()); + if (!(__position != const_iterator())) + __builtin_unreachable(); // PR 106434 + + if (__position == end()) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(1); + _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, + __x); + ++this->_M_impl._M_finish; + _GLIBCXX_ASAN_ANNOTATE_GREW(1); + } + else + { +#if __cplusplus >= 201103L + const auto __pos = begin() + (__position - cbegin()); + // __x could be an existing element of this vector, so make a + // copy of it before _M_insert_aux moves elements around. + _Temporary_value __x_copy(this, __x); + _M_insert_aux(__pos, std::move(__x_copy._M_val())); +#else + _M_insert_aux(__position, __x); +#endif + } + } + else +#if __cplusplus >= 201103L + _M_realloc_insert(begin() + (__position - cbegin()), __x); +#else + _M_realloc_insert(__position, __x); +#endif + + return iterator(this->_M_impl._M_start + __n); + } + + template + _GLIBCXX20_CONSTEXPR + typename vector<_Tp, _Alloc>::iterator + vector<_Tp, _Alloc>:: + _M_erase(iterator __position) + { + if (__position + 1 != end()) + _GLIBCXX_MOVE3(__position + 1, end(), __position); + --this->_M_impl._M_finish; + _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish); + _GLIBCXX_ASAN_ANNOTATE_SHRINK(1); + return __position; + } + + template + _GLIBCXX20_CONSTEXPR + typename vector<_Tp, _Alloc>::iterator + vector<_Tp, _Alloc>:: + _M_erase(iterator __first, iterator __last) + { + if (__first != __last) + { + if (__last != end()) + _GLIBCXX_MOVE3(__last, end(), __first); + _M_erase_at_end(__first.base() + (end() - __last)); + } + return __first; + } + + template + _GLIBCXX20_CONSTEXPR + vector<_Tp, _Alloc>& + vector<_Tp, _Alloc>:: + operator=(const vector<_Tp, _Alloc>& __x) + { + if (std::__addressof(__x) != this) + { + _GLIBCXX_ASAN_ANNOTATE_REINIT; +#if __cplusplus >= 201103L + if (_Alloc_traits::_S_propagate_on_copy_assign()) + { + if (!_Alloc_traits::_S_always_equal() + && _M_get_Tp_allocator() != __x._M_get_Tp_allocator()) + { + // replacement allocator cannot free existing storage + this->clear(); + _M_deallocate(this->_M_impl._M_start, + this->_M_impl._M_end_of_storage + - this->_M_impl._M_start); + this->_M_impl._M_start = nullptr; + this->_M_impl._M_finish = nullptr; + this->_M_impl._M_end_of_storage = nullptr; + } + std::__alloc_on_copy(_M_get_Tp_allocator(), + __x._M_get_Tp_allocator()); + } +#endif + const size_type __xlen = __x.size(); + if (__xlen > capacity()) + { + pointer __tmp = _M_allocate_and_copy(__xlen, __x.begin(), + __x.end()); + std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, + _M_get_Tp_allocator()); + _M_deallocate(this->_M_impl._M_start, + this->_M_impl._M_end_of_storage + - this->_M_impl._M_start); + this->_M_impl._M_start = __tmp; + this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __xlen; + } + else if (size() >= __xlen) + { + std::_Destroy(std::copy(__x.begin(), __x.end(), begin()), + end(), _M_get_Tp_allocator()); + } + else + { + std::copy(__x._M_impl._M_start, __x._M_impl._M_start + size(), + this->_M_impl._M_start); + std::__uninitialized_copy_a(__x._M_impl._M_start + size(), + __x._M_impl._M_finish, + this->_M_impl._M_finish, + _M_get_Tp_allocator()); + } + this->_M_impl._M_finish = this->_M_impl._M_start + __xlen; + } + return *this; + } + + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_fill_assign(size_t __n, const value_type& __val) + { + const size_type __sz = size(); + if (__n > capacity()) + { + if (__n <= __sz) + __builtin_unreachable(); + vector __tmp(__n, __val, _M_get_Tp_allocator()); + __tmp._M_impl._M_swap_data(this->_M_impl); + } + else if (__n > __sz) + { + std::fill(begin(), end(), __val); + const size_type __add = __n - __sz; + _GLIBCXX_ASAN_ANNOTATE_GROW(__add); + this->_M_impl._M_finish = + std::__uninitialized_fill_n_a(this->_M_impl._M_finish, + __add, __val, _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_GREW(__add); + } + else + _M_erase_at_end(std::fill_n(this->_M_impl._M_start, __n, __val)); + } + + template + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_assign_aux(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag) + { + pointer __cur(this->_M_impl._M_start); + for (; __first != __last && __cur != this->_M_impl._M_finish; + ++__cur, (void)++__first) + *__cur = *__first; + if (__first == __last) + _M_erase_at_end(__cur); + else + _M_range_insert(end(), __first, __last, + std::__iterator_category(__first)); + } + + template + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { + const size_type __sz = size(); + const size_type __len = std::distance(__first, __last); + + if (__len > capacity()) + { + if (__len <= __sz) + __builtin_unreachable(); + + _S_check_init_len(__len, _M_get_Tp_allocator()); + pointer __tmp(_M_allocate_and_copy(__len, __first, __last)); + std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, + _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_REINIT; + _M_deallocate(this->_M_impl._M_start, + this->_M_impl._M_end_of_storage + - this->_M_impl._M_start); + this->_M_impl._M_start = __tmp; + this->_M_impl._M_finish = this->_M_impl._M_start + __len; + this->_M_impl._M_end_of_storage = this->_M_impl._M_finish; + } + else if (__sz >= __len) + _M_erase_at_end(std::copy(__first, __last, this->_M_impl._M_start)); + else + { + _ForwardIterator __mid = __first; + std::advance(__mid, __sz); + std::copy(__first, __mid, this->_M_impl._M_start); + const size_type __attribute__((__unused__)) __n = __len - __sz; + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + this->_M_impl._M_finish = + std::__uninitialized_copy_a(__mid, __last, + this->_M_impl._M_finish, + _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_GREW(__n); + } + } + +#if __cplusplus >= 201103L + template + _GLIBCXX20_CONSTEXPR + auto + vector<_Tp, _Alloc>:: + _M_insert_rval(const_iterator __position, value_type&& __v) -> iterator + { + const auto __n = __position - cbegin(); + if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) + if (__position == cend()) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(1); + _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, + std::move(__v)); + ++this->_M_impl._M_finish; + _GLIBCXX_ASAN_ANNOTATE_GREW(1); + } + else + _M_insert_aux(begin() + __n, std::move(__v)); + else + _M_realloc_insert(begin() + __n, std::move(__v)); + + return iterator(this->_M_impl._M_start + __n); + } + + template + template + _GLIBCXX20_CONSTEXPR + auto + vector<_Tp, _Alloc>:: + _M_emplace_aux(const_iterator __position, _Args&&... __args) + -> iterator + { + const auto __n = __position - cbegin(); + if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) + if (__position == cend()) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(1); + _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, + std::forward<_Args>(__args)...); + ++this->_M_impl._M_finish; + _GLIBCXX_ASAN_ANNOTATE_GREW(1); + } + else + { + // We need to construct a temporary because something in __args... + // could alias one of the elements of the container and so we + // need to use it before _M_insert_aux moves elements around. + _Temporary_value __tmp(this, std::forward<_Args>(__args)...); + _M_insert_aux(begin() + __n, std::move(__tmp._M_val())); + } + else + _M_realloc_insert(begin() + __n, std::forward<_Args>(__args)...); + + return iterator(this->_M_impl._M_start + __n); + } + + template + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_insert_aux(iterator __position, _Arg&& __arg) +#else + template + void + vector<_Tp, _Alloc>:: + _M_insert_aux(iterator __position, const _Tp& __x) +#endif + { + _GLIBCXX_ASAN_ANNOTATE_GROW(1); + _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, + _GLIBCXX_MOVE(*(this->_M_impl._M_finish - 1))); + ++this->_M_impl._M_finish; + _GLIBCXX_ASAN_ANNOTATE_GREW(1); +#if __cplusplus < 201103L + _Tp __x_copy = __x; +#endif + _GLIBCXX_MOVE_BACKWARD3(__position.base(), + this->_M_impl._M_finish - 2, + this->_M_impl._M_finish - 1); +#if __cplusplus < 201103L + *__position = __x_copy; +#else + *__position = std::forward<_Arg>(__arg); +#endif + } + +#if __cplusplus >= 201103L + template + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_realloc_insert(iterator __position, _Args&&... __args) +#else + template + void + vector<_Tp, _Alloc>:: + _M_realloc_insert(iterator __position, const _Tp& __x) +#endif + { + const size_type __len = _M_check_len(1u, "vector::_M_realloc_insert"); + if (__len <= 0) + __builtin_unreachable (); + pointer __old_start = this->_M_impl._M_start; + pointer __old_finish = this->_M_impl._M_finish; + const size_type __elems_before = __position - begin(); + pointer __new_start(this->_M_allocate(__len)); + pointer __new_finish(__new_start); + + { + _Guard_alloc __guard(__new_start, __len, *this); + + // The order of the three operations is dictated by the C++11 + // case, where the moves could alter a new element belonging + // to the existing vector. This is an issue only for callers + // taking the element by lvalue ref (see last bullet of C++11 + // [res.on.arguments]). + + // If this throws, the existing elements are unchanged. +#if __cplusplus >= 201103L + _Alloc_traits::construct(this->_M_impl, + std::__to_address(__new_start + __elems_before), + std::forward<_Args>(__args)...); +#else + _Alloc_traits::construct(this->_M_impl, + __new_start + __elems_before, + __x); +#endif + +#if __cplusplus >= 201103L + if _GLIBCXX17_CONSTEXPR (_S_use_relocate()) + { + // Relocation cannot throw. + __new_finish = _S_relocate(__old_start, __position.base(), + __new_start, _M_get_Tp_allocator()); + ++__new_finish; + __new_finish = _S_relocate(__position.base(), __old_finish, + __new_finish, _M_get_Tp_allocator()); + } + else +#endif + { + // RAII type to destroy initialized elements. + struct _Guard_elts + { + pointer _M_first, _M_last; // Elements to destroy + _Tp_alloc_type& _M_alloc; + + _GLIBCXX20_CONSTEXPR + _Guard_elts(pointer __elt, _Tp_alloc_type& __a) + : _M_first(__elt), _M_last(__elt + 1), _M_alloc(__a) + { } + + _GLIBCXX20_CONSTEXPR + ~_Guard_elts() + { std::_Destroy(_M_first, _M_last, _M_alloc); } + + private: + _Guard_elts(const _Guard_elts&); + }; + + // Guard the new element so it will be destroyed if anything throws. + _Guard_elts __guard_elts(__new_start + __elems_before, _M_impl); + + __new_finish = std::__uninitialized_move_if_noexcept_a( + __old_start, __position.base(), + __new_start, _M_get_Tp_allocator()); + + ++__new_finish; + // Guard everything before the new element too. + __guard_elts._M_first = __new_start; + + __new_finish = std::__uninitialized_move_if_noexcept_a( + __position.base(), __old_finish, + __new_finish, _M_get_Tp_allocator()); + + // New storage has been fully initialized, destroy the old elements. + __guard_elts._M_first = __old_start; + __guard_elts._M_last = __old_finish; + } + __guard._M_storage = __old_start; + __guard._M_len = this->_M_impl._M_end_of_storage - __old_start; + } + // deallocate should be called before assignments to _M_impl, + // to avoid call-clobbering + + this->_M_impl._M_start = __new_start; + this->_M_impl._M_finish = __new_finish; + this->_M_impl._M_end_of_storage = __new_start + __len; + } + +#if __cplusplus >= 201103L + template + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_realloc_append(_Args&&... __args) +#else + template + void + vector<_Tp, _Alloc>:: + _M_realloc_append(const _Tp& __x) +#endif + { + const size_type __len = _M_check_len(1u, "vector::_M_realloc_append"); + if (__len <= 0) + __builtin_unreachable (); + pointer __old_start = this->_M_impl._M_start; + pointer __old_finish = this->_M_impl._M_finish; + const size_type __elems = end() - begin(); + pointer __new_start(this->_M_allocate(__len)); + pointer __new_finish(__new_start); + + { + _Guard_alloc __guard(__new_start, __len, *this); + + // The order of the three operations is dictated by the C++11 + // case, where the moves could alter a new element belonging + // to the existing vector. This is an issue only for callers + // taking the element by lvalue ref (see last bullet of C++11 + // [res.on.arguments]). + + // If this throws, the existing elements are unchanged. +#if __cplusplus >= 201103L + _Alloc_traits::construct(this->_M_impl, + std::__to_address(__new_start + __elems), + std::forward<_Args>(__args)...); +#else + _Alloc_traits::construct(this->_M_impl, + __new_start + __elems, + __x); +#endif + +#if __cplusplus >= 201103L + if _GLIBCXX17_CONSTEXPR (_S_use_relocate()) + { + // Relocation cannot throw. + __new_finish = _S_relocate(__old_start, __old_finish, + __new_start, _M_get_Tp_allocator()); + ++__new_finish; + } + else +#endif + { + // RAII type to destroy initialized elements. + struct _Guard_elts + { + pointer _M_first, _M_last; // Elements to destroy + _Tp_alloc_type& _M_alloc; + + _GLIBCXX20_CONSTEXPR + _Guard_elts(pointer __elt, _Tp_alloc_type& __a) + : _M_first(__elt), _M_last(__elt + 1), _M_alloc(__a) + { } + + _GLIBCXX20_CONSTEXPR + ~_Guard_elts() + { std::_Destroy(_M_first, _M_last, _M_alloc); } + + private: + _Guard_elts(const _Guard_elts&); + }; + + // Guard the new element so it will be destroyed if anything throws. + _Guard_elts __guard_elts(__new_start + __elems, _M_impl); + + __new_finish = std::__uninitialized_move_if_noexcept_a( + __old_start, __old_finish, + __new_start, _M_get_Tp_allocator()); + + ++__new_finish; + + // New storage has been fully initialized, destroy the old elements. + __guard_elts._M_first = __old_start; + __guard_elts._M_last = __old_finish; + } + __guard._M_storage = __old_start; + __guard._M_len = this->_M_impl._M_end_of_storage - __old_start; + } + // deallocate should be called before assignments to _M_impl, + // to avoid call-clobbering + + this->_M_impl._M_start = __new_start; + this->_M_impl._M_finish = __new_finish; + this->_M_impl._M_end_of_storage = __new_start + __len; + } + + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_fill_insert(iterator __position, size_type __n, const value_type& __x) + { + if (__n != 0) + { + if (__position.base() == this->_M_impl._M_finish) + _M_fill_append(__n, __x); + else if (size_type(this->_M_impl._M_end_of_storage + - this->_M_impl._M_finish) >= __n) + { +#if __cplusplus < 201103L + value_type __x_copy = __x; +#else + _Temporary_value __tmp(this, __x); + value_type& __x_copy = __tmp._M_val(); +#endif + const size_type __elems_after = end() - __position; + pointer __old_finish(this->_M_impl._M_finish); + if (__elems_after > __n) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + std::__uninitialized_move_a(__old_finish - __n, + __old_finish, + __old_finish, + _M_get_Tp_allocator()); + this->_M_impl._M_finish += __n; + _GLIBCXX_ASAN_ANNOTATE_GREW(__n); + _GLIBCXX_MOVE_BACKWARD3(__position.base(), + __old_finish - __n, __old_finish); + std::fill(__position.base(), __position.base() + __n, + __x_copy); + } + else + { + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + this->_M_impl._M_finish = + std::__uninitialized_fill_n_a(__old_finish, + __n - __elems_after, + __x_copy, + _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_GREW(__n - __elems_after); + std::__uninitialized_move_a(__position.base(), __old_finish, + this->_M_impl._M_finish, + _M_get_Tp_allocator()); + this->_M_impl._M_finish += __elems_after; + _GLIBCXX_ASAN_ANNOTATE_GREW(__elems_after); + std::fill(__position.base(), __old_finish, __x_copy); + } + } + else + { + // Make local copies of these members because the compiler thinks + // the allocator can alter them if 'this' is globally reachable. + pointer __old_start = this->_M_impl._M_start; + pointer __old_finish = this->_M_impl._M_finish; + const pointer __pos = __position.base(); + + const size_type __len = + _M_check_len(__n, "vector::_M_fill_insert"); + const size_type __elems_before = __pos - __old_start; + pointer __new_start(this->_M_allocate(__len)); + pointer __new_finish(__new_start); + __try + { + // See _M_realloc_insert above. + std::__uninitialized_fill_n_a(__new_start + __elems_before, + __n, __x, + _M_get_Tp_allocator()); + __new_finish = pointer(); + + __new_finish + = std::__uninitialized_move_if_noexcept_a + (__old_start, __pos, __new_start, _M_get_Tp_allocator()); + + __new_finish += __n; + + __new_finish + = std::__uninitialized_move_if_noexcept_a + (__pos, __old_finish, __new_finish, _M_get_Tp_allocator()); + } + __catch(...) + { + if (!__new_finish) + std::_Destroy(__new_start + __elems_before, + __new_start + __elems_before + __n, + _M_get_Tp_allocator()); + else + std::_Destroy(__new_start, __new_finish, + _M_get_Tp_allocator()); + _M_deallocate(__new_start, __len); + __throw_exception_again; + } + std::_Destroy(__old_start, __old_finish, _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_REINIT; + _M_deallocate(__old_start, + this->_M_impl._M_end_of_storage - __old_start); + this->_M_impl._M_start = __new_start; + this->_M_impl._M_finish = __new_finish; + this->_M_impl._M_end_of_storage = __new_start + __len; + } + } + } + + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_fill_append(size_type __n, const value_type& __x) + { + if (size_type(this->_M_impl._M_end_of_storage + - this->_M_impl._M_finish) >= __n) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + this->_M_impl._M_finish = + std::__uninitialized_fill_n_a(this->_M_impl._M_finish, __n, __x, + _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_GREW(__n); + } + else + { + // Make local copies of these members because the compiler thinks + // the allocator can alter them if 'this' is globally reachable. + pointer __old_start = this->_M_impl._M_start; + pointer __old_finish = this->_M_impl._M_finish; + const size_type __old_size = __old_finish - __old_start; + + const size_type __len = + _M_check_len(__n, "vector::_M_fill_append"); + pointer __new_start(this->_M_allocate(__len)); + pointer __new_finish(__new_start + __old_size); + __try + { + // See _M_realloc_insert above. + __new_finish = std::__uninitialized_fill_n_a( + __new_finish, __n, __x, + _M_get_Tp_allocator()); + std::__uninitialized_move_if_noexcept_a( + __old_start, __old_finish, __new_start, + _M_get_Tp_allocator()); + } + __catch(...) + { + std::_Destroy(__new_start + __old_size, __new_finish, + _M_get_Tp_allocator()); + _M_deallocate(__new_start, __len); + __throw_exception_again; + } + std::_Destroy(__old_start, __old_finish, _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_REINIT; + _M_deallocate(__old_start, + this->_M_impl._M_end_of_storage - __old_start); + this->_M_impl._M_start = __new_start; + this->_M_impl._M_finish = __new_finish; + this->_M_impl._M_end_of_storage = __new_start + __len; + } + } + +#if __cplusplus >= 201103L + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_default_append(size_type __n) + { + if (__n != 0) + { + const size_type __size = size(); + size_type __navail = size_type(this->_M_impl._M_end_of_storage + - this->_M_impl._M_finish); + + if (__size > max_size() || __navail > max_size() - __size) + __builtin_unreachable(); + + if (__navail >= __n) + { + if (!this->_M_impl._M_finish) + __builtin_unreachable(); + + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + this->_M_impl._M_finish = + std::__uninitialized_default_n_a(this->_M_impl._M_finish, + __n, _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_GREW(__n); + } + else + { + // Make local copies of these members because the compiler thinks + // the allocator can alter them if 'this' is globally reachable. + pointer __old_start = this->_M_impl._M_start; + pointer __old_finish = this->_M_impl._M_finish; + + const size_type __len = + _M_check_len(__n, "vector::_M_default_append"); + pointer __new_start(this->_M_allocate(__len)); + + { + _Guard_alloc __guard(__new_start, __len, *this); + + std::__uninitialized_default_n_a(__new_start + __size, __n, + _M_get_Tp_allocator()); + + if _GLIBCXX17_CONSTEXPR (_S_use_relocate()) + { + _S_relocate(__old_start, __old_finish, + __new_start, _M_get_Tp_allocator()); + } + else + { + // RAII type to destroy initialized elements. + struct _Guard_elts + { + pointer _M_first, _M_last; // Elements to destroy + _Tp_alloc_type& _M_alloc; + + _GLIBCXX20_CONSTEXPR + _Guard_elts(pointer __first, size_type __n, + _Tp_alloc_type& __a) + : _M_first(__first), _M_last(__first + __n), _M_alloc(__a) + { } + + _GLIBCXX20_CONSTEXPR + ~_Guard_elts() + { std::_Destroy(_M_first, _M_last, _M_alloc); } + + private: + _Guard_elts(const _Guard_elts&); + }; + _Guard_elts __guard_elts(__new_start + __size, __n, _M_impl); + + std::__uninitialized_move_if_noexcept_a( + __old_start, __old_finish, __new_start, + _M_get_Tp_allocator()); + + __guard_elts._M_first = __old_start; + __guard_elts._M_last = __old_finish; + } + _GLIBCXX_ASAN_ANNOTATE_REINIT; + __guard._M_storage = __old_start; + __guard._M_len = this->_M_impl._M_end_of_storage - __old_start; + } + // deallocate should be called before assignments to _M_impl, + // to avoid call-clobbering + + this->_M_impl._M_start = __new_start; + this->_M_impl._M_finish = __new_start + __size + __n; + this->_M_impl._M_end_of_storage = __new_start + __len; + } + } + } + + template + _GLIBCXX20_CONSTEXPR + bool + vector<_Tp, _Alloc>:: + _M_shrink_to_fit() + { + if (capacity() == size()) + return false; + _GLIBCXX_ASAN_ANNOTATE_REINIT; + return std::__shrink_to_fit_aux::_S_do_it(*this); + } +#endif + + template + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_range_insert(iterator __pos, _InputIterator __first, + _InputIterator __last, std::input_iterator_tag) + { + if (__pos == end()) + { + for (; __first != __last; ++__first) + insert(end(), *__first); + } + else if (__first != __last) + { + vector __tmp(__first, __last, _M_get_Tp_allocator()); + insert(__pos, + _GLIBCXX_MAKE_MOVE_ITERATOR(__tmp.begin()), + _GLIBCXX_MAKE_MOVE_ITERATOR(__tmp.end())); + } + } + + template + template + _GLIBCXX20_CONSTEXPR + void + vector<_Tp, _Alloc>:: + _M_range_insert(iterator __position, _ForwardIterator __first, + _ForwardIterator __last, std::forward_iterator_tag) + { + if (__first != __last) + { + const size_type __n = std::distance(__first, __last); + if (size_type(this->_M_impl._M_end_of_storage + - this->_M_impl._M_finish) >= __n) + { + const size_type __elems_after = end() - __position; + pointer __old_finish(this->_M_impl._M_finish); + if (__elems_after > __n) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + std::__uninitialized_move_a(this->_M_impl._M_finish - __n, + this->_M_impl._M_finish, + this->_M_impl._M_finish, + _M_get_Tp_allocator()); + this->_M_impl._M_finish += __n; + _GLIBCXX_ASAN_ANNOTATE_GREW(__n); + _GLIBCXX_MOVE_BACKWARD3(__position.base(), + __old_finish - __n, __old_finish); + std::copy(__first, __last, __position); + } + else + { + _ForwardIterator __mid = __first; + std::advance(__mid, __elems_after); + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + std::__uninitialized_copy_a(__mid, __last, + this->_M_impl._M_finish, + _M_get_Tp_allocator()); + this->_M_impl._M_finish += __n - __elems_after; + _GLIBCXX_ASAN_ANNOTATE_GREW(__n - __elems_after); + std::__uninitialized_move_a(__position.base(), + __old_finish, + this->_M_impl._M_finish, + _M_get_Tp_allocator()); + this->_M_impl._M_finish += __elems_after; + _GLIBCXX_ASAN_ANNOTATE_GREW(__elems_after); + std::copy(__first, __mid, __position); + } + } + else + { + // Make local copies of these members because the compiler + // thinks the allocator can alter them if 'this' is globally + // reachable. + pointer __old_start = this->_M_impl._M_start; + pointer __old_finish = this->_M_impl._M_finish; + + const size_type __len = + _M_check_len(__n, "vector::_M_range_insert"); +#if __cplusplus < 201103L + if (__len < (__n + (__old_finish - __old_start))) + __builtin_unreachable(); +#endif + + pointer __new_start(this->_M_allocate(__len)); + pointer __new_finish(__new_start); + __try + { + __new_finish + = std::__uninitialized_move_if_noexcept_a + (__old_start, __position.base(), + __new_start, _M_get_Tp_allocator()); + __new_finish + = std::__uninitialized_copy_a(__first, __last, + __new_finish, + _M_get_Tp_allocator()); + __new_finish + = std::__uninitialized_move_if_noexcept_a + (__position.base(), __old_finish, + __new_finish, _M_get_Tp_allocator()); + } + __catch(...) + { + std::_Destroy(__new_start, __new_finish, + _M_get_Tp_allocator()); + _M_deallocate(__new_start, __len); + __throw_exception_again; + } + std::_Destroy(__old_start, __old_finish, + _M_get_Tp_allocator()); + _GLIBCXX_ASAN_ANNOTATE_REINIT; + _M_deallocate(__old_start, + this->_M_impl._M_end_of_storage - __old_start); + this->_M_impl._M_start = __new_start; + this->_M_impl._M_finish = __new_finish; + this->_M_impl._M_end_of_storage = __new_start + __len; + } + } + } + +#if __glibcxx_containers_ranges // C++ >= 23 + template + template<__detail::__container_compatible_range<_Tp> _Rg> + constexpr auto + vector<_Tp, _Alloc>:: + insert_range(const_iterator __pos, _Rg&& __rg) + -> iterator + { + if (__pos == cend()) + { + const auto __ins_idx = size(); + append_range(std::forward<_Rg>(__rg)); + return begin() + __ins_idx; + } + + if constexpr (ranges::forward_range<_Rg>) + { + const auto __ins_idx = __pos - cbegin(); + // Number of new elements to insert: + const auto __n = size_type(ranges::distance(__rg)); + if (__n == 0) + return begin() + __ins_idx; + + // Start of existing elements: + pointer __old_start = this->_M_impl._M_start; + // End of existing elements: + pointer __old_finish = this->_M_impl._M_finish; + // Insertion point: + pointer __ins = __old_start + __ins_idx; + // Number of elements that can fit in unused capacity: + const auto __cap = this->_M_impl._M_end_of_storage - __old_finish; + if (__cap >= __n) + { + // Number of existing elements after insertion point: + const size_type __elems_after = cend() - __pos; + if (__elems_after > __n) + { + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + std::__uninitialized_move_a(__old_finish - __n, + __old_finish, + __old_finish, + _M_get_Tp_allocator()); + this->_M_impl._M_finish += __n; + _GLIBCXX_ASAN_ANNOTATE_GREW(__n); + std::move_backward(__ins, __old_finish - __n, __old_finish); + ranges::copy(__rg, __ins); + } + else + { + auto __first = ranges::begin(__rg); + const auto __last = ranges::end(__rg); + auto __mid = ranges::next(__first, __elems_after); + _GLIBCXX_ASAN_ANNOTATE_GROW(__n); + _Base::_M_append_range(ranges::subrange(__mid, __last)); + _GLIBCXX_ASAN_ANNOTATE_GREW(__n - __elems_after); + std::__uninitialized_move_a(__ins, __old_finish, + this->_M_impl._M_finish, + _M_get_Tp_allocator()); + this->_M_impl._M_finish += __elems_after; + _GLIBCXX_ASAN_ANNOTATE_GREW(__elems_after); + ranges::copy(__first, __mid, __ins); + } + } + else // Reallocate + { + const size_type __len + = _M_check_len(__n, "vector::insert_range"); + + struct _Guard : _Guard_alloc + { + // End of elements to destroy: + pointer _M_finish = _Guard_alloc::_M_storage; + + using _Guard_alloc::_Guard_alloc; + + constexpr + ~_Guard() + { + std::_Destroy(this->_M_storage, _M_finish, + this->_M_vect._M_get_Tp_allocator()); + } + }; + + // Allocate new storage: + pointer __new_start(this->_M_allocate(__len)); + _Guard __guard(__new_start, __len, *this); + + auto& __alloc = _M_get_Tp_allocator(); + + // Populate the new storage in three steps. After each step, + // __guard owns the new storage and any elements that have + // been constructed there. + + // Move elements from before insertion point to new storage: + __guard._M_finish + = std::__uninitialized_move_if_noexcept_a( + __old_start, __ins, __new_start, __alloc); + + // Append new elements to new storage: + _Base::_M_append_range_to(__rg, __guard._M_finish); + + // Move elements from after insertion point to new storage: + __guard._M_finish + = std::__uninitialized_move_if_noexcept_a( + __ins, __old_finish, __guard._M_finish, __alloc); + + _GLIBCXX_ASAN_ANNOTATE_REINIT; // Creates _Asan::_Reinit. + + // All elements are in the new storage, exchange ownership + // with __guard so that it cleans up the old storage: + this->_M_impl._M_start = __guard._M_storage; + this->_M_impl._M_finish = __guard._M_finish; + this->_M_impl._M_end_of_storage = __new_start + __len; + __guard._M_storage = __old_start; + __guard._M_finish = __old_finish; + __guard._M_len = (__old_finish - __old_start) + __cap; + // _Asan::_Reinit destructor marks unused capacity. + // _Guard destructor destroys [old_start,old_finish). + // _Guard_alloc destructor frees [old_start,old_start+len). + } + return begin() + __ins_idx; + } + else + return insert_range(__pos, vector(from_range, std::forward<_Rg>(__rg), + _M_get_Tp_allocator())); + } +#endif // containers_ranges + + // vector + template + _GLIBCXX20_CONSTEXPR + void + vector:: + _M_reallocate(size_type __n) + { + const iterator __begin = begin(), __end = end(); + if (size_type(__end - __begin) > __n) + __builtin_unreachable(); + _Bit_pointer __q = this->_M_allocate(__n); + iterator __start(std::__addressof(*__q), 0); + iterator __finish(_M_copy_aligned(__begin, __end, __start)); + this->_M_deallocate(); + this->_M_impl._M_start = __start; + this->_M_impl._M_finish = __finish; + this->_M_impl._M_end_of_storage = __q + _S_nword(__n); + } + + template + _GLIBCXX20_CONSTEXPR + void + vector:: + _M_fill_insert(iterator __position, size_type __n, bool __x) + { + if (__n == 0) + return; + if (capacity() - size() >= __n) + { + std::copy_backward(__position, end(), + this->_M_impl._M_finish + difference_type(__n)); + std::fill(__position, __position + difference_type(__n), __x); + this->_M_impl._M_finish += difference_type(__n); + } + else + { + const size_type __len = + _M_check_len(__n, "vector::_M_fill_insert"); + iterator __begin = begin(), __end = end(); + _Bit_pointer __q = this->_M_allocate(__len); + iterator __start(std::__addressof(*__q), 0); + iterator __i = _M_copy_aligned(__begin, __position, __start); + std::fill(__i, __i + difference_type(__n), __x); + iterator __finish = std::copy(__position, __end, + __i + difference_type(__n)); + this->_M_deallocate(); + this->_M_impl._M_end_of_storage = __q + _S_nword(__len); + this->_M_impl._M_start = __start; + this->_M_impl._M_finish = __finish; + } + } + + template + template + _GLIBCXX20_CONSTEXPR + void + vector:: + _M_insert_range(iterator __position, _ForwardIterator __first, + _ForwardIterator __last, std::forward_iterator_tag) + { + if (__first != __last) + { + size_type __n = std::distance(__first, __last); + if (capacity() - size() >= __n) + { + std::copy_backward(__position, end(), + this->_M_impl._M_finish + + difference_type(__n)); + std::copy(__first, __last, __position); + this->_M_impl._M_finish += difference_type(__n); + } + else + { + const size_type __len = + _M_check_len(__n, "vector::_M_insert_range"); + const iterator __begin = begin(), __end = end(); + _Bit_pointer __q = this->_M_allocate(__len); + iterator __start(std::__addressof(*__q), 0); + iterator __i = _M_copy_aligned(__begin, __position, __start); + __i = std::copy(__first, __last, __i); + iterator __finish = std::copy(__position, __end, __i); + this->_M_deallocate(); + this->_M_impl._M_end_of_storage = __q + _S_nword(__len); + this->_M_impl._M_start = __start; + this->_M_impl._M_finish = __finish; + } + } + } + + template + _GLIBCXX20_CONSTEXPR + void + vector:: + _M_insert_aux(iterator __position, bool __x) + { + if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()) + { + std::copy_backward(__position, this->_M_impl._M_finish, + this->_M_impl._M_finish + 1); + *__position = __x; + ++this->_M_impl._M_finish; + } + else + { + const size_type __len = + _M_check_len(size_type(1), "vector::_M_insert_aux"); + _Bit_pointer __q = this->_M_allocate(__len); + iterator __start(std::__addressof(*__q), 0); + iterator __i = _M_copy_aligned(begin(), __position, __start); + *__i++ = __x; + iterator __finish = std::copy(__position, end(), __i); + this->_M_deallocate(); + this->_M_impl._M_end_of_storage = __q + _S_nword(__len); + this->_M_impl._M_start = __start; + this->_M_impl._M_finish = __finish; + } + } + + template + _GLIBCXX20_CONSTEXPR + typename vector::iterator + vector:: + _M_erase(iterator __position) + { + if (__position + 1 != end()) + std::copy(__position + 1, end(), __position); + --this->_M_impl._M_finish; + return __position; + } + + template + _GLIBCXX20_CONSTEXPR + typename vector::iterator + vector:: + _M_erase(iterator __first, iterator __last) + { + if (__first != __last) + _M_erase_at_end(std::copy(__last, end(), __first)); + return __first; + } + +#if __cplusplus >= 201103L + template + _GLIBCXX20_CONSTEXPR + bool + vector:: + _M_shrink_to_fit() + { + if (capacity() - size() < int(_S_word_bit)) + return false; + __try + { + if (size_type __n = size()) + _M_reallocate(__n); + else + { + this->_M_deallocate(); + this->_M_impl._M_reset(); + } + return true; + } + __catch(...) + { return false; } + } +#endif + +_GLIBCXX_END_NAMESPACE_CONTAINER +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#if __cplusplus >= 201103L + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + size_t + hash<_GLIBCXX_STD_C::vector>:: + operator()(const _GLIBCXX_STD_C::vector& __b) const noexcept + { + size_t __hash = 0; + const size_t __words = __b.size() / _S_word_bit; + if (__words) + { + const size_t __clength = __words * sizeof(_Bit_type); + __hash = std::_Hash_impl::hash(__b._M_impl._M_start._M_p, __clength); + } + + const size_t __extrabits = __b.size() % _S_word_bit; + if (__extrabits) + { + _Bit_type __hiword = *__b._M_impl._M_finish._M_p; + __hiword &= ~((~static_cast<_Bit_type>(0)) << __extrabits); + + const size_t __clength + = (__extrabits + __CHAR_BIT__ - 1) / __CHAR_BIT__; + if (__words) + __hash = std::_Hash_impl::hash(&__hiword, __clength, __hash); + else + __hash = std::_Hash_impl::hash(&__hiword, __clength); + } + + return __hash; + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 + +#undef _GLIBCXX_ASAN_ANNOTATE_REINIT +#undef _GLIBCXX_ASAN_ANNOTATE_GROW +#undef _GLIBCXX_ASAN_ANNOTATE_GREW +#undef _GLIBCXX_ASAN_ANNOTATE_SHRINK + +#endif /* _VECTOR_TCC */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@vector.tcc.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@vector.tcc.blob new file mode 100644 index 0000000..1b26b1b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@vector.tcc.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@version.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@version.h new file mode 100644 index 0000000..000bde9 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@version.h @@ -0,0 +1,2188 @@ +// Copyright (C) 2023-2025 Free Software Foundation, Inc. + +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// DO NOT EDIT THIS FILE (version.h) +// +// It has been AutoGen-ed +// From the definitions version.def +// and the template file version.tpl + +/** @file bits/version.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{version} + */ + +// Usage guide: +// +// In your usual header, do something like: +// +// #define __glibcxx_want_ranges +// #define __glibcxx_want_concepts +// #include +// +// This will generate the FTMs you named, and let you use them in your code as +// if it was user code. All macros are also exposed under __glibcxx_NAME even +// if unwanted, to permit bits and other FTMs to depend on them for condtional +// computation without exposing extra FTMs to user code. + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#if !defined(__cpp_lib_incomplete_container_elements) +# if _GLIBCXX_HOSTED +# define __glibcxx_incomplete_container_elements 201505L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_incomplete_container_elements) +# define __cpp_lib_incomplete_container_elements 201505L +# endif +# endif +#endif /* !defined(__cpp_lib_incomplete_container_elements) && defined(__glibcxx_want_incomplete_container_elements) */ +#undef __glibcxx_want_incomplete_container_elements + +#if !defined(__cpp_lib_uncaught_exceptions) +# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 199711L)) +# define __glibcxx_uncaught_exceptions 201411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_uncaught_exceptions) +# define __cpp_lib_uncaught_exceptions 201411L +# endif +# endif +#endif /* !defined(__cpp_lib_uncaught_exceptions) && defined(__glibcxx_want_uncaught_exceptions) */ +#undef __glibcxx_want_uncaught_exceptions + +#if !defined(__cpp_lib_allocator_traits_is_always_equal) +# if (__cplusplus >= 201103L) +# define __glibcxx_allocator_traits_is_always_equal 201411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_allocator_traits_is_always_equal) +# define __cpp_lib_allocator_traits_is_always_equal 201411L +# endif +# endif +#endif /* !defined(__cpp_lib_allocator_traits_is_always_equal) && defined(__glibcxx_want_allocator_traits_is_always_equal) */ +#undef __glibcxx_want_allocator_traits_is_always_equal + +#if !defined(__cpp_lib_is_null_pointer) +# if (__cplusplus >= 201103L) +# define __glibcxx_is_null_pointer 201309L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_null_pointer) +# define __cpp_lib_is_null_pointer 201309L +# endif +# endif +#endif /* !defined(__cpp_lib_is_null_pointer) && defined(__glibcxx_want_is_null_pointer) */ +#undef __glibcxx_want_is_null_pointer + +#if !defined(__cpp_lib_result_of_sfinae) +# if (__cplusplus >= 201103L) +# define __glibcxx_result_of_sfinae 201210L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_result_of_sfinae) +# define __cpp_lib_result_of_sfinae 201210L +# endif +# endif +#endif /* !defined(__cpp_lib_result_of_sfinae) && defined(__glibcxx_want_result_of_sfinae) */ +#undef __glibcxx_want_result_of_sfinae + +#if !defined(__cpp_lib_shared_ptr_arrays) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_shared_ptr_arrays 201707L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_ptr_arrays) +# define __cpp_lib_shared_ptr_arrays 201707L +# endif +# elif (__cplusplus >= 201103L) && _GLIBCXX_HOSTED +# define __glibcxx_shared_ptr_arrays 201611L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_ptr_arrays) +# define __cpp_lib_shared_ptr_arrays 201611L +# endif +# endif +#endif /* !defined(__cpp_lib_shared_ptr_arrays) && defined(__glibcxx_want_shared_ptr_arrays) */ +#undef __glibcxx_want_shared_ptr_arrays + +#if !defined(__cpp_lib_is_swappable) +# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 201103L)) +# define __glibcxx_is_swappable 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_swappable) +# define __cpp_lib_is_swappable 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_is_swappable) && defined(__glibcxx_want_is_swappable) */ +#undef __glibcxx_want_is_swappable + +#if !defined(__cpp_lib_void_t) +# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 201103L)) +# define __glibcxx_void_t 201411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_void_t) +# define __cpp_lib_void_t 201411L +# endif +# endif +#endif /* !defined(__cpp_lib_void_t) && defined(__glibcxx_want_void_t) */ +#undef __glibcxx_want_void_t + +#if !defined(__cpp_lib_enable_shared_from_this) +# if ((defined(__STRICT_ANSI__) && __cplusplus >= 201703L) || (!defined(__STRICT_ANSI__) && __cplusplus >= 201103L)) && _GLIBCXX_HOSTED +# define __glibcxx_enable_shared_from_this 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_enable_shared_from_this) +# define __cpp_lib_enable_shared_from_this 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_enable_shared_from_this) && defined(__glibcxx_want_enable_shared_from_this) */ +#undef __glibcxx_want_enable_shared_from_this + +#if !defined(__cpp_lib_math_spec_funcs) +# if (__cplusplus >= 201103L) +# define __glibcxx_math_spec_funcs 201003L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_math_spec_funcs) +# define __STDCPP_MATH_SPEC_FUNCS__ 201003L +# endif +# endif +#endif /* !defined(__cpp_lib_math_spec_funcs) && defined(__glibcxx_want_math_spec_funcs) */ +#undef __glibcxx_want_math_spec_funcs + +#if !defined(__cpp_lib_coroutine) +# if (__cplusplus >= 201402L) && (__cpp_impl_coroutine) +# define __glibcxx_coroutine 201902L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_coroutine) +# define __cpp_lib_coroutine 201902L +# endif +# endif +#endif /* !defined(__cpp_lib_coroutine) && defined(__glibcxx_want_coroutine) */ +#undef __glibcxx_want_coroutine + +#if !defined(__cpp_lib_exchange_function) +# if (__cplusplus >= 201402L) +# define __glibcxx_exchange_function 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_exchange_function) +# define __cpp_lib_exchange_function 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_exchange_function) && defined(__glibcxx_want_exchange_function) */ +#undef __glibcxx_want_exchange_function + +#if !defined(__cpp_lib_integer_sequence) +# if (__cplusplus >= 201402L) +# define __glibcxx_integer_sequence 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_integer_sequence) +# define __cpp_lib_integer_sequence 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_integer_sequence) && defined(__glibcxx_want_integer_sequence) */ +#undef __glibcxx_want_integer_sequence + +#if !defined(__cpp_lib_integral_constant_callable) +# if (__cplusplus >= 201402L) +# define __glibcxx_integral_constant_callable 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_integral_constant_callable) +# define __cpp_lib_integral_constant_callable 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_integral_constant_callable) && defined(__glibcxx_want_integral_constant_callable) */ +#undef __glibcxx_want_integral_constant_callable + +#if !defined(__cpp_lib_is_final) +# if (__cplusplus >= 201402L) +# define __glibcxx_is_final 201402L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_final) +# define __cpp_lib_is_final 201402L +# endif +# endif +#endif /* !defined(__cpp_lib_is_final) && defined(__glibcxx_want_is_final) */ +#undef __glibcxx_want_is_final + +#if !defined(__cpp_lib_make_reverse_iterator) +# if (__cplusplus >= 201402L) +# define __glibcxx_make_reverse_iterator 201402L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_reverse_iterator) +# define __cpp_lib_make_reverse_iterator 201402L +# endif +# endif +#endif /* !defined(__cpp_lib_make_reverse_iterator) && defined(__glibcxx_want_make_reverse_iterator) */ +#undef __glibcxx_want_make_reverse_iterator + +#if !defined(__cpp_lib_null_iterators) +# if (__cplusplus >= 201402L) +# define __glibcxx_null_iterators 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_null_iterators) +# define __cpp_lib_null_iterators 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_null_iterators) && defined(__glibcxx_want_null_iterators) */ +#undef __glibcxx_want_null_iterators + +#if !defined(__cpp_lib_transformation_trait_aliases) +# if (__cplusplus >= 201402L) +# define __glibcxx_transformation_trait_aliases 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_transformation_trait_aliases) +# define __cpp_lib_transformation_trait_aliases 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_transformation_trait_aliases) && defined(__glibcxx_want_transformation_trait_aliases) */ +#undef __glibcxx_want_transformation_trait_aliases + +#if !defined(__cpp_lib_transparent_operators) +# if (__cplusplus >= 201402L) +# define __glibcxx_transparent_operators 201510L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_transparent_operators) +# define __cpp_lib_transparent_operators 201510L +# endif +# endif +#endif /* !defined(__cpp_lib_transparent_operators) && defined(__glibcxx_want_transparent_operators) */ +#undef __glibcxx_want_transparent_operators + +#if !defined(__cpp_lib_tuple_element_t) +# if (__cplusplus >= 201402L) +# define __glibcxx_tuple_element_t 201402L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuple_element_t) +# define __cpp_lib_tuple_element_t 201402L +# endif +# endif +#endif /* !defined(__cpp_lib_tuple_element_t) && defined(__glibcxx_want_tuple_element_t) */ +#undef __glibcxx_want_tuple_element_t + +#if !defined(__cpp_lib_tuples_by_type) +# if (__cplusplus >= 201402L) +# define __glibcxx_tuples_by_type 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuples_by_type) +# define __cpp_lib_tuples_by_type 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_tuples_by_type) && defined(__glibcxx_want_tuples_by_type) */ +#undef __glibcxx_want_tuples_by_type + +#if !defined(__cpp_lib_robust_nonmodifying_seq_ops) +# if (__cplusplus >= 201402L) +# define __glibcxx_robust_nonmodifying_seq_ops 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_robust_nonmodifying_seq_ops) +# define __cpp_lib_robust_nonmodifying_seq_ops 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_robust_nonmodifying_seq_ops) && defined(__glibcxx_want_robust_nonmodifying_seq_ops) */ +#undef __glibcxx_want_robust_nonmodifying_seq_ops + +#if !defined(__cpp_lib_to_chars) +# if (__cplusplus > 202302L) && (_GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 && __SIZE_WIDTH__ >= 32) +# define __glibcxx_to_chars 202306L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_chars) +# define __cpp_lib_to_chars 202306L +# endif +# elif (__cplusplus >= 201402L) && (_GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 && __SIZE_WIDTH__ >= 32) +# define __glibcxx_to_chars 201611L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_chars) +# define __cpp_lib_to_chars 201611L +# endif +# endif +#endif /* !defined(__cpp_lib_to_chars) && defined(__glibcxx_want_to_chars) */ +#undef __glibcxx_want_to_chars + +#if !defined(__cpp_lib_chrono_udls) +# if (__cplusplus >= 201402L) +# define __glibcxx_chrono_udls 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono_udls) +# define __cpp_lib_chrono_udls 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_chrono_udls) && defined(__glibcxx_want_chrono_udls) */ +#undef __glibcxx_want_chrono_udls + +#if !defined(__cpp_lib_complex_udls) +# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED +# define __glibcxx_complex_udls 201309L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_complex_udls) +# define __cpp_lib_complex_udls 201309L +# endif +# endif +#endif /* !defined(__cpp_lib_complex_udls) && defined(__glibcxx_want_complex_udls) */ +#undef __glibcxx_want_complex_udls + +#if !defined(__cpp_lib_generic_associative_lookup) +# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED +# define __glibcxx_generic_associative_lookup 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_generic_associative_lookup) +# define __cpp_lib_generic_associative_lookup 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_generic_associative_lookup) && defined(__glibcxx_want_generic_associative_lookup) */ +#undef __glibcxx_want_generic_associative_lookup + +#if !defined(__cpp_lib_make_unique) +# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED +# define __glibcxx_make_unique 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_unique) +# define __cpp_lib_make_unique 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_make_unique) && defined(__glibcxx_want_make_unique) */ +#undef __glibcxx_want_make_unique + +#if !defined(__cpp_lib_quoted_string_io) +# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED +# define __glibcxx_quoted_string_io 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_quoted_string_io) +# define __cpp_lib_quoted_string_io 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_quoted_string_io) && defined(__glibcxx_want_quoted_string_io) */ +#undef __glibcxx_want_quoted_string_io + +#if !defined(__cpp_lib_shared_timed_mutex) +# if (__cplusplus >= 201402L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED +# define __glibcxx_shared_timed_mutex 201402L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_timed_mutex) +# define __cpp_lib_shared_timed_mutex 201402L +# endif +# endif +#endif /* !defined(__cpp_lib_shared_timed_mutex) && defined(__glibcxx_want_shared_timed_mutex) */ +#undef __glibcxx_want_shared_timed_mutex + +#if !defined(__cpp_lib_string_udls) +# if (__cplusplus >= 201402L) && _GLIBCXX_HOSTED +# define __glibcxx_string_udls 201304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_udls) +# define __cpp_lib_string_udls 201304L +# endif +# endif +#endif /* !defined(__cpp_lib_string_udls) && defined(__glibcxx_want_string_udls) */ +#undef __glibcxx_want_string_udls + +#if !defined(__cpp_lib_addressof_constexpr) +# if (__cplusplus >= 201703L) +# define __glibcxx_addressof_constexpr 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_addressof_constexpr) +# define __cpp_lib_addressof_constexpr 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_addressof_constexpr) && defined(__glibcxx_want_addressof_constexpr) */ +#undef __glibcxx_want_addressof_constexpr + +#if !defined(__cpp_lib_any) +# if (__cplusplus >= 201703L) +# define __glibcxx_any 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_any) +# define __cpp_lib_any 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_any) && defined(__glibcxx_want_any) */ +#undef __glibcxx_want_any + +#if !defined(__cpp_lib_apply) +# if (__cplusplus >= 201703L) +# define __glibcxx_apply 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_apply) +# define __cpp_lib_apply 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_apply) && defined(__glibcxx_want_apply) */ +#undef __glibcxx_want_apply + +#if !defined(__cpp_lib_as_const) +# if (__cplusplus >= 201703L) +# define __glibcxx_as_const 201510L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_as_const) +# define __cpp_lib_as_const 201510L +# endif +# endif +#endif /* !defined(__cpp_lib_as_const) && defined(__glibcxx_want_as_const) */ +#undef __glibcxx_want_as_const + +#if !defined(__cpp_lib_atomic_is_always_lock_free) +# if (__cplusplus >= 201703L) +# define __glibcxx_atomic_is_always_lock_free 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_is_always_lock_free) +# define __cpp_lib_atomic_is_always_lock_free 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_atomic_is_always_lock_free) && defined(__glibcxx_want_atomic_is_always_lock_free) */ +#undef __glibcxx_want_atomic_is_always_lock_free + +#if !defined(__cpp_lib_bool_constant) +# if (__cplusplus >= 201703L) +# define __glibcxx_bool_constant 201505L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bool_constant) +# define __cpp_lib_bool_constant 201505L +# endif +# endif +#endif /* !defined(__cpp_lib_bool_constant) && defined(__glibcxx_want_bool_constant) */ +#undef __glibcxx_want_bool_constant + +#if !defined(__cpp_lib_byte) +# if (__cplusplus >= 201703L) +# define __glibcxx_byte 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_byte) +# define __cpp_lib_byte 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_byte) && defined(__glibcxx_want_byte) */ +#undef __glibcxx_want_byte + +#if !defined(__cpp_lib_has_unique_object_representations) +# if (__cplusplus >= 201703L) && (defined(_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP)) +# define __glibcxx_has_unique_object_representations 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_has_unique_object_representations) +# define __cpp_lib_has_unique_object_representations 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_has_unique_object_representations) && defined(__glibcxx_want_has_unique_object_representations) */ +#undef __glibcxx_want_has_unique_object_representations + +#if !defined(__cpp_lib_hardware_interference_size) +# if (__cplusplus >= 201703L) && (defined(__GCC_DESTRUCTIVE_SIZE)) +# define __glibcxx_hardware_interference_size 201703L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_hardware_interference_size) +# define __cpp_lib_hardware_interference_size 201703L +# endif +# endif +#endif /* !defined(__cpp_lib_hardware_interference_size) && defined(__glibcxx_want_hardware_interference_size) */ +#undef __glibcxx_want_hardware_interference_size + +#if !defined(__cpp_lib_invoke) +# if (__cplusplus >= 201703L) +# define __glibcxx_invoke 201411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_invoke) +# define __cpp_lib_invoke 201411L +# endif +# endif +#endif /* !defined(__cpp_lib_invoke) && defined(__glibcxx_want_invoke) */ +#undef __glibcxx_want_invoke + +#if !defined(__cpp_lib_is_aggregate) +# if (__cplusplus >= 201703L) && (defined(_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE)) +# define __glibcxx_is_aggregate 201703L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_aggregate) +# define __cpp_lib_is_aggregate 201703L +# endif +# endif +#endif /* !defined(__cpp_lib_is_aggregate) && defined(__glibcxx_want_is_aggregate) */ +#undef __glibcxx_want_is_aggregate + +#if !defined(__cpp_lib_is_invocable) +# if (__cplusplus >= 201703L) +# define __glibcxx_is_invocable 201703L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_invocable) +# define __cpp_lib_is_invocable 201703L +# endif +# endif +#endif /* !defined(__cpp_lib_is_invocable) && defined(__glibcxx_want_is_invocable) */ +#undef __glibcxx_want_is_invocable + +#if !defined(__cpp_lib_launder) +# if (__cplusplus >= 201703L) && (defined(_GLIBCXX_HAVE_BUILTIN_LAUNDER)) +# define __glibcxx_launder 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_launder) +# define __cpp_lib_launder 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_launder) && defined(__glibcxx_want_launder) */ +#undef __glibcxx_want_launder + +#if !defined(__cpp_lib_logical_traits) +# if (__cplusplus >= 201703L) +# define __glibcxx_logical_traits 201510L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_logical_traits) +# define __cpp_lib_logical_traits 201510L +# endif +# endif +#endif /* !defined(__cpp_lib_logical_traits) && defined(__glibcxx_want_logical_traits) */ +#undef __glibcxx_want_logical_traits + +#if !defined(__cpp_lib_make_from_tuple) +# if (__cplusplus >= 201703L) +# define __glibcxx_make_from_tuple 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_from_tuple) +# define __cpp_lib_make_from_tuple 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_make_from_tuple) && defined(__glibcxx_want_make_from_tuple) */ +#undef __glibcxx_want_make_from_tuple + +#if !defined(__cpp_lib_not_fn) +# if (__cplusplus >= 201703L) +# define __glibcxx_not_fn 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_not_fn) +# define __cpp_lib_not_fn 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_not_fn) && defined(__glibcxx_want_not_fn) */ +#undef __glibcxx_want_not_fn + +#if !defined(__cpp_lib_type_trait_variable_templates) +# if (__cplusplus >= 201703L) +# define __glibcxx_type_trait_variable_templates 201510L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_type_trait_variable_templates) +# define __cpp_lib_type_trait_variable_templates 201510L +# endif +# endif +#endif /* !defined(__cpp_lib_type_trait_variable_templates) && defined(__glibcxx_want_type_trait_variable_templates) */ +#undef __glibcxx_want_type_trait_variable_templates + +#if !defined(__cpp_lib_variant) +# if (__cplusplus > 202302L) && (__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L && __cpp_explicit_this_parameter) +# define __glibcxx_variant 202306L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_variant) +# define __cpp_lib_variant 202306L +# endif +# elif (__cplusplus >= 202002L) && (__cpp_concepts >= 202002L && __cpp_constexpr >= 201811L) +# define __glibcxx_variant 202106L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_variant) +# define __cpp_lib_variant 202106L +# endif +# elif (__cplusplus >= 201703L) +# define __glibcxx_variant 202102L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_variant) +# define __cpp_lib_variant 202102L +# endif +# endif +#endif /* !defined(__cpp_lib_variant) && defined(__glibcxx_want_variant) */ +#undef __glibcxx_want_variant + +#if !defined(__cpp_lib_lcm) +# if (__cplusplus >= 201703L) +# define __glibcxx_lcm 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_lcm) +# define __cpp_lib_lcm 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_lcm) && defined(__glibcxx_want_lcm) */ +#undef __glibcxx_want_lcm + +#if !defined(__cpp_lib_gcd) +# if (__cplusplus >= 201703L) +# define __glibcxx_gcd 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_gcd) +# define __cpp_lib_gcd 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_gcd) && defined(__glibcxx_want_gcd) */ +#undef __glibcxx_want_gcd + +#if !defined(__cpp_lib_gcd_lcm) +# if (__cplusplus >= 201703L) +# define __glibcxx_gcd_lcm 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_gcd_lcm) +# define __cpp_lib_gcd_lcm 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_gcd_lcm) && defined(__glibcxx_want_gcd_lcm) */ +#undef __glibcxx_want_gcd_lcm + +#if !defined(__cpp_lib_raw_memory_algorithms) +# if (__cplusplus > 202302L) && (__cpp_constexpr >= 202406L) +# define __glibcxx_raw_memory_algorithms 202411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_raw_memory_algorithms) +# define __cpp_lib_raw_memory_algorithms 202411L +# endif +# elif (__cplusplus >= 201703L) +# define __glibcxx_raw_memory_algorithms 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_raw_memory_algorithms) +# define __cpp_lib_raw_memory_algorithms 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_raw_memory_algorithms) && defined(__glibcxx_want_raw_memory_algorithms) */ +#undef __glibcxx_want_raw_memory_algorithms + +#if !defined(__cpp_lib_array_constexpr) +# if (__cplusplus >= 202002L) +# define __glibcxx_array_constexpr 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_array_constexpr) +# define __cpp_lib_array_constexpr 201811L +# endif +# elif (__cplusplus >= 201703L) +# define __glibcxx_array_constexpr 201803L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_array_constexpr) +# define __cpp_lib_array_constexpr 201803L +# endif +# endif +#endif /* !defined(__cpp_lib_array_constexpr) && defined(__glibcxx_want_array_constexpr) */ +#undef __glibcxx_want_array_constexpr + +#if !defined(__cpp_lib_nonmember_container_access) +# if (__cplusplus >= 201703L) +# define __glibcxx_nonmember_container_access 201411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_nonmember_container_access) +# define __cpp_lib_nonmember_container_access 201411L +# endif +# endif +#endif /* !defined(__cpp_lib_nonmember_container_access) && defined(__glibcxx_want_nonmember_container_access) */ +#undef __glibcxx_want_nonmember_container_access + +#if !defined(__cpp_lib_clamp) +# if (__cplusplus >= 201703L) +# define __glibcxx_clamp 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_clamp) +# define __cpp_lib_clamp 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_clamp) && defined(__glibcxx_want_clamp) */ +#undef __glibcxx_want_clamp + +#if !defined(__cpp_lib_sample) +# if (__cplusplus >= 201703L) +# define __glibcxx_sample 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_sample) +# define __cpp_lib_sample 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_sample) && defined(__glibcxx_want_sample) */ +#undef __glibcxx_want_sample + +#if !defined(__cpp_lib_boyer_moore_searcher) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_boyer_moore_searcher 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_boyer_moore_searcher) +# define __cpp_lib_boyer_moore_searcher 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_boyer_moore_searcher) && defined(__glibcxx_want_boyer_moore_searcher) */ +#undef __glibcxx_want_boyer_moore_searcher + +#if !defined(__cpp_lib_chrono) +# if (__cplusplus >= 202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED +# define __glibcxx_chrono 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono) +# define __cpp_lib_chrono 201907L +# endif +# elif (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_chrono 201611L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_chrono) +# define __cpp_lib_chrono 201611L +# endif +# endif +#endif /* !defined(__cpp_lib_chrono) && defined(__glibcxx_want_chrono) */ +#undef __glibcxx_want_chrono + +#if !defined(__cpp_lib_execution) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_execution 201902L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_execution) +# define __cpp_lib_execution 201902L +# endif +# endif +#endif /* !defined(__cpp_lib_execution) && defined(__glibcxx_want_execution) */ +#undef __glibcxx_want_execution + +#if !defined(__cpp_lib_filesystem) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_filesystem 201703L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_filesystem) +# define __cpp_lib_filesystem 201703L +# endif +# endif +#endif /* !defined(__cpp_lib_filesystem) && defined(__glibcxx_want_filesystem) */ +#undef __glibcxx_want_filesystem + +#if !defined(__cpp_lib_hypot) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_hypot 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_hypot) +# define __cpp_lib_hypot 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_hypot) && defined(__glibcxx_want_hypot) */ +#undef __glibcxx_want_hypot + +#if !defined(__cpp_lib_map_try_emplace) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_map_try_emplace 201411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_map_try_emplace) +# define __cpp_lib_map_try_emplace 201411L +# endif +# endif +#endif /* !defined(__cpp_lib_map_try_emplace) && defined(__glibcxx_want_map_try_emplace) */ +#undef __glibcxx_want_map_try_emplace + +#if !defined(__cpp_lib_math_special_functions) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_math_special_functions 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_math_special_functions) +# define __cpp_lib_math_special_functions 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_math_special_functions) && defined(__glibcxx_want_math_special_functions) */ +#undef __glibcxx_want_math_special_functions + +#if !defined(__cpp_lib_memory_resource) +# if (__cplusplus >= 201703L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED +# define __glibcxx_memory_resource 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_memory_resource) +# define __cpp_lib_memory_resource 201603L +# endif +# elif (__cplusplus >= 201703L) && !defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED +# define __glibcxx_memory_resource 1L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_memory_resource) +# define __cpp_lib_memory_resource 1L +# endif +# endif +#endif /* !defined(__cpp_lib_memory_resource) && defined(__glibcxx_want_memory_resource) */ +#undef __glibcxx_want_memory_resource + +#if !defined(__cpp_lib_node_extract) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_node_extract 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_node_extract) +# define __cpp_lib_node_extract 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_node_extract) && defined(__glibcxx_want_node_extract) */ +#undef __glibcxx_want_node_extract + +#if !defined(__cpp_lib_parallel_algorithm) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_parallel_algorithm 201603L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_parallel_algorithm) +# define __cpp_lib_parallel_algorithm 201603L +# endif +# endif +#endif /* !defined(__cpp_lib_parallel_algorithm) && defined(__glibcxx_want_parallel_algorithm) */ +#undef __glibcxx_want_parallel_algorithm + +#if !defined(__cpp_lib_scoped_lock) +# if (__cplusplus >= 201703L) +# define __glibcxx_scoped_lock 201703L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_scoped_lock) +# define __cpp_lib_scoped_lock 201703L +# endif +# endif +#endif /* !defined(__cpp_lib_scoped_lock) && defined(__glibcxx_want_scoped_lock) */ +#undef __glibcxx_want_scoped_lock + +#if !defined(__cpp_lib_shared_mutex) +# if (__cplusplus >= 201703L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED +# define __glibcxx_shared_mutex 201505L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_mutex) +# define __cpp_lib_shared_mutex 201505L +# endif +# endif +#endif /* !defined(__cpp_lib_shared_mutex) && defined(__glibcxx_want_shared_mutex) */ +#undef __glibcxx_want_shared_mutex + +#if !defined(__cpp_lib_shared_ptr_weak_type) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_shared_ptr_weak_type 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shared_ptr_weak_type) +# define __cpp_lib_shared_ptr_weak_type 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_shared_ptr_weak_type) && defined(__glibcxx_want_shared_ptr_weak_type) */ +#undef __glibcxx_want_shared_ptr_weak_type + +#if !defined(__cpp_lib_string_view) +# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED +# define __glibcxx_string_view 202403L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_view) +# define __cpp_lib_string_view 202403L +# endif +# elif (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_string_view 201803L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_view) +# define __cpp_lib_string_view 201803L +# endif +# endif +#endif /* !defined(__cpp_lib_string_view) && defined(__glibcxx_want_string_view) */ +#undef __glibcxx_want_string_view + +#if !defined(__cpp_lib_unordered_map_try_emplace) +# if (__cplusplus >= 201703L) && _GLIBCXX_HOSTED +# define __glibcxx_unordered_map_try_emplace 201411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_unordered_map_try_emplace) +# define __cpp_lib_unordered_map_try_emplace 201411L +# endif +# endif +#endif /* !defined(__cpp_lib_unordered_map_try_emplace) && defined(__glibcxx_want_unordered_map_try_emplace) */ +#undef __glibcxx_want_unordered_map_try_emplace + +#if !defined(__cpp_lib_assume_aligned) +# if (__cplusplus >= 202002L) +# define __glibcxx_assume_aligned 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_assume_aligned) +# define __cpp_lib_assume_aligned 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_assume_aligned) && defined(__glibcxx_want_assume_aligned) */ +#undef __glibcxx_want_assume_aligned + +#if !defined(__cpp_lib_atomic_flag_test) +# if (__cplusplus >= 202002L) +# define __glibcxx_atomic_flag_test 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_flag_test) +# define __cpp_lib_atomic_flag_test 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_atomic_flag_test) && defined(__glibcxx_want_atomic_flag_test) */ +#undef __glibcxx_want_atomic_flag_test + +#if !defined(__cpp_lib_atomic_float) +# if (__cplusplus >= 202002L) +# define __glibcxx_atomic_float 201711L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_float) +# define __cpp_lib_atomic_float 201711L +# endif +# endif +#endif /* !defined(__cpp_lib_atomic_float) && defined(__glibcxx_want_atomic_float) */ +#undef __glibcxx_want_atomic_float + +#if !defined(__cpp_lib_atomic_lock_free_type_aliases) +# if (__cplusplus >= 202002L) && ((__GCC_ATOMIC_INT_LOCK_FREE | __GCC_ATOMIC_LONG_LOCK_FREE | __GCC_ATOMIC_CHAR_LOCK_FREE) & 2) +# define __glibcxx_atomic_lock_free_type_aliases 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_lock_free_type_aliases) +# define __cpp_lib_atomic_lock_free_type_aliases 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_atomic_lock_free_type_aliases) && defined(__glibcxx_want_atomic_lock_free_type_aliases) */ +#undef __glibcxx_want_atomic_lock_free_type_aliases + +#if !defined(__cpp_lib_atomic_ref) +# if (__cplusplus >= 202002L) +# define __glibcxx_atomic_ref 201806L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_ref) +# define __cpp_lib_atomic_ref 201806L +# endif +# endif +#endif /* !defined(__cpp_lib_atomic_ref) && defined(__glibcxx_want_atomic_ref) */ +#undef __glibcxx_want_atomic_ref + +#if !defined(__cpp_lib_atomic_value_initialization) +# if (__cplusplus >= 202002L) && (__cpp_concepts >= 201907L) +# define __glibcxx_atomic_value_initialization 201911L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_value_initialization) +# define __cpp_lib_atomic_value_initialization 201911L +# endif +# endif +#endif /* !defined(__cpp_lib_atomic_value_initialization) && defined(__glibcxx_want_atomic_value_initialization) */ +#undef __glibcxx_want_atomic_value_initialization + +#if !defined(__cpp_lib_bind_front) +# if (__cplusplus >= 202002L) +# define __glibcxx_bind_front 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bind_front) +# define __cpp_lib_bind_front 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_bind_front) && defined(__glibcxx_want_bind_front) */ +#undef __glibcxx_want_bind_front + +#if !defined(__cpp_lib_bind_back) +# if (__cplusplus >= 202100L) && (__cpp_explicit_this_parameter) +# define __glibcxx_bind_back 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bind_back) +# define __cpp_lib_bind_back 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_bind_back) && defined(__glibcxx_want_bind_back) */ +#undef __glibcxx_want_bind_back + +#if !defined(__cpp_lib_starts_ends_with) +# if (__cplusplus >= 202002L) +# define __glibcxx_starts_ends_with 201711L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_starts_ends_with) +# define __cpp_lib_starts_ends_with 201711L +# endif +# endif +#endif /* !defined(__cpp_lib_starts_ends_with) && defined(__glibcxx_want_starts_ends_with) */ +#undef __glibcxx_want_starts_ends_with + +#if !defined(__cpp_lib_bit_cast) +# if (__cplusplus >= 202002L) && (__has_builtin(__builtin_bit_cast)) +# define __glibcxx_bit_cast 201806L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bit_cast) +# define __cpp_lib_bit_cast 201806L +# endif +# endif +#endif /* !defined(__cpp_lib_bit_cast) && defined(__glibcxx_want_bit_cast) */ +#undef __glibcxx_want_bit_cast + +#if !defined(__cpp_lib_bitops) +# if (__cplusplus >= 202002L) +# define __glibcxx_bitops 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bitops) +# define __cpp_lib_bitops 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_bitops) && defined(__glibcxx_want_bitops) */ +#undef __glibcxx_want_bitops + +#if !defined(__cpp_lib_bounded_array_traits) +# if (__cplusplus >= 202002L) +# define __glibcxx_bounded_array_traits 201902L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_bounded_array_traits) +# define __cpp_lib_bounded_array_traits 201902L +# endif +# endif +#endif /* !defined(__cpp_lib_bounded_array_traits) && defined(__glibcxx_want_bounded_array_traits) */ +#undef __glibcxx_want_bounded_array_traits + +#if !defined(__cpp_lib_concepts) +# if (__cplusplus >= 202002L) && (__cpp_concepts >= 201907L) +# define __glibcxx_concepts 202002L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_concepts) +# define __cpp_lib_concepts 202002L +# endif +# endif +#endif /* !defined(__cpp_lib_concepts) && defined(__glibcxx_want_concepts) */ +#undef __glibcxx_want_concepts + +#if !defined(__cpp_lib_optional) +# if (__cplusplus >= 202100L) && (__glibcxx_concepts) +# define __glibcxx_optional 202110L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional) +# define __cpp_lib_optional 202110L +# endif +# elif (__cplusplus >= 202002L) +# define __glibcxx_optional 202106L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional) +# define __cpp_lib_optional 202106L +# endif +# elif (__cplusplus >= 201703L) +# define __glibcxx_optional 201606L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_optional) +# define __cpp_lib_optional 201606L +# endif +# endif +#endif /* !defined(__cpp_lib_optional) && defined(__glibcxx_want_optional) */ +#undef __glibcxx_want_optional + +#if !defined(__cpp_lib_destroying_delete) +# if (__cplusplus >= 202002L) && (__cpp_impl_destroying_delete) +# define __glibcxx_destroying_delete 201806L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_destroying_delete) +# define __cpp_lib_destroying_delete 201806L +# endif +# endif +#endif /* !defined(__cpp_lib_destroying_delete) && defined(__glibcxx_want_destroying_delete) */ +#undef __glibcxx_want_destroying_delete + +#if !defined(__cpp_lib_constexpr_string_view) +# if (__cplusplus >= 202002L) +# define __glibcxx_constexpr_string_view 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string_view) +# define __cpp_lib_constexpr_string_view 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_string_view) && defined(__glibcxx_want_constexpr_string_view) */ +#undef __glibcxx_want_constexpr_string_view + +#if !defined(__cpp_lib_endian) +# if (__cplusplus >= 202002L) +# define __glibcxx_endian 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_endian) +# define __cpp_lib_endian 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_endian) && defined(__glibcxx_want_endian) */ +#undef __glibcxx_want_endian + +#if !defined(__cpp_lib_int_pow2) +# if (__cplusplus >= 202002L) +# define __glibcxx_int_pow2 202002L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_int_pow2) +# define __cpp_lib_int_pow2 202002L +# endif +# endif +#endif /* !defined(__cpp_lib_int_pow2) && defined(__glibcxx_want_int_pow2) */ +#undef __glibcxx_want_int_pow2 + +#if !defined(__cpp_lib_integer_comparison_functions) +# if (__cplusplus >= 202002L) +# define __glibcxx_integer_comparison_functions 202002L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_integer_comparison_functions) +# define __cpp_lib_integer_comparison_functions 202002L +# endif +# endif +#endif /* !defined(__cpp_lib_integer_comparison_functions) && defined(__glibcxx_want_integer_comparison_functions) */ +#undef __glibcxx_want_integer_comparison_functions + +#if !defined(__cpp_lib_is_constant_evaluated) +# if (__cplusplus >= 202002L) && (defined(_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED)) +# define __glibcxx_is_constant_evaluated 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_constant_evaluated) +# define __cpp_lib_is_constant_evaluated 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_is_constant_evaluated) && defined(__glibcxx_want_is_constant_evaluated) */ +#undef __glibcxx_want_is_constant_evaluated + +#if !defined(__cpp_lib_constexpr_char_traits) +# if (__cplusplus >= 202002L) && (defined(__glibcxx_is_constant_evaluated)) +# define __glibcxx_constexpr_char_traits 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_char_traits) +# define __cpp_lib_constexpr_char_traits 201811L +# endif +# elif (__cplusplus >= 201703L) && (_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED) +# define __glibcxx_constexpr_char_traits 201611L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_char_traits) +# define __cpp_lib_constexpr_char_traits 201611L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_char_traits) && defined(__glibcxx_want_constexpr_char_traits) */ +#undef __glibcxx_want_constexpr_char_traits + +#if !defined(__cpp_lib_is_layout_compatible) +# if (__cplusplus >= 202002L) && (__has_builtin(__is_layout_compatible) && __has_builtin(__builtin_is_corresponding_member)) +# define __glibcxx_is_layout_compatible 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_layout_compatible) +# define __cpp_lib_is_layout_compatible 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_is_layout_compatible) && defined(__glibcxx_want_is_layout_compatible) */ +#undef __glibcxx_want_is_layout_compatible + +#if !defined(__cpp_lib_is_nothrow_convertible) +# if (__cplusplus >= 202002L) +# define __glibcxx_is_nothrow_convertible 201806L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_nothrow_convertible) +# define __cpp_lib_is_nothrow_convertible 201806L +# endif +# endif +#endif /* !defined(__cpp_lib_is_nothrow_convertible) && defined(__glibcxx_want_is_nothrow_convertible) */ +#undef __glibcxx_want_is_nothrow_convertible + +#if !defined(__cpp_lib_is_pointer_interconvertible) +# if (__cplusplus >= 202002L) && (__has_builtin(__is_pointer_interconvertible_base_of) && __has_builtin(__builtin_is_pointer_interconvertible_with_class)) +# define __glibcxx_is_pointer_interconvertible 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_pointer_interconvertible) +# define __cpp_lib_is_pointer_interconvertible 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_is_pointer_interconvertible) && defined(__glibcxx_want_is_pointer_interconvertible) */ +#undef __glibcxx_want_is_pointer_interconvertible + +#if !defined(__cpp_lib_math_constants) +# if (__cplusplus >= 202002L) +# define __glibcxx_math_constants 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_math_constants) +# define __cpp_lib_math_constants 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_math_constants) && defined(__glibcxx_want_math_constants) */ +#undef __glibcxx_want_math_constants + +#if !defined(__cpp_lib_make_obj_using_allocator) +# if (__cplusplus >= 202002L) && (__cpp_concepts) +# define __glibcxx_make_obj_using_allocator 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_make_obj_using_allocator) +# define __cpp_lib_make_obj_using_allocator 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_make_obj_using_allocator) && defined(__glibcxx_want_make_obj_using_allocator) */ +#undef __glibcxx_want_make_obj_using_allocator + +#if !defined(__cpp_lib_remove_cvref) +# if (__cplusplus >= 202002L) +# define __glibcxx_remove_cvref 201711L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_remove_cvref) +# define __cpp_lib_remove_cvref 201711L +# endif +# endif +#endif /* !defined(__cpp_lib_remove_cvref) && defined(__glibcxx_want_remove_cvref) */ +#undef __glibcxx_want_remove_cvref + +#if !defined(__cpp_lib_source_location) +# if (__cplusplus >= 202002L) && (__has_builtin(__builtin_source_location)) +# define __glibcxx_source_location 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_source_location) +# define __cpp_lib_source_location 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_source_location) && defined(__glibcxx_want_source_location) */ +#undef __glibcxx_want_source_location + +#if !defined(__cpp_lib_span) +# if (__cplusplus > 202302L) && (__glibcxx_concepts) +# define __glibcxx_span 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_span) +# define __cpp_lib_span 202311L +# endif +# elif (__cplusplus >= 202002L) && (__glibcxx_concepts) +# define __glibcxx_span 202002L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_span) +# define __cpp_lib_span 202002L +# endif +# endif +#endif /* !defined(__cpp_lib_span) && defined(__glibcxx_want_span) */ +#undef __glibcxx_want_span + +#if !defined(__cpp_lib_ssize) +# if (__cplusplus >= 202002L) +# define __glibcxx_ssize 201902L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ssize) +# define __cpp_lib_ssize 201902L +# endif +# endif +#endif /* !defined(__cpp_lib_ssize) && defined(__glibcxx_want_ssize) */ +#undef __glibcxx_want_ssize + +#if !defined(__cpp_lib_three_way_comparison) +# if (__cplusplus >= 202002L) && (__cpp_impl_three_way_comparison >= 201907L && __glibcxx_concepts) +# define __glibcxx_three_way_comparison 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_three_way_comparison) +# define __cpp_lib_three_way_comparison 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_three_way_comparison) && defined(__glibcxx_want_three_way_comparison) */ +#undef __glibcxx_want_three_way_comparison + +#if !defined(__cpp_lib_to_address) +# if (__cplusplus >= 202002L) +# define __glibcxx_to_address 201711L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_address) +# define __cpp_lib_to_address 201711L +# endif +# endif +#endif /* !defined(__cpp_lib_to_address) && defined(__glibcxx_want_to_address) */ +#undef __glibcxx_want_to_address + +#if !defined(__cpp_lib_to_array) +# if (__cplusplus >= 202002L) && (__cpp_generic_lambdas >= 201707L) +# define __glibcxx_to_array 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_array) +# define __cpp_lib_to_array 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_to_array) && defined(__glibcxx_want_to_array) */ +#undef __glibcxx_want_to_array + +#if !defined(__cpp_lib_type_identity) +# if (__cplusplus >= 202002L) +# define __glibcxx_type_identity 201806L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_type_identity) +# define __cpp_lib_type_identity 201806L +# endif +# endif +#endif /* !defined(__cpp_lib_type_identity) && defined(__glibcxx_want_type_identity) */ +#undef __glibcxx_want_type_identity + +#if !defined(__cpp_lib_unwrap_ref) +# if (__cplusplus >= 202002L) +# define __glibcxx_unwrap_ref 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_unwrap_ref) +# define __cpp_lib_unwrap_ref 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_unwrap_ref) && defined(__glibcxx_want_unwrap_ref) */ +#undef __glibcxx_want_unwrap_ref + +#if !defined(__cpp_lib_constexpr_iterator) +# if (__cplusplus >= 202002L) +# define __glibcxx_constexpr_iterator 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_iterator) +# define __cpp_lib_constexpr_iterator 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_iterator) && defined(__glibcxx_want_constexpr_iterator) */ +#undef __glibcxx_want_constexpr_iterator + +#if !defined(__cpp_lib_interpolate) +# if (__cplusplus >= 202002L) +# define __glibcxx_interpolate 201902L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_interpolate) +# define __cpp_lib_interpolate 201902L +# endif +# endif +#endif /* !defined(__cpp_lib_interpolate) && defined(__glibcxx_want_interpolate) */ +#undef __glibcxx_want_interpolate + +#if !defined(__cpp_lib_constexpr_utility) +# if (__cplusplus >= 202002L) +# define __glibcxx_constexpr_utility 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_utility) +# define __cpp_lib_constexpr_utility 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_utility) && defined(__glibcxx_want_constexpr_utility) */ +#undef __glibcxx_want_constexpr_utility + +#if !defined(__cpp_lib_shift) +# if (__cplusplus >= 202002L) +# define __glibcxx_shift 201806L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_shift) +# define __cpp_lib_shift 201806L +# endif +# endif +#endif /* !defined(__cpp_lib_shift) && defined(__glibcxx_want_shift) */ +#undef __glibcxx_want_shift + +#if !defined(__cpp_lib_ranges) +# if (__cplusplus > 202302L) && (__glibcxx_concepts) +# define __glibcxx_ranges 202406L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges) +# define __cpp_lib_ranges 202406L +# endif +# elif (__cplusplus >= 202100L) && (__glibcxx_concepts) +# define __glibcxx_ranges 202302L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges) +# define __cpp_lib_ranges 202302L +# endif +# elif (__cplusplus >= 202002L) && (__glibcxx_concepts) +# define __glibcxx_ranges 202110L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges) +# define __cpp_lib_ranges 202110L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges) && defined(__glibcxx_want_ranges) */ +#undef __glibcxx_want_ranges + +#if !defined(__cpp_lib_constexpr_numeric) +# if (__cplusplus >= 202002L) +# define __glibcxx_constexpr_numeric 201911L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_numeric) +# define __cpp_lib_constexpr_numeric 201911L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_numeric) && defined(__glibcxx_want_constexpr_numeric) */ +#undef __glibcxx_want_constexpr_numeric + +#if !defined(__cpp_lib_constexpr_functional) +# if (__cplusplus >= 202002L) +# define __glibcxx_constexpr_functional 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_functional) +# define __cpp_lib_constexpr_functional 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_functional) && defined(__glibcxx_want_constexpr_functional) */ +#undef __glibcxx_want_constexpr_functional + +#if !defined(__cpp_lib_constexpr_algorithms) +# if (__cplusplus > 202302L) +# define __glibcxx_constexpr_algorithms 202306L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_algorithms) +# define __cpp_lib_constexpr_algorithms 202306L +# endif +# elif (__cplusplus >= 202002L) +# define __glibcxx_constexpr_algorithms 201806L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_algorithms) +# define __cpp_lib_constexpr_algorithms 201806L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_algorithms) && defined(__glibcxx_want_constexpr_algorithms) */ +#undef __glibcxx_want_constexpr_algorithms + +#if !defined(__cpp_lib_constexpr_tuple) +# if (__cplusplus >= 202002L) +# define __glibcxx_constexpr_tuple 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_tuple) +# define __cpp_lib_constexpr_tuple 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_tuple) && defined(__glibcxx_want_constexpr_tuple) */ +#undef __glibcxx_want_constexpr_tuple + +#if !defined(__cpp_lib_constexpr_memory) +# if (__cplusplus >= 202100L) && (__cpp_constexpr_dynamic_alloc) +# define __glibcxx_constexpr_memory 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_memory) +# define __cpp_lib_constexpr_memory 202202L +# endif +# elif (__cplusplus >= 202002L) +# define __glibcxx_constexpr_memory 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_memory) +# define __cpp_lib_constexpr_memory 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_memory) && defined(__glibcxx_want_constexpr_memory) */ +#undef __glibcxx_want_constexpr_memory + +#if !defined(__cpp_lib_atomic_shared_ptr) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_atomic_shared_ptr 201711L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_shared_ptr) +# define __cpp_lib_atomic_shared_ptr 201711L +# endif +# endif +#endif /* !defined(__cpp_lib_atomic_shared_ptr) && defined(__glibcxx_want_atomic_shared_ptr) */ +#undef __glibcxx_want_atomic_shared_ptr + +#if !defined(__cpp_lib_atomic_wait) +# if (__cplusplus >= 202002L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED +# define __glibcxx_atomic_wait 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_wait) +# define __cpp_lib_atomic_wait 201907L +# endif +# elif (__cplusplus >= 202002L) && !defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED && (defined(_GLIBCXX_HAVE_LINUX_FUTEX)) +# define __glibcxx_atomic_wait 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_atomic_wait) +# define __cpp_lib_atomic_wait 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_atomic_wait) && defined(__glibcxx_want_atomic_wait) */ +#undef __glibcxx_want_atomic_wait + +#if !defined(__cpp_lib_barrier) +# if (__cplusplus >= 202002L) && (__cpp_aligned_new && __glibcxx_atomic_wait) +# define __glibcxx_barrier 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_barrier) +# define __cpp_lib_barrier 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_barrier) && defined(__glibcxx_want_barrier) */ +#undef __glibcxx_want_barrier + +#if !defined(__cpp_lib_format) +# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED +# define __glibcxx_format 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format) +# define __cpp_lib_format 202311L +# endif +# elif (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_format 202304L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format) +# define __cpp_lib_format 202304L +# endif +# endif +#endif /* !defined(__cpp_lib_format) && defined(__glibcxx_want_format) */ +#undef __glibcxx_want_format + +#if !defined(__cpp_lib_format_uchar) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_format_uchar 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format_uchar) +# define __cpp_lib_format_uchar 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_format_uchar) && defined(__glibcxx_want_format_uchar) */ +#undef __glibcxx_want_format_uchar + +#if !defined(__cpp_lib_constexpr_complex) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_constexpr_complex 201711L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_complex) +# define __cpp_lib_constexpr_complex 201711L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_complex) && defined(__glibcxx_want_constexpr_complex) */ +#undef __glibcxx_want_constexpr_complex + +#if !defined(__cpp_lib_constexpr_dynamic_alloc) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_constexpr_dynamic_alloc 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_dynamic_alloc) +# define __cpp_lib_constexpr_dynamic_alloc 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_dynamic_alloc) && defined(__glibcxx_want_constexpr_dynamic_alloc) */ +#undef __glibcxx_want_constexpr_dynamic_alloc + +#if !defined(__cpp_lib_constexpr_string) +# if (__cplusplus >= 202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED && (defined(__glibcxx_is_constant_evaluated)) +# define __glibcxx_constexpr_string 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string) +# define __cpp_lib_constexpr_string 201907L +# endif +# elif (__cplusplus >= 202002L) && !_GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED && (defined(__glibcxx_is_constant_evaluated)) +# define __glibcxx_constexpr_string 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string) +# define __cpp_lib_constexpr_string 201811L +# endif +# elif (__cplusplus >= 201703L) && _GLIBCXX_HOSTED && (_GLIBCXX_HAVE_IS_CONSTANT_EVALUATED) +# define __glibcxx_constexpr_string 201611L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_string) +# define __cpp_lib_constexpr_string 201611L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_string) && defined(__glibcxx_want_constexpr_string) */ +#undef __glibcxx_want_constexpr_string + +#if !defined(__cpp_lib_constexpr_vector) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_constexpr_vector 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_vector) +# define __cpp_lib_constexpr_vector 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_vector) && defined(__glibcxx_want_constexpr_vector) */ +#undef __glibcxx_want_constexpr_vector + +#if !defined(__cpp_lib_constrained_equality) +# if (__cplusplus >= 202100L) && (__glibcxx_three_way_comparison) +# define __glibcxx_constrained_equality 202411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constrained_equality) +# define __cpp_lib_constrained_equality 202411L +# endif +# elif (__cplusplus >= 202002L) && (__glibcxx_three_way_comparison) +# define __glibcxx_constrained_equality 202403L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constrained_equality) +# define __cpp_lib_constrained_equality 202403L +# endif +# endif +#endif /* !defined(__cpp_lib_constrained_equality) && defined(__glibcxx_want_constrained_equality) */ +#undef __glibcxx_want_constrained_equality + +#if !defined(__cpp_lib_erase_if) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_erase_if 202002L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_erase_if) +# define __cpp_lib_erase_if 202002L +# endif +# endif +#endif /* !defined(__cpp_lib_erase_if) && defined(__glibcxx_want_erase_if) */ +#undef __glibcxx_want_erase_if + +#if !defined(__cpp_lib_generic_unordered_lookup) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_generic_unordered_lookup 201811L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_generic_unordered_lookup) +# define __cpp_lib_generic_unordered_lookup 201811L +# endif +# endif +#endif /* !defined(__cpp_lib_generic_unordered_lookup) && defined(__glibcxx_want_generic_unordered_lookup) */ +#undef __glibcxx_want_generic_unordered_lookup + +#if !defined(__cpp_lib_jthread) +# if (__cplusplus >= 202002L) && defined(_GLIBCXX_HAS_GTHREADS) && _GLIBCXX_HOSTED +# define __glibcxx_jthread 201911L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_jthread) +# define __cpp_lib_jthread 201911L +# endif +# endif +#endif /* !defined(__cpp_lib_jthread) && defined(__glibcxx_want_jthread) */ +#undef __glibcxx_want_jthread + +#if !defined(__cpp_lib_latch) +# if (__cplusplus >= 202002L) && (__glibcxx_atomic_wait) +# define __glibcxx_latch 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_latch) +# define __cpp_lib_latch 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_latch) && defined(__glibcxx_want_latch) */ +#undef __glibcxx_want_latch + +#if !defined(__cpp_lib_list_remove_return_type) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_list_remove_return_type 201806L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_list_remove_return_type) +# define __cpp_lib_list_remove_return_type 201806L +# endif +# endif +#endif /* !defined(__cpp_lib_list_remove_return_type) && defined(__glibcxx_want_list_remove_return_type) */ +#undef __glibcxx_want_list_remove_return_type + +#if !defined(__cpp_lib_polymorphic_allocator) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_polymorphic_allocator 201902L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_polymorphic_allocator) +# define __cpp_lib_polymorphic_allocator 201902L +# endif +# endif +#endif /* !defined(__cpp_lib_polymorphic_allocator) && defined(__glibcxx_want_polymorphic_allocator) */ +#undef __glibcxx_want_polymorphic_allocator + +#if !defined(__cpp_lib_move_iterator_concept) +# if (__cplusplus >= 202002L) && (__glibcxx_concepts) +# define __glibcxx_move_iterator_concept 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_move_iterator_concept) +# define __cpp_lib_move_iterator_concept 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_move_iterator_concept) && defined(__glibcxx_want_move_iterator_concept) */ +#undef __glibcxx_want_move_iterator_concept + +#if !defined(__cpp_lib_semaphore) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED && (__glibcxx_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE) +# define __glibcxx_semaphore 201907L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_semaphore) +# define __cpp_lib_semaphore 201907L +# endif +# endif +#endif /* !defined(__cpp_lib_semaphore) && defined(__glibcxx_want_semaphore) */ +#undef __glibcxx_want_semaphore + +#if !defined(__cpp_lib_smart_ptr_for_overwrite) +# if (__cplusplus >= 202002L) && _GLIBCXX_HOSTED +# define __glibcxx_smart_ptr_for_overwrite 202002L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_smart_ptr_for_overwrite) +# define __cpp_lib_smart_ptr_for_overwrite 202002L +# endif +# endif +#endif /* !defined(__cpp_lib_smart_ptr_for_overwrite) && defined(__glibcxx_want_smart_ptr_for_overwrite) */ +#undef __glibcxx_want_smart_ptr_for_overwrite + +#if !defined(__cpp_lib_syncbuf) +# if (__cplusplus >= 202002L) && _GLIBCXX_USE_CXX11_ABI && _GLIBCXX_HOSTED +# define __glibcxx_syncbuf 201803L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_syncbuf) +# define __cpp_lib_syncbuf 201803L +# endif +# endif +#endif /* !defined(__cpp_lib_syncbuf) && defined(__glibcxx_want_syncbuf) */ +#undef __glibcxx_want_syncbuf + +#if !defined(__cpp_lib_byteswap) +# if (__cplusplus >= 202100L) +# define __glibcxx_byteswap 202110L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_byteswap) +# define __cpp_lib_byteswap 202110L +# endif +# endif +#endif /* !defined(__cpp_lib_byteswap) && defined(__glibcxx_want_byteswap) */ +#undef __glibcxx_want_byteswap + +#if !defined(__cpp_lib_constexpr_charconv) +# if (__cplusplus >= 202100L) +# define __glibcxx_constexpr_charconv 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_charconv) +# define __cpp_lib_constexpr_charconv 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_charconv) && defined(__glibcxx_want_constexpr_charconv) */ +#undef __glibcxx_want_constexpr_charconv + +#if !defined(__cpp_lib_constexpr_typeinfo) +# if (__cplusplus >= 202100L) +# define __glibcxx_constexpr_typeinfo 202106L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_typeinfo) +# define __cpp_lib_constexpr_typeinfo 202106L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_typeinfo) && defined(__glibcxx_want_constexpr_typeinfo) */ +#undef __glibcxx_want_constexpr_typeinfo + +#if !defined(__cpp_lib_expected) +# if (__cplusplus >= 202100L) && (__cpp_concepts >= 202002L) +# define __glibcxx_expected 202211L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_expected) +# define __cpp_lib_expected 202211L +# endif +# endif +#endif /* !defined(__cpp_lib_expected) && defined(__glibcxx_want_expected) */ +#undef __glibcxx_want_expected + +#if !defined(__cpp_lib_format_ranges) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_format_ranges 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_format_ranges) +# define __cpp_lib_format_ranges 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_format_ranges) && defined(__glibcxx_want_format_ranges) */ +#undef __glibcxx_want_format_ranges + +#if !defined(__cpp_lib_freestanding_algorithm) +# if (__cplusplus >= 202100L) +# define __glibcxx_freestanding_algorithm 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_algorithm) +# define __cpp_lib_freestanding_algorithm 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_freestanding_algorithm) && defined(__glibcxx_want_freestanding_algorithm) */ +#undef __glibcxx_want_freestanding_algorithm + +#if !defined(__cpp_lib_freestanding_array) +# if (__cplusplus >= 202100L) +# define __glibcxx_freestanding_array 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_array) +# define __cpp_lib_freestanding_array 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_freestanding_array) && defined(__glibcxx_want_freestanding_array) */ +#undef __glibcxx_want_freestanding_array + +#if !defined(__cpp_lib_freestanding_cstring) +# if (__cplusplus >= 202100L) +# define __glibcxx_freestanding_cstring 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_cstring) +# define __cpp_lib_freestanding_cstring 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_freestanding_cstring) && defined(__glibcxx_want_freestanding_cstring) */ +#undef __glibcxx_want_freestanding_cstring + +#if !defined(__cpp_lib_freestanding_expected) +# if (__cplusplus >= 202100L) && (__cpp_lib_expected) +# define __glibcxx_freestanding_expected 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_expected) +# define __cpp_lib_freestanding_expected 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_freestanding_expected) && defined(__glibcxx_want_freestanding_expected) */ +#undef __glibcxx_want_freestanding_expected + +#if !defined(__cpp_lib_freestanding_optional) +# if (__cplusplus >= 202100L) +# define __glibcxx_freestanding_optional 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_optional) +# define __cpp_lib_freestanding_optional 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_freestanding_optional) && defined(__glibcxx_want_freestanding_optional) */ +#undef __glibcxx_want_freestanding_optional + +#if !defined(__cpp_lib_freestanding_string_view) +# if (__cplusplus >= 202100L) +# define __glibcxx_freestanding_string_view 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_string_view) +# define __cpp_lib_freestanding_string_view 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_freestanding_string_view) && defined(__glibcxx_want_freestanding_string_view) */ +#undef __glibcxx_want_freestanding_string_view + +#if !defined(__cpp_lib_freestanding_variant) +# if (__cplusplus >= 202100L) +# define __glibcxx_freestanding_variant 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_freestanding_variant) +# define __cpp_lib_freestanding_variant 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_freestanding_variant) && defined(__glibcxx_want_freestanding_variant) */ +#undef __glibcxx_want_freestanding_variant + +#if !defined(__cpp_lib_invoke_r) +# if (__cplusplus >= 202100L) +# define __glibcxx_invoke_r 202106L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_invoke_r) +# define __cpp_lib_invoke_r 202106L +# endif +# endif +#endif /* !defined(__cpp_lib_invoke_r) && defined(__glibcxx_want_invoke_r) */ +#undef __glibcxx_want_invoke_r + +#if !defined(__cpp_lib_is_scoped_enum) +# if (__cplusplus >= 202100L) +# define __glibcxx_is_scoped_enum 202011L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_scoped_enum) +# define __cpp_lib_is_scoped_enum 202011L +# endif +# endif +#endif /* !defined(__cpp_lib_is_scoped_enum) && defined(__glibcxx_want_is_scoped_enum) */ +#undef __glibcxx_want_is_scoped_enum + +#if !defined(__cpp_lib_reference_from_temporary) +# if (__cplusplus >= 202100L) && (__has_builtin(__reference_constructs_from_temporary) && __has_builtin(__reference_converts_from_temporary)) +# define __glibcxx_reference_from_temporary 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_reference_from_temporary) +# define __cpp_lib_reference_from_temporary 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_reference_from_temporary) && defined(__glibcxx_want_reference_from_temporary) */ +#undef __glibcxx_want_reference_from_temporary + +#if !defined(__cpp_lib_containers_ranges) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_containers_ranges 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_containers_ranges) +# define __cpp_lib_containers_ranges 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_containers_ranges) && defined(__glibcxx_want_containers_ranges) */ +#undef __glibcxx_want_containers_ranges + +#if !defined(__cpp_lib_ranges_to_container) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_ranges_to_container 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_to_container) +# define __cpp_lib_ranges_to_container 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_to_container) && defined(__glibcxx_want_ranges_to_container) */ +#undef __glibcxx_want_ranges_to_container + +#if !defined(__cpp_lib_ranges_zip) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_zip 202110L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_zip) +# define __cpp_lib_ranges_zip 202110L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_zip) && defined(__glibcxx_want_ranges_zip) */ +#undef __glibcxx_want_ranges_zip + +#if !defined(__cpp_lib_ranges_chunk) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_chunk 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_chunk) +# define __cpp_lib_ranges_chunk 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_chunk) && defined(__glibcxx_want_ranges_chunk) */ +#undef __glibcxx_want_ranges_chunk + +#if !defined(__cpp_lib_ranges_slide) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_slide 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_slide) +# define __cpp_lib_ranges_slide 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_slide) && defined(__glibcxx_want_ranges_slide) */ +#undef __glibcxx_want_ranges_slide + +#if !defined(__cpp_lib_ranges_chunk_by) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_chunk_by 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_chunk_by) +# define __cpp_lib_ranges_chunk_by 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_chunk_by) && defined(__glibcxx_want_ranges_chunk_by) */ +#undef __glibcxx_want_ranges_chunk_by + +#if !defined(__cpp_lib_ranges_join_with) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_join_with 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_join_with) +# define __cpp_lib_ranges_join_with 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_join_with) && defined(__glibcxx_want_ranges_join_with) */ +#undef __glibcxx_want_ranges_join_with + +#if !defined(__cpp_lib_ranges_repeat) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_repeat 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_repeat) +# define __cpp_lib_ranges_repeat 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_repeat) && defined(__glibcxx_want_ranges_repeat) */ +#undef __glibcxx_want_ranges_repeat + +#if !defined(__cpp_lib_ranges_stride) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_stride 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_stride) +# define __cpp_lib_ranges_stride 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_stride) && defined(__glibcxx_want_ranges_stride) */ +#undef __glibcxx_want_ranges_stride + +#if !defined(__cpp_lib_ranges_cartesian_product) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_cartesian_product 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_cartesian_product) +# define __cpp_lib_ranges_cartesian_product 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_cartesian_product) && defined(__glibcxx_want_ranges_cartesian_product) */ +#undef __glibcxx_want_ranges_cartesian_product + +#if !defined(__cpp_lib_ranges_as_rvalue) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_as_rvalue 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_as_rvalue) +# define __cpp_lib_ranges_as_rvalue 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_as_rvalue) && defined(__glibcxx_want_ranges_as_rvalue) */ +#undef __glibcxx_want_ranges_as_rvalue + +#if !defined(__cpp_lib_ranges_as_const) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_as_const 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_as_const) +# define __cpp_lib_ranges_as_const 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_as_const) && defined(__glibcxx_want_ranges_as_const) */ +#undef __glibcxx_want_ranges_as_const + +#if !defined(__cpp_lib_ranges_enumerate) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_enumerate 202302L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_enumerate) +# define __cpp_lib_ranges_enumerate 202302L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_enumerate) && defined(__glibcxx_want_ranges_enumerate) */ +#undef __glibcxx_want_ranges_enumerate + +#if !defined(__cpp_lib_ranges_fold) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_fold 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_fold) +# define __cpp_lib_ranges_fold 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_fold) && defined(__glibcxx_want_ranges_fold) */ +#undef __glibcxx_want_ranges_fold + +#if !defined(__cpp_lib_ranges_contains) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_contains 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_contains) +# define __cpp_lib_ranges_contains 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_contains) && defined(__glibcxx_want_ranges_contains) */ +#undef __glibcxx_want_ranges_contains + +#if !defined(__cpp_lib_ranges_iota) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_iota 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_iota) +# define __cpp_lib_ranges_iota 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_iota) && defined(__glibcxx_want_ranges_iota) */ +#undef __glibcxx_want_ranges_iota + +#if !defined(__cpp_lib_ranges_find_last) +# if (__cplusplus >= 202100L) +# define __glibcxx_ranges_find_last 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_find_last) +# define __cpp_lib_ranges_find_last 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_find_last) && defined(__glibcxx_want_ranges_find_last) */ +#undef __glibcxx_want_ranges_find_last + +#if !defined(__cpp_lib_constexpr_bitset) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED && (__cpp_constexpr_dynamic_alloc) +# define __glibcxx_constexpr_bitset 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_bitset) +# define __cpp_lib_constexpr_bitset 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_bitset) && defined(__glibcxx_want_constexpr_bitset) */ +#undef __glibcxx_want_constexpr_bitset + +#if !defined(__cpp_lib_stdatomic_h) +# if (__cplusplus >= 202100L) +# define __glibcxx_stdatomic_h 202011L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_stdatomic_h) +# define __cpp_lib_stdatomic_h 202011L +# endif +# endif +#endif /* !defined(__cpp_lib_stdatomic_h) && defined(__glibcxx_want_stdatomic_h) */ +#undef __glibcxx_want_stdatomic_h + +#if !defined(__cpp_lib_adaptor_iterator_pair_constructor) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_adaptor_iterator_pair_constructor 202106L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_adaptor_iterator_pair_constructor) +# define __cpp_lib_adaptor_iterator_pair_constructor 202106L +# endif +# endif +#endif /* !defined(__cpp_lib_adaptor_iterator_pair_constructor) && defined(__glibcxx_want_adaptor_iterator_pair_constructor) */ +#undef __glibcxx_want_adaptor_iterator_pair_constructor + +#if !defined(__cpp_lib_flat_map) +# if (__cplusplus >= 202100L) +# define __glibcxx_flat_map 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_flat_map) +# define __cpp_lib_flat_map 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_flat_map) && defined(__glibcxx_want_flat_map) */ +#undef __glibcxx_want_flat_map + +#if !defined(__cpp_lib_flat_set) +# if (__cplusplus >= 202100L) +# define __glibcxx_flat_set 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_flat_set) +# define __cpp_lib_flat_set 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_flat_set) && defined(__glibcxx_want_flat_set) */ +#undef __glibcxx_want_flat_set + +#if !defined(__cpp_lib_common_reference) +# if (__cplusplus >= 202002L) +# define __glibcxx_common_reference 202302L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_common_reference) +# define __cpp_lib_common_reference 202302L +# endif +# endif +#endif /* !defined(__cpp_lib_common_reference) && defined(__glibcxx_want_common_reference) */ +#undef __glibcxx_want_common_reference + +#if !defined(__cpp_lib_formatters) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_formatters 202302L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_formatters) +# define __cpp_lib_formatters 202302L +# endif +# endif +#endif /* !defined(__cpp_lib_formatters) && defined(__glibcxx_want_formatters) */ +#undef __glibcxx_want_formatters + +#if !defined(__cpp_lib_forward_like) +# if (__cplusplus >= 202100L) +# define __glibcxx_forward_like 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_forward_like) +# define __cpp_lib_forward_like 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_forward_like) && defined(__glibcxx_want_forward_like) */ +#undef __glibcxx_want_forward_like + +#if !defined(__cpp_lib_generator) +# if (__cplusplus >= 202100L) && (__glibcxx_coroutine && __cpp_sized_deallocation) +# define __glibcxx_generator 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_generator) +# define __cpp_lib_generator 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_generator) && defined(__glibcxx_want_generator) */ +#undef __glibcxx_want_generator + +#if !defined(__cpp_lib_ios_noreplace) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_ios_noreplace 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ios_noreplace) +# define __cpp_lib_ios_noreplace 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_ios_noreplace) && defined(__glibcxx_want_ios_noreplace) */ +#undef __glibcxx_want_ios_noreplace + +#if !defined(__cpp_lib_move_only_function) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_move_only_function 202110L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_move_only_function) +# define __cpp_lib_move_only_function 202110L +# endif +# endif +#endif /* !defined(__cpp_lib_move_only_function) && defined(__glibcxx_want_move_only_function) */ +#undef __glibcxx_want_move_only_function + +#if !defined(__cpp_lib_out_ptr) +# if (__cplusplus >= 202100L) +# define __glibcxx_out_ptr 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_out_ptr) +# define __cpp_lib_out_ptr 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_out_ptr) && defined(__glibcxx_want_out_ptr) */ +#undef __glibcxx_want_out_ptr + +#if !defined(__cpp_lib_print) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_print 202211L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_print) +# define __cpp_lib_print 202211L +# endif +# endif +#endif /* !defined(__cpp_lib_print) && defined(__glibcxx_want_print) */ +#undef __glibcxx_want_print + +#if !defined(__cpp_lib_spanstream) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED && (__glibcxx_span) +# define __glibcxx_spanstream 202106L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_spanstream) +# define __cpp_lib_spanstream 202106L +# endif +# endif +#endif /* !defined(__cpp_lib_spanstream) && defined(__glibcxx_want_spanstream) */ +#undef __glibcxx_want_spanstream + +#if !defined(__cpp_lib_stacktrace) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED && (_GLIBCXX_HAVE_STACKTRACE) +# define __glibcxx_stacktrace 202011L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_stacktrace) +# define __cpp_lib_stacktrace 202011L +# endif +# endif +#endif /* !defined(__cpp_lib_stacktrace) && defined(__glibcxx_want_stacktrace) */ +#undef __glibcxx_want_stacktrace + +#if !defined(__cpp_lib_string_contains) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_string_contains 202011L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_contains) +# define __cpp_lib_string_contains 202011L +# endif +# endif +#endif /* !defined(__cpp_lib_string_contains) && defined(__glibcxx_want_string_contains) */ +#undef __glibcxx_want_string_contains + +#if !defined(__cpp_lib_string_resize_and_overwrite) +# if (__cplusplus >= 202100L) && _GLIBCXX_HOSTED +# define __glibcxx_string_resize_and_overwrite 202110L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_string_resize_and_overwrite) +# define __cpp_lib_string_resize_and_overwrite 202110L +# endif +# endif +#endif /* !defined(__cpp_lib_string_resize_and_overwrite) && defined(__glibcxx_want_string_resize_and_overwrite) */ +#undef __glibcxx_want_string_resize_and_overwrite + +#if !defined(__cpp_lib_to_underlying) +# if (__cplusplus >= 202100L) +# define __glibcxx_to_underlying 202102L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_underlying) +# define __cpp_lib_to_underlying 202102L +# endif +# endif +#endif /* !defined(__cpp_lib_to_underlying) && defined(__glibcxx_want_to_underlying) */ +#undef __glibcxx_want_to_underlying + +#if !defined(__cpp_lib_tuple_like) +# if (__cplusplus > 202302L) && (__cpp_explicit_this_parameter >= 202110L) +# define __glibcxx_tuple_like 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuple_like) +# define __cpp_lib_tuple_like 202311L +# endif +# elif (__cplusplus >= 202100L) +# define __glibcxx_tuple_like 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_tuple_like) +# define __cpp_lib_tuple_like 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_tuple_like) && defined(__glibcxx_want_tuple_like) */ +#undef __glibcxx_want_tuple_like + +#if !defined(__cpp_lib_unreachable) +# if (__cplusplus >= 202100L) +# define __glibcxx_unreachable 202202L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_unreachable) +# define __cpp_lib_unreachable 202202L +# endif +# endif +#endif /* !defined(__cpp_lib_unreachable) && defined(__glibcxx_want_unreachable) */ +#undef __glibcxx_want_unreachable + +#if !defined(__cpp_lib_algorithm_default_value_type) +# if (__cplusplus > 202302L) +# define __glibcxx_algorithm_default_value_type 202403L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_algorithm_default_value_type) +# define __cpp_lib_algorithm_default_value_type 202403L +# endif +# endif +#endif /* !defined(__cpp_lib_algorithm_default_value_type) && defined(__glibcxx_want_algorithm_default_value_type) */ +#undef __glibcxx_want_algorithm_default_value_type + +#if !defined(__cpp_lib_constexpr_new) +# if (__cplusplus > 202302L) && (__cpp_constexpr >= 202406L) +# define __glibcxx_constexpr_new 202406L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_new) +# define __cpp_lib_constexpr_new 202406L +# endif +# endif +#endif /* !defined(__cpp_lib_constexpr_new) && defined(__glibcxx_want_constexpr_new) */ +#undef __glibcxx_want_constexpr_new + +#if !defined(__cpp_lib_fstream_native_handle) +# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED +# define __glibcxx_fstream_native_handle 202306L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_fstream_native_handle) +# define __cpp_lib_fstream_native_handle 202306L +# endif +# endif +#endif /* !defined(__cpp_lib_fstream_native_handle) && defined(__glibcxx_want_fstream_native_handle) */ +#undef __glibcxx_want_fstream_native_handle + +#if !defined(__cpp_lib_is_virtual_base_of) +# if (__cplusplus > 202302L) && (__has_builtin(__builtin_is_virtual_base_of)) +# define __glibcxx_is_virtual_base_of 202406L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_is_virtual_base_of) +# define __cpp_lib_is_virtual_base_of 202406L +# endif +# endif +#endif /* !defined(__cpp_lib_is_virtual_base_of) && defined(__glibcxx_want_is_virtual_base_of) */ +#undef __glibcxx_want_is_virtual_base_of + +#if !defined(__cpp_lib_ranges_cache_latest) +# if (__cplusplus > 202302L) +# define __glibcxx_ranges_cache_latest 202411L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_cache_latest) +# define __cpp_lib_ranges_cache_latest 202411L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_cache_latest) && defined(__glibcxx_want_ranges_cache_latest) */ +#undef __glibcxx_want_ranges_cache_latest + +#if !defined(__cpp_lib_ranges_concat) +# if (__cplusplus > 202302L) && (__cpp_pack_indexing) +# define __glibcxx_ranges_concat 202403L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_concat) +# define __cpp_lib_ranges_concat 202403L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_concat) && defined(__glibcxx_want_ranges_concat) */ +#undef __glibcxx_want_ranges_concat + +#if !defined(__cpp_lib_ratio) +# if (__cplusplus > 202302L) +# define __glibcxx_ratio 202306L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ratio) +# define __cpp_lib_ratio 202306L +# endif +# endif +#endif /* !defined(__cpp_lib_ratio) && defined(__glibcxx_want_ratio) */ +#undef __glibcxx_want_ratio + +#if !defined(__cpp_lib_reference_wrapper) +# if (__cplusplus > 202302L) +# define __glibcxx_reference_wrapper 202403L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_reference_wrapper) +# define __cpp_lib_reference_wrapper 202403L +# endif +# endif +#endif /* !defined(__cpp_lib_reference_wrapper) && defined(__glibcxx_want_reference_wrapper) */ +#undef __glibcxx_want_reference_wrapper + +#if !defined(__cpp_lib_saturation_arithmetic) +# if (__cplusplus > 202302L) +# define __glibcxx_saturation_arithmetic 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_saturation_arithmetic) +# define __cpp_lib_saturation_arithmetic 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_saturation_arithmetic) && defined(__glibcxx_want_saturation_arithmetic) */ +#undef __glibcxx_want_saturation_arithmetic + +#if !defined(__cpp_lib_span_initializer_list) +# if (__cplusplus > 202302L) +# define __glibcxx_span_initializer_list 202311L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_span_initializer_list) +# define __cpp_lib_span_initializer_list 202311L +# endif +# endif +#endif /* !defined(__cpp_lib_span_initializer_list) && defined(__glibcxx_want_span_initializer_list) */ +#undef __glibcxx_want_span_initializer_list + +#if !defined(__cpp_lib_text_encoding) +# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED && (_GLIBCXX_USE_NL_LANGINFO_L) +# define __glibcxx_text_encoding 202306L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_text_encoding) +# define __cpp_lib_text_encoding 202306L +# endif +# endif +#endif /* !defined(__cpp_lib_text_encoding) && defined(__glibcxx_want_text_encoding) */ +#undef __glibcxx_want_text_encoding + +#if !defined(__cpp_lib_ranges_to_input) +# if (__cplusplus > 202302L) +# define __glibcxx_ranges_to_input 202502L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_to_input) +# define __cpp_lib_ranges_to_input 202502L +# endif +# endif +#endif /* !defined(__cpp_lib_ranges_to_input) && defined(__glibcxx_want_ranges_to_input) */ +#undef __glibcxx_want_ranges_to_input + +#if !defined(__cpp_lib_to_string) +# if (__cplusplus > 202302L) && _GLIBCXX_HOSTED && (__glibcxx_to_chars) +# define __glibcxx_to_string 202306L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_to_string) +# define __cpp_lib_to_string 202306L +# endif +# endif +#endif /* !defined(__cpp_lib_to_string) && defined(__glibcxx_want_to_string) */ +#undef __glibcxx_want_to_string + +#if !defined(__cpp_lib_modules) +# if (__cplusplus >= 202002L) && (__cpp_modules) +# define __glibcxx_modules 202207L +# if defined(__glibcxx_want_all) || defined(__glibcxx_want_modules) +# define __cpp_lib_modules 202207L +# endif +# endif +#endif /* !defined(__cpp_lib_modules) && defined(__glibcxx_want_modules) */ +#undef __glibcxx_want_modules + +#undef __glibcxx_want_all diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@version.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@version.h.blob new file mode 100644 index 0000000..a00ae5c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@bits@version.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cctype b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cctype new file mode 100644 index 0000000..d569bb4 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cctype @@ -0,0 +1,96 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/cctype + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c ctype.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: +// + +#ifndef _GLIBCXX_CCTYPE +#define _GLIBCXX_CCTYPE 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef isalnum +#undef isalpha +#undef iscntrl +#undef isdigit +#undef isgraph +#undef islower +#undef isprint +#undef ispunct +#undef isspace +#undef isupper +#undef isxdigit +#undef tolower +#undef toupper + +namespace std +{ + using ::isalnum; + using ::isalpha; + using ::iscntrl; + using ::isdigit; + using ::isgraph; + using ::islower; + using ::isprint; + using ::ispunct; + using ::isspace; + using ::isupper; + using ::isxdigit; + using ::tolower; + using ::toupper; +} // namespace std + +#if __cplusplus >= 201103L + +#ifdef _GLIBCXX_USE_C99_CTYPE + +#undef isblank + +namespace std +{ + using ::isblank; +} // namespace std + +#endif // _GLIBCXX_USE_C99_CTYPE + +#endif // C++11 + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cctype.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cctype.blob new file mode 100644 index 0000000..ea84786 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cctype.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cerrno b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cerrno new file mode 100644 index 0000000..ef8d9b1 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cerrno @@ -0,0 +1,54 @@ +// The -*- C++ -*- forwarding header. + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file cerrno + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c errno.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 19.3 Error numbers +// + +#ifndef _GLIBCXX_CERRNO +#define _GLIBCXX_CERRNO 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 +#ifndef errno +#define errno errno +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cerrno.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cerrno.blob new file mode 100644 index 0000000..dc4a1b6 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cerrno.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@clocale b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@clocale new file mode 100644 index 0000000..fd30f17 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@clocale @@ -0,0 +1,60 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file clocale + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c locale.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 18.2.2 Implementation properties: C library +// + +#ifndef _GLIBCXX_CLOCALE +#define _GLIBCXX_CLOCALE 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef setlocale +#undef localeconv + +namespace std +{ + using ::lconv; + using ::setlocale; + using ::localeconv; +} // namespace std + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@clocale.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@clocale.blob new file mode 100644 index 0000000..d9e3766 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@clocale.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@codecvt b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@codecvt new file mode 100644 index 0000000..20e54ef --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@codecvt @@ -0,0 +1,179 @@ +// -*- C++ -*- + +// Copyright (C) 2015-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// ISO C++ 14882: 22.5 Standard code conversion facets + +/** @file include/codecvt + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_CODECVT +#define _GLIBCXX_CODECVT 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus < 201103L +# include +#else + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + enum codecvt_mode + { + consume_header = 4, + generate_header = 2, + little_endian = 1 + }; + + template + class codecvt_utf8 : public codecvt<_Elem, char, mbstate_t> + { + public: + explicit + codecvt_utf8(size_t __refs = 0); + + ~codecvt_utf8(); + }; + + template + class codecvt_utf16 : public codecvt<_Elem, char, mbstate_t> + { + public: + explicit + codecvt_utf16(size_t __refs = 0); + + ~codecvt_utf16(); + }; + + template + class codecvt_utf8_utf16 : public codecvt<_Elem, char, mbstate_t> + { + public: + explicit + codecvt_utf8_utf16(size_t __refs = 0); + + ~codecvt_utf8_utf16(); + }; + +#define _GLIBCXX_CODECVT_SPECIALIZATION2(_NAME, _ELEM) \ + template<> \ + class _NAME<_ELEM> \ + : public codecvt<_ELEM, char, mbstate_t> \ + { \ + public: \ + typedef _ELEM intern_type; \ + typedef char extern_type; \ + typedef mbstate_t state_type; \ + \ + protected: \ + _NAME(unsigned long __maxcode, codecvt_mode __mode, size_t __refs) \ + : codecvt(__refs), _M_maxcode(__maxcode), _M_mode(__mode) { } \ + \ + virtual \ + ~_NAME(); \ + \ + virtual result \ + do_out(state_type& __state, const intern_type* __from, \ + const intern_type* __from_end, const intern_type*& __from_next, \ + extern_type* __to, extern_type* __to_end, \ + extern_type*& __to_next) const; \ + \ + virtual result \ + do_unshift(state_type& __state, \ + extern_type* __to, extern_type* __to_end, \ + extern_type*& __to_next) const; \ + \ + virtual result \ + do_in(state_type& __state, \ + const extern_type* __from, const extern_type* __from_end, \ + const extern_type*& __from_next, \ + intern_type* __to, intern_type* __to_end, \ + intern_type*& __to_next) const; \ + \ + virtual \ + int do_encoding() const throw(); \ + \ + virtual \ + bool do_always_noconv() const throw(); \ + \ + virtual \ + int do_length(state_type&, const extern_type* __from, \ + const extern_type* __end, size_t __max) const; \ + \ + virtual int \ + do_max_length() const throw(); \ + \ + private: \ + unsigned long _M_maxcode; \ + codecvt_mode _M_mode; \ + } + +#define _GLIBCXX_CODECVT_SPECIALIZATION(_NAME, _ELEM) \ + _GLIBCXX_CODECVT_SPECIALIZATION2(__ ## _NAME ## _base, _ELEM); \ + template \ + class _NAME<_ELEM, _Maxcode, _Mode> \ + : public __ ## _NAME ## _base<_ELEM> \ + { \ + public: \ + explicit \ + _NAME(size_t __refs = 0) \ + : __ ## _NAME ## _base<_ELEM>(std::min(_Maxcode, 0x10fffful), \ + _Mode, __refs) \ + { } \ + } + + template class __codecvt_utf8_base; + template class __codecvt_utf16_base; + template class __codecvt_utf8_utf16_base; + + _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8, char16_t); + _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf16, char16_t); + _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8_utf16, char16_t); + + _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8, char32_t); + _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf16, char32_t); + _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8_utf16, char32_t); + +#ifdef _GLIBCXX_USE_WCHAR_T + _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8, wchar_t); + _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf16, wchar_t); + _GLIBCXX_CODECVT_SPECIALIZATION(codecvt_utf8_utf16, wchar_t); +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // C++11 + +#endif /* _GLIBCXX_CODECVT */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@codecvt.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@codecvt.blob new file mode 100644 index 0000000..6ccf438 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@codecvt.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@concepts b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@concepts new file mode 100644 index 0000000..b60b52b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@concepts @@ -0,0 +1,407 @@ +// -*- C++ -*- + +// Copyright (C) 2019-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/concepts + * This is a Standard C++ Library header. + * @ingroup concepts + */ + +#ifndef _GLIBCXX_CONCEPTS +#define _GLIBCXX_CONCEPTS 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#define __glibcxx_want_concepts +#include + +#ifdef __cpp_lib_concepts // C++ >= 20 && concepts +/** + * @defgroup concepts Concepts + * @ingroup utilities + * + * Concepts for checking type requirements. + */ + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // [concepts.lang], language-related concepts + + namespace __detail + { + template + concept __same_as = std::is_same_v<_Tp, _Up>; + } // namespace __detail + + /// [concept.same], concept same_as + template + concept same_as + = __detail::__same_as<_Tp, _Up> && __detail::__same_as<_Up, _Tp>; + + namespace __detail + { + template + concept __different_from + = !same_as, remove_cvref_t<_Up>>; + } // namespace __detail + + /// [concept.derived], concept derived_from + template + concept derived_from = __is_base_of(_Base, _Derived) + && is_convertible_v; + + /// [concept.convertible], concept convertible_to + template + concept convertible_to = is_convertible_v<_From, _To> + && requires { static_cast<_To>(std::declval<_From>()); }; + + /// [concept.commonref], concept common_reference_with + template + concept common_reference_with + = same_as, common_reference_t<_Up, _Tp>> + && convertible_to<_Tp, common_reference_t<_Tp, _Up>> + && convertible_to<_Up, common_reference_t<_Tp, _Up>>; + + /// [concept.common], concept common_with + template + concept common_with + = same_as, common_type_t<_Up, _Tp>> + && requires { + static_cast>(std::declval<_Tp>()); + static_cast>(std::declval<_Up>()); + } + && common_reference_with, + add_lvalue_reference_t> + && common_reference_with>, + common_reference_t< + add_lvalue_reference_t, + add_lvalue_reference_t>>; + + // [concepts.arithmetic], arithmetic concepts + + template + concept integral = is_integral_v<_Tp>; + + template + concept signed_integral = integral<_Tp> && is_signed_v<_Tp>; + + template + concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>; + + template + concept floating_point = is_floating_point_v<_Tp>; + + namespace __detail + { + template + using __cref = const remove_reference_t<_Tp>&; + + template + concept __class_or_enum + = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>; + + template + constexpr bool __destructible_impl = false; + template + requires requires(_Tp& __t) { { __t.~_Tp() } noexcept; } + constexpr bool __destructible_impl<_Tp> = true; + + template + constexpr bool __destructible = __destructible_impl<_Tp>; + template + constexpr bool __destructible<_Tp&> = true; + template + constexpr bool __destructible<_Tp&&> = true; + template + constexpr bool __destructible<_Tp[_Nm]> = __destructible<_Tp>; + + } // namespace __detail + + /// [concept.assignable], concept assignable_from + template + concept assignable_from + = is_lvalue_reference_v<_Lhs> + && common_reference_with<__detail::__cref<_Lhs>, __detail::__cref<_Rhs>> + && requires(_Lhs __lhs, _Rhs&& __rhs) { + { __lhs = static_cast<_Rhs&&>(__rhs) } -> same_as<_Lhs>; + }; + + /// [concept.destructible], concept destructible + template + concept destructible = __detail::__destructible<_Tp>; + + /// [concept.constructible], concept constructible_from + template + concept constructible_from + = destructible<_Tp> && is_constructible_v<_Tp, _Args...>; + + /// [concept.defaultinitializable], concept default_initializable + template + concept default_initializable = constructible_from<_Tp> + && requires + { + _Tp{}; + (void) ::new _Tp; + }; + + /// [concept.moveconstructible], concept move_constructible + template + concept move_constructible + = constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>; + + /// [concept.copyconstructible], concept copy_constructible + template + concept copy_constructible + = move_constructible<_Tp> + && constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> + && constructible_from<_Tp, const _Tp&> && convertible_to + && constructible_from<_Tp, const _Tp> && convertible_to; + + // [concept.swappable], concept swappable + + namespace ranges + { + /// @cond undocumented + namespace __swap + { + template void swap(_Tp&, _Tp&) = delete; + + template + concept __adl_swap + = (std::__detail::__class_or_enum> + || std::__detail::__class_or_enum>) + && requires(_Tp&& __t, _Up&& __u) { + swap(static_cast<_Tp&&>(__t), static_cast<_Up&&>(__u)); + }; + + struct _Swap + { + private: + template + static constexpr bool + _S_noexcept() + { + if constexpr (__adl_swap<_Tp, _Up>) + return noexcept(swap(std::declval<_Tp>(), std::declval<_Up>())); + else + return is_nothrow_move_constructible_v> + && is_nothrow_move_assignable_v>; + } + + public: + template + requires __adl_swap<_Tp, _Up> + || (same_as<_Tp, _Up> && is_lvalue_reference_v<_Tp> + && move_constructible> + && assignable_from<_Tp, remove_reference_t<_Tp>>) + constexpr void + operator()(_Tp&& __t, _Up&& __u) const + noexcept(_S_noexcept<_Tp, _Up>()) + { + if constexpr (__adl_swap<_Tp, _Up>) + swap(static_cast<_Tp&&>(__t), static_cast<_Up&&>(__u)); + else + { + auto __tmp = static_cast&&>(__t); + __t = static_cast&&>(__u); + __u = static_cast&&>(__tmp); + } + } + + template + requires requires(const _Swap& __swap, _Tp& __e1, _Up& __e2) { + __swap(__e1, __e2); + } + constexpr void + operator()(_Tp (&__e1)[_Num], _Up (&__e2)[_Num]) const + noexcept(noexcept(std::declval()(*__e1, *__e2))) + { + for (size_t __n = 0; __n < _Num; ++__n) + (*this)(__e1[__n], __e2[__n]); + } + }; + } // namespace __swap + /// @endcond + + inline namespace _Cpo { + inline constexpr __swap::_Swap swap{}; + } + } // namespace ranges + + template + concept swappable + = requires(_Tp& __a, _Tp& __b) { ranges::swap(__a, __b); }; + + template + concept swappable_with = common_reference_with<_Tp, _Up> + && requires(_Tp&& __t, _Up&& __u) { + ranges::swap(static_cast<_Tp&&>(__t), static_cast<_Tp&&>(__t)); + ranges::swap(static_cast<_Up&&>(__u), static_cast<_Up&&>(__u)); + ranges::swap(static_cast<_Tp&&>(__t), static_cast<_Up&&>(__u)); + ranges::swap(static_cast<_Up&&>(__u), static_cast<_Tp&&>(__t)); + }; + + // [concepts.object], Object concepts + + template + concept movable = is_object_v<_Tp> && move_constructible<_Tp> + && assignable_from<_Tp&, _Tp> && swappable<_Tp>; + + template + concept copyable = copy_constructible<_Tp> && movable<_Tp> + && assignable_from<_Tp&, _Tp&> && assignable_from<_Tp&, const _Tp&> + && assignable_from<_Tp&, const _Tp>; + + template + concept semiregular = copyable<_Tp> && default_initializable<_Tp>; + + // [concepts.compare], comparison concepts + + // [concept.booleantestable], Boolean testability + namespace __detail + { + template + concept __boolean_testable_impl = convertible_to<_Tp, bool>; + + template + concept __boolean_testable + = __boolean_testable_impl<_Tp> + && requires(_Tp&& __t) + { { !static_cast<_Tp&&>(__t) } -> __boolean_testable_impl; }; + } // namespace __detail + + // [concept.equalitycomparable], concept equality_comparable + + namespace __detail + { + template + concept __weakly_eq_cmp_with + = requires(__detail::__cref<_Tp> __t, __detail::__cref<_Up> __u) { + { __t == __u } -> __boolean_testable; + { __t != __u } -> __boolean_testable; + { __u == __t } -> __boolean_testable; + { __u != __t } -> __boolean_testable; + }; + } // namespace __detail + + template + concept equality_comparable = __detail::__weakly_eq_cmp_with<_Tp, _Tp>; + + template + concept equality_comparable_with + = equality_comparable<_Tp> && equality_comparable<_Up> + && common_reference_with<__detail::__cref<_Tp>, __detail::__cref<_Up>> + && equality_comparable, + __detail::__cref<_Up>>> + && __detail::__weakly_eq_cmp_with<_Tp, _Up>; + + namespace __detail + { + template + concept __partially_ordered_with + = requires(const remove_reference_t<_Tp>& __t, + const remove_reference_t<_Up>& __u) { + { __t < __u } -> __boolean_testable; + { __t > __u } -> __boolean_testable; + { __t <= __u } -> __boolean_testable; + { __t >= __u } -> __boolean_testable; + { __u < __t } -> __boolean_testable; + { __u > __t } -> __boolean_testable; + { __u <= __t } -> __boolean_testable; + { __u >= __t } -> __boolean_testable; + }; + } // namespace __detail + + // [concept.totallyordered], concept totally_ordered + template + concept totally_ordered + = equality_comparable<_Tp> + && __detail::__partially_ordered_with<_Tp, _Tp>; + + template + concept totally_ordered_with + = totally_ordered<_Tp> && totally_ordered<_Up> + && equality_comparable_with<_Tp, _Up> + && totally_ordered, + __detail::__cref<_Up>>> + && __detail::__partially_ordered_with<_Tp, _Up>; + + template + concept regular = semiregular<_Tp> && equality_comparable<_Tp>; + + // [concepts.callable], callable concepts + + /// [concept.invocable], concept invocable + template + concept invocable = is_invocable_v<_Fn, _Args...>; + + /// [concept.regularinvocable], concept regular_invocable + template + concept regular_invocable = invocable<_Fn, _Args...>; + + /// [concept.predicate], concept predicate + template + concept predicate = regular_invocable<_Fn, _Args...> + && __detail::__boolean_testable>; + + /// [concept.relation], concept relation + template + concept relation + = predicate<_Rel, _Tp, _Tp> && predicate<_Rel, _Up, _Up> + && predicate<_Rel, _Tp, _Up> && predicate<_Rel, _Up, _Tp>; + + /// [concept.equiv], concept equivalence_relation + template + concept equivalence_relation = relation<_Rel, _Tp, _Up>; + + /// [concept.strictweakorder], concept strict_weak_order + template + concept strict_weak_order = relation<_Rel, _Tp, _Up>; + + namespace __detail + { + // operator<=> are automatically reversed, so we need to consider + // both directions if types are different. + template + concept __not_overloaded_spaceship + = ! requires(_Tp&& __t, _Up&& __u) + { operator<=>(static_cast<_Tp&&>(__t), static_cast<_Up&&>(__u)); } + && ! requires(_Tp&& __t, _Up&& __u) + { static_cast<_Tp&&>(__t).operator<=>(static_cast<_Up&&>(__u)); } + && (is_same_v<_Tp, _Up> + || (! requires(_Tp&& __t, _Up&& __u) + { operator<=>(static_cast<_Up&&>(__u), static_cast<_Tp&&>(__t)); } + && ! requires(_Tp&& __t, _Up&& __u) + { static_cast<_Up&&>(__u).operator<=>(static_cast<_Tp&&>(__t)); })); + } +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +#endif // __cpp_lib_concepts + +#endif /* _GLIBCXX_CONCEPTS */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@concepts.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@concepts.blob new file mode 100644 index 0000000..c9dbd74 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@concepts.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstddef b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstddef new file mode 100644 index 0000000..35fe21f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstddef @@ -0,0 +1,199 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file cstddef + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c stddef.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 18.1 Types +// + +#ifndef _GLIBCXX_CSTDDEF +#define _GLIBCXX_CSTDDEF 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#undef __need_wchar_t +#undef __need_ptrdiff_t +#undef __need_size_t +#undef __need_NULL +#undef __need_wint_t +#include +#include + +#define __glibcxx_want_byte +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" // __int128 + +extern "C++" +{ +#if __cplusplus >= 201103L +namespace std +{ + // We handle size_t, ptrdiff_t, and nullptr_t in c++config.h. + using ::max_align_t; +} +#endif // C++11 + +#ifdef __cpp_lib_byte // C++ >= 17 +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + /// std::byte + enum class byte : unsigned char {}; + + template struct __byte_operand { }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; +#ifdef _GLIBCXX_USE_CHAR8_T + template<> struct __byte_operand { using __type = byte; }; +#endif + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; + template<> struct __byte_operand { using __type = byte; }; +#if defined(__GLIBCXX_TYPE_INT_N_0) + template<> struct __byte_operand<__GLIBCXX_TYPE_INT_N_0> + { using __type = byte; }; + template<> struct __byte_operand + { using __type = byte; }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_1) + template<> struct __byte_operand<__GLIBCXX_TYPE_INT_N_1> + { using __type = byte; }; + template<> struct __byte_operand + { using __type = byte; }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_2) + template<> struct __byte_operand<__GLIBCXX_TYPE_INT_N_2> + { using __type = byte; }; + template<> struct __byte_operand + { using __type = byte; }; +#endif + template + struct __byte_operand + : __byte_operand<_IntegerType> { }; + template + struct __byte_operand + : __byte_operand<_IntegerType> { }; + template + struct __byte_operand + : __byte_operand<_IntegerType> { }; + + template + using __byte_op_t = typename __byte_operand<_IntegerType>::__type; + + template + [[__gnu__::__always_inline__]] + constexpr __byte_op_t<_IntegerType> + operator<<(byte __b, _IntegerType __shift) noexcept + { return (byte)(unsigned char)((unsigned)__b << __shift); } + + template + [[__gnu__::__always_inline__]] + constexpr __byte_op_t<_IntegerType> + operator>>(byte __b, _IntegerType __shift) noexcept + { return (byte)(unsigned char)((unsigned)__b >> __shift); } + + [[__gnu__::__always_inline__]] + constexpr byte + operator|(byte __l, byte __r) noexcept + { return (byte)(unsigned char)((unsigned)__l | (unsigned)__r); } + + [[__gnu__::__always_inline__]] + constexpr byte + operator&(byte __l, byte __r) noexcept + { return (byte)(unsigned char)((unsigned)__l & (unsigned)__r); } + + [[__gnu__::__always_inline__]] + constexpr byte + operator^(byte __l, byte __r) noexcept + { return (byte)(unsigned char)((unsigned)__l ^ (unsigned)__r); } + + [[__gnu__::__always_inline__]] + constexpr byte + operator~(byte __b) noexcept + { return (byte)(unsigned char)~(unsigned)__b; } + + template + [[__gnu__::__always_inline__]] + constexpr __byte_op_t<_IntegerType>& + operator<<=(byte& __b, _IntegerType __shift) noexcept + { return __b = __b << __shift; } + + template + [[__gnu__::__always_inline__]] + constexpr __byte_op_t<_IntegerType>& + operator>>=(byte& __b, _IntegerType __shift) noexcept + { return __b = __b >> __shift; } + + [[__gnu__::__always_inline__]] + constexpr byte& + operator|=(byte& __l, byte __r) noexcept + { return __l = __l | __r; } + + [[__gnu__::__always_inline__]] + constexpr byte& + operator&=(byte& __l, byte __r) noexcept + { return __l = __l & __r; } + + [[__gnu__::__always_inline__]] + constexpr byte& + operator^=(byte& __l, byte __r) noexcept + { return __l = __l ^ __r; } + + template + [[nodiscard,__gnu__::__always_inline__]] + constexpr _IntegerType + to_integer(__byte_op_t<_IntegerType> __b) noexcept + { return _IntegerType(__b); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // __cpp_lib_byte +} // extern "C++" + +#pragma GCC diagnostic pop + +#endif // _GLIBCXX_CSTDDEF diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstddef.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstddef.blob new file mode 100644 index 0000000..adcd499 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstddef.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdint b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdint new file mode 100644 index 0000000..1c81d0c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdint @@ -0,0 +1,148 @@ +// -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/cstdint + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_CSTDINT +#define _GLIBCXX_CSTDINT 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus < 201103L +# include +#else + +#include + +#if ! _GLIBCXX_HOSTED && __has_include() +// For --disable-hosted-libstdcxx we want GCC's own stdint-gcc.h header +// even when -ffreestanding isn't used. +# include +#elif __has_include() +# include +#endif + +namespace std +{ +#ifdef _GLIBCXX_USE_C99_STDINT + using ::int8_t; + using ::int16_t; + using ::int32_t; + using ::int64_t; + + using ::int_fast8_t; + using ::int_fast16_t; + using ::int_fast32_t; + using ::int_fast64_t; + + using ::int_least8_t; + using ::int_least16_t; + using ::int_least32_t; + using ::int_least64_t; + + using ::intmax_t; + using ::intptr_t; + + using ::uint8_t; + using ::uint16_t; + using ::uint32_t; + using ::uint64_t; + + using ::uint_fast8_t; + using ::uint_fast16_t; + using ::uint_fast32_t; + using ::uint_fast64_t; + + using ::uint_least8_t; + using ::uint_least16_t; + using ::uint_least32_t; + using ::uint_least64_t; + + using ::uintmax_t; + using ::uintptr_t; +#else // !_GLIBCXX_USE_C99_STDINT + + using intmax_t = __INTMAX_TYPE__; + using uintmax_t = __UINTMAX_TYPE__; + +#ifdef __INT8_TYPE__ + using int8_t = __INT8_TYPE__; +#endif +#ifdef __INT16_TYPE__ + using int16_t = __INT16_TYPE__; +#endif +#ifdef __INT32_TYPE__ + using int32_t = __INT32_TYPE__; +#endif +#ifdef __INT64_TYPE__ + using int64_t = __INT64_TYPE__; +#endif + + using int_least8_t = __INT_LEAST8_TYPE__; + using int_least16_t = __INT_LEAST16_TYPE__; + using int_least32_t = __INT_LEAST32_TYPE__; + using int_least64_t = __INT_LEAST64_TYPE__; + using int_fast8_t = __INT_FAST8_TYPE__; + using int_fast16_t = __INT_FAST16_TYPE__; + using int_fast32_t = __INT_FAST32_TYPE__; + using int_fast64_t = __INT_FAST64_TYPE__; + +#ifdef __INTPTR_TYPE__ + using intptr_t = __INTPTR_TYPE__; +#endif + +#ifdef __UINT8_TYPE__ + using uint8_t = __UINT8_TYPE__; +#endif +#ifdef __UINT16_TYPE__ + using uint16_t = __UINT16_TYPE__; +#endif +#ifdef __UINT32_TYPE__ + using uint32_t = __UINT32_TYPE__; +#endif +#ifdef __UINT64_TYPE__ + using uint64_t = __UINT64_TYPE__; +#endif + using uint_least8_t = __UINT_LEAST8_TYPE__; + using uint_least16_t = __UINT_LEAST16_TYPE__; + using uint_least32_t = __UINT_LEAST32_TYPE__; + using uint_least64_t = __UINT_LEAST64_TYPE__; + using uint_fast8_t = __UINT_FAST8_TYPE__; + using uint_fast16_t = __UINT_FAST16_TYPE__; + using uint_fast32_t = __UINT_FAST32_TYPE__; + using uint_fast64_t = __UINT_FAST64_TYPE__; +#ifdef __UINTPTR_TYPE__ + using uintptr_t = __UINTPTR_TYPE__; +#endif + +#endif // _GLIBCXX_USE_C99_STDINT +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_CSTDINT diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdint.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdint.blob new file mode 100644 index 0000000..85508d5 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdint.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdio b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdio new file mode 100644 index 0000000..8d4aa8b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdio @@ -0,0 +1,196 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/cstdio + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c stdio.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 27.8.2 C Library files +// + +#ifndef _GLIBCXX_CSTDIO +#define _GLIBCXX_CSTDIO 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +#if __cplusplus <= 201103L && !defined(_GLIBCXX_HAVE_GETS) +extern "C" char* gets (char* __s) __attribute__((__deprecated__)); +#endif + +// Get rid of those macros defined in in lieu of real functions. +#undef clearerr +#undef fclose +#undef feof +#undef ferror +#undef fflush +#undef fgetc +#undef fgetpos +#undef fgets +#undef fopen +#undef fprintf +#undef fputc +#undef fputs +#undef fread +#undef freopen +#undef fscanf +#undef fseek +#undef fsetpos +#undef ftell +#undef fwrite +#undef getc +#undef getchar +#if __cplusplus <= 201103L +# undef gets +#endif +#undef perror +#undef printf +#undef putc +#undef putchar +#undef puts +#undef remove +#undef rename +#undef rewind +#undef scanf +#undef setbuf +#undef setvbuf +#undef sprintf +#undef sscanf +#undef tmpfile +#undef tmpnam +#undef ungetc +#undef vfprintf +#undef vprintf +#undef vsprintf + +namespace std +{ + using ::FILE; + using ::fpos_t; + + using ::clearerr; + using ::fclose; + using ::feof; + using ::ferror; + using ::fflush; + using ::fgetc; + using ::fgetpos; + using ::fgets; + using ::fopen; + using ::fprintf; + using ::fputc; + using ::fputs; + using ::fread; + using ::freopen; + using ::fscanf; + using ::fseek; + using ::fsetpos; + using ::ftell; + using ::fwrite; + using ::getc; + using ::getchar; +#if __cplusplus <= 201103L + // LWG 2249 + using ::gets; +#endif + using ::perror; + using ::printf; + using ::putc; + using ::putchar; + using ::puts; + using ::remove; + using ::rename; + using ::rewind; + using ::scanf; + using ::setbuf; + using ::setvbuf; + using ::sprintf; + using ::sscanf; + using ::tmpfile; +#if _GLIBCXX_USE_TMPNAM + using ::tmpnam; +#endif + using ::ungetc; + using ::vfprintf; + using ::vprintf; + using ::vsprintf; +} // namespace + +#if _GLIBCXX_USE_C99_STDIO + +#undef snprintf +#undef vfscanf +#undef vscanf +#undef vsnprintf +#undef vsscanf + +namespace __gnu_cxx +{ +#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC + extern "C" int + (snprintf)(char * __restrict, std::size_t, const char * __restrict, ...) + throw (); + extern "C" int + (vfscanf)(FILE * __restrict, const char * __restrict, __gnuc_va_list); + extern "C" int (vscanf)(const char * __restrict, __gnuc_va_list); + extern "C" int + (vsnprintf)(char * __restrict, std::size_t, const char * __restrict, + __gnuc_va_list) throw (); + extern "C" int + (vsscanf)(const char * __restrict, const char * __restrict, __gnuc_va_list) + throw (); +#endif + +#if !_GLIBCXX_USE_C99_DYNAMIC + using ::snprintf; + using ::vfscanf; + using ::vscanf; + using ::vsnprintf; + using ::vsscanf; +#endif +} // namespace __gnu_cxx + +namespace std +{ + using ::__gnu_cxx::snprintf; + using ::__gnu_cxx::vfscanf; + using ::__gnu_cxx::vscanf; + using ::__gnu_cxx::vsnprintf; + using ::__gnu_cxx::vsscanf; +} // namespace std + +#endif // _GLIBCXX_USE_C99_STDIO + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdio.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdio.blob new file mode 100644 index 0000000..4814330 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdio.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdlib b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdlib new file mode 100644 index 0000000..ced9247 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdlib @@ -0,0 +1,288 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/cstdlib + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c stdlib.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSTDLIB +#define _GLIBCXX_CSTDLIB 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#if !_GLIBCXX_HOSTED +// The C standard does not require a freestanding implementation to +// provide . However, the C++ standard does still require +// -- but only the functionality mentioned in +// [lib.support.start.term]. + +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 +#define NULL __null + +namespace std +{ + extern "C" void abort(void) _GLIBCXX_NOTHROW _GLIBCXX_NORETURN; + extern "C" int atexit(void (*)(void)) _GLIBCXX_NOTHROW; + extern "C" void exit(int) _GLIBCXX_NOTHROW _GLIBCXX_NORETURN; +#if __cplusplus >= 201103L +# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT + extern "C" int at_quick_exit(void (*)(void)) _GLIBCXX_NOTHROW; +# endif +# ifdef _GLIBCXX_HAVE_QUICK_EXIT + extern "C" void quick_exit(int) _GLIBCXX_NOTHROW _GLIBCXX_NORETURN; +# endif +#if _GLIBCXX_USE_C99_STDLIB + extern "C" void _Exit(int) _GLIBCXX_NOTHROW _GLIBCXX_NORETURN; +#endif +#endif +} // namespace std + +#else + +// Need to ensure this finds the C library's not a libstdc++ +// wrapper that might already be installed later in the include search path. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" // include_next +#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +#include_next +#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS +#pragma GCC diagnostic pop + +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef abort +#if __cplusplus >= 201703L && defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) +# undef aligned_alloc +#endif +#undef atexit +#if __cplusplus >= 201103L +# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT +# undef at_quick_exit +# endif +#endif +#undef atof +#undef atoi +#undef atol +#undef bsearch +#undef calloc +#undef div +#undef exit +#undef free +#undef getenv +#undef labs +#undef ldiv +#undef malloc +#undef mblen +#undef mbstowcs +#undef mbtowc +#undef qsort +#if __cplusplus >= 201103L +# ifdef _GLIBCXX_HAVE_QUICK_EXIT +# undef quick_exit +# endif +#endif +#undef rand +#undef realloc +#undef srand +#undef strtod +#undef strtol +#undef strtoul +#undef system +#undef wcstombs +#undef wctomb + +extern "C++" +{ +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using ::div_t; + using ::ldiv_t; + + using ::abort; +#if __cplusplus >= 201703L && defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) + using ::aligned_alloc; +#endif + using ::atexit; +#if __cplusplus >= 201103L +# ifdef _GLIBCXX_HAVE_AT_QUICK_EXIT + using ::at_quick_exit; +# endif +#endif + using ::atof; + using ::atoi; + using ::atol; + using ::bsearch; + using ::calloc; + using ::div; + using ::exit; + using ::free; + using ::getenv; + using ::labs; + using ::ldiv; + using ::malloc; +#ifdef _GLIBCXX_HAVE_MBSTATE_T + using ::mblen; + using ::mbstowcs; + using ::mbtowc; +#endif // _GLIBCXX_HAVE_MBSTATE_T + using ::qsort; +#if __cplusplus >= 201103L +# ifdef _GLIBCXX_HAVE_QUICK_EXIT + using ::quick_exit; +# endif +#endif + using ::rand; + using ::realloc; + using ::srand; + using ::strtod; + using ::strtol; + using ::strtoul; + using ::system; +#ifdef _GLIBCXX_USE_WCHAR_T + using ::wcstombs; + using ::wctomb; +#endif // _GLIBCXX_USE_WCHAR_T + +#ifndef __CORRECT_ISO_CPP_STDLIB_H_PROTO + inline ldiv_t + div(long __i, long __j) _GLIBCXX_NOTHROW { return ldiv(__i, __j); } +#endif + + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if _GLIBCXX_USE_C99_STDLIB + +#undef _Exit +#undef llabs +#undef lldiv +#undef atoll +#undef strtoll +#undef strtoull +#undef strtof +#undef strtold + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::lldiv_t; +#endif +#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC + extern "C" void (_Exit)(int) _GLIBCXX_NOTHROW _GLIBCXX_NORETURN; +#endif +#if !_GLIBCXX_USE_C99_DYNAMIC + using ::_Exit; +#endif + +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + using ::llabs; + + inline lldiv_t + div(long long __n, long long __d) + { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } + + using ::lldiv; +#pragma GCC diagnostic pop +#endif + +#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + extern "C" long long int (atoll)(const char *) _GLIBCXX_NOTHROW; + extern "C" long long int + (strtoll)(const char * __restrict, char ** __restrict, int) _GLIBCXX_NOTHROW; + extern "C" unsigned long long int + (strtoull)(const char * __restrict, char ** __restrict, int) _GLIBCXX_NOTHROW; +#endif +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::atoll; + using ::strtoll; + using ::strtoull; +#endif + using ::strtof; + using ::strtold; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __gnu_cxx + +namespace std +{ +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::__gnu_cxx::lldiv_t; +#endif + using ::__gnu_cxx::_Exit; +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::__gnu_cxx::llabs; + using ::__gnu_cxx::div; + using ::__gnu_cxx::lldiv; +#endif + using ::__gnu_cxx::atoll; + using ::__gnu_cxx::strtof; + using ::__gnu_cxx::strtoll; + using ::__gnu_cxx::strtoull; + using ::__gnu_cxx::strtold; +} // namespace std + +#else // ! _GLIBCXX_USE_C99_STDLIB + +// We also check for strtof and strtold separately from _GLIBCXX_USE_C99_STDLIB + +#if _GLIBCXX_HAVE_STRTOF +#undef strtof +namespace std { using ::strtof; } +#endif + +#if _GLIBCXX_HAVE_STRTOLD +#undef strtold +namespace std { using ::strtold; } +#endif + +#endif // _GLIBCXX_USE_C99_STDLIB + +} // extern "C++" + +#endif // !_GLIBCXX_HOSTED + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdlib.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdlib.blob new file mode 100644 index 0000000..fec63f0 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cstdlib.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ctime b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ctime new file mode 100644 index 0000000..02e00ec --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ctime @@ -0,0 +1,86 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/ctime + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c time.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 20.5 Date and time +// + +#ifndef _GLIBCXX_CTIME +#define _GLIBCXX_CTIME 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef clock +#undef difftime +#undef mktime +#undef time +#undef asctime +#undef ctime +#undef gmtime +#undef localtime +#undef strftime + +namespace std +{ + using ::clock_t; + using ::time_t; + using ::tm; + + using ::clock; + using ::difftime; + using ::mktime; + using ::time; + using ::asctime; + using ::ctime; + using ::gmtime; + using ::localtime; + using ::strftime; +} // namespace + +#if __cplusplus >= 201703L && defined(_GLIBCXX_HAVE_TIMESPEC_GET) +#undef timespec_get +namespace std +{ + using ::timespec; + using ::timespec_get; +} // namespace std +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ctime.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ctime.blob new file mode 100644 index 0000000..1b748bf Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ctime.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwchar b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwchar new file mode 100644 index 0000000..dbcc104 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwchar @@ -0,0 +1,308 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/cwchar + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c wchar.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 21.4 +// + +#ifndef _GLIBCXX_CWCHAR +#define _GLIBCXX_CWCHAR 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#if _GLIBCXX_HAVE_WCHAR_H +#include +#endif + +// Need to do a bit of trickery here with mbstate_t as char_traits +// assumes it is in wchar.h, regardless of wchar_t specializations. +#ifndef _GLIBCXX_HAVE_MBSTATE_T +extern "C" +{ + typedef struct + { + int __fill[6]; + } mbstate_t; +} +#endif + +namespace std +{ + using ::mbstate_t; +} // namespace std + +// Get rid of those macros defined in in lieu of real functions. +#undef btowc +#undef fgetwc +#undef fgetws +#undef fputwc +#undef fputws +#undef fwide +#undef fwprintf +#undef fwscanf +#undef getwc +#undef getwchar +#undef mbrlen +#undef mbrtowc +#undef mbsinit +#undef mbsrtowcs +#undef putwc +#undef putwchar +#undef swprintf +#undef swscanf +#undef ungetwc +#undef vfwprintf +#if _GLIBCXX_HAVE_VFWSCANF +# undef vfwscanf +#endif +#undef vswprintf +#if _GLIBCXX_HAVE_VSWSCANF +# undef vswscanf +#endif +#undef vwprintf +#if _GLIBCXX_HAVE_VWSCANF +# undef vwscanf +#endif +#undef wcrtomb +#undef wcscat +#undef wcschr +#undef wcscmp +#undef wcscoll +#undef wcscpy +#undef wcscspn +#undef wcsftime +#undef wcslen +#undef wcsncat +#undef wcsncmp +#undef wcsncpy +#undef wcspbrk +#undef wcsrchr +#undef wcsrtombs +#undef wcsspn +#undef wcsstr +#undef wcstod +#if _GLIBCXX_HAVE_WCSTOF +# undef wcstof +#endif +#undef wcstok +#undef wcstol +#undef wcstoul +#undef wcsxfrm +#undef wctob +#undef wmemchr +#undef wmemcmp +#undef wmemcpy +#undef wmemmove +#undef wmemset +#undef wprintf +#undef wscanf + +#if _GLIBCXX_USE_WCHAR_T + +extern "C++" +{ +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using ::wint_t; + + using ::btowc; + using ::fgetwc; + using ::fgetws; + using ::fputwc; + using ::fputws; + using ::fwide; + using ::fwprintf; + using ::fwscanf; + using ::getwc; + using ::getwchar; + using ::mbrlen; + using ::mbrtowc; + using ::mbsinit; + using ::mbsrtowcs; + using ::putwc; + using ::putwchar; +#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF + using ::swprintf; +#endif + using ::swscanf; + using ::ungetwc; + using ::vfwprintf; +#if _GLIBCXX_HAVE_VFWSCANF + using ::vfwscanf; +#endif +#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF + using ::vswprintf; +#endif +#if _GLIBCXX_HAVE_VSWSCANF + using ::vswscanf; +#endif + using ::vwprintf; +#if _GLIBCXX_HAVE_VWSCANF + using ::vwscanf; +#endif + using ::wcrtomb; + using ::wcscat; + using ::wcscmp; + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; + using ::wcsftime; + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; + using ::wcsncpy; + using ::wcsrtombs; + using ::wcsspn; + using ::wcstod; +#if _GLIBCXX_HAVE_WCSTOF + using ::wcstof; +#endif + using ::wcstok; + using ::wcstol; + using ::wcstoul; + using ::wcsxfrm; + using ::wctob; + using ::wmemcmp; + using ::wmemcpy; + using ::wmemmove; + using ::wmemset; + using ::wprintf; + using ::wscanf; + using ::wcschr; + using ::wcspbrk; + using ::wcsrchr; + using ::wcsstr; + using ::wmemchr; + +#ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO + inline wchar_t* + wcschr(wchar_t* __p, wchar_t __c) + { return wcschr(const_cast(__p), __c); } + + inline wchar_t* + wcspbrk(wchar_t* __s1, const wchar_t* __s2) + { return wcspbrk(const_cast(__s1), __s2); } + + inline wchar_t* + wcsrchr(wchar_t* __p, wchar_t __c) + { return wcsrchr(const_cast(__p), __c); } + + inline wchar_t* + wcsstr(wchar_t* __s1, const wchar_t* __s2) + { return wcsstr(const_cast(__s1), __s2); } + + inline wchar_t* + wmemchr(wchar_t* __p, wchar_t __c, size_t __n) + { return wmemchr(const_cast(__p), __c, __n); } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +} // extern "C++" + +#if _GLIBCXX_USE_C99_WCHAR + +#undef wcstold +#undef wcstoll +#undef wcstoull + +namespace __gnu_cxx +{ +#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC + extern "C" long double + (wcstold)(const wchar_t * __restrict, wchar_t ** __restrict) throw (); +#endif +#if !_GLIBCXX_USE_C99_DYNAMIC + using ::wcstold; +#endif +#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + extern "C" long long int + (wcstoll)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); + extern "C" unsigned long long int + (wcstoull)(const wchar_t * __restrict, wchar_t ** __restrict, int) throw (); +#endif +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::wcstoll; + using ::wcstoull; +#endif +} // namespace __gnu_cxx + +namespace std +{ + using ::__gnu_cxx::wcstold; + using ::__gnu_cxx::wcstoll; + using ::__gnu_cxx::wcstoull; +} // namespace + +#endif + +#endif //_GLIBCXX_USE_WCHAR_T + +#if __cplusplus >= 201103L + +#ifdef _GLIBCXX_USE_WCHAR_T + +namespace std +{ +#if _GLIBCXX_HAVE_WCSTOF + using std::wcstof; +#endif +#if _GLIBCXX_HAVE_VFWSCANF + using std::vfwscanf; +#endif +#if _GLIBCXX_HAVE_VSWSCANF + using std::vswscanf; +#endif +#if _GLIBCXX_HAVE_VWSCANF + using std::vwscanf; +#endif + +#if _GLIBCXX_USE_C99_WCHAR + using std::wcstold; + using std::wcstoll; + using std::wcstoull; +#endif +} // namespace + +#endif // _GLIBCXX_USE_WCHAR_T + +#endif // C++11 + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwchar.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwchar.blob new file mode 100644 index 0000000..86b4a98 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwchar.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwctype b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwctype new file mode 100644 index 0000000..07471eb --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwctype @@ -0,0 +1,112 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/cwctype + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c wctype.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: +// + +#ifndef _GLIBCXX_CWCTYPE +#define _GLIBCXX_CWCTYPE 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#if _GLIBCXX_HAVE_WCTYPE_H + +#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 10 +// Work around glibc BZ 9694 +#include +#endif + +#include +#endif // _GLIBCXX_HAVE_WCTYPE_H + +// Get rid of those macros defined in in lieu of real functions. +#undef iswalnum +#undef iswalpha +#if _GLIBCXX_HAVE_ISWBLANK +# undef iswblank +#endif +#undef iswcntrl +#undef iswctype +#undef iswdigit +#undef iswgraph +#undef iswlower +#undef iswprint +#undef iswpunct +#undef iswspace +#undef iswupper +#undef iswxdigit +#undef towctrans +#undef towlower +#undef towupper +#undef wctrans +#undef wctype + +#if _GLIBCXX_USE_WCHAR_T + +namespace std +{ + using ::wctrans_t; + using ::wctype_t; + using ::wint_t; + + using ::iswalnum; + using ::iswalpha; +#if _GLIBCXX_HAVE_ISWBLANK + using ::iswblank; +#endif + using ::iswcntrl; + using ::iswctype; + using ::iswdigit; + using ::iswgraph; + using ::iswlower; + using ::iswprint; + using ::iswpunct; + using ::iswspace; + using ::iswupper; + using ::iswxdigit; + using ::towctrans; + using ::towlower; + using ::towupper; + using ::wctrans; + using ::wctype; +} // namespace + +#endif //_GLIBCXX_USE_WCHAR_T + +#endif // _GLIBCXX_CWCTYPE diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwctype.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwctype.blob new file mode 100644 index 0000000..ba55d3d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@cwctype.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@assertions.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@assertions.h new file mode 100644 index 0000000..86720a7 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@assertions.h @@ -0,0 +1,70 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/assertions.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_ASSERTIONS_H +#define _GLIBCXX_DEBUG_ASSERTIONS_H 1 + +#include + +#ifndef _GLIBCXX_DEBUG +// Verify that [_First, _Last) forms a non-empty iterator range. +# define __glibcxx_requires_non_empty_range(_First,_Last) \ + __glibcxx_assert(_First != _Last) +# define __glibcxx_requires_subscript(_N) \ + __glibcxx_assert(_N < this->size()) +// Verify that the container is nonempty +# define __glibcxx_requires_nonempty() \ + __glibcxx_assert(!this->empty()) +#else // Use the more verbose Debug Mode checks. +# define __glibcxx_requires_non_empty_range(_First,_Last) \ + __glibcxx_check_non_empty_range(_First,_Last) +# define __glibcxx_requires_nonempty() \ + __glibcxx_check_nonempty() +# define __glibcxx_requires_subscript(_N) \ + __glibcxx_check_subscript(_N) +#endif + +#if defined _GLIBCXX_DEBUG && _GLIBCXX_HOSTED + +# define _GLIBCXX_DEBUG_ASSERT(_Condition) __glibcxx_assert(_Condition) + +# ifdef _GLIBCXX_DEBUG_PEDANTIC +# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition) +# else +# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) +# endif + +# define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement + +#else +# define _GLIBCXX_DEBUG_ASSERT(_Condition) +# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) +# define _GLIBCXX_DEBUG_ONLY(_Statement) +#endif + +#endif // _GLIBCXX_DEBUG_ASSERTIONS diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@assertions.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@assertions.h.blob new file mode 100644 index 0000000..1e35d8c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@assertions.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@debug.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@debug.h new file mode 100644 index 0000000..0e02d58 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@debug.h @@ -0,0 +1,145 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/debug.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H +#define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1 + +/** Macros and namespaces used by the implementation outside of debug + * wrappers to verify certain properties. The __glibcxx_requires_xxx + * macros are merely wrappers around the __glibcxx_check_xxx wrappers + * when we are compiling with debug mode, but disappear when we are + * in release mode so that there is no checking performed in, e.g., + * the standard library algorithms. +*/ + +#include + +// Debug mode namespaces. + +/** + * @namespace std::__debug + * @brief GNU debug code, replaces standard behavior with debug behavior. + */ +namespace std +{ + namespace __debug { } +} + +/** @namespace __gnu_debug + * @brief GNU debug classes for public use. +*/ +namespace __gnu_debug +{ + using namespace std::__debug; + + template + struct _Safe_iterator; +} + +#if ! defined _GLIBCXX_DEBUG || ! _GLIBCXX_HOSTED + +# define __glibcxx_requires_cond(_Cond,_Msg) +# define __glibcxx_requires_valid_range(_First,_Last) +# define __glibcxx_requires_can_increment(_First,_Size) +# define __glibcxx_requires_can_increment_range(_First1,_Last1,_First2) +# define __glibcxx_requires_can_decrement_range(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted(_First,_Last) +# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) +# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) +# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_heap(_First,_Last) +# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) +# define __glibcxx_requires_string(_String) +# define __glibcxx_requires_string_len(_String,_Len) +# define __glibcxx_requires_irreflexive(_First,_Last) +# define __glibcxx_requires_irreflexive2(_First,_Last) +# define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred) +# define __glibcxx_requires_irreflexive_pred2(_First,_Last,_Pred) + +#else + +# include + +# define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg) +# define __glibcxx_requires_valid_range(_First,_Last) \ + __glibcxx_check_valid_range(_First,_Last) +# define __glibcxx_requires_can_increment(_First,_Size) \ + __glibcxx_check_can_increment(_First,_Size) +# define __glibcxx_requires_can_increment_range(_First1,_Last1,_First2) \ + __glibcxx_check_can_increment_range(_First1,_Last1,_First2) +# define __glibcxx_requires_can_decrement_range(_First1,_Last1,_First2) \ + __glibcxx_check_can_decrement_range(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted(_First,_Last) \ + __glibcxx_check_sorted(_First,_Last) +# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \ + __glibcxx_check_sorted_pred(_First,_Last,_Pred) +# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) \ + __glibcxx_check_sorted_set(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ + __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) +# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) \ + __glibcxx_check_partitioned_lower(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) \ + __glibcxx_check_partitioned_upper(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ + __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ + __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_heap(_First,_Last) \ + __glibcxx_check_heap(_First,_Last) +# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \ + __glibcxx_check_heap_pred(_First,_Last,_Pred) +# if __cplusplus < 201103L +# define __glibcxx_requires_string(_String) \ + _GLIBCXX_DEBUG_PEDASSERT(_String != 0) +# define __glibcxx_requires_string_len(_String,_Len) \ + _GLIBCXX_DEBUG_PEDASSERT(_String != 0 || _Len == 0) +# else +# define __glibcxx_requires_string(_String) \ + _GLIBCXX_DEBUG_PEDASSERT(_String != nullptr) +# define __glibcxx_requires_string_len(_String,_Len) \ + _GLIBCXX_DEBUG_PEDASSERT(_String != nullptr || _Len == 0) +# endif +# define __glibcxx_requires_irreflexive(_First,_Last) \ + __glibcxx_check_irreflexive(_First,_Last) +# define __glibcxx_requires_irreflexive2(_First,_Last) \ + __glibcxx_check_irreflexive2(_First,_Last) +# define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred) \ + __glibcxx_check_irreflexive_pred(_First,_Last,_Pred) +# define __glibcxx_requires_irreflexive_pred2(_First,_Last,_Pred) \ + __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) + +# include + +#endif + +#endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@debug.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@debug.h.blob new file mode 100644 index 0000000..db1c664 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@debug@debug.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@exception b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@exception new file mode 100644 index 0000000..246c9b1 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@exception @@ -0,0 +1,172 @@ +// Exception Handling support header for -*- C++ -*- + +// Copyright (C) 1995-2025 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file exception + * This is a Standard C++ Library header. + */ + +#ifndef __EXCEPTION__ +#define __EXCEPTION__ + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +#define __glibcxx_want_uncaught_exceptions +#include + +extern "C++" { + +namespace std _GLIBCXX_VISIBILITY(default) +{ + /** @addtogroup exceptions + * @{ + */ + + /** If an %exception is thrown which is not listed in a function's + * %exception specification, one of these may be thrown. + * + * @ingroup exceptions + */ + class bad_exception : public exception + { + public: + bad_exception() _GLIBCXX_USE_NOEXCEPT { } + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 + virtual ~bad_exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT; + + // See comment in eh_exception.cc. + virtual const char* + what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT; + }; + + /// If you write a replacement %terminate handler, it must be of this type. + typedef void (*terminate_handler) (); + + /// Takes a new handler function as an argument, returns the old function. + terminate_handler set_terminate(terminate_handler) _GLIBCXX_USE_NOEXCEPT; + +#if __cplusplus >= 201103L + /// Return the current terminate handler. + terminate_handler get_terminate() noexcept; +#endif + + /** The runtime will call this function if %exception handling must be + * abandoned for any reason. It can also be called by the user. */ + void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__,__cold__)); + +#if __cplusplus < 201703L || (__cplusplus <= 202002L && _GLIBCXX_USE_DEPRECATED) + /// If you write a replacement %unexpected handler, it must be of this type. + typedef void (*_GLIBCXX11_DEPRECATED unexpected_handler) (); + + /** Takes a new handler function as an argument, returns the old function. + * + * @deprecated Removed from the C++ standard in C++17 + */ + _GLIBCXX11_DEPRECATED + unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT; + +#if __cplusplus >= 201103L + /** Return the current unexpected handler. + * + * @since C++11 + * @deprecated Removed from the C++ standard in C++17 + */ + _GLIBCXX11_DEPRECATED + unexpected_handler get_unexpected() noexcept; +#endif + + /** The runtime will call this function if an %exception is thrown which + * violates the function's %exception specification. + * + * @deprecated Removed from the C++ standard in C++17 + */ + _GLIBCXX11_DEPRECATED + void unexpected() __attribute__ ((__noreturn__,__cold__)); +#endif + + /** [18.6.4]/1: 'Returns true after completing evaluation of a + * throw-expression until either completing initialization of the + * exception-declaration in the matching handler or entering `unexpected()` + * due to the throw; or after entering `terminate()` for any reason + * other than an explicit call to `terminate()`. [Note: This includes + * stack unwinding [15.2]. end note]' + * + * 2: 'When `uncaught_exception()` is true, throwing an + * %exception can result in a call of 1terminate()` + * (15.5.1).' + */ + _GLIBCXX17_DEPRECATED_SUGGEST("std::uncaught_exceptions()") + bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); + +#ifdef __cpp_lib_uncaught_exceptions // C++ >= 17 || GNU++ >= 03 + /** The number of uncaught exceptions. + * @since C++17, or any non-strict mode, e.g. `-std=gnu++98` + * @see uncaught_exception() + */ + int uncaught_exceptions() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); +#endif + + /// @} group exceptions +} // namespace std + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief A replacement for the standard terminate_handler which + * prints more information about the terminating exception (if any) + * on stderr. + * + * @ingroup exceptions + * + * Call + * @code + * std::set_terminate(__gnu_cxx::__verbose_terminate_handler) + * @endcode + * to use. For more info, see + * http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt02ch06s02.html + * + * In 3.4 and later, this is on by default. + */ + void __verbose_terminate_handler(); + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +} // extern "C++" + +#if (__cplusplus >= 201103L) +#include +#include +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@exception.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@exception.blob new file mode 100644 index 0000000..4da4920 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@exception.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@aligned_buffer.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@aligned_buffer.h new file mode 100644 index 0000000..15c88d6 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@aligned_buffer.h @@ -0,0 +1,130 @@ +// Aligned memory buffer -*- C++ -*- + +// Copyright (C) 2013-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/aligned_buffer.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _ALIGNED_BUFFER_H +#define _ALIGNED_BUFFER_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus >= 201103L +# include +#else +# include +#endif + +namespace __gnu_cxx +{ + // A utility type containing a POD object that can hold an object of type + // _Tp initialized via placement new or allocator_traits::construct. + // Intended for use as a data member subobject, use __aligned_buffer for + // complete objects. + template + struct __aligned_membuf + { + // Target macro ADJUST_FIELD_ALIGN can produce different alignment for + // types when used as class members. __aligned_membuf is intended + // for use as a class member, so align the buffer as for a class member. + // Since GCC 8 we can just use alignas(_Tp) to get the right alignment. +#ifdef __EDG__ + // The EDG front end does not implement the PR c++/69560 alignof change. + struct _Tp2 { _Tp _M_t; }; + alignas(__alignof__(_Tp2::_M_t)) +#else + alignas(_Tp) +#endif + unsigned char _M_storage[sizeof(_Tp)]; + + __aligned_membuf() = default; + + // Can be used to avoid value-initialization zeroing _M_storage. + __aligned_membuf(std::nullptr_t) { } + + void* + _M_addr() noexcept + { return static_cast(&_M_storage); } + + const void* + _M_addr() const noexcept + { return static_cast(&_M_storage); } + + _Tp* + _M_ptr() noexcept + { return static_cast<_Tp*>(_M_addr()); } + + const _Tp* + _M_ptr() const noexcept + { return static_cast(_M_addr()); } + }; + +#if _GLIBCXX_INLINE_VERSION + template + using __aligned_buffer = __aligned_membuf<_Tp>; +#else + // Similar to __aligned_membuf but aligned for complete objects, not members. + // This type is used in , , + // and , but ideally they would use __aligned_membuf + // instead, as it has smaller size for some types on some targets. + // This type is still used to avoid an ABI change. + template + struct __aligned_buffer + { + // Using __alignof__ gives the alignment for a complete object. + alignas(__alignof__(_Tp)) unsigned char _M_storage[sizeof(_Tp)]; + + __aligned_buffer() = default; + + // Can be used to avoid value-initialization + __aligned_buffer(std::nullptr_t) { } + + void* + _M_addr() noexcept + { + return static_cast(&_M_storage); + } + + const void* + _M_addr() const noexcept + { + return static_cast(&_M_storage); + } + + _Tp* + _M_ptr() noexcept + { return static_cast<_Tp*>(_M_addr()); } + + const _Tp* + _M_ptr() const noexcept + { return static_cast(_M_addr()); } + }; +#endif + +} // namespace + +#endif /* _ALIGNED_BUFFER_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@aligned_buffer.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@aligned_buffer.h.blob new file mode 100644 index 0000000..8151313 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@aligned_buffer.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@alloc_traits.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@alloc_traits.h new file mode 100644 index 0000000..b99fe31 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@alloc_traits.h @@ -0,0 +1,187 @@ +// Allocator traits -*- C++ -*- + +// Copyright (C) 2011-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/alloc_traits.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _EXT_ALLOC_TRAITS_H +#define _EXT_ALLOC_TRAITS_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +# include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +/** + * @brief Uniform interface to C++98 and C++11 allocators. + * @ingroup allocators +*/ +template + struct __alloc_traits +#if __cplusplus >= 201103L + : std::allocator_traits<_Alloc> +#endif + { + typedef _Alloc allocator_type; +#if __cplusplus >= 201103L + typedef std::allocator_traits<_Alloc> _Base_type; + typedef typename _Base_type::value_type value_type; + typedef typename _Base_type::pointer pointer; + typedef typename _Base_type::const_pointer const_pointer; + typedef typename _Base_type::size_type size_type; + typedef typename _Base_type::difference_type difference_type; + // C++11 allocators do not define reference or const_reference + typedef value_type& reference; + typedef const value_type& const_reference; + using _Base_type::allocate; + using _Base_type::deallocate; + using _Base_type::construct; + using _Base_type::destroy; + using _Base_type::max_size; + + private: + template + using __is_custom_pointer + = std::__and_, + std::__not_>>; + + public: + // overload construct for non-standard pointer types + template + [[__gnu__::__always_inline__]] + static _GLIBCXX14_CONSTEXPR + std::__enable_if_t<__is_custom_pointer<_Ptr>::value> + construct(_Alloc& __a, _Ptr __p, _Args&&... __args) + noexcept(noexcept(_Base_type::construct(__a, std::__to_address(__p), + std::forward<_Args>(__args)...))) + { + _Base_type::construct(__a, std::__to_address(__p), + std::forward<_Args>(__args)...); + } + + // overload destroy for non-standard pointer types + template + [[__gnu__::__always_inline__]] + static _GLIBCXX14_CONSTEXPR + std::__enable_if_t<__is_custom_pointer<_Ptr>::value> + destroy(_Alloc& __a, _Ptr __p) + noexcept(noexcept(_Base_type::destroy(__a, std::__to_address(__p)))) + { _Base_type::destroy(__a, std::__to_address(__p)); } + + [[__gnu__::__always_inline__]] + static constexpr _Alloc _S_select_on_copy(const _Alloc& __a) + { return _Base_type::select_on_container_copy_construction(__a); } + + [[__gnu__::__always_inline__]] + static _GLIBCXX14_CONSTEXPR void _S_on_swap(_Alloc& __a, _Alloc& __b) + { std::__alloc_on_swap(__a, __b); } + + [[__gnu__::__always_inline__]] + static constexpr bool _S_propagate_on_copy_assign() + { return _Base_type::propagate_on_container_copy_assignment::value; } + + [[__gnu__::__always_inline__]] + static constexpr bool _S_propagate_on_move_assign() + { return _Base_type::propagate_on_container_move_assignment::value; } + + [[__gnu__::__always_inline__]] + static constexpr bool _S_propagate_on_swap() + { return _Base_type::propagate_on_container_swap::value; } + + [[__gnu__::__always_inline__]] + static constexpr bool _S_always_equal() + { return _Base_type::is_always_equal::value; } + + __attribute__((__always_inline__)) + static constexpr bool _S_nothrow_move() + { return _S_propagate_on_move_assign() || _S_always_equal(); } + + template + struct rebind + { typedef typename _Base_type::template rebind_alloc<_Tp> other; }; +#else // ! C++11 + + typedef typename _Alloc::pointer pointer; + typedef typename _Alloc::const_pointer const_pointer; + typedef typename _Alloc::value_type value_type; + typedef typename _Alloc::reference reference; + typedef typename _Alloc::const_reference const_reference; + typedef typename _Alloc::size_type size_type; + typedef typename _Alloc::difference_type difference_type; + + __attribute__((__always_inline__)) _GLIBCXX_NODISCARD + static pointer + allocate(_Alloc& __a, size_type __n) + { return __a.allocate(__n); } + + template + __attribute__((__always_inline__)) _GLIBCXX_NODISCARD + static pointer + allocate(_Alloc& __a, size_type __n, _Hint __hint) + { return __a.allocate(__n, __hint); } + + __attribute__((__always_inline__)) + static void deallocate(_Alloc& __a, pointer __p, size_type __n) + { __a.deallocate(__p, __n); } + + template + __attribute__((__always_inline__)) + static void construct(_Alloc& __a, pointer __p, const _Tp& __arg) + { __a.construct(__p, __arg); } + + __attribute__((__always_inline__)) + static void destroy(_Alloc& __a, pointer __p) + { __a.destroy(__p); } + + __attribute__((__always_inline__)) + static size_type max_size(const _Alloc& __a) + { return __a.max_size(); } + + __attribute__((__always_inline__)) + static const _Alloc& _S_select_on_copy(const _Alloc& __a) { return __a; } + + __attribute__((__always_inline__)) + static void _S_on_swap(_Alloc& __a, _Alloc& __b) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 431. Swapping containers with unequal allocators. + std::__alloc_swap<_Alloc>::_S_do_it(__a, __b); + } + + template + struct rebind + { typedef typename _Alloc::template rebind<_Tp>::other other; }; +#endif // C++11 + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __gnu_cxx + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@alloc_traits.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@alloc_traits.h.blob new file mode 100644 index 0000000..4673e98 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@alloc_traits.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@atomicity.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@atomicity.h new file mode 100644 index 0000000..98f745c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@atomicity.h @@ -0,0 +1,129 @@ +// Support for atomic operations -*- C++ -*- + +// Copyright (C) 2004-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/atomicity.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_ATOMICITY_H +#define _GLIBCXX_ATOMICITY_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include +#include +#if __has_include() +# include +#endif + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + __attribute__((__always_inline__)) + inline bool + __is_single_threaded() _GLIBCXX_NOTHROW + { +#ifndef __GTHREADS + return true; +#elif __has_include() + return ::__libc_single_threaded; +#else + return !__gthread_active_p(); +#endif + } + + // Functions for portable atomic access. + // To abstract locking primitives across all thread policies, use: + // __exchange_and_add_dispatch + // __atomic_add_dispatch +#ifdef _GLIBCXX_ATOMIC_BUILTINS + inline _Atomic_word + __attribute__((__always_inline__)) + __exchange_and_add(volatile _Atomic_word* __mem, int __val) + { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } + + inline void + __attribute__((__always_inline__)) + __atomic_add(volatile _Atomic_word* __mem, int __val) + { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } +#else + _Atomic_word + __exchange_and_add(volatile _Atomic_word*, int) _GLIBCXX_NOTHROW; + + void + __atomic_add(volatile _Atomic_word*, int) _GLIBCXX_NOTHROW; +#endif + + inline _Atomic_word + __attribute__((__always_inline__)) + __exchange_and_add_single(_Atomic_word* __mem, int __val) + { + _Atomic_word __result = *__mem; + *__mem += __val; + return __result; + } + + inline void + __attribute__((__always_inline__)) + __atomic_add_single(_Atomic_word* __mem, int __val) + { *__mem += __val; } + + inline _Atomic_word + __attribute__ ((__always_inline__)) + __exchange_and_add_dispatch(_Atomic_word* __mem, int __val) + { + if (__is_single_threaded()) + return __exchange_and_add_single(__mem, __val); + else + return __exchange_and_add(__mem, __val); + } + + inline void + __attribute__ ((__always_inline__)) + __atomic_add_dispatch(_Atomic_word* __mem, int __val) + { + if (__is_single_threaded()) + __atomic_add_single(__mem, __val); + else + __atomic_add(__mem, __val); + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +// Even if the CPU doesn't need a memory barrier, we need to ensure +// that the compiler doesn't reorder memory accesses across the +// barriers. +#ifndef _GLIBCXX_READ_MEM_BARRIER +#define _GLIBCXX_READ_MEM_BARRIER __atomic_thread_fence (__ATOMIC_ACQUIRE) +#endif +#ifndef _GLIBCXX_WRITE_MEM_BARRIER +#define _GLIBCXX_WRITE_MEM_BARRIER __atomic_thread_fence (__ATOMIC_RELEASE) +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@atomicity.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@atomicity.h.blob new file mode 100644 index 0000000..c1a5b23 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@atomicity.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@concurrence.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@concurrence.h new file mode 100644 index 0000000..2c3a893 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@concurrence.h @@ -0,0 +1,322 @@ +// Support for concurrent programing -*- C++ -*- + +// Copyright (C) 2003-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/concurrence.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _CONCURRENCE_H +#define _CONCURRENCE_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include +#include +#include +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Available locking policies: + // _S_single single-threaded code that doesn't need to be locked. + // _S_mutex multi-threaded code that requires additional support + // from gthr.h or abstraction layers in concurrence.h. + // _S_atomic multi-threaded code using atomic operations. + enum _Lock_policy { _S_single, _S_mutex, _S_atomic }; + + // Compile time constant that indicates prefered locking policy in + // the current configuration. + _GLIBCXX17_INLINE const _Lock_policy __default_lock_policy = +#ifndef __GTHREADS + _S_single; +#elif defined _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY + _S_atomic; +#else + _S_mutex; +#endif + + // NB: As this is used in libsupc++, need to only depend on + // exception. No stdexception classes, no use of std::string. + class __concurrence_lock_error : public std::exception + { + public: + virtual char const* + what() const throw() + { return "__gnu_cxx::__concurrence_lock_error"; } + }; + + class __concurrence_unlock_error : public std::exception + { + public: + virtual char const* + what() const throw() + { return "__gnu_cxx::__concurrence_unlock_error"; } + }; + + class __concurrence_broadcast_error : public std::exception + { + public: + virtual char const* + what() const throw() + { return "__gnu_cxx::__concurrence_broadcast_error"; } + }; + + class __concurrence_wait_error : public std::exception + { + public: + virtual char const* + what() const throw() + { return "__gnu_cxx::__concurrence_wait_error"; } + }; + + // Substitute for concurrence_error object in the case of -fno-exceptions. + inline void + __throw_concurrence_lock_error() + { _GLIBCXX_THROW_OR_ABORT(__concurrence_lock_error()); } + + inline void + __throw_concurrence_unlock_error() + { _GLIBCXX_THROW_OR_ABORT(__concurrence_unlock_error()); } + +#ifdef __GTHREAD_HAS_COND + inline void + __throw_concurrence_broadcast_error() + { _GLIBCXX_THROW_OR_ABORT(__concurrence_broadcast_error()); } + + inline void + __throw_concurrence_wait_error() + { _GLIBCXX_THROW_OR_ABORT(__concurrence_wait_error()); } +#endif + + class __mutex + { + private: +#if __GTHREADS && defined __GTHREAD_MUTEX_INIT + __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT; +#else + __gthread_mutex_t _M_mutex; +#endif + + __mutex(const __mutex&); + __mutex& operator=(const __mutex&); + + public: + __mutex() + { +#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT + if (__gthread_active_p()) + __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); +#endif + } + +#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT + ~__mutex() + { + if (__gthread_active_p()) + __gthread_mutex_destroy(&_M_mutex); + } +#endif + + void lock() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_mutex_lock(&_M_mutex) != 0) + __throw_concurrence_lock_error(); + } +#endif + } + + void unlock() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_mutex_unlock(&_M_mutex) != 0) + __throw_concurrence_unlock_error(); + } +#endif + } + + __gthread_mutex_t* gthread_mutex(void) + { return &_M_mutex; } + }; + + class __recursive_mutex + { + private: +#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT + __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT; +#else + __gthread_recursive_mutex_t _M_mutex; +#endif + + __recursive_mutex(const __recursive_mutex&); + __recursive_mutex& operator=(const __recursive_mutex&); + + public: + __recursive_mutex() + { +#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT + if (__gthread_active_p()) + __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); +#endif + } + +#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT + ~__recursive_mutex() + { + if (__gthread_active_p()) + __gthread_recursive_mutex_destroy(&_M_mutex); + } +#endif + + void lock() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_recursive_mutex_lock(&_M_mutex) != 0) + __throw_concurrence_lock_error(); + } +#endif + } + + void unlock() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_recursive_mutex_unlock(&_M_mutex) != 0) + __throw_concurrence_unlock_error(); + } +#endif + } + + __gthread_recursive_mutex_t* gthread_recursive_mutex(void) + { return &_M_mutex; } + }; + + /// Scoped lock idiom. + // Acquire the mutex here with a constructor call, then release with + // the destructor call in accordance with RAII style. + class __scoped_lock + { + public: + typedef __mutex __mutex_type; + + private: + __mutex_type& _M_device; + + __scoped_lock(const __scoped_lock&); + __scoped_lock& operator=(const __scoped_lock&); + + public: + explicit __scoped_lock(__mutex_type& __name) : _M_device(__name) + { _M_device.lock(); } + + ~__scoped_lock() throw() + { _M_device.unlock(); } + }; + +#ifdef __GTHREAD_HAS_COND + class __cond + { + private: +#if __GTHREADS && defined __GTHREAD_COND_INIT + __gthread_cond_t _M_cond = __GTHREAD_COND_INIT; +#else + __gthread_cond_t _M_cond; +#endif + + __cond(const __cond&); + __cond& operator=(const __cond&); + + public: + __cond() + { +#if __GTHREADS && ! defined __GTHREAD_COND_INIT + if (__gthread_active_p()) + __GTHREAD_COND_INIT_FUNCTION(&_M_cond); +#endif + } + +#if __GTHREADS && ! defined __GTHREAD_COND_INIT + ~__cond() + { + if (__gthread_active_p()) + __gthread_cond_destroy(&_M_cond); + } +#endif + + void broadcast() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_cond_broadcast(&_M_cond) != 0) + __throw_concurrence_broadcast_error(); + } +#endif + } + + void wait(__mutex *mutex) + { +#if __GTHREADS + { + if (__gthread_cond_wait(&_M_cond, mutex->gthread_mutex()) != 0) + __throw_concurrence_wait_error(); + } +#endif + } + + void wait_recursive(__recursive_mutex *mutex) + { +#if __GTHREADS + { + if (__gthread_cond_wait_recursive(&_M_cond, + mutex->gthread_recursive_mutex()) + != 0) + __throw_concurrence_wait_error(); + } +#endif + } + }; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#pragma GCC diagnostic pop + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@concurrence.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@concurrence.h.blob new file mode 100644 index 0000000..43148f5 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@concurrence.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@numeric_traits.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@numeric_traits.h new file mode 100644 index 0000000..2cd8943 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@numeric_traits.h @@ -0,0 +1,243 @@ +// -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/numeric_traits.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _EXT_NUMERIC_TRAITS +#define _EXT_NUMERIC_TRAITS 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Compile time constants for builtin types. + // In C++98 std::numeric_limits member functions are not constant expressions + // (that changed in C++11 with the addition of 'constexpr'). + // Even for C++11, this header is smaller than and can be used + // when only is_signed, digits, min, or max values are needed for integers, + // or is_signed, digits10, max_digits10, or max_exponent10 for floats. + + // Unlike __is_integer (and std::is_integral) this trait is true for + // non-standard built-in integer types such as __int128 and __int20. + template + struct __is_integer_nonstrict + : public std::__is_integer<_Tp> + { + using std::__is_integer<_Tp>::__value; + + // The number of bits in the value representation. + enum { __width = __value ? sizeof(_Tp) * __CHAR_BIT__ : 0 }; + }; + + template + struct __numeric_traits_integer + { +#if __cplusplus >= 201103L + static_assert(__is_integer_nonstrict<_Value>::__value, + "invalid specialization"); +#endif + + // NB: these two are also available in std::numeric_limits as compile + // time constants, but is big and we can avoid including it. + static const bool __is_signed = (_Value)(-1) < 0; + static const int __digits + = __is_integer_nonstrict<_Value>::__width - __is_signed; + + // The initializers must be constants so that __max and __min are too. + static const _Value __max = __is_signed + ? (((((_Value)1 << (__digits - 1)) - 1) << 1) + 1) + : ~(_Value)0; + static const _Value __min = __is_signed ? -__max - 1 : (_Value)0; + }; + + template + const _Value __numeric_traits_integer<_Value>::__min; + + template + const _Value __numeric_traits_integer<_Value>::__max; + + template + const bool __numeric_traits_integer<_Value>::__is_signed; + + template + const int __numeric_traits_integer<_Value>::__digits; + + // Enable __numeric_traits_integer for types where the __is_integer_nonstrict + // primary template doesn't give the right answer. +#define _GLIBCXX_INT_N_TRAITS(T, WIDTH) \ + __extension__ \ + template<> struct __is_integer_nonstrict \ + { \ + enum { __value = 1 }; \ + typedef std::__true_type __type; \ + enum { __width = WIDTH }; \ + }; \ + __extension__ \ + template<> struct __is_integer_nonstrict \ + { \ + enum { __value = 1 }; \ + typedef std::__true_type __type; \ + enum { __width = WIDTH }; \ + }; + + // We need to specify the width for some __intNN types because they + // have padding bits, e.g. the object representation of __int20 has 32 bits, + // but its width (number of bits in the value representation) is only 20. +#if defined __GLIBCXX_TYPE_INT_N_0 && __GLIBCXX_BITSIZE_INT_N_0 % __CHAR_BIT__ + _GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0) +#endif +#if defined __GLIBCXX_TYPE_INT_N_1 && __GLIBCXX_BITSIZE_INT_N_1 % __CHAR_BIT__ + _GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1) +#endif +#if defined __GLIBCXX_TYPE_INT_N_2 && __GLIBCXX_BITSIZE_INT_N_2 % __CHAR_BIT__ + _GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2) +#endif +#if defined __GLIBCXX_TYPE_INT_N_3 && __GLIBCXX_BITSIZE_INT_N_3 % __CHAR_BIT__ + _GLIBCXX_INT_N_TRAITS(__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3) +#endif + +#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__ + // In strict modes __is_integer<__int128> is false, + // but we still want to define __numeric_traits_integer<__int128>. + _GLIBCXX_INT_N_TRAITS(__int128, 128) +#endif + +#undef _GLIBCXX_INT_N_TRAITS + +#if __cplusplus >= 201103L + /// Convenience alias for __numeric_traits. + template + using __int_traits = __numeric_traits_integer<_Tp>; +#endif + +#define __glibcxx_floating(_Tp, _Fval, _Dval, _LDval) \ + (std::__are_same<_Tp, float>::__value ? _Fval \ + : std::__are_same<_Tp, double>::__value ? _Dval : _LDval) + +#define __glibcxx_max_digits10(_Tp) \ + (2 + __glibcxx_floating(_Tp, __FLT_MANT_DIG__, __DBL_MANT_DIG__, \ + __LDBL_MANT_DIG__) * 643L / 2136) + +#define __glibcxx_digits10(_Tp) \ + __glibcxx_floating(_Tp, __FLT_DIG__, __DBL_DIG__, __LDBL_DIG__) + +#define __glibcxx_max_exponent10(_Tp) \ + __glibcxx_floating(_Tp, __FLT_MAX_10_EXP__, __DBL_MAX_10_EXP__, \ + __LDBL_MAX_10_EXP__) + + // N.B. this only supports float, double and long double (no __float128 etc.) + template + struct __numeric_traits_floating + { + // Only floating point types. See N1822. + static const int __max_digits10 = __glibcxx_max_digits10(_Value); + + // See above comment... + static const bool __is_signed = true; + static const int __digits10 = __glibcxx_digits10(_Value); + static const int __max_exponent10 = __glibcxx_max_exponent10(_Value); + }; + + template + const int __numeric_traits_floating<_Value>::__max_digits10; + + template + const bool __numeric_traits_floating<_Value>::__is_signed; + + template + const int __numeric_traits_floating<_Value>::__digits10; + + template + const int __numeric_traits_floating<_Value>::__max_exponent10; + +#undef __glibcxx_floating +#undef __glibcxx_max_digits10 +#undef __glibcxx_digits10 +#undef __glibcxx_max_exponent10 + + template + struct __numeric_traits + : public __numeric_traits_integer<_Value> + { }; + + template<> + struct __numeric_traits + : public __numeric_traits_floating + { }; + + template<> + struct __numeric_traits + : public __numeric_traits_floating + { }; + + template<> + struct __numeric_traits + : public __numeric_traits_floating + { }; + +#ifdef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT +# if defined __LONG_DOUBLE_IEEE128__ + // long double is __ieee128, define traits for __ibm128 + template<> + struct __numeric_traits_floating<__ibm128> + { + static const int __max_digits10 = 33; + static const bool __is_signed = true; + static const int __digits10 = 31; + static const int __max_exponent10 = 308; + }; + template<> + struct __numeric_traits<__ibm128> + : public __numeric_traits_floating<__ibm128> + { }; +# elif defined __LONG_DOUBLE_IBM128__ + // long double is __ibm128, define traits for __ieee128 + template<> + struct __numeric_traits_floating<__ieee128> + { + static const int __max_digits10 = 36; + static const bool __is_signed = true; + static const int __digits10 = 33; + static const int __max_exponent10 = 4932; + }; + template<> + struct __numeric_traits<__ieee128> + : public __numeric_traits_floating<__ieee128> + { }; +# endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@numeric_traits.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@numeric_traits.h.blob new file mode 100644 index 0000000..580d00e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@numeric_traits.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@string_conversions.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@string_conversions.h new file mode 100644 index 0000000..a9e478b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@string_conversions.h @@ -0,0 +1,127 @@ +// String Conversions -*- C++ -*- + +// Copyright (C) 2008-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/string_conversions.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _STRING_CONVERSIONS_H +#define _STRING_CONVERSIONS_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // GNU extensions are currently omitted + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include +#include +#include +#include +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Helper for all the sto* functions. + template + _Ret + __stoa(_TRet (*__convf) (const _CharT*, _CharT**, _Base...), + const char* __name, const _CharT* __str, std::size_t* __idx, + _Base... __base) + { + _Ret __ret; + + _CharT* __endptr; + + struct _Save_errno { + _Save_errno() : _M_errno(errno) { errno = 0; } + ~_Save_errno() { if (errno == 0) errno = _M_errno; } + int _M_errno; + } const __save_errno; + + struct _Range_chk { + static bool + _S_chk(_TRet, std::false_type) { return false; } + + static bool + _S_chk(_TRet __val, std::true_type) // only called when _Ret is int + { + return __val < _TRet(__numeric_traits::__min) + || __val > _TRet(__numeric_traits::__max); + } + }; + + const _TRet __tmp = __convf(__str, &__endptr, __base...); + + if (__endptr == __str) + std::__throw_invalid_argument(__name); + else if (errno == ERANGE + || _Range_chk::_S_chk(__tmp, std::is_same<_Ret, int>{})) + std::__throw_out_of_range(__name); + else + __ret = __tmp; + + if (__idx) + *__idx = __endptr - __str; + + return __ret; + } + + // Helper for the to_string / to_wstring functions. + template + _String + __to_xstring(int (*__convf) (_CharT*, std::size_t, const _CharT*, + __builtin_va_list), std::size_t __n, + const _CharT* __fmt, ...) + { + // XXX Eventually the result should be constructed in-place in + // the __cxx11 string, likely with the help of internal hooks. + _CharT* __s = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) + * __n)); + + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + + const int __len = __convf(__s, __n, __fmt, __args); + + __builtin_va_end(__args); + + return _String(__s, __s + __len); + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // C++11 + +#endif // _STRING_CONVERSIONS_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@string_conversions.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@string_conversions.h.blob new file mode 100644 index 0000000..490638c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@string_conversions.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@type_traits.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@type_traits.h new file mode 100644 index 0000000..0615552 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@type_traits.h @@ -0,0 +1,280 @@ +// -*- C++ -*- + +// Copyright (C) 2005-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License as published by the Free Software +// Foundation; either version 3, or (at your option) any later +// version. + +// This library is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/type_traits.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _EXT_TYPE_TRAITS +#define _EXT_TYPE_TRAITS 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + +extern "C++" { + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Define a nested type if some predicate holds. + template + struct __enable_if + { }; + + template + struct __enable_if + { typedef _Tp __type; }; + + + // Conditional expression for types. If true, first, if false, second. + template + struct __conditional_type + { typedef _Iftrue __type; }; + + template + struct __conditional_type + { typedef _Iffalse __type; }; + + + // Given an integral builtin type, return the corresponding unsigned type. + template + struct __add_unsigned + { + private: + typedef __enable_if::__value, _Tp> __if_type; + + public: + typedef typename __if_type::__type __type; + }; + + template<> + struct __add_unsigned + { typedef unsigned char __type; }; + + template<> + struct __add_unsigned + { typedef unsigned char __type; }; + + template<> + struct __add_unsigned + { typedef unsigned short __type; }; + + template<> + struct __add_unsigned + { typedef unsigned int __type; }; + + template<> + struct __add_unsigned + { typedef unsigned long __type; }; + + template<> + struct __add_unsigned + { typedef unsigned long long __type; }; + + // Declare but don't define. + template<> + struct __add_unsigned; + + template<> + struct __add_unsigned; + + + // Given an integral builtin type, return the corresponding signed type. + template + struct __remove_unsigned + { + private: + typedef __enable_if::__value, _Tp> __if_type; + + public: + typedef typename __if_type::__type __type; + }; + + template<> + struct __remove_unsigned + { typedef signed char __type; }; + + template<> + struct __remove_unsigned + { typedef signed char __type; }; + + template<> + struct __remove_unsigned + { typedef short __type; }; + + template<> + struct __remove_unsigned + { typedef int __type; }; + + template<> + struct __remove_unsigned + { typedef long __type; }; + + template<> + struct __remove_unsigned + { typedef long long __type; }; + + // Declare but don't define. + template<> + struct __remove_unsigned; + + template<> + struct __remove_unsigned; + + + // For use in string and vstring. + template + _GLIBCXX_CONSTEXPR + inline bool + __is_null_pointer(_Type* __ptr) + { return __ptr == 0; } + + template + _GLIBCXX_CONSTEXPR + inline bool + __is_null_pointer(_Type) + { return false; } + +#if __cplusplus >= 201103L + constexpr bool + __is_null_pointer(std::nullptr_t) + { return true; } +#endif + + // For arithmetic promotions in and + + template::__value> + struct __promote + { typedef double __type; }; + + // No nested __type member for non-integer non-floating point types, + // allows this type to be used for SFINAE to constrain overloads in + // and to only the intended types. + template + struct __promote<_Tp, false> + { }; + + template<> + struct __promote + { typedef long double __type; }; + + template<> + struct __promote + { typedef double __type; }; + + template<> + struct __promote + { typedef float __type; }; + +#ifdef __STDCPP_FLOAT16_T__ + template<> + struct __promote<_Float16> + { typedef _Float16 __type; }; +#endif + +#ifdef __STDCPP_FLOAT32_T__ + template<> + struct __promote<_Float32> + { typedef _Float32 __type; }; +#endif + +#ifdef __STDCPP_FLOAT64_T__ + template<> + struct __promote<_Float64> + { typedef _Float64 __type; }; +#endif + +#ifdef __STDCPP_FLOAT128_T__ + template<> + struct __promote<_Float128> + { typedef _Float128 __type; }; +#endif + +#ifdef __STDCPP_BFLOAT16_T__ + template<> + struct __promote<__gnu_cxx::__bfloat16_t> + { typedef __gnu_cxx::__bfloat16_t __type; }; +#endif + +#if __cpp_fold_expressions + + template + using __promoted_t = decltype((typename __promote<_Tp>::__type(0) + ...)); + + // Deducing the promoted type is done by __promoted_t<_Tp...>, + // then __promote is used to provide the nested __type member. + template + using __promote_2 = __promote<__promoted_t<_Tp, _Up>>; + + template + using __promote_3 = __promote<__promoted_t<_Tp, _Up, _Vp>>; + + template + using __promote_4 = __promote<__promoted_t<_Tp, _Up, _Vp, _Wp>>; + +#else + + template::__type, + typename _Up2 = typename __promote<_Up>::__type> + struct __promote_2 + { + typedef __typeof__(_Tp2() + _Up2()) __type; + }; + + template::__type, + typename _Up2 = typename __promote<_Up>::__type, + typename _Vp2 = typename __promote<_Vp>::__type> + struct __promote_3 + { + typedef __typeof__(_Tp2() + _Up2() + _Vp2()) __type; + }; + + template::__type, + typename _Up2 = typename __promote<_Up>::__type, + typename _Vp2 = typename __promote<_Vp>::__type, + typename _Wp2 = typename __promote<_Wp>::__type> + struct __promote_4 + { + typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type; + }; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +} // extern "C++" + +#pragma GCC diagnostic pop + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@type_traits.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@type_traits.h.blob new file mode 100644 index 0000000..ce71639 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ext@type_traits.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@filesystem b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@filesystem new file mode 100644 index 0000000..3525e1b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@filesystem @@ -0,0 +1,60 @@ +// -*- C++ -*- + +// Copyright (C) 2014-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/filesystem + * This is a Standard C++ Library header. + * @ingroup filesystem + */ + +#ifndef _GLIBCXX_FILESYSTEM +#define _GLIBCXX_FILESYSTEM 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include + +#define __glibcxx_want_filesystem +#include + +#ifdef __cpp_lib_filesystem // C++ >= 17 && HOSTED + +/** + * @defgroup filesystem File System + * + * Utilities for performing operations on file systems and their components, + * such as paths, regular files, and directories. + * + * @since C++17 + */ + +#include +#include +#include +#include + +#endif // __cpp_lib_filesystem + +#endif // _GLIBCXX_FILESYSTEM diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@filesystem.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@filesystem.blob new file mode 100644 index 0000000..18a3b81 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@filesystem.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@initializer_list b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@initializer_list new file mode 100644 index 0000000..e33f75c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@initializer_list @@ -0,0 +1,107 @@ +// std::initializer_list support -*- C++ -*- + +// Copyright (C) 2008-2025 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file initializer_list + * This is a Standard C++ Library header. + */ + +#ifndef _INITIALIZER_LIST +#define _INITIALIZER_LIST + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus < 201103L +# include +#else // C++0x + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ + /// initializer_list + template + class initializer_list + { + public: + typedef _E value_type; + typedef const _E& reference; + typedef const _E& const_reference; + typedef size_t size_type; + typedef const _E* iterator; + typedef const _E* const_iterator; + + private: + iterator _M_array; + size_type _M_len; + + // The compiler can call a private constructor. + constexpr initializer_list(const_iterator __a, size_type __l) + : _M_array(__a), _M_len(__l) { } + + public: + constexpr initializer_list() noexcept + : _M_array(0), _M_len(0) { } + + // Number of elements. + constexpr size_type + size() const noexcept { return _M_len; } + + // First element. + constexpr const_iterator + begin() const noexcept { return _M_array; } + + // One past the last element. + constexpr const_iterator + end() const noexcept { return begin() + size(); } + }; + + /** + * @brief Return an iterator pointing to the first element of + * the initializer_list. + * @param __ils Initializer list. + * @relates initializer_list + */ + template + constexpr const _Tp* + begin(initializer_list<_Tp> __ils) noexcept + { return __ils.begin(); } + + /** + * @brief Return an iterator pointing to one past the last element + * of the initializer_list. + * @param __ils Initializer list. + * @relates initializer_list + */ + template + constexpr const _Tp* + end(initializer_list<_Tp> __ils) noexcept + { return __ils.end(); } +} + +#endif // C++11 + +#endif // _INITIALIZER_LIST diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@initializer_list.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@initializer_list.blob new file mode 100644 index 0000000..e96e362 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@initializer_list.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iomanip b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iomanip new file mode 100644 index 0000000..afa3698 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iomanip @@ -0,0 +1,552 @@ +// Standard stream manipulators -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/iomanip + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.6.3 Standard manipulators +// + +#ifndef _GLIBCXX_IOMANIP +#define _GLIBCXX_IOMANIP 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" + +#include // iostreams + +#include +#include +#include + +#define __glibcxx_want_quoted_string_io +#include + +#if __cplusplus >= 201103L +#include +#if __cplusplus > 201103L +#include +#endif +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // [27.6.3] standard manipulators + // Also see DR 183. + + struct _Resetiosflags { ios_base::fmtflags _M_mask; }; + + /** + * @brief Manipulator for @c setf. + * @param __mask A format flags mask. + * + * Sent to a stream object, this manipulator resets the specified flags, + * via @e stream.setf(0,__mask). + */ + inline _Resetiosflags + resetiosflags(ios_base::fmtflags __mask) + { return { __mask }; } + + template + inline basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) + { + __is.setf(ios_base::fmtflags(0), __f._M_mask); + return __is; + } + + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, _Resetiosflags __f) + { + __os.setf(ios_base::fmtflags(0), __f._M_mask); + return __os; + } + + + struct _Setiosflags { ios_base::fmtflags _M_mask; }; + + /** + * @brief Manipulator for @c setf. + * @param __mask A format flags mask. + * + * Sent to a stream object, this manipulator sets the format flags + * to @a __mask. + */ + inline _Setiosflags + setiosflags(ios_base::fmtflags __mask) + { return { __mask }; } + + template + inline basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) + { + __is.setf(__f._M_mask); + return __is; + } + + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, _Setiosflags __f) + { + __os.setf(__f._M_mask); + return __os; + } + + + struct _Setbase { int _M_base; }; + + /** + * @brief Manipulator for @c setf. + * @param __base A numeric base. + * + * Sent to a stream object, this manipulator changes the + * @c ios_base::basefield flags to @c oct, @c dec, or @c hex when @a base + * is 8, 10, or 16, accordingly, and to 0 if @a __base is any other value. + */ + inline _Setbase + setbase(int __base) + { return { __base }; } + + template + inline basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f) + { + __is.setf(__f._M_base == 8 ? ios_base::oct : + __f._M_base == 10 ? ios_base::dec : + __f._M_base == 16 ? ios_base::hex : + ios_base::fmtflags(0), ios_base::basefield); + return __is; + } + + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, _Setbase __f) + { + __os.setf(__f._M_base == 8 ? ios_base::oct : + __f._M_base == 10 ? ios_base::dec : + __f._M_base == 16 ? ios_base::hex : + ios_base::fmtflags(0), ios_base::basefield); + return __os; + } + + + template + struct _Setfill { _CharT _M_c; }; + + /** + * @brief Manipulator for @c fill. + * @param __c The new fill character. + * + * Sent to a stream object, this manipulator calls @c fill(__c) for that + * object. + */ + template + inline _Setfill<_CharT> + setfill(_CharT __c) + { return { __c }; } + + template + __attribute__((__deprecated__("'std::setfill' should only be used with " + "output streams"))) + inline basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f) + { + __is.fill(__f._M_c); + return __is; + } + + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, _Setfill<_CharT> __f) + { + __os.fill(__f._M_c); + return __os; + } + + + struct _Setprecision { int _M_n; }; + + /** + * @brief Manipulator for @c precision. + * @param __n The new precision. + * + * Sent to a stream object, this manipulator calls @c precision(__n) for + * that object. + */ + inline _Setprecision + setprecision(int __n) + { return { __n }; } + + template + inline basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f) + { + __is.precision(__f._M_n); + return __is; + } + + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, _Setprecision __f) + { + __os.precision(__f._M_n); + return __os; + } + + + struct _Setw { int _M_n; }; + + /** + * @brief Manipulator for @c width. + * @param __n The new width. + * + * Sent to a stream object, this manipulator calls @c width(__n) for + * that object. + */ + inline _Setw + setw(int __n) + { return { __n }; } + + template + inline basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, _Setw __f) + { + __is.width(__f._M_n); + return __is; + } + + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, _Setw __f) + { + __os.width(__f._M_n); + return __os; + } + +#if __cplusplus >= 201103L + + template + struct _Get_money { _MoneyT& _M_mon; bool _M_intl; }; + + /** + * @brief Extended manipulator for extracting money. + * @param __mon Either long double or a specialization of @c basic_string. + * @param __intl A bool indicating whether international format + * is to be used. + * + * Sent to a stream object, this manipulator extracts @a __mon. + */ + template + inline _Get_money<_MoneyT> + get_money(_MoneyT& __mon, bool __intl = false) + { return { __mon, __intl }; } + + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, _Get_money<_MoneyT> __f) + { + typename basic_istream<_CharT, _Traits>::sentry __cerb(__is, false); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + typedef istreambuf_iterator<_CharT, _Traits> _Iter; + typedef money_get<_CharT, _Iter> _MoneyGet; + + const _MoneyGet& __mg = use_facet<_MoneyGet>(__is.getloc()); + __mg.get(_Iter(__is.rdbuf()), _Iter(), __f._M_intl, + __is, __err, __f._M_mon); + } + __catch(__cxxabiv1::__forced_unwind&) + { + __is._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __is._M_setstate(ios_base::badbit); } + if (__err) + __is.setstate(__err); + } + return __is; + } + + + template + struct _Put_money { const _MoneyT& _M_mon; bool _M_intl; }; + + /** + * @brief Extended manipulator for inserting money. + * @param __mon Either long double or a specialization of @c basic_string. + * @param __intl A bool indicating whether international format + * is to be used. + * + * Sent to a stream object, this manipulator inserts @a __mon. + */ + template + inline _Put_money<_MoneyT> + put_money(const _MoneyT& __mon, bool __intl = false) + { return { __mon, __intl }; } + + template + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_money<_MoneyT> __f) + { + typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + typedef ostreambuf_iterator<_CharT, _Traits> _Iter; + typedef money_put<_CharT, _Iter> _MoneyPut; + + const _MoneyPut& __mp = use_facet<_MoneyPut>(__os.getloc()); + if (__mp.put(_Iter(__os.rdbuf()), __f._M_intl, __os, + __os.fill(), __f._M_mon).failed()) + __err |= ios_base::badbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + __os._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __os._M_setstate(ios_base::badbit); } + if (__err) + __os.setstate(__err); + } + return __os; + } + + template + struct _Put_time + { + const std::tm* _M_tmb; + const _CharT* _M_fmt; + }; + + /** + * @brief Extended manipulator for formatting time. + * + * This manipulator uses time_put::put to format time. + * [ext.manip] + * + * @param __tmb struct tm time data to format. + * @param __fmt format string. + */ + template + inline _Put_time<_CharT> + put_time(const std::tm* __tmb, const _CharT* __fmt) + { return { __tmb, __fmt }; } + + template + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, _Put_time<_CharT> __f) + { + typename basic_ostream<_CharT, _Traits>::sentry __cerb(__os); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + typedef ostreambuf_iterator<_CharT, _Traits> _Iter; + typedef time_put<_CharT, _Iter> _TimePut; + + const _CharT* const __fmt_end = __f._M_fmt + + _Traits::length(__f._M_fmt); + + const _TimePut& __mp = use_facet<_TimePut>(__os.getloc()); + if (__mp.put(_Iter(__os.rdbuf()), __os, __os.fill(), + __f._M_tmb, __f._M_fmt, __fmt_end).failed()) + __err |= ios_base::badbit; + } + __catch(__cxxabiv1::__forced_unwind&) + { + __os._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __os._M_setstate(ios_base::badbit); } + if (__err) + __os.setstate(__err); + } + return __os; + } + + template + struct _Get_time + { + std::tm* _M_tmb; + const _CharT* _M_fmt; + }; + + /** + * @brief Extended manipulator for extracting time. + * + * This manipulator uses time_get::get to extract time. + * [ext.manip] + * + * @param __tmb struct to extract the time data to. + * @param __fmt format string. + */ + template + inline _Get_time<_CharT> + get_time(std::tm* __tmb, const _CharT* __fmt) + { return { __tmb, __fmt }; } + + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, _Get_time<_CharT> __f) + { + typename basic_istream<_CharT, _Traits>::sentry __cerb(__is, false); + if (__cerb) + { + ios_base::iostate __err = ios_base::goodbit; + __try + { + typedef istreambuf_iterator<_CharT, _Traits> _Iter; + typedef time_get<_CharT, _Iter> _TimeGet; + + const _CharT* const __fmt_end = __f._M_fmt + + _Traits::length(__f._M_fmt); + + const _TimeGet& __mg = use_facet<_TimeGet>(__is.getloc()); + __mg.get(_Iter(__is.rdbuf()), _Iter(), __is, + __err, __f._M_tmb, __f._M_fmt, __fmt_end); + } + __catch(__cxxabiv1::__forced_unwind&) + { + __is._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __is._M_setstate(ios_base::badbit); } + if (__err) + __is.setstate(__err); + } + return __is; + } + +#ifdef __cpp_lib_quoted_string_io // C++ >= 14 && HOSTED + + /** + * @brief Manipulator for quoted strings. + * @param __string String to quote. + * @param __delim Character to quote string with. + * @param __escape Escape character to escape itself or quote character. + * @since C++14 + */ + template + inline auto + quoted(const _CharT* __string, + _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) + { + return __detail::_Quoted_string(__string, __delim, + __escape); + } + + template + inline auto + quoted(const basic_string<_CharT, _Traits, _Alloc>& __string, + _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) + { + return __detail::_Quoted_string< + const basic_string<_CharT, _Traits, _Alloc>&, _CharT>( + __string, __delim, __escape); + } + + template + inline auto + quoted(basic_string<_CharT, _Traits, _Alloc>& __string, + _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) + { + return __detail::_Quoted_string< + basic_string<_CharT, _Traits, _Alloc>&, _CharT>( + __string, __delim, __escape); + } + +#if __cplusplus >= 201703L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2785. quoted should work with basic_string_view + template + inline auto + quoted(basic_string_view<_CharT, _Traits> __sv, + _CharT __delim = _CharT('"'), _CharT __escape = _CharT('\\')) + { + return __detail::_Quoted_string< + basic_string_view<_CharT, _Traits>, _CharT>(__sv, __delim, __escape); + } +#endif // C++17 +#endif // __cpp_lib_quoted_string_io + +#endif // __cplusplus >= 201103L + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. + // NB: This syntax is a GNU extension. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template ostream& operator<<(ostream&, _Setfill); + extern template ostream& operator<<(ostream&, _Setiosflags); + extern template ostream& operator<<(ostream&, _Resetiosflags); + extern template ostream& operator<<(ostream&, _Setbase); + extern template ostream& operator<<(ostream&, _Setprecision); + extern template ostream& operator<<(ostream&, _Setw); + extern template istream& operator>>(istream&, _Setfill); + extern template istream& operator>>(istream&, _Setiosflags); + extern template istream& operator>>(istream&, _Resetiosflags); + extern template istream& operator>>(istream&, _Setbase); + extern template istream& operator>>(istream&, _Setprecision); + extern template istream& operator>>(istream&, _Setw); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template wostream& operator<<(wostream&, _Setfill); + extern template wostream& operator<<(wostream&, _Setiosflags); + extern template wostream& operator<<(wostream&, _Resetiosflags); + extern template wostream& operator<<(wostream&, _Setbase); + extern template wostream& operator<<(wostream&, _Setprecision); + extern template wostream& operator<<(wostream&, _Setw); + extern template wistream& operator>>(wistream&, _Setfill); + extern template wistream& operator>>(wistream&, _Setiosflags); + extern template wistream& operator>>(wistream&, _Resetiosflags); + extern template wistream& operator>>(wistream&, _Setbase); + extern template wistream& operator>>(wistream&, _Setprecision); + extern template wistream& operator>>(wistream&, _Setw); +#endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#pragma GCC diagnostic pop +#endif /* _GLIBCXX_IOMANIP */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iomanip.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iomanip.blob new file mode 100644 index 0000000..303d671 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iomanip.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ios b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ios new file mode 100644 index 0000000..63267c9 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ios @@ -0,0 +1,53 @@ +// Iostreams base classes -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/ios + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.4 Iostreams base classes +// + +#ifndef _GLIBCXX_IOS +#define _GLIBCXX_IOS 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // iostreams + +#include +#include // For ios_base::failure +#include // For char_traits, streamoff, streamsize, fpos +#include // For class locale +#include // For ios_base declarations. +#include +#include + +#define __glibcxx_want_ios_noreplace +#include + +#endif /* _GLIBCXX_IOS */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ios.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ios.blob new file mode 100644 index 0000000..e2d2a3f Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ios.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iosfwd b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iosfwd new file mode 100644 index 0000000..4decf24 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iosfwd @@ -0,0 +1,260 @@ +// Forward declarations -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/iosfwd + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.2 Forward declarations +// + +#ifndef _GLIBCXX_IOSFWD +#define _GLIBCXX_IOSFWD 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // iostreams + +#include +#include // For string forward declarations. +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup io I/O + * + * Nearly all of the I/O classes are parameterized on the type of + * characters they read and write. (The major exception is ios_base at + * the top of the hierarchy.) This is a change from pre-Standard + * streams, which were not templates. + * + * For ease of use and compatibility, all of the basic_* I/O-related + * classes are given typedef names for both of the builtin character + * widths (wide and narrow). The typedefs are the same as the + * pre-Standard names, for example: + * + * @code + * typedef basic_ifstream ifstream; + * @endcode + * + * Because properly forward-declaring these classes can be difficult, you + * should not do it yourself. Instead, include the <iosfwd> + * header, which contains only declarations of all the I/O classes as + * well as the typedefs. Trying to forward-declare the typedefs + * themselves (e.g., class ostream;) is not valid ISO C++. + * + * For more specific declarations, see + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html#std.io.objects + * + * @{ + */ + class ios_base; + + template > + class basic_ios; + + template > + class basic_streambuf; + + template > + class basic_istream; + + template > + class basic_ostream; + + template > + class basic_iostream; + + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + template, + typename _Alloc = allocator<_CharT> > + class basic_stringbuf; + + template, + typename _Alloc = allocator<_CharT> > + class basic_istringstream; + + template, + typename _Alloc = allocator<_CharT> > + class basic_ostringstream; + + template, + typename _Alloc = allocator<_CharT> > + class basic_stringstream; + +_GLIBCXX_END_NAMESPACE_CXX11 + + template > + class basic_filebuf; + + template > + class basic_ifstream; + + template > + class basic_ofstream; + + template > + class basic_fstream; + + template > + class istreambuf_iterator; + + template > + class ostreambuf_iterator; + + + /// Base class for @c char streams. + typedef basic_ios ios; + + /// Base class for @c char buffers. + typedef basic_streambuf streambuf; + + /// Base class for @c char input streams. + typedef basic_istream istream; + + /// Base class for @c char output streams. + typedef basic_ostream ostream; + + /// Base class for @c char mixed input and output streams. + typedef basic_iostream iostream; + + /// Class for @c char memory buffers. + typedef basic_stringbuf stringbuf; + + /// Class for @c char input memory streams. + typedef basic_istringstream istringstream; + + /// Class for @c char output memory streams. + typedef basic_ostringstream ostringstream; + + /// Class for @c char mixed input and output memory streams. + typedef basic_stringstream stringstream; + + /// Class for @c char file buffers. + typedef basic_filebuf filebuf; + + /// Class for @c char input file streams. + typedef basic_ifstream ifstream; + + /// Class for @c char output file streams. + typedef basic_ofstream ofstream; + + /// Class for @c char mixed input and output file streams. + typedef basic_fstream fstream; + +#ifdef _GLIBCXX_USE_WCHAR_T + /// Base class for @c wchar_t streams. + typedef basic_ios wios; + + /// Base class for @c wchar_t buffers. + typedef basic_streambuf wstreambuf; + + /// Base class for @c wchar_t input streams. + typedef basic_istream wistream; + + /// Base class for @c wchar_t output streams. + typedef basic_ostream wostream; + + /// Base class for @c wchar_t mixed input and output streams. + typedef basic_iostream wiostream; + + /// Class for @c wchar_t memory buffers. + typedef basic_stringbuf wstringbuf; + + /// Class for @c wchar_t input memory streams. + typedef basic_istringstream wistringstream; + + /// Class for @c wchar_t output memory streams. + typedef basic_ostringstream wostringstream; + + /// Class for @c wchar_t mixed input and output memory streams. + typedef basic_stringstream wstringstream; + + /// Class for @c wchar_t file buffers. + typedef basic_filebuf wfilebuf; + + /// Class for @c wchar_t input file streams. + typedef basic_ifstream wifstream; + + /// Class for @c wchar_t output file streams. + typedef basic_ofstream wofstream; + + /// Class for @c wchar_t mixed input and output file streams. + typedef basic_fstream wfstream; +#endif + +#if __cplusplus >= 202002L && _GLIBCXX_USE_CXX11_ABI + template, + typename _Allocator = allocator<_CharT>> + class basic_syncbuf; + template, + typename _Allocator = allocator<_CharT>> + class basic_osyncstream; + + using syncbuf = basic_syncbuf; + using osyncstream = basic_osyncstream; + +#ifdef _GLIBCXX_USE_WCHAR_T + using wsyncbuf = basic_syncbuf; + using wosyncstream = basic_osyncstream; +#endif +#endif // C++20 && CXX11_ABI + +#if __cplusplus > 202002L + template> + class basic_spanbuf; + template> + class basic_ispanstream; + template> + class basic_ospanstream; + template> + class basic_spanstream; + + using spanbuf = basic_spanbuf; + using ispanstream = basic_ispanstream; + using ospanstream = basic_ospanstream; + using spanstream = basic_spanstream; + +#ifdef _GLIBCXX_USE_WCHAR_T + using wspanbuf = basic_spanbuf; + using wispanstream = basic_ispanstream; + using wospanstream = basic_ospanstream; + using wspanstream = basic_spanstream; +#endif +#endif // C++23 + + /** @} */ + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _GLIBCXX_IOSFWD */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iosfwd.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iosfwd.blob new file mode 100644 index 0000000..769e079 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@iosfwd.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@istream b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@istream new file mode 100644 index 0000000..d5bb187 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@istream @@ -0,0 +1,1113 @@ +// Input streams -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// +// ISO C++ 14882: 27.6.1 Input streams +// + +/** @file include/istream + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_ISTREAM +#define _GLIBCXX_ISTREAM 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // iostreams + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Template class basic_istream. + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * + * This is the base class for all input streams. It provides text + * formatting of all builtin types, and communicates with any class + * derived from basic_streambuf to do the actual input. + */ + template + class basic_istream : virtual public basic_ios<_CharT, _Traits> + { + public: + // Types (inherited from basic_ios (27.4.4)): + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + // Non-standard Types: + typedef basic_streambuf<_CharT, _Traits> __streambuf_type; + typedef basic_ios<_CharT, _Traits> __ios_type; + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > + __num_get_type; + typedef ctype<_CharT> __ctype_type; + + protected: + // Data Members: + /** + * The number of characters extracted in the previous unformatted + * function; see gcount(). + */ + streamsize _M_gcount; + + public: + /** + * @brief Base constructor. + * + * This ctor is almost never called by the user directly, rather from + * derived classes' initialization lists, which pass a pointer to + * their own stream buffer. + */ + explicit + basic_istream(__streambuf_type* __sb) + : _M_gcount(streamsize(0)) + { this->init(__sb); } + + /** + * @brief Base destructor. + * + * This does very little apart from providing a virtual base dtor. + */ + virtual + ~basic_istream() + { _M_gcount = streamsize(0); } + + /// Safe prefix/suffix operations. + class sentry; + friend class sentry; + + ///@{ + /** + * @brief Interface for manipulators. + * + * Manipulators such as @c std::ws and @c std::dec use these + * functions in constructs like + * std::cin >> std::ws. + * For more information, see the iomanip header. + */ + __istream_type& + operator>>(__istream_type& (*__pf)(__istream_type&)) + { return __pf(*this); } + + __istream_type& + operator>>(__ios_type& (*__pf)(__ios_type&)) + { + __pf(*this); + return *this; + } + + __istream_type& + operator>>(ios_base& (*__pf)(ios_base&)) + { + __pf(*this); + return *this; + } + ///@} + + ///@{ + /** + * @name Extractors + * + * All the @c operator>> functions (aka formatted input + * functions) have some common behavior. Each starts by + * constructing a temporary object of type std::basic_istream::sentry + * with the second argument (noskipws) set to false. This has several + * effects, concluding with the setting of a status flag; see the + * sentry documentation for more. + * + * If the sentry status is good, the function tries to extract + * whatever data is appropriate for the type of the argument. + * + * If an exception is thrown during extraction, ios_base::badbit + * will be turned on in the stream's error state (without causing an + * ios_base::failure to be thrown) and the original exception will + * be rethrown if badbit is set in the exceptions mask. + */ + + ///@{ + /** + * @brief Integer arithmetic extractors + * @param __n A variable of builtin integral type. + * @return @c *this if successful + * + * These functions use the stream's current locale (specifically, the + * @c num_get facet) to parse the input data. + */ + __istream_type& + operator>>(bool& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(short& __n); + + __istream_type& + operator>>(unsigned short& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(int& __n); + + __istream_type& + operator>>(unsigned int& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(long& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(unsigned long& __n) + { return _M_extract(__n); } + +#ifdef _GLIBCXX_USE_LONG_LONG +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlong-long" + __istream_type& + operator>>(long long& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(unsigned long long& __n) + { return _M_extract(__n); } +#pragma GCC diagnostic pop +#endif + ///@} + + ///@{ + /** + * @brief Floating point arithmetic extractors + * @param __f A variable of builtin floating point type. + * @return @c *this if successful + * + * These functions use the stream's current locale (specifically, the + * @c num_get facet) to parse the input data. + */ + __istream_type& + operator>>(float& __f) + { return _M_extract(__f); } + + __istream_type& + operator>>(double& __f) + { return _M_extract(__f); } + + __istream_type& + operator>>(long double& __f) + { return _M_extract(__f); } + ///@} + +#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + __attribute__((__always_inline__)) + __istream_type& + operator>>(_Float16& __f) + { + float __flt; + __istream_type& __ret = _M_extract(__flt); + ios_base::iostate __err = ios_base::goodbit; + if (__flt < -__FLT16_MAX__) + { + __f = -__FLT16_MAX__; + __err = ios_base::failbit; + } + else if (__flt > __FLT16_MAX__) + { + __f = __FLT16_MAX__; + __err = ios_base::failbit; + } + else + __f = static_cast<_Float16>(__flt); + if (__err) + this->setstate(__err); + return __ret; + } +#endif + +#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + __attribute__((__always_inline__)) + __istream_type& + operator>>(_Float32& __f) + { + float __flt; + __istream_type& __ret = _M_extract(__flt); + __f = static_cast<_Float32> (__flt); + return __ret; + } +#endif + +#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) + __attribute__((__always_inline__)) + __istream_type& + operator>>(_Float64& __f) + { + double __dbl; + __istream_type& __ret = _M_extract(__dbl); + __f = static_cast<_Float64> (__dbl); + return __ret; + } +#endif + +#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) + __attribute__((__always_inline__)) + __istream_type& + operator>>(_Float128& __f) + { + long double __ldbl; + __istream_type& __ret = _M_extract(__ldbl); + __f = static_cast<_Float128> (__ldbl); + return __ret; + } +#endif + +#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + __attribute__((__always_inline__)) + __istream_type& + operator>>(__gnu_cxx::__bfloat16_t & __f) + { + float __flt; + __istream_type& __ret = _M_extract(__flt); + ios_base::iostate __err = ios_base::goodbit; + if (__flt < -__BFLT16_MAX__) + { + __f = -__BFLT16_MAX__; + __err = ios_base::failbit; + } + else if (__flt > __BFLT16_MAX__) + { + __f = __BFLT16_MAX__; + __err = ios_base::failbit; + } + else + __f = static_cast<__gnu_cxx::__bfloat16_t>(__flt); + if (__err) + this->setstate(__err); + return __ret; + } +#endif + + /** + * @brief Basic arithmetic extractors + * @param __p A variable of pointer type. + * @return @c *this if successful + * + * These functions use the stream's current locale (specifically, the + * @c num_get facet) to parse the input data. + */ + __istream_type& + operator>>(void*& __p) + { return _M_extract(__p); } + + /** + * @brief Extracting into another streambuf. + * @param __sb A pointer to a streambuf + * + * This function behaves like one of the basic arithmetic extractors, + * in that it also constructs a sentry object and has the same error + * handling behavior. + * + * If @p __sb is NULL, the stream will set failbit in its error state. + * + * Characters are extracted from this stream and inserted into the + * @p __sb streambuf until one of the following occurs: + * + * - the input stream reaches end-of-file, + * - insertion into the output buffer fails (in this case, the + * character that would have been inserted is not extracted), or + * - an exception occurs (and in this case is caught) + * + * If the function inserts no characters, failbit is set. + */ + __istream_type& + operator>>(__streambuf_type* __sb); + ///@} + + // [27.6.1.3] unformatted input + /** + * @brief Character counting + * @return The number of characters extracted by the previous + * unformatted input function dispatched for this stream. + */ + streamsize + gcount() const + { return _M_gcount; } + + ///@{ + /** + * @name Unformatted Input Functions + * + * All the unformatted input functions have some common behavior. + * Each starts by constructing a temporary object of type + * std::basic_istream::sentry with the second argument (noskipws) + * set to true. This has several effects, concluding with the + * setting of a status flag; see the sentry documentation for more. + * + * If the sentry status is good, the function tries to extract + * whatever data is appropriate for the type of the argument. + * + * The number of characters extracted is stored for later retrieval + * by gcount(). + * + * If an exception is thrown during extraction, ios_base::badbit + * will be turned on in the stream's error state (without causing an + * ios_base::failure to be thrown) and the original exception will + * be rethrown if badbit is set in the exceptions mask. + */ + + /** + * @brief Simple extraction. + * @return A character, or eof(). + * + * Tries to extract a character. If none are available, sets failbit + * and returns traits::eof(). + */ + int_type + get(); + + /** + * @brief Simple extraction. + * @param __c The character in which to store data. + * @return *this + * + * Tries to extract a character and store it in @a __c. If none are + * available, sets failbit and returns traits::eof(). + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __istream_type& + get(char_type& __c); + + /** + * @brief Simple multiple-character extraction. + * @param __s Pointer to an array. + * @param __n Maximum number of characters to store in @a __s. + * @param __delim A "stop" character. + * @return *this + * + * Characters are extracted and stored into @a __s until one of the + * following happens: + * + * - @c __n-1 characters are stored + * - the input sequence reaches EOF + * - the next character equals @a __delim, in which case the character + * is not extracted + * + * If no characters are stored, failbit is set in the stream's error + * state. + * + * In any case, a null character is stored into the next location in + * the array. + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __istream_type& + get(char_type* __s, streamsize __n, char_type __delim); + + /** + * @brief Simple multiple-character extraction. + * @param __s Pointer to an array. + * @param __n Maximum number of characters to store in @a s. + * @return *this + * + * Returns @c get(__s,__n,widen('\\n')). + */ + __istream_type& + get(char_type* __s, streamsize __n) + { return this->get(__s, __n, this->widen('\n')); } + + /** + * @brief Extraction into another streambuf. + * @param __sb A streambuf in which to store data. + * @param __delim A "stop" character. + * @return *this + * + * Characters are extracted and inserted into @a __sb until one of the + * following happens: + * + * - the input sequence reaches EOF + * - insertion into the output buffer fails (in this case, the + * character that would have been inserted is not extracted) + * - the next character equals @a __delim (in this case, the character + * is not extracted) + * - an exception occurs (and in this case is caught) + * + * If no characters are stored, failbit is set in the stream's error + * state. + */ + __istream_type& + get(__streambuf_type& __sb, char_type __delim); + + /** + * @brief Extraction into another streambuf. + * @param __sb A streambuf in which to store data. + * @return *this + * + * Returns @c get(__sb,widen('\\n')). + */ + __istream_type& + get(__streambuf_type& __sb) + { return this->get(__sb, this->widen('\n')); } + + /** + * @brief String extraction. + * @param __s A character array in which to store the data. + * @param __n Maximum number of characters to extract. + * @param __delim A "stop" character. + * @return *this + * + * Extracts and stores characters into @a __s until one of the + * following happens. Note that these criteria are required to be + * tested in the order listed here, to allow an input line to exactly + * fill the @a __s array without setting failbit. + * + * -# the input sequence reaches end-of-file, in which case eofbit + * is set in the stream error state + * -# the next character equals @c __delim, in which case the character + * is extracted (and therefore counted in @c gcount()) but not stored + * -# @c __n-1 characters are stored, in which case failbit is set + * in the stream error state + * + * If no characters are extracted, failbit is set. (An empty line of + * input should therefore not cause failbit to be set.) + * + * In any case, a null character is stored in the next location in + * the array. + */ + __istream_type& + getline(char_type* __s, streamsize __n, char_type __delim); + + /** + * @brief String extraction. + * @param __s A character array in which to store the data. + * @param __n Maximum number of characters to extract. + * @return *this + * + * Returns @c getline(__s,__n,widen('\\n')). + */ + __istream_type& + getline(char_type* __s, streamsize __n) + { return this->getline(__s, __n, this->widen('\n')); } + + /** + * @brief Discarding characters + * @param __n Number of characters to discard. + * @param __delim A "stop" character. + * @return *this + * + * Extracts characters and throws them away until one of the + * following happens: + * - if @a __n @c != @c std::numeric_limits::max(), @a __n + * characters are extracted + * - the input sequence reaches end-of-file + * - the next character equals @a __delim (in this case, the character + * is extracted); note that this condition will never occur if + * @a __delim equals @c traits::eof(). + * + * NB: Provide three overloads, instead of the single function + * (with defaults) mandated by the Standard: this leads to a + * better performing implementation, while still conforming to + * the Standard. + */ + __istream_type& + ignore(streamsize __n, int_type __delim); + + __istream_type& + ignore(streamsize __n); + + __istream_type& + ignore(); + + /** + * @brief Looking ahead in the stream + * @return The next character, or eof(). + * + * If, after constructing the sentry object, @c good() is false, + * returns @c traits::eof(). Otherwise reads but does not extract + * the next input character. + */ + int_type + peek(); + + /** + * @brief Extraction without delimiters. + * @param __s A character array. + * @param __n Maximum number of characters to store. + * @return *this + * + * If the stream state is @c good(), extracts characters and stores + * them into @a __s until one of the following happens: + * - @a __n characters are stored + * - the input sequence reaches end-of-file, in which case the error + * state is set to @c failbit|eofbit. + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __istream_type& + read(char_type* __s, streamsize __n); + + /** + * @brief Extraction until the buffer is exhausted, but no more. + * @param __s A character array. + * @param __n Maximum number of characters to store. + * @return The number of characters extracted. + * + * Extracts characters and stores them into @a __s depending on the + * number of characters remaining in the streambuf's buffer, + * @c rdbuf()->in_avail(), called @c A here: + * - if @c A @c == @c -1, sets eofbit and extracts no characters + * - if @c A @c == @c 0, extracts no characters + * - if @c A @c > @c 0, extracts @c min(A,n) + * + * The goal is to empty the current buffer, and to not request any + * more from the external input sequence controlled by the streambuf. + */ + streamsize + readsome(char_type* __s, streamsize __n); + + /** + * @brief Unextracting a single character. + * @param __c The character to push back into the input stream. + * @return *this + * + * If @c rdbuf() is not null, calls @c rdbuf()->sputbackc(c). + * + * If @c rdbuf() is null or if @c sputbackc() fails, sets badbit in + * the error state. + * + * @note This function first clears eofbit. Since no characters + * are extracted, the next call to @c gcount() will return 0, + * as required by DR 60. + */ + __istream_type& + putback(char_type __c); + + /** + * @brief Unextracting the previous character. + * @return *this + * + * If @c rdbuf() is not null, calls @c rdbuf()->sungetc(c). + * + * If @c rdbuf() is null or if @c sungetc() fails, sets badbit in + * the error state. + * + * @note This function first clears eofbit. Since no characters + * are extracted, the next call to @c gcount() will return 0, + * as required by DR 60. + */ + __istream_type& + unget(); + + /** + * @brief Synchronizing the stream buffer. + * @return 0 on success, -1 on failure + * + * If @c rdbuf() is a null pointer, returns -1. + * + * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1, + * sets badbit and returns -1. + * + * Otherwise, returns 0. + * + * @note This function does not count the number of characters + * extracted, if any, and therefore does not affect the next + * call to @c gcount(). + */ + int + sync(); + + /** + * @brief Getting the current read position. + * @return A file position object. + * + * If @c fail() is not false, returns @c pos_type(-1) to indicate + * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,in). + * + * @note This function does not count the number of characters + * extracted, if any, and therefore does not affect the next + * call to @c gcount(). At variance with putback, unget and + * seekg, eofbit is not cleared first. + */ + pos_type + tellg(); + + /** + * @brief Changing the current read position. + * @param __pos A file position object. + * @return *this + * + * If @c fail() is not true, calls @c rdbuf()->pubseekpos(__pos). If + * that function fails, sets failbit. + * + * @note This function first clears eofbit. It does not count the + * number of characters extracted, if any, and therefore does + * not affect the next call to @c gcount(). + */ + __istream_type& + seekg(pos_type); + + /** + * @brief Changing the current read position. + * @param __off A file offset object. + * @param __dir The direction in which to seek. + * @return *this + * + * If @c fail() is not true, calls @c rdbuf()->pubseekoff(__off,__dir). + * If that function fails, sets failbit. + * + * @note This function first clears eofbit. It does not count the + * number of characters extracted, if any, and therefore does + * not affect the next call to @c gcount(). + */ + __istream_type& + seekg(off_type, ios_base::seekdir); + ///@} + + protected: + basic_istream() + : _M_gcount(streamsize(0)) + { this->init(0); } + +#if __cplusplus >= 201103L + basic_istream(const basic_istream&) = delete; + + basic_istream(basic_istream&& __rhs) + : __ios_type(), _M_gcount(__rhs._M_gcount) + { + __ios_type::move(__rhs); + __rhs._M_gcount = 0; + } + + // 27.7.3.3 Assign/swap + + basic_istream& operator=(const basic_istream&) = delete; + + basic_istream& + operator=(basic_istream&& __rhs) + { + swap(__rhs); + return *this; + } + + void + swap(basic_istream& __rhs) + { + __ios_type::swap(__rhs); + std::swap(_M_gcount, __rhs._M_gcount); + } +#endif + + template + __istream_type& + _M_extract(_ValueT& __v); + }; + + /// Explicit specialization declarations, defined in src/istream.cc. + template<> + basic_istream& + basic_istream:: + getline(char_type* __s, streamsize __n, char_type __delim); + + template<> + basic_istream& + basic_istream:: + ignore(streamsize __n); + + template<> + basic_istream& + basic_istream:: + ignore(streamsize __n, int_type __delim); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + basic_istream& + basic_istream:: + getline(char_type* __s, streamsize __n, char_type __delim); + + template<> + basic_istream& + basic_istream:: + ignore(streamsize __n); + + template<> + basic_istream& + basic_istream:: + ignore(streamsize __n, int_type __delim); +#endif + + /** + * @brief Performs setup work for input streams. + * + * Objects of this class are created before all of the standard + * extractors are run. It is responsible for exception-safe + * prefix and suffix operations, although only prefix actions + * are currently required by the standard. + */ + template + class basic_istream<_CharT, _Traits>::sentry + { + // Data Members. + bool _M_ok; + + public: + /// Easy access to dependent types. + typedef _Traits traits_type; + typedef basic_streambuf<_CharT, _Traits> __streambuf_type; + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef typename __istream_type::__ctype_type __ctype_type; + typedef typename _Traits::int_type __int_type; + + /** + * @brief The constructor performs all the work. + * @param __is The input stream to guard. + * @param __noskipws Whether to consume whitespace or not. + * + * If the stream state is good (@a __is.good() is true), then the + * following actions are performed, otherwise the sentry state + * is false (not okay) and failbit is set in the + * stream state. + * + * The sentry's preparatory actions are: + * + * -# if the stream is tied to an output stream, @c is.tie()->flush() + * is called to synchronize the output sequence + * -# if @a __noskipws is false, and @c ios_base::skipws is set in + * @c is.flags(), the sentry extracts and discards whitespace + * characters from the stream. The currently imbued locale is + * used to determine whether each character is whitespace. + * + * If the stream state is still good, then the sentry state becomes + * true (@a okay). + */ + explicit + sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false); + + /** + * @brief Quick status checking. + * @return The sentry state. + * + * For ease of use, sentries may be converted to booleans. The + * return value is that of the sentry state (true == okay). + */ +#if __cplusplus >= 201103L + explicit +#endif + operator bool() const + { return _M_ok; } + }; + + ///@{ + /** + * @brief Character extractors + * @param __in An input stream. + * @param __c A character reference. + * @return in + * + * Behaves like one of the formatted arithmetic extractors described in + * std::basic_istream. After constructing a sentry object with good + * status, this function extracts a character (if one is available) and + * stores it in @a __c. Otherwise, sets failbit in the input stream. + */ + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c); + + template + inline basic_istream& + operator>>(basic_istream& __in, unsigned char& __c) + { return (__in >> reinterpret_cast(__c)); } + + template + inline basic_istream& + operator>>(basic_istream& __in, signed char& __c) + { return (__in >> reinterpret_cast(__c)); } + ///@} + + + template + void + __istream_extract(basic_istream<_CharT, _Traits>&, _CharT*, streamsize); + + void __istream_extract(istream&, char*, streamsize); + + ///@{ + /** + * @brief Character string extractors + * @param __in An input stream. + * @param __s A character array (or a pointer to an array before C++20). + * @return __in + * + * Behaves like one of the formatted arithmetic extractors described in + * `std::basic_istream`. After constructing a sentry object with good + * status, this function extracts up to `n` characters and stores them + * into the array `__s`. `n` is defined as: + * + * - if `width()` is greater than zero, `n` is `min(width(), n)` + * - otherwise `n` is the number of elements of the array + * - (before C++20 the pointer is assumed to point to an array of + * the largest possible size for an array of `char_type`). + * + * Characters are extracted and stored until one of the following happens: + * - `n - 1` characters are stored + * - EOF is reached + * - the next character is whitespace according to the current locale + * + * `width(0)` is then called for the input stream. + * + * If no characters are extracted, sets failbit. + */ + +#if __cplusplus <= 201703L + template + __attribute__((__nonnull__(2), __access__(__write_only__, 2))) + inline basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) + { +#ifdef __OPTIMIZE__ + // Function inlining might make the buffer size known, allowing us to + // prevent overflow. + size_t __n = __builtin_object_size(__s, 0); + if (__n < sizeof(_CharT)) + { + // There is not even space for the required null terminator. + __glibcxx_assert(__n >= sizeof(_CharT)); + // No point calling __istream_extract, but still need to reset width. + __in.width(0); + __in.setstate(ios_base::failbit); + } + else if (__n != (size_t)-1) + { + __n /= sizeof(_CharT); + streamsize __w = __in.width(); + std::__istream_extract(__in, __s, __n); + if (__in.good() && (__w <= 0 || __n < (size_t)__w)) + { + // Stopped extracting early to avoid overflowing the buffer, + // but might have stopped anyway (and set eofbit) if at EOF. + const typename _Traits::int_type __c = __in.rdbuf()->sgetc(); + const bool __eof = _Traits::eq_int_type(__c, _Traits::eof()); + if (__builtin_expect(__eof, true)) // Assume EOF, not overflow. + __in.setstate(ios_base::eofbit); + } + } + else +#endif // __OPTIMIZE + { + // Buffer size is unknown, have to assume it's huge. + streamsize __n = __gnu_cxx::__numeric_traits::__max; + __n /= sizeof(_CharT); + std::__istream_extract(__in, __s, __n); + } + return __in; + } + + template + __attribute__((__nonnull__(2), __access__(__write_only__, 2))) + inline basic_istream& + operator>>(basic_istream& __in, unsigned char* __s) + { return __in >> reinterpret_cast(__s); } + + template + __attribute__((__nonnull__(2), __access__(__write_only__, 2))) + inline basic_istream& + operator>>(basic_istream& __in, signed char* __s) + { return __in >> reinterpret_cast(__s); } +#else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2499. operator>>(istream&, char*) makes it hard to avoid buffer overflows + template + inline basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __in, _CharT (&__s)[_Num]) + { + static_assert(_Num <= __gnu_cxx::__numeric_traits::__max); + std::__istream_extract(__in, __s, _Num); + return __in; + } + + template + inline basic_istream& + operator>>(basic_istream& __in, unsigned char (&__s)[_Num]) + { return __in >> reinterpret_cast(__s); } + + template + inline basic_istream& + operator>>(basic_istream& __in, signed char (&__s)[_Num]) + { return __in >> reinterpret_cast(__s); } +#endif + ///@} + + /** + * @brief Template class basic_iostream + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * + * This class multiply inherits from the input and output stream classes + * simply to provide a single interface. + */ + template + class basic_iostream + : public basic_istream<_CharT, _Traits>, + public basic_ostream<_CharT, _Traits> + { + public: + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 271. basic_iostream missing typedefs + // Types (inherited): + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + // Non-standard Types: + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef basic_ostream<_CharT, _Traits> __ostream_type; + + /** + * @brief Constructor does nothing. + * + * Both of the parent classes are initialized with the same + * streambuf pointer passed to this constructor. + */ + explicit + basic_iostream(basic_streambuf<_CharT, _Traits>* __sb) + : __istream_type(__sb), __ostream_type(__sb) { } + + /** + * @brief Destructor does nothing. + */ + virtual + ~basic_iostream() { } + + protected: + basic_iostream() + : __istream_type(), __ostream_type() { } + +#if __cplusplus >= 201103L + basic_iostream(const basic_iostream&) = delete; + + basic_iostream(basic_iostream&& __rhs) + : __istream_type(std::move(__rhs)), __ostream_type(*this) + { } + + // 27.7.3.3 Assign/swap + + basic_iostream& operator=(const basic_iostream&) = delete; + + basic_iostream& + operator=(basic_iostream&& __rhs) + { + swap(__rhs); + return *this; + } + + void + swap(basic_iostream& __rhs) + { __istream_type::swap(__rhs); } +#endif + }; + + /** + * @brief Quick and easy way to eat whitespace + * + * This manipulator extracts whitespace characters, stopping when the + * next character is non-whitespace, or when the input sequence is empty. + * If the sequence is empty, @c eofbit is set in the stream, but not + * @c failbit. + * + * The current locale is used to distinguish whitespace characters. + * + * Example: + * @code + * MyClass mc; + * + * std::cin >> std::ws >> mc; + * @endcode + * will skip leading whitespace before calling operator>> on cin and your + * object. Note that the same effect can be achieved by creating a + * std::basic_istream::sentry inside your definition of operator>>. + */ + template + basic_istream<_CharT, _Traits>& + ws(basic_istream<_CharT, _Traits>& __is); + +#if __cplusplus >= 201103L + // C++11 27.7.2.6 Rvalue stream extraction [istream.rvalue] + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2328. Rvalue stream extraction should use perfect forwarding + // 1203. More useful rvalue stream insertion + +#if __cpp_concepts >= 201907L && __glibcxx_type_trait_variable_templates + template + requires __derived_from_ios_base<_Is> + && requires (_Is& __is, _Tp&& __t) { __is >> std::forward<_Tp>(__t); } + using __rvalue_stream_extraction_t = _Is&&; +#else + template, + typename = decltype(std::declval<_Is&>() >> std::declval<_Tp>())> + using __rvalue_stream_extraction_t = _Is&&; +#endif + + /** + * @brief Generic extractor for rvalue stream + * @param __is An input stream. + * @param __x A reference to the extraction target. + * @return __is + * + * This is just a forwarding function to allow extraction from + * rvalue streams since they won't bind to the extractor functions + * that take an lvalue reference. + */ + template + inline __rvalue_stream_extraction_t<_Istream, _Tp> + operator>>(_Istream&& __is, _Tp&& __x) + { + __is >> std::forward<_Tp>(__x); + return std::move(__is); + } +#endif // C++11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#include + +#endif /* _GLIBCXX_ISTREAM */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@istream.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@istream.blob new file mode 100644 index 0000000..4a814d8 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@istream.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@limits b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@limits new file mode 100644 index 0000000..5662a22 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@limits @@ -0,0 +1,2240 @@ +// The template and inlines for the numeric_limits classes. -*- C++ -*- + +// Copyright (C) 1999-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/limits + * This is a Standard C++ Library header. + */ + +// Note: this is not a conforming implementation. +// Written by Gabriel Dos Reis + +// +// ISO 14882:1998 +// 18.2.1 +// + +#ifndef _GLIBCXX_NUMERIC_LIMITS +#define _GLIBCXX_NUMERIC_LIMITS 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" // Q suffix +#pragma GCC diagnostic ignored "-Wlong-long" +#pragma GCC diagnostic ignored "-Wc++23-extensions" + +#include + +// +// The numeric_limits<> traits document implementation-defined aspects +// of fundamental arithmetic data types (integers and floating points). +// From Standard C++ point of view, there are 14 such types: +// * integers +// bool (1) +// char, signed char, unsigned char, wchar_t (4) +// short, unsigned short (2) +// int, unsigned (2) +// long, unsigned long (2) +// +// * floating points +// float (1) +// double (1) +// long double (1) +// +// GNU C++ understands (where supported by the host C-library) +// * integer +// long long, unsigned long long (2) +// +// which brings us to 16 fundamental arithmetic data types in GNU C++. +// +// +// Since a numeric_limits<> is a bit tricky to get right, we rely on +// an interface composed of macros which should be defined in config/os +// or config/cpu when they differ from the generic (read arbitrary) +// definitions given here. +// + +// These values can be overridden in the target configuration file. +// The default values are appropriate for many 32-bit targets. + +// GCC only intrinsically supports modulo integral types. The only remaining +// integral exceptional values is division by zero. Only targets that do not +// signal division by zero in some "hard to ignore" way should use false. +#ifndef __glibcxx_integral_traps +# define __glibcxx_integral_traps true +#endif + +// float +// + +// Default values. Should be overridden in configuration files if necessary. + +#ifndef __glibcxx_float_has_denorm_loss +# define __glibcxx_float_has_denorm_loss false +#endif +#ifndef __glibcxx_float_traps +# define __glibcxx_float_traps false +#endif +#ifndef __glibcxx_float_tinyness_before +# define __glibcxx_float_tinyness_before false +#endif + +// double + +// Default values. Should be overridden in configuration files if necessary. + +#ifndef __glibcxx_double_has_denorm_loss +# define __glibcxx_double_has_denorm_loss false +#endif +#ifndef __glibcxx_double_traps +# define __glibcxx_double_traps false +#endif +#ifndef __glibcxx_double_tinyness_before +# define __glibcxx_double_tinyness_before false +#endif + +// long double + +// Default values. Should be overridden in configuration files if necessary. + +#ifndef __glibcxx_long_double_has_denorm_loss +# define __glibcxx_long_double_has_denorm_loss false +#endif +#ifndef __glibcxx_long_double_traps +# define __glibcxx_long_double_traps false +#endif +#ifndef __glibcxx_long_double_tinyness_before +# define __glibcxx_long_double_tinyness_before false +#endif + +// You should not need to define any macros below this point. + +#define __glibcxx_signed_b(T,B) ((T)(-1) < 0) + +#define __glibcxx_min_b(T,B) \ + (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0) + +#define __glibcxx_max_b(T,B) \ + (__glibcxx_signed_b (T,B) ? \ + (((((T)1 << (__glibcxx_digits_b (T,B) - 1)) - 1) << 1) + 1) : ~(T)0) + +#define __glibcxx_digits_b(T,B) \ + (B - __glibcxx_signed_b (T,B)) + +// The fraction 643/2136 approximates log10(2) to 7 significant digits. +#define __glibcxx_digits10_b(T,B) \ + (__glibcxx_digits_b (T,B) * 643L / 2136) + +#define __glibcxx_signed(T) \ + __glibcxx_signed_b (T, sizeof(T) * __CHAR_BIT__) +#define __glibcxx_min(T) \ + __glibcxx_min_b (T, sizeof(T) * __CHAR_BIT__) +#define __glibcxx_max(T) \ + __glibcxx_max_b (T, sizeof(T) * __CHAR_BIT__) +#define __glibcxx_digits(T) \ + __glibcxx_digits_b (T, sizeof(T) * __CHAR_BIT__) +#define __glibcxx_digits10(T) \ + __glibcxx_digits10_b (T, sizeof(T) * __CHAR_BIT__) + +#define __glibcxx_max_digits10(T) \ + (2 + (T) * 643L / 2136) + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Describes the rounding style for floating-point types. + * + * This is used in the std::numeric_limits class. + */ + enum float_round_style + { + round_indeterminate = -1, ///< Intermediate. + round_toward_zero = 0, ///< To zero. + round_to_nearest = 1, ///< To the nearest representable value. + round_toward_infinity = 2, ///< To infinity. + round_toward_neg_infinity = 3 ///< To negative infinity. + }; + + /** + * @brief Describes the denormalization for floating-point types. + * + * These values represent the presence or absence of a variable number + * of exponent bits. This type is used in the std::numeric_limits class. + */ + enum float_denorm_style + { + /// Indeterminate at compile time whether denormalized values are allowed. + denorm_indeterminate = -1, + /// The type does not allow denormalized values. + denorm_absent = 0, + /// The type allows denormalized values. + denorm_present = 1 + }; + + /** + * @brief Part of std::numeric_limits. + * + * The @c static @c const members are usable as integral constant + * expressions. + * + * @note This is a separate class for purposes of efficiency; you + * should only access these members as part of an instantiation + * of the std::numeric_limits class. + */ + struct __numeric_limits_base + { + /** This will be true for all fundamental types (which have + specializations), and false for everything else. */ + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = false; + + /** The number of @c radix digits that be represented without change: for + integer types, the number of non-sign bits in the mantissa; for + floating types, the number of @c radix digits in the mantissa. */ + static _GLIBCXX_USE_CONSTEXPR int digits = 0; + + /** The number of base 10 digits that can be represented without change. */ + static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; + +#if __cplusplus >= 201103L + /** The number of base 10 digits required to ensure that values which + differ are always differentiated. */ + static constexpr int max_digits10 = 0; +#endif + + /** True if the type is signed. */ + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + + /** True if the type is integer. */ + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + + /** True if the type uses an exact representation. All integer types are + exact, but not all exact types are integer. For example, rational and + fixed-exponent representations are exact but not integer. */ + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + + /** For integer types, specifies the base of the representation. For + floating types, specifies the base of the exponent representation. */ + static _GLIBCXX_USE_CONSTEXPR int radix = 0; + + /** The minimum negative integer such that @c radix raised to the power of + (one less than that integer) is a normalized floating point number. */ + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + + /** The minimum negative integer such that 10 raised to that power is in + the range of normalized floating point numbers. */ + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + + /** The maximum positive integer such that @c radix raised to the power of + (one less than that integer) is a representable finite floating point + number. */ + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + + /** The maximum positive integer such that 10 raised to that power is in + the range of representable finite floating point numbers. */ + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + /** True if the type has a representation for positive infinity. */ + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + + /** True if the type has a representation for a quiet (non-signaling) + Not a Number. */ + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + + /** True if the type has a representation for a signaling + Not a Number. */ + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + + /** See std::float_denorm_style for more information. */ + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm = denorm_absent; + + /** True if loss of accuracy is detected as a denormalization loss, + rather than as an inexact result. */ + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + /** True if-and-only-if the type adheres to the IEC 559 standard, also + known as IEEE 754. (Only makes sense for floating point types.) */ + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + + /** True if the set of values representable by the type is + finite. All built-in types are bounded, this member would be + false for arbitrary precision types. */ + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = false; + + /** True if the type is @e modulo. A type is modulo if, for any + operation involving +, -, or * on values of that type whose + result would fall outside the range [min(),max()], the value + returned differs from the true value by an integer multiple of + max() - min() + 1. On most machines, this is false for floating + types, true for unsigned integers, and true for signed integers. + See PR22200 about signed integers. */ + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + /** True if trapping is implemented for this type. */ + static _GLIBCXX_USE_CONSTEXPR bool traps = false; + + /** True if tininess is detected before rounding. (see IEC 559) */ + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + + /** See std::float_round_style for more information. This is only + meaningful for floating types; integer types will all be + round_toward_zero. */ + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = + round_toward_zero; + }; + + /** + * @brief Properties of fundamental types. + * + * This class allows a program to obtain information about the + * representation of a fundamental type on a given platform. For + * non-fundamental types, the functions will return 0 and the data + * members will all be @c false. + */ + template + struct numeric_limits : public __numeric_limits_base + { + /** The minimum finite value, or for floating types with + denormalization, the minimum positive normalized value. */ + static _GLIBCXX_CONSTEXPR _Tp + min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } + + /** The maximum finite value. */ + static _GLIBCXX_CONSTEXPR _Tp + max() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } + +#if __cplusplus >= 201103L + /** A finite value x such that there is no other finite value y + * where y < x. */ + static constexpr _Tp + lowest() noexcept { return _Tp(); } +#endif + + /** The @e machine @e epsilon: the difference between 1 and the least + value greater than 1 that is representable. */ + static _GLIBCXX_CONSTEXPR _Tp + epsilon() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } + + /** The maximum rounding error measurement (see LIA-1). */ + static _GLIBCXX_CONSTEXPR _Tp + round_error() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } + + /** The representation of positive infinity, if @c has_infinity. */ + static _GLIBCXX_CONSTEXPR _Tp + infinity() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } + + /** The representation of a quiet Not a Number, + if @c has_quiet_NaN. */ + static _GLIBCXX_CONSTEXPR _Tp + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } + + /** The representation of a signaling Not a Number, if + @c has_signaling_NaN. */ + static _GLIBCXX_CONSTEXPR _Tp + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } + + /** The minimum positive denormalized value. For types where + @c has_denorm is false, this is the minimum positive normalized + value. */ + static _GLIBCXX_CONSTEXPR _Tp + denorm_min() _GLIBCXX_USE_NOEXCEPT { return _Tp(); } + }; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 559. numeric_limits + + template + struct numeric_limits + : public numeric_limits<_Tp> { }; + + template + struct numeric_limits + : public numeric_limits<_Tp> { }; + + template + struct numeric_limits + : public numeric_limits<_Tp> { }; + + // Now there follow 16 explicit specializations. Yes, 16. Make sure + // you get the count right. (18 in C++11 mode, with char16_t and char32_t.) + // (+1 if char8_t is enabled.) + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 184. numeric_limits wording problems + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR bool + min() _GLIBCXX_USE_NOEXCEPT { return false; } + + static _GLIBCXX_CONSTEXPR bool + max() _GLIBCXX_USE_NOEXCEPT { return true; } + +#if __cplusplus >= 201103L + static constexpr bool + lowest() noexcept { return min(); } +#endif + static _GLIBCXX_USE_CONSTEXPR int digits = 1; + static _GLIBCXX_USE_CONSTEXPR int digits10 = 0; +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR bool + epsilon() _GLIBCXX_USE_NOEXCEPT { return false; } + + static _GLIBCXX_CONSTEXPR bool + round_error() _GLIBCXX_USE_NOEXCEPT { return false; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR bool + infinity() _GLIBCXX_USE_NOEXCEPT { return false; } + + static _GLIBCXX_CONSTEXPR bool + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } + + static _GLIBCXX_CONSTEXPR bool + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return false; } + + static _GLIBCXX_CONSTEXPR bool + denorm_min() _GLIBCXX_USE_NOEXCEPT { return false; } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + // It is not clear what it means for a boolean type to trap. + // This is a DR on the LWG issue list. Here, I use integer + // promotion semantics. + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR char + min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min(char); } + + static _GLIBCXX_CONSTEXPR char + max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max(char); } + +#if __cplusplus >= 201103L + static constexpr char + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char); + static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char); + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR char + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR char + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR + char infinity() _GLIBCXX_USE_NOEXCEPT { return char(); } + + static _GLIBCXX_CONSTEXPR char + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } + + static _GLIBCXX_CONSTEXPR char + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char(); } + + static _GLIBCXX_CONSTEXPR char + denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR signed char + min() _GLIBCXX_USE_NOEXCEPT { return -__SCHAR_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR signed char + max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__; } + +#if __cplusplus >= 201103L + static constexpr signed char + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (signed char); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (signed char); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR signed char + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR signed char + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR signed char + infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR signed char + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR signed char + signaling_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR signed char + denorm_min() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned char + min() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned char + max() _GLIBCXX_USE_NOEXCEPT { return __SCHAR_MAX__ * 2U + 1; } + +#if __cplusplus >= 201103L + static constexpr unsigned char + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned char); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned char); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned char + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned char + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned char + infinity() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned char + quiet_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned char + signaling_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned char + denorm_min() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR wchar_t + min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (wchar_t); } + + static _GLIBCXX_CONSTEXPR wchar_t + max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (wchar_t); } + +#if __cplusplus >= 201103L + static constexpr wchar_t + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (wchar_t); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (wchar_t); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (wchar_t); + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR wchar_t + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR wchar_t + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR wchar_t + infinity() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } + + static _GLIBCXX_CONSTEXPR wchar_t + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } + + static _GLIBCXX_CONSTEXPR wchar_t + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } + + static _GLIBCXX_CONSTEXPR wchar_t + denorm_min() _GLIBCXX_USE_NOEXCEPT { return wchar_t(); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + +#if _GLIBCXX_USE_CHAR8_T + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR char8_t + min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (char8_t); } + + static _GLIBCXX_CONSTEXPR char8_t + max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (char8_t); } + + static _GLIBCXX_CONSTEXPR char8_t + lowest() _GLIBCXX_USE_NOEXCEPT { return min(); } + + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (char8_t); + static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (char8_t); + static _GLIBCXX_USE_CONSTEXPR int max_digits10 = 0; + static _GLIBCXX_USE_CONSTEXPR bool is_signed = __glibcxx_signed (char8_t); + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR char8_t + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR char8_t + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR char8_t + infinity() _GLIBCXX_USE_NOEXCEPT { return char8_t(); } + + static _GLIBCXX_CONSTEXPR char8_t + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return char8_t(); } + + static _GLIBCXX_CONSTEXPR char8_t + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return char8_t(); } + + static _GLIBCXX_CONSTEXPR char8_t + denorm_min() _GLIBCXX_USE_NOEXCEPT { return char8_t(); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = !is_signed; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; +#endif + +#if __cplusplus >= 201103L + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static constexpr bool is_specialized = true; + + static constexpr char16_t + min() noexcept { return __glibcxx_min (char16_t); } + + static constexpr char16_t + max() noexcept { return __glibcxx_max (char16_t); } + + static constexpr char16_t + lowest() noexcept { return min(); } + + static constexpr int digits = __glibcxx_digits (char16_t); + static constexpr int digits10 = __glibcxx_digits10 (char16_t); + static constexpr int max_digits10 = 0; + static constexpr bool is_signed = __glibcxx_signed (char16_t); + static constexpr bool is_integer = true; + static constexpr bool is_exact = true; + static constexpr int radix = 2; + + static constexpr char16_t + epsilon() noexcept { return 0; } + + static constexpr char16_t + round_error() noexcept { return 0; } + + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NaN = false; + static constexpr bool has_signaling_NaN = false; + static constexpr float_denorm_style has_denorm = denorm_absent; + static constexpr bool has_denorm_loss = false; + + static constexpr char16_t + infinity() noexcept { return char16_t(); } + + static constexpr char16_t + quiet_NaN() noexcept { return char16_t(); } + + static constexpr char16_t + signaling_NaN() noexcept { return char16_t(); } + + static constexpr char16_t + denorm_min() noexcept { return char16_t(); } + + static constexpr bool is_iec559 = false; + static constexpr bool is_bounded = true; + static constexpr bool is_modulo = !is_signed; + + static constexpr bool traps = __glibcxx_integral_traps; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static constexpr bool is_specialized = true; + + static constexpr char32_t + min() noexcept { return __glibcxx_min (char32_t); } + + static constexpr char32_t + max() noexcept { return __glibcxx_max (char32_t); } + + static constexpr char32_t + lowest() noexcept { return min(); } + + static constexpr int digits = __glibcxx_digits (char32_t); + static constexpr int digits10 = __glibcxx_digits10 (char32_t); + static constexpr int max_digits10 = 0; + static constexpr bool is_signed = __glibcxx_signed (char32_t); + static constexpr bool is_integer = true; + static constexpr bool is_exact = true; + static constexpr int radix = 2; + + static constexpr char32_t + epsilon() noexcept { return 0; } + + static constexpr char32_t + round_error() noexcept { return 0; } + + static constexpr int min_exponent = 0; + static constexpr int min_exponent10 = 0; + static constexpr int max_exponent = 0; + static constexpr int max_exponent10 = 0; + + static constexpr bool has_infinity = false; + static constexpr bool has_quiet_NaN = false; + static constexpr bool has_signaling_NaN = false; + static constexpr float_denorm_style has_denorm = denorm_absent; + static constexpr bool has_denorm_loss = false; + + static constexpr char32_t + infinity() noexcept { return char32_t(); } + + static constexpr char32_t + quiet_NaN() noexcept { return char32_t(); } + + static constexpr char32_t + signaling_NaN() noexcept { return char32_t(); } + + static constexpr char32_t + denorm_min() noexcept { return char32_t(); } + + static constexpr bool is_iec559 = false; + static constexpr bool is_bounded = true; + static constexpr bool is_modulo = !is_signed; + + static constexpr bool traps = __glibcxx_integral_traps; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_toward_zero; + }; +#endif + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR short + min() _GLIBCXX_USE_NOEXCEPT { return -__SHRT_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR short + max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__; } + +#if __cplusplus >= 201103L + static constexpr short + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (short); + static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (short); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR short + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR short + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR short + infinity() _GLIBCXX_USE_NOEXCEPT { return short(); } + + static _GLIBCXX_CONSTEXPR short + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } + + static _GLIBCXX_CONSTEXPR short + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return short(); } + + static _GLIBCXX_CONSTEXPR short + denorm_min() _GLIBCXX_USE_NOEXCEPT { return short(); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned short + min() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned short + max() _GLIBCXX_USE_NOEXCEPT { return __SHRT_MAX__ * 2U + 1; } + +#if __cplusplus >= 201103L + static constexpr unsigned short + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned short); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned short); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned short + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned short + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned short + infinity() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned short + quiet_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned short + signaling_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned short + denorm_min() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR int + min() _GLIBCXX_USE_NOEXCEPT { return -__INT_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR int + max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__; } + +#if __cplusplus >= 201103L + static constexpr int + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (int); + static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (int); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR int + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR int + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR int + infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR int + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR int + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR int + denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned int + min() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned int + max() _GLIBCXX_USE_NOEXCEPT { return __INT_MAX__ * 2U + 1; } + +#if __cplusplus >= 201103L + static constexpr unsigned int + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned int); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned int); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned int + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned int + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned int + infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned int + quiet_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned int + signaling_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned int + denorm_min() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR long + min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR long + max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__; } + +#if __cplusplus >= 201103L + static constexpr long + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits = __glibcxx_digits (long); + static _GLIBCXX_USE_CONSTEXPR int digits10 = __glibcxx_digits10 (long); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR long + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR long + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR long + infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR long + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR long + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR long + denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned long + min() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned long + max() _GLIBCXX_USE_NOEXCEPT { return __LONG_MAX__ * 2UL + 1; } + +#if __cplusplus >= 201103L + static constexpr unsigned long + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned long); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned long); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned long + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned long + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned long + infinity() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned long + quiet_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned long + signaling_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned long + denorm_min() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR long long + min() _GLIBCXX_USE_NOEXCEPT { return -__LONG_LONG_MAX__ - 1; } + + static _GLIBCXX_CONSTEXPR long long + max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__; } + +#if __cplusplus >= 201103L + static constexpr long long + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (long long); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (long long); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR long long + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR long long + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR long long + infinity() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR long long + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR long long + signaling_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR long long + denorm_min() _GLIBCXX_USE_NOEXCEPT { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR unsigned long long + min() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned long long + max() _GLIBCXX_USE_NOEXCEPT { return __LONG_LONG_MAX__ * 2ULL + 1; } + +#if __cplusplus >= 201103L + static constexpr unsigned long long + lowest() noexcept { return min(); } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits + = __glibcxx_digits (unsigned long long); + static _GLIBCXX_USE_CONSTEXPR int digits10 + = __glibcxx_digits10 (unsigned long long); +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 0; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; + static _GLIBCXX_USE_CONSTEXPR int radix = 2; + + static _GLIBCXX_CONSTEXPR unsigned long long + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_CONSTEXPR unsigned long long + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR unsigned long long + infinity() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned long long + quiet_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned long long + signaling_NaN() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_CONSTEXPR unsigned long long + denorm_min() _GLIBCXX_USE_NOEXCEPT + { return static_cast(0); } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_toward_zero; + }; + +#define __INT_N(TYPE, BITSIZE, EXT, UEXT) \ + __extension__ \ + template<> \ + struct numeric_limits \ + { \ + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ + \ + static _GLIBCXX_CONSTEXPR TYPE \ + min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min_b (TYPE, BITSIZE); } \ + \ + static _GLIBCXX_CONSTEXPR TYPE \ + max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \ + \ + static _GLIBCXX_USE_CONSTEXPR int digits \ + = BITSIZE - 1; \ + static _GLIBCXX_USE_CONSTEXPR int digits10 \ + = (BITSIZE - 1) * 643L / 2136; \ + \ + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \ + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \ + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \ + static _GLIBCXX_USE_CONSTEXPR int radix = 2; \ + \ + static _GLIBCXX_CONSTEXPR TYPE \ + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \ + \ + static _GLIBCXX_CONSTEXPR TYPE \ + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \ + \ + EXT \ + \ + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \ + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \ + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \ + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \ + \ + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \ + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \ + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \ + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ + = denorm_absent; \ + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ + \ + static _GLIBCXX_CONSTEXPR TYPE \ + infinity() _GLIBCXX_USE_NOEXCEPT \ + { return static_cast(0); } \ + \ + static _GLIBCXX_CONSTEXPR TYPE \ + quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ + { return static_cast(0); } \ + \ + static _GLIBCXX_CONSTEXPR TYPE \ + signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ + { return static_cast(0); } \ + \ + static _GLIBCXX_CONSTEXPR TYPE \ + denorm_min() _GLIBCXX_USE_NOEXCEPT \ + { return static_cast(0); } \ + \ + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \ + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \ + \ + static _GLIBCXX_USE_CONSTEXPR bool traps \ + = __glibcxx_integral_traps; \ + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ + = round_toward_zero; \ + }; \ + \ + __extension__ \ + template<> \ + struct numeric_limits \ + { \ + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ + \ + static _GLIBCXX_CONSTEXPR unsigned TYPE \ + min() _GLIBCXX_USE_NOEXCEPT { return 0; } \ + \ + static _GLIBCXX_CONSTEXPR unsigned TYPE \ + max() _GLIBCXX_USE_NOEXCEPT \ + { return __glibcxx_max_b (unsigned TYPE, BITSIZE); } \ + \ + UEXT \ + \ + static _GLIBCXX_USE_CONSTEXPR int digits \ + = BITSIZE; \ + static _GLIBCXX_USE_CONSTEXPR int digits10 \ + = BITSIZE * 643L / 2136; \ + static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; \ + static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \ + static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \ + static _GLIBCXX_USE_CONSTEXPR int radix = 2; \ + \ + static _GLIBCXX_CONSTEXPR unsigned TYPE \ + epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \ + \ + static _GLIBCXX_CONSTEXPR unsigned TYPE \ + round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \ + \ + static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \ + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \ + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \ + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \ + \ + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \ + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \ + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \ + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ + = denorm_absent; \ + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ + \ + static _GLIBCXX_CONSTEXPR unsigned TYPE \ + infinity() _GLIBCXX_USE_NOEXCEPT \ + { return static_cast(0); } \ + \ + static _GLIBCXX_CONSTEXPR unsigned TYPE \ + quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ + { return static_cast(0); } \ + \ + static _GLIBCXX_CONSTEXPR unsigned TYPE \ + signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ + { return static_cast(0); } \ + \ + static _GLIBCXX_CONSTEXPR unsigned TYPE \ + denorm_min() _GLIBCXX_USE_NOEXCEPT \ + { return static_cast(0); } \ + \ + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \ + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; \ + \ + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; \ + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ + = round_toward_zero; \ + }; + +#if __cplusplus >= 201103L + +#define __INT_N_201103(TYPE) \ + static constexpr TYPE \ + lowest() noexcept { return min(); } \ + static constexpr int max_digits10 = 0; + +#define __INT_N_U201103(TYPE) \ + static constexpr unsigned TYPE \ + lowest() noexcept { return min(); } \ + static constexpr int max_digits10 = 0; + +#else +#define __INT_N_201103(TYPE) +#define __INT_N_U201103(TYPE) +#endif + +#if !defined(__STRICT_ANSI__) +#ifdef __GLIBCXX_TYPE_INT_N_0 + __INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0, + __INT_N_201103 (__GLIBCXX_TYPE_INT_N_0), + __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_0)) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_1 + __INT_N (__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1, + __INT_N_201103 (__GLIBCXX_TYPE_INT_N_1), + __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_1)) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_2 + __INT_N (__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2, + __INT_N_201103 (__GLIBCXX_TYPE_INT_N_2), + __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_2)) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_3 + __INT_N (__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3, + __INT_N_201103 (__GLIBCXX_TYPE_INT_N_3), + __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3)) +#endif + +#elif defined __STRICT_ANSI__ && defined __SIZEOF_INT128__ + __INT_N(__int128, 128, + __INT_N_201103 (__int128), + __INT_N_U201103 (__int128)) +#endif + +#undef __INT_N +#undef __INT_N_201103 +#undef __INT_N_U201103 + + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR float + min() _GLIBCXX_USE_NOEXCEPT { return __FLT_MIN__; } + + static _GLIBCXX_CONSTEXPR float + max() _GLIBCXX_USE_NOEXCEPT { return __FLT_MAX__; } + +#if __cplusplus >= 201103L + static constexpr float + lowest() noexcept { return -__FLT_MAX__; } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits = __FLT_MANT_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits10 = __FLT_DIG__; +#if __cplusplus >= 201103L + static constexpr int max_digits10 + = __glibcxx_max_digits10 (__FLT_MANT_DIG__); +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; + + static _GLIBCXX_CONSTEXPR float + epsilon() _GLIBCXX_USE_NOEXCEPT { return __FLT_EPSILON__; } + + static _GLIBCXX_CONSTEXPR float + round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = __FLT_MIN_EXP__; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __FLT_MIN_10_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = __FLT_MAX_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __FLT_MAX_10_EXP__; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __FLT_HAS_INFINITY__; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss + = __glibcxx_float_has_denorm_loss; + + static _GLIBCXX_CONSTEXPR float + infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_valf(); } + + static _GLIBCXX_CONSTEXPR float + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanf(""); } + + static _GLIBCXX_CONSTEXPR float + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansf(""); } + + static _GLIBCXX_CONSTEXPR float + denorm_min() _GLIBCXX_USE_NOEXCEPT { return __FLT_DENORM_MIN__; } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_float_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before + = __glibcxx_float_tinyness_before; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_to_nearest; + }; + +#undef __glibcxx_float_has_denorm_loss +#undef __glibcxx_float_traps +#undef __glibcxx_float_tinyness_before + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR double + min() _GLIBCXX_USE_NOEXCEPT { return __DBL_MIN__; } + + static _GLIBCXX_CONSTEXPR double + max() _GLIBCXX_USE_NOEXCEPT { return __DBL_MAX__; } + +#if __cplusplus >= 201103L + static constexpr double + lowest() noexcept { return -__DBL_MAX__; } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits = __DBL_MANT_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits10 = __DBL_DIG__; +#if __cplusplus >= 201103L + static constexpr int max_digits10 + = __glibcxx_max_digits10 (__DBL_MANT_DIG__); +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; + + static _GLIBCXX_CONSTEXPR double + epsilon() _GLIBCXX_USE_NOEXCEPT { return __DBL_EPSILON__; } + + static _GLIBCXX_CONSTEXPR double + round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = __DBL_MIN_EXP__; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __DBL_MIN_10_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = __DBL_MAX_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __DBL_MAX_10_EXP__; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __DBL_HAS_INFINITY__; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss + = __glibcxx_double_has_denorm_loss; + + static _GLIBCXX_CONSTEXPR double + infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_val(); } + + static _GLIBCXX_CONSTEXPR double + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nan(""); } + + static _GLIBCXX_CONSTEXPR double + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nans(""); } + + static _GLIBCXX_CONSTEXPR double + denorm_min() _GLIBCXX_USE_NOEXCEPT { return __DBL_DENORM_MIN__; } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_double_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before + = __glibcxx_double_tinyness_before; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_to_nearest; + }; + +#undef __glibcxx_double_has_denorm_loss +#undef __glibcxx_double_traps +#undef __glibcxx_double_tinyness_before + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR long double + min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MIN__; } + + static _GLIBCXX_CONSTEXPR long double + max() _GLIBCXX_USE_NOEXCEPT { return __LDBL_MAX__; } + +#if __cplusplus >= 201103L + static constexpr long double + lowest() noexcept { return -__LDBL_MAX__; } +#endif + + static _GLIBCXX_USE_CONSTEXPR int digits = __LDBL_MANT_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits10 = __LDBL_DIG__; +#if __cplusplus >= 201103L + static _GLIBCXX_USE_CONSTEXPR int max_digits10 + = __glibcxx_max_digits10 (__LDBL_MANT_DIG__); +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; + + static _GLIBCXX_CONSTEXPR long double + epsilon() _GLIBCXX_USE_NOEXCEPT { return __LDBL_EPSILON__; } + + static _GLIBCXX_CONSTEXPR long double + round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5L; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = __LDBL_MIN_EXP__; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __LDBL_MIN_10_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = __LDBL_MAX_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __LDBL_MAX_10_EXP__; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = __LDBL_HAS_INFINITY__; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss + = __glibcxx_long_double_has_denorm_loss; + + static _GLIBCXX_CONSTEXPR long double + infinity() _GLIBCXX_USE_NOEXCEPT { return __builtin_huge_vall(); } + + static _GLIBCXX_CONSTEXPR long double + quiet_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nanl(""); } + + static _GLIBCXX_CONSTEXPR long double + signaling_NaN() _GLIBCXX_USE_NOEXCEPT { return __builtin_nansl(""); } + + static _GLIBCXX_CONSTEXPR long double + denorm_min() _GLIBCXX_USE_NOEXCEPT { return __LDBL_DENORM_MIN__; } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_long_double_traps; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = + __glibcxx_long_double_tinyness_before; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = + round_to_nearest; + }; + +#undef __glibcxx_long_double_has_denorm_loss +#undef __glibcxx_long_double_traps +#undef __glibcxx_long_double_tinyness_before + +#define __glibcxx_concat3_(P,M,S) P ## M ## S +#define __glibcxx_concat3(P,M,S) __glibcxx_concat3_ (P,M,S) + +#if __cplusplus >= 201103L +# define __max_digits10 max_digits10 +#endif + +#define __glibcxx_float_n(BITSIZE) \ + __extension__ \ + template<> \ + struct numeric_limits<_Float##BITSIZE> \ + { \ + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \ + \ + static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ + min() _GLIBCXX_USE_NOEXCEPT \ + { return __glibcxx_concat3 (__FLT, BITSIZE, _MIN__); } \ + \ + static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ + max() _GLIBCXX_USE_NOEXCEPT \ + { return __glibcxx_concat3 (__FLT, BITSIZE, _MAX__); } \ + \ + static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ + lowest() _GLIBCXX_USE_NOEXCEPT \ + { return -__glibcxx_concat3 (__FLT, BITSIZE, _MAX__); } \ + \ + static _GLIBCXX_USE_CONSTEXPR int digits \ + = __glibcxx_concat3 (__FLT, BITSIZE, _MANT_DIG__); \ + static _GLIBCXX_USE_CONSTEXPR int digits10 \ + = __glibcxx_concat3 (__FLT, BITSIZE, _DIG__); \ + static _GLIBCXX_USE_CONSTEXPR int __max_digits10 \ + = __glibcxx_max_digits10 (__glibcxx_concat3 (__FLT, BITSIZE, \ + _MANT_DIG__)); \ + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \ + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; \ + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; \ + static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; \ + \ + static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ + epsilon() _GLIBCXX_USE_NOEXCEPT \ + { return __glibcxx_concat3 (__FLT, BITSIZE, _EPSILON__); } \ + \ + static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ + round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5F##BITSIZE; } \ + \ + static _GLIBCXX_USE_CONSTEXPR int min_exponent \ + = __glibcxx_concat3 (__FLT, BITSIZE, _MIN_EXP__); \ + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 \ + = __glibcxx_concat3 (__FLT, BITSIZE, _MIN_10_EXP__); \ + static _GLIBCXX_USE_CONSTEXPR int max_exponent \ + = __glibcxx_concat3 (__FLT, BITSIZE, _MAX_EXP__); \ + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 \ + = __glibcxx_concat3 (__FLT, BITSIZE, _MAX_10_EXP__); \ + \ + static _GLIBCXX_USE_CONSTEXPR bool has_infinity \ + = __glibcxx_concat3 (__FLT, BITSIZE, _HAS_INFINITY__); \ + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN \ + = __glibcxx_concat3 (__FLT, BITSIZE, _HAS_QUIET_NAN__); \ + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN \ + = has_quiet_NaN; \ + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \ + = bool(__glibcxx_concat3 (__FLT, BITSIZE, _HAS_DENORM__)) \ + ? denorm_present : denorm_absent; \ + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \ + \ + static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ + infinity() _GLIBCXX_USE_NOEXCEPT \ + { return __builtin_huge_valf##BITSIZE(); } \ + \ + static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ + quiet_NaN() _GLIBCXX_USE_NOEXCEPT \ + { return __builtin_nanf##BITSIZE(""); } \ + \ + static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ + signaling_NaN() _GLIBCXX_USE_NOEXCEPT \ + { return __builtin_nansf##BITSIZE(""); } \ + \ + static _GLIBCXX_CONSTEXPR _Float##BITSIZE \ + denorm_min() _GLIBCXX_USE_NOEXCEPT \ + { return __glibcxx_concat3 (__FLT, BITSIZE, _DENORM_MIN__); } \ + \ + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 \ + = has_infinity && has_quiet_NaN && has_denorm == denorm_present;\ + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \ + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \ + \ + static _GLIBCXX_USE_CONSTEXPR bool traps = false; \ + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \ + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \ + = round_to_nearest; \ + }; \ + +#ifdef __STDCPP_FLOAT16_T__ +__glibcxx_float_n(16) +#endif +#ifdef __FLT32_DIG__ +__glibcxx_float_n(32) +#endif +#ifdef __FLT64_DIG__ +__glibcxx_float_n(64) +#endif +#ifdef __FLT128_DIG__ +__glibcxx_float_n(128) +#endif +#undef __glibcxx_float_n +#undef __glibcxx_concat3 +#undef __glibcxx_concat3_ + +#if __cplusplus >= 201103L +# undef __max_digits10 +#endif + +#ifdef __STDCPP_BFLOAT16_T__ + __extension__ + template<> + struct numeric_limits<__gnu_cxx::__bfloat16_t> + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t + min() _GLIBCXX_USE_NOEXCEPT + { return __BFLT16_MIN__; } + + static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t + max() _GLIBCXX_USE_NOEXCEPT + { return __BFLT16_MAX__; } + + static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t + lowest() _GLIBCXX_USE_NOEXCEPT + { return -__BFLT16_MAX__; } + + static _GLIBCXX_USE_CONSTEXPR int digits = __BFLT16_MANT_DIG__; + static _GLIBCXX_USE_CONSTEXPR int digits10 = __BFLT16_DIG__; +#if __cplusplus >= 201103L + static _GLIBCXX_USE_CONSTEXPR int max_digits10 + = __glibcxx_max_digits10 (__BFLT16_MANT_DIG__); +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; + + static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t + epsilon() _GLIBCXX_USE_NOEXCEPT + { return __BFLT16_EPSILON__; } + + static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t + round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5BF16; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = __BFLT16_MIN_EXP__; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = __BFLT16_MIN_10_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = __BFLT16_MAX_EXP__; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = __BFLT16_MAX_10_EXP__; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity + = __BFLT16_HAS_INFINITY__; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN + = __BFLT16_HAS_QUIET_NAN__; + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = has_quiet_NaN; + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = bool(__BFLT16_HAS_DENORM__) ? denorm_present : denorm_absent; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t + infinity() _GLIBCXX_USE_NOEXCEPT + { return __gnu_cxx::__bfloat16_t(__builtin_huge_valf()); } + + static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t + quiet_NaN() _GLIBCXX_USE_NOEXCEPT + { return __gnu_cxx::__bfloat16_t(__builtin_nanf("")); } + + static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t + signaling_NaN() _GLIBCXX_USE_NOEXCEPT + { return __builtin_nansf16b(""); } + + static _GLIBCXX_CONSTEXPR __gnu_cxx::__bfloat16_t + denorm_min() _GLIBCXX_USE_NOEXCEPT + { return __BFLT16_DENORM_MIN__; } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = false; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_to_nearest; + }; +#endif // __STDCPP_BFLOAT16_T__ + +#if defined(_GLIBCXX_USE_FLOAT128) +// We either need Q literal suffixes, or IEEE double. +#if ! defined(__STRICT_ANSI__) || defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) + __extension__ + template<> + struct numeric_limits<__float128> + { + static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; + + static _GLIBCXX_CONSTEXPR __float128 + min() _GLIBCXX_USE_NOEXCEPT + { +#ifdef __STRICT_ANSI__ + // 0x1.0p-30 * 0x1.0p-16352 + return double(9.3132257461547852e-10) * _S_1pm16352(); +#else + return __extension__ 0x1.0p-16382Q; +#endif + } + + static _GLIBCXX_CONSTEXPR __float128 + max() _GLIBCXX_USE_NOEXCEPT + { +#ifdef __STRICT_ANSI__ + // (0x1.fffffffffffffp+127 + 0x0.fffffffffffffp+75 + 0x0.ffp+23) + // * 0x1.0p16256 + return (__float128(double(3.4028236692093843e+38)) + + double(3.7778931862957153e+22) + double(8.35584e+6)) + * _S_1p16256(); +#else + return __extension__ 0x1.ffffffffffffffffffffffffffffp+16383Q; +#endif + } + + static _GLIBCXX_CONSTEXPR __float128 + lowest() _GLIBCXX_USE_NOEXCEPT + { return -max(); } + + static _GLIBCXX_USE_CONSTEXPR int digits = 113; + static _GLIBCXX_USE_CONSTEXPR int digits10 = 33; +#if __cplusplus >= 201103L + static constexpr int max_digits10 = 36; +#endif + static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; + static _GLIBCXX_USE_CONSTEXPR bool is_integer = false; + static _GLIBCXX_USE_CONSTEXPR bool is_exact = false; + static _GLIBCXX_USE_CONSTEXPR int radix = __FLT_RADIX__; + + static _GLIBCXX_CONSTEXPR __float128 + epsilon() _GLIBCXX_USE_NOEXCEPT + { return double(1.9259299443872359e-34); } + + static _GLIBCXX_CONSTEXPR __float128 + round_error() _GLIBCXX_USE_NOEXCEPT { return 0.5; } + + static _GLIBCXX_USE_CONSTEXPR int min_exponent = -16381; + static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = -4931; + static _GLIBCXX_USE_CONSTEXPR int max_exponent = 16384; + static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 4932; + + static _GLIBCXX_USE_CONSTEXPR bool has_infinity = 1; + static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = 1; +#if __has_builtin(__builtin_nansq) \ + || (__has_builtin(__builtin_bit_cast) && __has_builtin(__builtin_nansf128)) + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = true; +#else + static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; +#endif + static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm + = denorm_present; + static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; + + static _GLIBCXX_CONSTEXPR __float128 + infinity() _GLIBCXX_USE_NOEXCEPT + { return __builtin_huge_val(); } + + static _GLIBCXX_CONSTEXPR __float128 + quiet_NaN() _GLIBCXX_USE_NOEXCEPT + { return __builtin_nan(""); } + + static _GLIBCXX_CONSTEXPR __float128 + signaling_NaN() _GLIBCXX_USE_NOEXCEPT + { +#if __has_builtin(__builtin_nansq) + return __builtin_nansq(""); +#elif __has_builtin(__builtin_bit_cast) && __has_builtin(__builtin_nansf128) + return __builtin_bit_cast(__float128, __builtin_nansf128("")); +#else + return quiet_NaN(); +#endif + } + + static _GLIBCXX_CONSTEXPR __float128 + denorm_min() _GLIBCXX_USE_NOEXCEPT + { +#if defined(__STRICT_ANSI__) || defined(__INTEL_COMPILER) + // 0x1.0p-142 * 0x1.0p-16352 + return double(1.7936620343357659e-43) * _S_1pm16352(); +#else + return __extension__ 0x1.0p-16494Q; +#endif + } + + static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = has_signaling_NaN; + static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; + static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; + + static _GLIBCXX_USE_CONSTEXPR bool traps = false; + static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; + static _GLIBCXX_USE_CONSTEXPR float_round_style round_style + = round_to_nearest; + +#if defined(__STRICT_ANSI__) || defined(__INTEL_COMPILER) + private: + static _GLIBCXX_CONSTEXPR __float128 + _S_4p(__float128 __v) _GLIBCXX_USE_NOEXCEPT + { return __v * __v * __v * __v; } + + static _GLIBCXX_CONSTEXPR __float128 + _S_1pm4088() _GLIBCXX_USE_NOEXCEPT + { return _S_4p(/* 0x1.0p-1022 */ double(2.2250738585072014e-308)); } + + static _GLIBCXX_CONSTEXPR __float128 + _S_1pm16352() _GLIBCXX_USE_NOEXCEPT + { return _S_4p(_S_1pm4088()); } + + static _GLIBCXX_CONSTEXPR __float128 + _S_1p4064() _GLIBCXX_USE_NOEXCEPT + { return _S_4p(/* 0x1.0p+1016 */ double(7.0222388080559215e+305)); } + + static _GLIBCXX_CONSTEXPR __float128 + _S_1p16256() _GLIBCXX_USE_NOEXCEPT + { return _S_4p(_S_1p4064()); } +#endif + }; +#endif // !__STRICT_ANSI__ || DOUBLE_IS_IEEE_BINARY64 +#endif // _GLIBCXX_USE_FLOAT128 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#undef __glibcxx_signed +#undef __glibcxx_min +#undef __glibcxx_max +#undef __glibcxx_digits +#undef __glibcxx_digits10 +#undef __glibcxx_max_digits10 + +#pragma GCC diagnostic pop +#endif // _GLIBCXX_NUMERIC_LIMITS diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@limits.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@limits.blob new file mode 100644 index 0000000..e485b63 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@limits.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@locale b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@locale new file mode 100644 index 0000000..769f168 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@locale @@ -0,0 +1,50 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// +// ISO C++ 14882: 22.1 Locales +// + +/** @file include/locale + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_LOCALE +#define _GLIBCXX_LOCALE 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // locales + +#include +#include +#include +#include +#if __cplusplus >= 201103L +# include +#endif + +#endif /* _GLIBCXX_LOCALE */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@locale.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@locale.blob new file mode 100644 index 0000000..8674a9e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@locale.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@new b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@new new file mode 100644 index 0000000..a550373 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@new @@ -0,0 +1,269 @@ +// The -*- C++ -*- dynamic memory management header. + +// Copyright (C) 1994-2025 Free Software Foundation, Inc. + +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file new + * This is a Standard C++ Library header. + * + * The header @c new defines several functions to manage dynamic memory and + * handling memory allocation errors; see + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/dynamic_memory.html + * for more. + */ + +#ifndef _NEW +#define _NEW + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +#define __glibcxx_want_launder +#define __glibcxx_want_hardware_interference_size +#define __glibcxx_want_destroying_delete +#define __glibcxx_want_constexpr_new +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++11-extensions" // scoped enum + +#pragma GCC visibility push(default) + +extern "C++" { + +namespace std +{ + /** + * @brief Exception possibly thrown by @c new. + * @ingroup exceptions + * + * @c bad_alloc (or classes derived from it) is used to report allocation + * errors from the throwing forms of @c new. */ + class bad_alloc : public exception + { + public: + bad_alloc() throw() { } + +#if __cplusplus >= 201103L + bad_alloc(const bad_alloc&) = default; + bad_alloc& operator=(const bad_alloc&) = default; +#endif + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 + virtual ~bad_alloc() throw(); + + // See comment in eh_exception.cc. + virtual const char* what() const throw(); + }; + +#if __cplusplus >= 201103L + class bad_array_new_length : public bad_alloc + { + public: + bad_array_new_length() throw() { } + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 + virtual ~bad_array_new_length() throw(); + + // See comment in eh_exception.cc. + virtual const char* what() const throw(); + }; +#endif + +#if __cpp_aligned_new + enum class align_val_t: size_t {}; +#endif + + struct nothrow_t + { +#if __cplusplus >= 201103L + explicit nothrow_t() = default; +#endif + }; + + extern const nothrow_t nothrow; + + /** If you write your own error handler to be called by @c new, it must + * be of this type. */ + typedef void (*new_handler)(); + + /// Takes a replacement handler as the argument, returns the + /// previous handler. + new_handler set_new_handler(new_handler) throw(); + +#if __cplusplus >= 201103L + /// Return the current new handler. + new_handler get_new_handler() noexcept; +#endif +} // namespace std + +//@{ +/** These are replaceable signatures: + * - normal single new and delete (no arguments, throw @c bad_alloc on error) + * - normal array new and delete (same) + * - @c nothrow single new and delete (take a @c nothrow argument, return + * @c NULL on error) + * - @c nothrow array new and delete (same) + * + * Placement new and delete signatures (take a memory address argument, + * does nothing) may not be replaced by a user's program. +*/ +_GLIBCXX_NODISCARD void* operator new(std::size_t) + _GLIBCXX_TXN_SAFE _GLIBCXX_THROW (std::bad_alloc) + __attribute__((__externally_visible__, __malloc__)); +_GLIBCXX_NODISCARD void* operator new[](std::size_t) + _GLIBCXX_TXN_SAFE _GLIBCXX_THROW (std::bad_alloc) + __attribute__((__externally_visible__, __malloc__)); +void operator delete(void*) _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void operator delete[](void*) _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +#if __cpp_sized_deallocation +void operator delete(void*, std::size_t) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void operator delete[](void*, std::size_t) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +#endif +_GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); +_GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); +void operator delete(void*, const std::nothrow_t&) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +void operator delete[](void*, const std::nothrow_t&) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__)); +#if __cpp_aligned_new +_GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) + _GLIBCXX_TXN_SAFE + __attribute__((__externally_visible__, __alloc_size__ (1), __alloc_align__ (2), __malloc__)); +_GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__, __alloc_size__ (1), __alloc_align__ (2), __malloc__)); +void operator delete(void*, std::align_val_t) _GLIBCXX_TXN_SAFE + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +void operator delete(void*, std::align_val_t, const std::nothrow_t&) + _GLIBCXX_TXN_SAFE + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +_GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) + _GLIBCXX_TXN_SAFE + __attribute__((__externally_visible__, __alloc_size__ (1), __alloc_align__ (2), __malloc__)); +_GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT + __attribute__((__externally_visible__, __alloc_size__ (1), __alloc_align__ (2), __malloc__)); +void operator delete[](void*, std::align_val_t) _GLIBCXX_TXN_SAFE + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +void operator delete[](void*, std::align_val_t, const std::nothrow_t&) + _GLIBCXX_TXN_SAFE + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +#if __cpp_sized_deallocation +void operator delete(void*, std::size_t, std::align_val_t) _GLIBCXX_TXN_SAFE + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +void operator delete[](void*, std::size_t, std::align_val_t) _GLIBCXX_TXN_SAFE + _GLIBCXX_USE_NOEXCEPT __attribute__((__externally_visible__)); +#endif // __cpp_sized_deallocation +#endif // __cpp_aligned_new + +#if __cpp_lib_constexpr_new >= 202406L +# define _GLIBCXX_PLACEMENT_CONSTEXPR constexpr +#else +# define _GLIBCXX_PLACEMENT_CONSTEXPR inline +#endif + +// Default placement versions of operator new. +_GLIBCXX_NODISCARD _GLIBCXX_PLACEMENT_CONSTEXPR +void* operator new(std::size_t, void* __p) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT +{ return __p; } +_GLIBCXX_NODISCARD _GLIBCXX_PLACEMENT_CONSTEXPR +void* operator new[](std::size_t, void* __p) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT +{ return __p; } + +#undef _GLIBCXX_PLACEMENT_CONSTEXPR + +// Default placement versions of operator delete. +inline void operator delete (void*, void*) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT +{ } +inline void operator delete[](void*, void*) + _GLIBCXX_TXN_SAFE _GLIBCXX_USE_NOEXCEPT +{ } +//@} +} // extern "C++" + +namespace std +{ +#ifdef __cpp_lib_launder // C++ >= 17 && HAVE_BUILTIN_LAUNDER + /// Pointer optimization barrier [ptr.launder] + template + [[nodiscard]] constexpr _Tp* + launder(_Tp* __p) noexcept + { + if constexpr (__is_same(const volatile _Tp, const volatile void)) + static_assert(!__is_same(const volatile _Tp, const volatile void), + "std::launder argument must not be a void pointer"); +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function) + else if constexpr (__is_function(_Tp)) + static_assert(!__is_function(_Tp), + "std::launder argument must not be a function pointer"); +#endif + else + return __builtin_launder(__p); + return nullptr; + } +#endif // __cpp_lib_launder + +#ifdef __cpp_lib_hardware_interference_size // C++ >= 17 && defined(gcc_dest_sz) + inline constexpr size_t hardware_destructive_interference_size = __GCC_DESTRUCTIVE_SIZE; + inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUCTIVE_SIZE; +#endif // __cpp_lib_hardware_interference_size + +// Emitted despite the FTM potentially being undefined. +#if __cplusplus >= 202002L + /// Tag type used to declare a class-specific operator delete that can + /// invoke the destructor before deallocating the memory. + struct destroying_delete_t + { + explicit destroying_delete_t() = default; + }; + /// Tag variable of type destroying_delete_t. + inline constexpr destroying_delete_t destroying_delete{}; +#endif // C++20 +} + +#pragma GCC visibility pop +#pragma GCC diagnostic pop + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@new.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@new.blob new file mode 100644 index 0000000..1606f6d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@new.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ostream b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ostream new file mode 100644 index 0000000..644e568 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ostream @@ -0,0 +1,296 @@ +// Output streams -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/ostream + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.6.2 Output streams +// + +#ifndef _GLIBCXX_OSTREAM +#define _GLIBCXX_OSTREAM 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // iostreams + +#include +#if __cplusplus > 202002L +# include +#endif + +# define __glibcxx_want_print +#include // __glibcxx_syncbuf + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Standard basic_ostream manipulators + + /** + * @brief Write a newline and flush the stream. + * + * This manipulator is often mistakenly used when a simple newline is + * desired, leading to poor buffering performance. See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering + * for more on this subject. + */ + template + inline basic_ostream<_CharT, _Traits>& + endl(basic_ostream<_CharT, _Traits>& __os) + { return flush(__os.put(__os.widen('\n'))); } + + /** + * @brief Write a null character into the output sequence. + * + * Null character is @c CharT() by definition. For CharT + * of @c char, this correctly writes the ASCII @c NUL character + * string terminator. + */ + template + inline basic_ostream<_CharT, _Traits>& + ends(basic_ostream<_CharT, _Traits>& __os) + { return __os.put(_CharT()); } + + /** + * @brief Flushes the output stream. + * + * This manipulator simply calls the stream's @c flush() member function. + */ + template + inline basic_ostream<_CharT, _Traits>& + flush(basic_ostream<_CharT, _Traits>& __os) + { return __os.flush(); } + +#ifdef __glibcxx_syncbuf // C++ >= 20 && HOSTED && CXX11ABI + template + class __syncbuf_base : public basic_streambuf<_CharT, _Traits> + { + public: + static bool* + _S_get(basic_streambuf<_CharT, _Traits>* __buf [[maybe_unused]]) noexcept + { +#if __cpp_rtti + if (auto __p = dynamic_cast<__syncbuf_base*>(__buf)) + return &__p->_M_emit_on_sync; +#endif + return nullptr; + } + + protected: + __syncbuf_base(basic_streambuf<_CharT, _Traits>* __w = nullptr) + : _M_wrapped(__w) + { } + + basic_streambuf<_CharT, _Traits>* _M_wrapped = nullptr; + bool _M_emit_on_sync = false; + bool _M_needs_sync = false; + }; + + template + inline basic_ostream<_CharT, _Traits>& + emit_on_flush(basic_ostream<_CharT, _Traits>& __os) + { + if (bool* __flag = __syncbuf_base<_CharT, _Traits>::_S_get(__os.rdbuf())) + *__flag = true; + return __os; + } + + template + inline basic_ostream<_CharT, _Traits>& + noemit_on_flush(basic_ostream<_CharT, _Traits>& __os) + { + if (bool* __flag = __syncbuf_base<_CharT, _Traits>::_S_get(__os.rdbuf())) + *__flag = false; + return __os; + } + + template + inline basic_ostream<_CharT, _Traits>& + flush_emit(basic_ostream<_CharT, _Traits>& __os) + { + struct _Restore + { + ~_Restore() { *_M_flag = _M_prev; } + + bool _M_prev = false; + bool* _M_flag = &_M_prev; + } __restore; + + if (bool* __flag = __syncbuf_base<_CharT, _Traits>::_S_get(__os.rdbuf())) + { + __restore._M_prev = *__flag; + __restore._M_flag = __flag; + *__flag = true; + } + + __os.flush(); + return __os; + } +#endif // __glibcxx_syncbuf + +#if __cpp_lib_print // C++ >= 23 + inline void + vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args) + { + ostream::sentry __cerb(__os); + if (__cerb) + { + __format::_Str_sink __buf; + std::vformat_to(__buf.out(), __os.getloc(), __fmt, __args); + auto __out = __buf.view(); + + __try + { + std::__ostream_write(__os, __out.data(), __out.size()); + } + __catch(const __cxxabiv1::__forced_unwind&) + { + __os._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __os._M_setstate(ios_base::badbit); } + } + } + + inline void + vprint_unicode(ostream& __os, string_view __fmt, format_args __args) + { +#if !defined(_WIN32) || defined(__CYGWIN__) + // For most targets we don't need to do anything special to write + // Unicode to a terminal. + std::vprint_nonunicode(__os, __fmt, __args); +#else + ostream::sentry __cerb(__os); + if (__cerb) + { + __format::_Str_sink __buf; + std::vformat_to(__buf.out(), __os.getloc(), __fmt, __args); + auto __out = __buf.view(); + + void* __open_terminal(streambuf*); + error_code __write_to_terminal(void*, span); + // If stream refers to a terminal, write a Unicode string to it. + if (auto __term = __open_terminal(__os.rdbuf())) + { +#if !defined(_WIN32) || defined(__CYGWIN__) + // For POSIX, __open_terminal(streambuf*) uses fdopen to open a + // new file, so we would need to close it here. This code is not + // actually compiled because it's inside an #ifdef _WIN32 group, + // but just in case that changes in future ... + struct _Guard + { + _Guard(void* __p) : _M_f((FILE*)__p) { } + ~_Guard() { std::fclose(_M_f); } + _Guard(_Guard&&) = delete; + _Guard& operator=(_Guard&&) = delete; + FILE* _M_f; + }; + _Guard __g(__term); +#endif + + ios_base::iostate __err = ios_base::goodbit; + __try + { + if (__os.rdbuf()->pubsync() == -1) + __err = ios::badbit; + else if (auto __e = __write_to_terminal(__term, __out)) + if (__e != std::make_error_code(errc::illegal_byte_sequence)) + __err = ios::badbit; + } + __catch(const __cxxabiv1::__forced_unwind&) + { + __os._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __os._M_setstate(ios_base::badbit); } + + if (__err) + __os.setstate(__err); + return; + } + + // Otherwise just insert the string as vprint_nonunicode does. + __try + { + std::__ostream_write(__os, __out.data(), __out.size()); + } + __catch(const __cxxabiv1::__forced_unwind&) + { + __os._M_setstate(ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __os._M_setstate(ios_base::badbit); } + } +#endif // _WIN32 + } + + template + inline void + print(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) + { + auto __fmtargs = std::make_format_args(__args...); + if constexpr (__unicode::__literal_encoding_is_utf8()) + std::vprint_unicode(__os, __fmt.get(), __fmtargs); + else + std::vprint_nonunicode(__os, __fmt.get(), __fmtargs); + } + + template + inline void + println(ostream& __os, format_string<_Args...> __fmt, _Args&&... __args) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 4088. println ignores the locale imbued in std::ostream + std::print(__os, "{}\n", std::format(__os.getloc(), __fmt, + std::forward<_Args>(__args)...)); + } + + // Defined for C++26, supported as an extension to C++23. + inline void println(ostream& __os) + { +#if defined(_WIN32) && !defined(__CYGWIN__) + if constexpr (__unicode::__literal_encoding_is_utf8()) + std::vprint_unicode(__os, "\n", std::make_format_args()); + else +#endif + __os.put('\n'); + } + +#endif // __cpp_lib_print + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#include + +#endif /* _GLIBCXX_OSTREAM */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ostream.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ostream.blob new file mode 100644 index 0000000..fac96a4 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ostream.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@pstl@pstl_config.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@pstl@pstl_config.h new file mode 100644 index 0000000..6fae154 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@pstl@pstl_config.h @@ -0,0 +1,198 @@ +// -*- C++ -*- +//===-- pstl_config.h -----------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _PSTL_CONFIG_H +#define _PSTL_CONFIG_H + +// The version is XYYZ, where X is major, YY is minor, and Z is patch (i.e. X.YY.Z) +#define _PSTL_VERSION 17000 +#define _PSTL_VERSION_MAJOR (_PSTL_VERSION / 1000) +#define _PSTL_VERSION_MINOR ((_PSTL_VERSION % 1000) / 10) +#define _PSTL_VERSION_PATCH (_PSTL_VERSION % 10) + +#if !defined(_PSTL_PAR_BACKEND_SERIAL) && !defined(_PSTL_PAR_BACKEND_TBB) && !defined(_PSTL_PAR_BACKEND_OPENMP) +# error "A parallel backend must be specified" +#endif + +// Check the user-defined macro for warnings +#if defined(PSTL_USAGE_WARNINGS) +# undef _PSTL_USAGE_WARNINGS +# define _PSTL_USAGE_WARNINGS PSTL_USAGE_WARNINGS +// Check the internal macro for warnings +#elif !defined(_PSTL_USAGE_WARNINGS) +# define _PSTL_USAGE_WARNINGS 0 +#endif + +// Portability "#pragma" definition +#ifdef _MSC_VER +# define _PSTL_PRAGMA(x) __pragma(x) +#else +# define _PSTL_PRAGMA(x) _Pragma(# x) +#endif + +#define _PSTL_STRING_AUX(x) #x +#define _PSTL_STRING(x) _PSTL_STRING_AUX(x) +#define _PSTL_STRING_CONCAT(x, y) x #y + +#ifdef _PSTL_HIDE_FROM_ABI_PER_TU +# define _PSTL_HIDE_FROM_ABI_PUSH \ + _Pragma("clang attribute push(__attribute__((internal_linkage)), apply_to=any(function,record))") +# define _PSTL_HIDE_FROM_ABI_POP _Pragma("clang attribute pop") +#else +# define _PSTL_HIDE_FROM_ABI_PUSH /* nothing */ +# define _PSTL_HIDE_FROM_ABI_POP /* nothing */ +#endif + +// note that when ICC or Clang is in use, _PSTL_GCC_VERSION might not fully match +// the actual GCC version on the system. +#define _PSTL_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + +#if defined(_GLIBCXX_CLANG) +// according to clang documentation, version can be vendor specific +# define _PSTL_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) +#endif + +// Enable SIMD for compilers that support OpenMP 4.0 +#if (defined(_OPENMP) && _OPENMP >= 201307) || \ + (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1600) || \ + (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 40900) || \ + defined(_GLIBCXX_CLANG) +# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(omp simd) +# define _PSTL_PRAGMA_DECLARE_SIMD _PSTL_PRAGMA(omp declare simd) +# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(omp simd reduction(PRM)) +#elif !defined(_MSC_VER) //#pragma simd +# define _PSTL_PRAGMA_SIMD _PSTL_PRAGMA(simd) +# define _PSTL_PRAGMA_DECLARE_SIMD +# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) _PSTL_PRAGMA(simd reduction(PRM)) +#else //no simd +# define _PSTL_PRAGMA_SIMD +# define _PSTL_PRAGMA_DECLARE_SIMD +# define _PSTL_PRAGMA_SIMD_REDUCTION(PRM) +#endif //Enable SIMD + +#if defined(__INTEL_COMPILER) +# define _PSTL_PRAGMA_FORCEINLINE _PSTL_PRAGMA(forceinline) +#else +# define _PSTL_PRAGMA_FORCEINLINE +#endif + +#if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1900) || \ + (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 100000) +# define _PSTL_PRAGMA_SIMD_SCAN(PRM) _PSTL_PRAGMA(omp simd reduction(inscan, PRM)) +# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan inclusive(PRM)) +# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) _PSTL_PRAGMA(omp scan exclusive(PRM)) +#else +# define _PSTL_PRAGMA_SIMD_SCAN(PRM) +# define _PSTL_PRAGMA_SIMD_INCLUSIVE_SCAN(PRM) +# define _PSTL_PRAGMA_SIMD_EXCLUSIVE_SCAN(PRM) +#endif + +// Should be defined to 1 for environments with a vendor implementation of C++17 execution policies +#define _PSTL_CPP17_EXECUTION_POLICIES_PRESENT (_MSC_VER >= 1912 && _MSVC_LANG >= 201703L) || \ + (_GLIBCXX_RELEASE >= 9 && __GLIBCXX__ >= 20190503 && __cplusplus >= 201703L) + +#if (defined(_MSC_VER) && _MSC_VER >= 1900) || \ + __cplusplus >= 201300L || \ + __cpp_lib_robust_nonmodifying_seq_ops == 201304 +# define _PSTL_CPP14_2RANGE_MISMATCH_EQUAL_PRESENT +#endif +#if (defined(_MSC_VER) && _MSC_VER >= 1900) || \ + __cplusplus >= 201402L || \ + __cpp_lib_make_reverse_iterator == 201402 +# define _PSTL_CPP14_MAKE_REVERSE_ITERATOR_PRESENT +#endif +#if (defined(_MSC_VER) && _MSC_VER >= 1900) || __cplusplus >= 201402L +# define _PSTL_CPP14_INTEGER_SEQUENCE_PRESENT +#endif +#if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) || \ + (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023918) || \ + __cplusplus >= 201402L +# define _PSTL_CPP14_VARIABLE_TEMPLATES_PRESENT +#endif + +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1800 +# define _PSTL_EARLYEXIT_PRESENT +# define _PSTL_MONOTONIC_PRESENT +#endif + +#if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1900) || \ + (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 40900) || \ + (defined(_OPENMP) && _OPENMP >= 201307) +# define _PSTL_UDR_PRESENT +#endif + +#if (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1900 && __INTEL_COMPILER_BUILD_DATE >= 20180626) || \ + (!defined(__INTEL_COMPILER) && _PSTL_GCC_VERSION >= 100000) +# define _PSTL_UDS_PRESENT +#endif + +#if defined(_PSTL_EARLYEXIT_PRESENT) +# define _PSTL_PRAGMA_SIMD_EARLYEXIT _PSTL_PRAGMA(omp simd early_exit) +#else +# define _PSTL_PRAGMA_SIMD_EARLYEXIT +#endif + +#if defined(_PSTL_MONOTONIC_PRESENT) +# define _PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) _PSTL_PRAGMA(omp ordered simd monotonic(PRM)) +# define _PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) _PSTL_PRAGMA(omp ordered simd monotonic(PRM1, PRM2)) +#else +# define _PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC(PRM) +# define _PSTL_PRAGMA_SIMD_ORDERED_MONOTONIC_2ARGS(PRM1, PRM2) +#endif + +// Declaration of reduction functor, where +// NAME - the name of the functor +// OP - type of the callable object with the reduction operation +// omp_in - refers to the local partial result +// omp_out - refers to the final value of the combiner operator +// omp_priv - refers to the private copy of the initial value +// omp_orig - refers to the original variable to be reduced +#define _PSTL_PRAGMA_DECLARE_REDUCTION(NAME, OP) \ + _PSTL_PRAGMA(omp declare reduction(NAME:OP : omp_out(omp_in)) initializer(omp_priv = omp_orig)) + +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1600 +# define _PSTL_PRAGMA_VECTOR_UNALIGNED _PSTL_PRAGMA(vector unaligned) +#else +# define _PSTL_PRAGMA_VECTOR_UNALIGNED +#endif + +// Check the user-defined macro to use non-temporal stores +#if defined(PSTL_USE_NONTEMPORAL_STORES) && (__INTEL_COMPILER >= 1600) +# define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED _PSTL_PRAGMA(vector nontemporal) +#else +# define _PSTL_USE_NONTEMPORAL_STORES_IF_ALLOWED +#endif + +#if defined(_MSC_VER) || defined(__INTEL_COMPILER) // the preprocessors don't type a message location +# define _PSTL_PRAGMA_LOCATION __FILE__ ":" _PSTL_STRING(__LINE__) ": [Parallel STL message]: " +#else +# define _PSTL_PRAGMA_LOCATION " [Parallel STL message]: " +#endif + +#define _PSTL_PRAGMA_MESSAGE_IMPL(x) _PSTL_PRAGMA(message(_PSTL_STRING_CONCAT(_PSTL_PRAGMA_LOCATION, x))) + +#if _PSTL_USAGE_WARNINGS +# define _PSTL_PRAGMA_MESSAGE(x) _PSTL_PRAGMA_MESSAGE_IMPL(x) +# define _PSTL_PRAGMA_MESSAGE_POLICIES(x) _PSTL_PRAGMA_MESSAGE_IMPL(x) +#else +# define _PSTL_PRAGMA_MESSAGE(x) +# define _PSTL_PRAGMA_MESSAGE_POLICIES(x) +#endif + +// broken macros +#if (defined(__GLIBCXX__) && __GLIBCXX__ < 20150716) || \ + (defined(_MSC_VER) && _MSC_VER < 1800) +# define _PSTL_CPP11_STD_ROTATE_BROKEN +#endif + +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER == 1800 +# define _PSTL_ICC_18_OMP_SIMD_BROKEN +#endif + +#endif /* _PSTL_CONFIG_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@pstl@pstl_config.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@pstl@pstl_config.h.blob new file mode 100644 index 0000000..133c58b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@pstl@pstl_config.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ratio b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ratio new file mode 100644 index 0000000..9fe8b00 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ratio @@ -0,0 +1,653 @@ +// ratio -*- C++ -*- + +// Copyright (C) 2008-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/ratio + * This is a Standard C++ Library header. + * @ingroup ratio + */ + +#ifndef _GLIBCXX_RATIO +#define _GLIBCXX_RATIO 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus < 201103L +# include +#else + +#include +#include // intmax_t, uintmax_t + +#define __glibcxx_want_ratio +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup ratio Rational Arithmetic + * @ingroup utilities + * + * Compile time representation of finite rational numbers. + * @{ + */ + + /// @cond undocumented + + template + struct __static_sign + : integral_constant + { }; + + template + struct __static_abs + : integral_constant::value> + { }; + + template + struct __static_gcd + : __static_gcd<_Qn, (_Pn % _Qn)> + { }; + + template + struct __static_gcd<_Pn, 0> + : integral_constant::value> + { }; + + template + struct __static_gcd<0, _Qn> + : integral_constant::value> + { }; + + // Let c = 2^(half # of bits in an intmax_t) + // then we find a1, a0, b1, b0 s.t. N = a1*c + a0, M = b1*c + b0 + // The multiplication of N and M becomes, + // N * M = (a1 * b1)c^2 + (a0 * b1 + b0 * a1)c + a0 * b0 + // Multiplication is safe if each term and the sum of the terms + // is representable by intmax_t. + template + struct __safe_multiply + { + private: + static const uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4); + + static const uintmax_t __a0 = __static_abs<_Pn>::value % __c; + static const uintmax_t __a1 = __static_abs<_Pn>::value / __c; + static const uintmax_t __b0 = __static_abs<_Qn>::value % __c; + static const uintmax_t __b1 = __static_abs<_Qn>::value / __c; + + static_assert(__a1 == 0 || __b1 == 0, + "overflow in multiplication"); + static_assert(__a0 * __b1 + __b0 * __a1 < (__c >> 1), + "overflow in multiplication"); + static_assert(__b0 * __a0 <= __INTMAX_MAX__, + "overflow in multiplication"); + static_assert((__a0 * __b1 + __b0 * __a1) * __c + <= __INTMAX_MAX__ - __b0 * __a0, + "overflow in multiplication"); + + public: + static const intmax_t value = _Pn * _Qn; + }; + + // Some double-precision utilities, where numbers are represented as + // __hi*2^(8*sizeof(uintmax_t)) + __lo. + template + struct __big_less + : integral_constant + { }; + + template + struct __big_add + { + static constexpr uintmax_t __lo = __lo1 + __lo2; + static constexpr uintmax_t __hi = (__hi1 + __hi2 + + (__lo1 + __lo2 < __lo1)); // carry + }; + + // Subtract a number from a bigger one. + template + struct __big_sub + { + static_assert(!__big_less<__hi1, __lo1, __hi2, __lo2>::value, + "Internal library error"); + static constexpr uintmax_t __lo = __lo1 - __lo2; + static constexpr uintmax_t __hi = (__hi1 - __hi2 - + (__lo1 < __lo2)); // carry + }; + + // Same principle as __safe_multiply. + template + struct __big_mul + { + private: + static constexpr uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4); + static constexpr uintmax_t __x0 = __x % __c; + static constexpr uintmax_t __x1 = __x / __c; + static constexpr uintmax_t __y0 = __y % __c; + static constexpr uintmax_t __y1 = __y / __c; + static constexpr uintmax_t __x0y0 = __x0 * __y0; + static constexpr uintmax_t __x0y1 = __x0 * __y1; + static constexpr uintmax_t __x1y0 = __x1 * __y0; + static constexpr uintmax_t __x1y1 = __x1 * __y1; + static constexpr uintmax_t __mix = __x0y1 + __x1y0; // possible carry... + static constexpr uintmax_t __mix_lo = __mix * __c; + static constexpr uintmax_t __mix_hi + = __mix / __c + ((__mix < __x0y1) ? __c : 0); // ... added here + typedef __big_add<__mix_hi, __mix_lo, __x1y1, __x0y0> _Res; + public: + static constexpr uintmax_t __hi = _Res::__hi; + static constexpr uintmax_t __lo = _Res::__lo; + }; + + // Adapted from __udiv_qrnnd_c in longlong.h + // This version assumes that the high bit of __d is 1. + template + struct __big_div_impl + { + private: + static_assert(__d >= (uintmax_t(1) << (sizeof(intmax_t) * 8 - 1)), + "Internal library error"); + static_assert(__n1 < __d, "Internal library error"); + static constexpr uintmax_t __c = uintmax_t(1) << (sizeof(intmax_t) * 4); + static constexpr uintmax_t __d1 = __d / __c; + static constexpr uintmax_t __d0 = __d % __c; + + static constexpr uintmax_t __q1x = __n1 / __d1; + static constexpr uintmax_t __r1x = __n1 % __d1; + static constexpr uintmax_t __m = __q1x * __d0; + static constexpr uintmax_t __r1y = __r1x * __c + __n0 / __c; + static constexpr uintmax_t __r1z = __r1y + __d; + static constexpr uintmax_t __r1 + = ((__r1y < __m) ? ((__r1z >= __d) && (__r1z < __m)) + ? (__r1z + __d) : __r1z : __r1y) - __m; + static constexpr uintmax_t __q1 + = __q1x - ((__r1y < __m) + ? ((__r1z >= __d) && (__r1z < __m)) ? 2 : 1 : 0); + static constexpr uintmax_t __q0x = __r1 / __d1; + static constexpr uintmax_t __r0x = __r1 % __d1; + static constexpr uintmax_t __n = __q0x * __d0; + static constexpr uintmax_t __r0y = __r0x * __c + __n0 % __c; + static constexpr uintmax_t __r0z = __r0y + __d; + static constexpr uintmax_t __r0 + = ((__r0y < __n) ? ((__r0z >= __d) && (__r0z < __n)) + ? (__r0z + __d) : __r0z : __r0y) - __n; + static constexpr uintmax_t __q0 + = __q0x - ((__r0y < __n) ? ((__r0z >= __d) + && (__r0z < __n)) ? 2 : 1 : 0); + + public: + static constexpr uintmax_t __quot = __q1 * __c + __q0; + static constexpr uintmax_t __rem = __r0; + + private: + typedef __big_mul<__quot, __d> _Prod; + typedef __big_add<_Prod::__hi, _Prod::__lo, 0, __rem> _Sum; + static_assert(_Sum::__hi == __n1 && _Sum::__lo == __n0, + "Internal library error"); + }; + + template + struct __big_div + { + private: + static_assert(__d != 0, "Internal library error"); + static_assert(sizeof (uintmax_t) == sizeof (unsigned long long), + "This library calls __builtin_clzll on uintmax_t, which " + "is unsafe on your platform. Please complain to " + "http://gcc.gnu.org/bugzilla/"); + static constexpr int __shift = __builtin_clzll(__d); + static constexpr int __coshift_ = sizeof(uintmax_t) * 8 - __shift; + static constexpr int __coshift = (__shift != 0) ? __coshift_ : 0; + static constexpr uintmax_t __c1 = uintmax_t(1) << __shift; + static constexpr uintmax_t __c2 = uintmax_t(1) << __coshift; + static constexpr uintmax_t __new_d = __d * __c1; + static constexpr uintmax_t __new_n0 = __n0 * __c1; + static constexpr uintmax_t __n1_shifted = (__n1 % __d) * __c1; + static constexpr uintmax_t __n0_top = (__shift != 0) ? (__n0 / __c2) : 0; + static constexpr uintmax_t __new_n1 = __n1_shifted + __n0_top; + typedef __big_div_impl<__new_n1, __new_n0, __new_d> _Res; + + public: + static constexpr uintmax_t __quot_hi = __n1 / __d; + static constexpr uintmax_t __quot_lo = _Res::__quot; + static constexpr uintmax_t __rem = _Res::__rem / __c1; + + private: + typedef __big_mul<__quot_lo, __d> _P0; + typedef __big_mul<__quot_hi, __d> _P1; + typedef __big_add<_P0::__hi, _P0::__lo, _P1::__lo, __rem> _Sum; + // No overflow. + static_assert(_P1::__hi == 0, "Internal library error"); + static_assert(_Sum::__hi >= _P0::__hi, "Internal library error"); + // Matches the input data. + static_assert(_Sum::__hi == __n1 && _Sum::__lo == __n0, + "Internal library error"); + static_assert(__rem < __d, "Internal library error"); + }; + + /// @endcond + + /** + * @brief Provides compile-time rational arithmetic. + * + * This class template represents any finite rational number with a + * numerator and denominator representable by compile-time constants of + * type intmax_t. The ratio is simplified when instantiated. + * + * For example: + * @code + * std::ratio<7,-21>::num == -1; + * std::ratio<7,-21>::den == 3; + * @endcode + * + */ + template + struct ratio + { + static_assert(_Den != 0, "denominator cannot be zero"); + static_assert(_Num >= -__INTMAX_MAX__ && _Den >= -__INTMAX_MAX__, + "out of range"); + + // Note: sign(N) * abs(N) == N + static constexpr intmax_t num = + _Num * __static_sign<_Den>::value / __static_gcd<_Num, _Den>::value; + + static constexpr intmax_t den = + __static_abs<_Den>::value / __static_gcd<_Num, _Den>::value; + + typedef ratio type; + }; + +#if ! __cpp_inline_variables + template + constexpr intmax_t ratio<_Num, _Den>::num; + + template + constexpr intmax_t ratio<_Num, _Den>::den; +#endif + + /// @cond undocumented + + template + struct __is_ratio + : std::false_type + { }; + + template + struct __is_ratio> + : std::true_type + { }; + +#if __cpp_variable_templates + template + constexpr bool __is_ratio_v = false; + template + constexpr bool __is_ratio_v> = true; +#endif + + template + constexpr bool + __are_both_ratios() noexcept + { +#if __cpp_variable_templates && __cpp_if_constexpr + if constexpr (__is_ratio_v<_R1>) + if constexpr (__is_ratio_v<_R2>) + return true; + return false; +#else + return __and_<__is_ratio<_R1>, __is_ratio<_R2>>::value; +#endif + } + + template + struct __ratio_multiply + { + static_assert(std::__are_both_ratios<_R1, _R2>(), + "both template arguments must be a std::ratio"); + + private: + static const intmax_t __gcd1 = + __static_gcd<_R1::num, _R2::den>::value; + static const intmax_t __gcd2 = + __static_gcd<_R2::num, _R1::den>::value; + + public: + typedef ratio< + __safe_multiply<(_R1::num / __gcd1), + (_R2::num / __gcd2)>::value, + __safe_multiply<(_R1::den / __gcd2), + (_R2::den / __gcd1)>::value> type; + + static constexpr intmax_t num = type::num; + static constexpr intmax_t den = type::den; + }; + +#if ! __cpp_inline_variables + template + constexpr intmax_t __ratio_multiply<_R1, _R2>::num; + + template + constexpr intmax_t __ratio_multiply<_R1, _R2>::den; +#endif + + /// @endcond + + /// ratio_multiply + template + using ratio_multiply = typename __ratio_multiply<_R1, _R2>::type; + + /// @cond undocumented + + template + struct __ratio_divide + { + static_assert(_R2::num != 0, "division by 0"); + + typedef typename __ratio_multiply< + _R1, + ratio<_R2::den, _R2::num>>::type type; + + static constexpr intmax_t num = type::num; + static constexpr intmax_t den = type::den; + }; + +#if ! __cpp_inline_variables + template + constexpr intmax_t __ratio_divide<_R1, _R2>::num; + + template + constexpr intmax_t __ratio_divide<_R1, _R2>::den; +#endif + + /// @endcond + + /// ratio_divide + template + using ratio_divide = typename __ratio_divide<_R1, _R2>::type; + + /// ratio_equal + template + struct ratio_equal + : integral_constant + { + static_assert(std::__are_both_ratios<_R1, _R2>(), + "both template arguments must be a std::ratio"); + }; + + /// ratio_not_equal + template + struct ratio_not_equal + : integral_constant::value> + { }; + + /// @cond undocumented + + // Both numbers are positive. + template, + typename _Right = __big_mul<_R2::num,_R1::den> > + struct __ratio_less_impl_1 + : integral_constant::value> + { }; + + template::value + != __static_sign<_R2::num>::value)), + bool = (__static_sign<_R1::num>::value == -1 + && __static_sign<_R2::num>::value == -1)> + struct __ratio_less_impl + : __ratio_less_impl_1<_R1, _R2>::type + { }; + + template + struct __ratio_less_impl<_R1, _R2, true, false> + : integral_constant + { }; + + template + struct __ratio_less_impl<_R1, _R2, false, true> + : __ratio_less_impl_1, + ratio<-_R1::num, _R1::den> >::type + { }; + + /// @endcond + + /// ratio_less + template + struct ratio_less + : __ratio_less_impl<_R1, _R2>::type + { + static_assert(std::__are_both_ratios<_R1, _R2>(), + "both template arguments must be a std::ratio"); + }; + + /// ratio_less_equal + template + struct ratio_less_equal + : integral_constant::value> + { }; + + /// ratio_greater + template + struct ratio_greater + : integral_constant::value> + { }; + + /// ratio_greater_equal + template + struct ratio_greater_equal + : integral_constant::value> + { }; + +#if __cplusplus > 201402L + template + inline constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value; + template + inline constexpr bool ratio_not_equal_v = ratio_not_equal<_R1, _R2>::value; + template + inline constexpr bool ratio_less_v = ratio_less<_R1, _R2>::value; + template + inline constexpr bool ratio_less_equal_v + = ratio_less_equal<_R1, _R2>::value; + template + inline constexpr bool ratio_greater_v = ratio_greater<_R1, _R2>::value; + template + inline constexpr bool ratio_greater_equal_v + = ratio_greater_equal<_R1, _R2>::value; +#endif // C++17 + + /// @cond undocumented + + template= 0), + bool = (_R2::num >= 0), + bool = ratio_less::value, _R1::den>, + ratio<__static_abs<_R2::num>::value, _R2::den> >::value> + struct __ratio_add_impl + { + private: + typedef typename __ratio_add_impl< + ratio<-_R1::num, _R1::den>, + ratio<-_R2::num, _R2::den> >::type __t; + public: + typedef ratio<-__t::num, __t::den> type; + }; + + // True addition of nonnegative numbers. + template + struct __ratio_add_impl<_R1, _R2, true, true, __b> + { + private: + static constexpr uintmax_t __g = __static_gcd<_R1::den, _R2::den>::value; + static constexpr uintmax_t __d2 = _R2::den / __g; + typedef __big_mul<_R1::den, __d2> __d; + typedef __big_mul<_R1::num, _R2::den / __g> __x; + typedef __big_mul<_R2::num, _R1::den / __g> __y; + typedef __big_add<__x::__hi, __x::__lo, __y::__hi, __y::__lo> __n; + static_assert(__n::__hi >= __x::__hi, "Internal library error"); + typedef __big_div<__n::__hi, __n::__lo, __g> __ng; + static constexpr uintmax_t __g2 = __static_gcd<__ng::__rem, __g>::value; + typedef __big_div<__n::__hi, __n::__lo, __g2> __n_final; + static_assert(__n_final::__rem == 0, "Internal library error"); + static_assert(__n_final::__quot_hi == 0 && + __n_final::__quot_lo <= __INTMAX_MAX__, "overflow in addition"); + typedef __big_mul<_R1::den / __g2, __d2> __d_final; + static_assert(__d_final::__hi == 0 && + __d_final::__lo <= __INTMAX_MAX__, "overflow in addition"); + public: + typedef ratio<__n_final::__quot_lo, __d_final::__lo> type; + }; + + template + struct __ratio_add_impl<_R1, _R2, false, true, true> + : __ratio_add_impl<_R2, _R1> + { }; + + // True subtraction of nonnegative numbers yielding a nonnegative result. + template + struct __ratio_add_impl<_R1, _R2, true, false, false> + { + private: + static constexpr uintmax_t __g = __static_gcd<_R1::den, _R2::den>::value; + static constexpr uintmax_t __d2 = _R2::den / __g; + typedef __big_mul<_R1::den, __d2> __d; + typedef __big_mul<_R1::num, _R2::den / __g> __x; + typedef __big_mul<-_R2::num, _R1::den / __g> __y; + typedef __big_sub<__x::__hi, __x::__lo, __y::__hi, __y::__lo> __n; + typedef __big_div<__n::__hi, __n::__lo, __g> __ng; + static constexpr uintmax_t __g2 = __static_gcd<__ng::__rem, __g>::value; + typedef __big_div<__n::__hi, __n::__lo, __g2> __n_final; + static_assert(__n_final::__rem == 0, "Internal library error"); + static_assert(__n_final::__quot_hi == 0 && + __n_final::__quot_lo <= __INTMAX_MAX__, "overflow in addition"); + typedef __big_mul<_R1::den / __g2, __d2> __d_final; + static_assert(__d_final::__hi == 0 && + __d_final::__lo <= __INTMAX_MAX__, "overflow in addition"); + public: + typedef ratio<__n_final::__quot_lo, __d_final::__lo> type; + }; + + template + struct __ratio_add + { + static_assert(std::__are_both_ratios<_R1, _R2>(), + "both template arguments must be a std::ratio"); + + typedef typename __ratio_add_impl<_R1, _R2>::type type; + static constexpr intmax_t num = type::num; + static constexpr intmax_t den = type::den; + }; + +#if ! __cpp_inline_variables + template + constexpr intmax_t __ratio_add<_R1, _R2>::num; + + template + constexpr intmax_t __ratio_add<_R1, _R2>::den; +#endif + + /// @endcond + + /// ratio_add + template + using ratio_add = typename __ratio_add<_R1, _R2>::type; + + /// @cond undocumented + + template + struct __ratio_subtract + { + typedef typename __ratio_add< + _R1, + ratio<-_R2::num, _R2::den>>::type type; + + static constexpr intmax_t num = type::num; + static constexpr intmax_t den = type::den; + }; + +#if ! __cpp_inline_variables + template + constexpr intmax_t __ratio_subtract<_R1, _R2>::num; + + template + constexpr intmax_t __ratio_subtract<_R1, _R2>::den; +#endif + + /// @endcond + + /// ratio_subtract + template + using ratio_subtract = typename __ratio_subtract<_R1, _R2>::type; + +#if __INTMAX_WIDTH__ >= 96 +# if __cpp_lib_ratio >= 202306L +# if __INTMAX_WIDTH__ >= 128 + using quecto = ratio< 1, 1000000000000000000000000000000>; +# endif + using ronto = ratio< 1, 1000000000000000000000000000>; +# endif + using yocto = ratio< 1, 1000000000000000000000000>; + using zepto = ratio< 1, 1000000000000000000000>; +#endif + using atto = ratio< 1, 1000000000000000000>; + using femto = ratio< 1, 1000000000000000>; + using pico = ratio< 1, 1000000000000>; + using nano = ratio< 1, 1000000000>; + using micro = ratio< 1, 1000000>; + using milli = ratio< 1, 1000>; + using centi = ratio< 1, 100>; + using deci = ratio< 1, 10>; + using deca = ratio< 10, 1>; + using hecto = ratio< 100, 1>; + using kilo = ratio< 1000, 1>; + using mega = ratio< 1000000, 1>; + using giga = ratio< 1000000000, 1>; + using tera = ratio< 1000000000000, 1>; + using peta = ratio< 1000000000000000, 1>; + using exa = ratio< 1000000000000000000, 1>; +#if __INTMAX_WIDTH__ >= 96 + using zetta = ratio< 1000000000000000000000, 1>; + using yotta = ratio<1000000000000000000000000, 1>; +# if __cpp_lib_ratio >= 202306L + using ronna = ratio<1000000000000000000000000000, 1>; +# if __INTMAX_WIDTH__ >= 128 + using quetta = ratio<1000000000000000000000000000000, 1>; +# endif +# endif +#endif + + /// @} group ratio +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // C++11 + +#endif //_GLIBCXX_RATIO diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ratio.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ratio.blob new file mode 100644 index 0000000..a0b5c53 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@ratio.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@sstream b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@sstream new file mode 100644 index 0000000..ad0c16a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@sstream @@ -0,0 +1,1257 @@ +// String based streams -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/sstream + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.7 String-based streams +// + +#ifndef _GLIBCXX_SSTREAM +#define _GLIBCXX_SSTREAM 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // iostream + +#include +#include +#include // allocator_traits, __allocator_like + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI +# define _GLIBCXX_LVAL_REF_QUAL & +# define _GLIBCXX_SSTREAM_ALWAYS_INLINE +#else +# define _GLIBCXX_LVAL_REF_QUAL +// For symbols that are not exported from libstdc++.so for the COW string ABI. +# define _GLIBCXX_SSTREAM_ALWAYS_INLINE [[__gnu__::__always_inline__]] +#endif + + + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + // [27.7.1] template class basic_stringbuf + /** + * @brief The actual work of input and output (for std::string). + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. + * + * This class associates either or both of its input and output sequences + * with a sequence of characters, which can be initialized from, or made + * available as, a @c std::basic_string. (Paraphrased from [27.7.1]/1.) + * + * For this class, open modes (of type @c ios_base::openmode) have + * @c in set if the input sequence can be read, and @c out set if the + * output sequence can be written. + */ + template + class basic_stringbuf : public basic_streambuf<_CharT, _Traits> + { + struct __xfer_bufptrs; + +#if __cplusplus >= 201103L + using allocator_traits = std::allocator_traits<_Alloc>; + using _Noexcept_swap + = __or_; +#endif + + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 251. basic_stringbuf missing allocator_type + typedef _Alloc allocator_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + typedef basic_streambuf __streambuf_type; + typedef basic_string __string_type; + typedef typename __string_type::size_type __size_type; + + protected: + /// Place to stash in || out || in | out settings for current stringbuf. + ios_base::openmode _M_mode; + + // Data Members: + __string_type _M_string; + + public: + // Constructors: + + /** + * @brief Starts with an empty string buffer. + * + * The default constructor initializes the parent class using its + * own default ctor. + */ + basic_stringbuf() + : __streambuf_type(), _M_mode(ios_base::in | ios_base::out), _M_string() + { } + + /** + * @brief Starts with an empty string buffer. + * @param __mode Whether the buffer can read, or write, or both. + * + * The default constructor initializes the parent class using its + * own default ctor. + */ + explicit + basic_stringbuf(ios_base::openmode __mode) + : __streambuf_type(), _M_mode(__mode), _M_string() + { } + + /** + * @brief Starts with an existing string buffer. + * @param __str A string to copy as a starting buffer. + * @param __mode Whether the buffer can read, or write, or both. + * + * This constructor initializes the parent class using its + * own default ctor. + */ + explicit + basic_stringbuf(const __string_type& __str, + ios_base::openmode __mode = ios_base::in | ios_base::out) + : __streambuf_type(), _M_mode(), + _M_string(__str.data(), __str.size(), __str.get_allocator()) + { _M_stringbuf_init(__mode); } + +#if __cplusplus >= 201103L + basic_stringbuf(const basic_stringbuf&) = delete; + + basic_stringbuf(basic_stringbuf&& __rhs) + : basic_stringbuf(std::move(__rhs), __xfer_bufptrs(__rhs, this)) + { __rhs._M_sync(const_cast(__rhs._M_string.data()), 0, 0); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + explicit + basic_stringbuf(const allocator_type& __a) + : basic_stringbuf(ios_base::in | std::ios_base::out, __a) + { } + + basic_stringbuf(ios_base::openmode __mode, + const allocator_type& __a) + : __streambuf_type(), _M_mode(__mode), _M_string(__a) + { } + + explicit + basic_stringbuf(__string_type&& __s, + ios_base::openmode __mode = ios_base::in + | ios_base::out) + : __streambuf_type(), _M_mode(__mode), _M_string(std::move(__s)) + { _M_stringbuf_init(__mode); } + + template + basic_stringbuf(const basic_string<_CharT, _Traits, _SAlloc>& __s, + const allocator_type& __a) + : basic_stringbuf(__s, ios_base::in | std::ios_base::out, __a) + { } + + template + basic_stringbuf(const basic_string<_CharT, _Traits, _SAlloc>& __s, + ios_base::openmode __mode, + const allocator_type& __a) + : __streambuf_type(), _M_mode(__mode), + _M_string(__s.data(), __s.size(), __a) + { _M_stringbuf_init(__mode); } + + template + explicit + basic_stringbuf(const basic_string<_CharT, _Traits, _SAlloc>& __s, + ios_base::openmode __mode = ios_base::in + | ios_base::out) + : basic_stringbuf(__s, __mode, allocator_type{}) + { } + + basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a) + : basic_stringbuf(std::move(__rhs), __a, __xfer_bufptrs(__rhs, this)) + { __rhs._M_sync(const_cast(__rhs._M_string.data()), 0, 0); } + + allocator_type get_allocator() const noexcept + { return _M_string.get_allocator(); } +#endif // C++20 + + // 27.8.2.2 Assign and swap: + + basic_stringbuf& + operator=(const basic_stringbuf&) = delete; + + basic_stringbuf& + operator=(basic_stringbuf&& __rhs) + { + __xfer_bufptrs __st{__rhs, this}; + const __streambuf_type& __base = __rhs; + __streambuf_type::operator=(__base); + this->pubimbue(__rhs.getloc()); + _M_mode = __rhs._M_mode; + _M_string = std::move(__rhs._M_string); + __rhs._M_sync(const_cast(__rhs._M_string.data()), 0, 0); + return *this; + } + + void + swap(basic_stringbuf& __rhs) noexcept(_Noexcept_swap::value) + { + __xfer_bufptrs __l_st{*this, std::__addressof(__rhs)}; + __xfer_bufptrs __r_st{__rhs, this}; + __streambuf_type& __base = __rhs; + __streambuf_type::swap(__base); + __rhs.pubimbue(this->pubimbue(__rhs.getloc())); + std::swap(_M_mode, __rhs._M_mode); + std::swap(_M_string, __rhs._M_string); // XXX not exception safe + } +#endif // C++11 + + // Getters and setters: + + /** + * @brief Copying out the string buffer. + * @return A copy of one of the underlying sequences. + * + * If the buffer is only created in input mode, the underlying + * character sequence is equal to the input sequence; otherwise, it + * is equal to the output sequence. [27.7.1.2]/1 + */ + _GLIBCXX_NODISCARD + __string_type + str() const _GLIBCXX_LVAL_REF_QUAL + { + __string_type __ret(_M_string.get_allocator()); + if (char_type* __hi = _M_high_mark()) + __ret.assign(this->pbase(), __hi); + else + __ret = _M_string; + return __ret; + } + +#if __cplusplus > 201703L +#if _GLIBCXX_USE_CXX11_ABI +#if __cpp_concepts + template<__allocator_like _SAlloc> + _GLIBCXX_NODISCARD + basic_string<_CharT, _Traits, _SAlloc> + str(const _SAlloc& __sa) const + { + auto __sv = view(); + return { __sv.data(), __sv.size(), __sa }; + } +#endif + + _GLIBCXX_NODISCARD + __string_type + str() && + { + if (char_type* __hi = _M_high_mark()) + { + // Set length to end of character sequence and add null terminator. + _M_string._M_set_length(_M_high_mark() - this->pbase()); + } + auto __str = std::move(_M_string); + _M_string.clear(); + _M_sync(_M_string.data(), 0, 0); + return __str; + } +#endif // cxx11 ABI + + _GLIBCXX_SSTREAM_ALWAYS_INLINE + basic_string_view + view() const noexcept + { + if (char_type* __hi = _M_high_mark()) + return { this->pbase(), __hi }; + else + return _M_string; + } +#endif // C++20 + + /** + * @brief Setting a new buffer. + * @param __s The string to use as a new sequence. + * + * Deallocates any previous stored sequence, then copies @a s to + * use as a new one. + */ + void + str(const __string_type& __s) + { + // Cannot use _M_string = __s, since v3 strings are COW + // (not always true now but assign() always works). + _M_string.assign(__s.data(), __s.size()); + _M_stringbuf_init(_M_mode); + } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI +#if __cpp_concepts + template<__allocator_like _SAlloc> + requires (!is_same_v<_SAlloc, _Alloc>) + void + str(const basic_string<_CharT, _Traits, _SAlloc>& __s) + { + _M_string.assign(__s.data(), __s.size()); + _M_stringbuf_init(_M_mode); + } +#endif + + void + str(__string_type&& __s) + { + _M_string = std::move(__s); + _M_stringbuf_init(_M_mode); + } +#endif + + protected: + // Common initialization code goes here. + void + _M_stringbuf_init(ios_base::openmode __mode) + { + _M_mode = __mode; + __size_type __len = 0; + if (_M_mode & (ios_base::ate | ios_base::app)) + __len = _M_string.size(); + _M_sync(const_cast(_M_string.data()), 0, __len); + } + + virtual streamsize + showmanyc() + { + streamsize __ret = -1; + if (_M_mode & ios_base::in) + { + _M_update_egptr(); + __ret = this->egptr() - this->gptr(); + } + return __ret; + } + + virtual int_type + underflow(); + + virtual int_type + pbackfail(int_type __c = traits_type::eof()); + + virtual int_type + overflow(int_type __c = traits_type::eof()); + + /** + * @brief Manipulates the buffer. + * @param __s Pointer to a buffer area. + * @param __n Size of @a __s. + * @return @c this + * + * If no buffer has already been created, and both @a __s and @a __n are + * non-zero, then @c __s is used as a buffer; see + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering + * for more. + */ + virtual __streambuf_type* + setbuf(char_type* __s, streamsize __n) + { + if (__s && __n >= 0) + { + // This is implementation-defined behavior, and assumes + // that an external char_type array of length __n exists + // and has been pre-allocated. If this is not the case, + // things will quickly blow up. + + // Step 1: Destroy the current internal array. + _M_string.clear(); + + // Step 2: Use the external array. + _M_sync(__s, __n, 0); + } + return this; + } + + virtual pos_type + seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + virtual pos_type + seekpos(pos_type __sp, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + // Internal function for correctly updating the internal buffer + // for a particular _M_string, due to initialization or re-sizing + // of an existing _M_string. + void + _M_sync(char_type* __base, __size_type __i, __size_type __o); + + // Internal function for correctly updating egptr() to the actual + // string end. + void + _M_update_egptr() + { + if (char_type* __pptr = this->pptr()) + { + char_type* __egptr = this->egptr(); + if (!__egptr || __pptr > __egptr) + { + if (_M_mode & ios_base::in) + this->setg(this->eback(), this->gptr(), __pptr); + else + this->setg(__pptr, __pptr, __pptr); + } + } + } + + // Works around the issue with pbump, part of the protected + // interface of basic_streambuf, taking just an int. + void + _M_pbump(char_type* __pbeg, char_type* __pend, off_type __off); + + private: + // Return a pointer to the end of the underlying character sequence. + // This might not be the same character as _M_string.end() because + // basic_stringbuf::overflow might have written to unused capacity + // in _M_string without updating its length. + __attribute__((__always_inline__)) + char_type* + _M_high_mark() const _GLIBCXX_NOEXCEPT + { + if (char_type* __pptr = this->pptr()) + { + char_type* __egptr = this->egptr(); + if (!__egptr || __pptr > __egptr) + return __pptr; // Underlying sequence is [pbase, pptr). + else + return __egptr; // Underlying sequence is [pbase, egptr). + } + return 0; // Underlying character sequence is just _M_string. + } + +#if __cplusplus >= 201103L +#if _GLIBCXX_USE_CXX11_ABI + // This type captures the state of the gptr / pptr pointers as offsets + // so they can be restored in another object after moving the string. + struct __xfer_bufptrs + { + __xfer_bufptrs(const basic_stringbuf& __from, basic_stringbuf* __to) + : _M_to{__to}, _M_goff{-1, -1, -1}, _M_poff{-1, -1, -1} + { + const _CharT* const __str = __from._M_string.data(); + const _CharT* __end = nullptr; + if (__from.eback()) + { + _M_goff[0] = __from.eback() - __str; + _M_goff[1] = __from.gptr() - __str; + _M_goff[2] = __from.egptr() - __str; + __end = __from.egptr(); + } + if (__from.pbase()) + { + _M_poff[0] = __from.pbase() - __str; + _M_poff[1] = __from.pptr() - __from.pbase(); + _M_poff[2] = __from.epptr() - __str; + if (!__end || __from.pptr() > __end) + __end = __from.pptr(); + } + + // Set _M_string length to the greater of the get and put areas. + if (__end) + { + // The const_cast avoids changing this constructor's signature, + // because it is exported from the dynamic library. + auto& __mut_from = const_cast(__from); + __mut_from._M_string._M_length(__end - __str); + } + } + + ~__xfer_bufptrs() + { + char_type* __str = const_cast(_M_to->_M_string.data()); + if (_M_goff[0] != -1) + _M_to->setg(__str+_M_goff[0], __str+_M_goff[1], __str+_M_goff[2]); + if (_M_poff[0] != -1) + _M_to->_M_pbump(__str+_M_poff[0], __str+_M_poff[2], _M_poff[1]); + } + + basic_stringbuf* _M_to; + off_type _M_goff[3]; + off_type _M_poff[3]; + }; +#else + // This type does nothing when using Copy-On-Write strings. + struct __xfer_bufptrs + { + __xfer_bufptrs(const basic_stringbuf&, basic_stringbuf*) { } + }; +#endif + + // The move constructor initializes an __xfer_bufptrs temporary then + // delegates to this constructor to performs moves during its lifetime. + basic_stringbuf(basic_stringbuf&& __rhs, __xfer_bufptrs&&) + : __streambuf_type(static_cast(__rhs)), + _M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string)) + { } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + // The move constructor initializes an __xfer_bufptrs temporary then + // delegates to this constructor to performs moves during its lifetime. + basic_stringbuf(basic_stringbuf&& __rhs, const allocator_type& __a, + __xfer_bufptrs&&) + : __streambuf_type(static_cast(__rhs)), + _M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string), __a) + { } +#endif +#endif // C++11 + }; + + + // [27.7.2] Template class basic_istringstream + /** + * @brief Controlling input for std::string. + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. + * + * This class supports reading from objects of type std::basic_string, + * using the inherited functions from std::basic_istream. To control + * the associated sequence, an instance of std::basic_stringbuf is used, + * which this page refers to as @c sb. + */ + template + class basic_istringstream : public basic_istream<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 251. basic_stringbuf missing allocator_type + typedef _Alloc allocator_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // Non-standard types: + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; + typedef basic_istream __istream_type; + + private: + __stringbuf_type _M_stringbuf; + + public: + // Constructors: + + /** + * @brief Default constructor starts with an empty string buffer. + * + * Initializes @c sb using @c in, and passes @c &sb to the base + * class initializer. Does not allocate any buffer. + * + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + */ + basic_istringstream() + : __istream_type(), _M_stringbuf(ios_base::in) + { this->init(&_M_stringbuf); } + + /** + * @brief Starts with an empty string buffer. + * @param __mode Whether the buffer can read, or write, or both. + * + * @c ios_base::in is automatically included in @a __mode. + * + * Initializes @c sb using @c __mode|in, and passes @c &sb to the base + * class initializer. Does not allocate any buffer. + * + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + */ + explicit + basic_istringstream(ios_base::openmode __mode) + : __istream_type(), _M_stringbuf(__mode | ios_base::in) + { this->init(&_M_stringbuf); } + + /** + * @brief Starts with an existing string buffer. + * @param __str A string to copy as a starting buffer. + * @param __mode Whether the buffer can read, or write, or both. + * + * @c ios_base::in is automatically included in @a mode. + * + * Initializes @c sb using @a str and @c mode|in, and passes @c &sb + * to the base class initializer. + * + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + */ + explicit + basic_istringstream(const __string_type& __str, + ios_base::openmode __mode = ios_base::in) + : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in) + { this->init(&_M_stringbuf); } + + /** + * @brief The destructor does nothing. + * + * The buffer is deallocated by the stringbuf object, not the + * formatting stream. + */ + ~basic_istringstream() + { } + +#if __cplusplus >= 201103L + basic_istringstream(const basic_istringstream&) = delete; + + basic_istringstream(basic_istringstream&& __rhs) + : __istream_type(std::move(__rhs)), + _M_stringbuf(std::move(__rhs._M_stringbuf)) + { __istream_type::set_rdbuf(&_M_stringbuf); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + basic_istringstream(ios_base::openmode __mode, const allocator_type& __a) + : __istream_type(), _M_stringbuf(__mode | ios_base::in, __a) + { this->init(std::__addressof(_M_stringbuf)); } + + explicit + basic_istringstream(__string_type&& __str, + ios_base::openmode __mode = ios_base::in) + : __istream_type(), _M_stringbuf(std::move(__str), __mode | ios_base::in) + { this->init(std::__addressof(_M_stringbuf)); } + + template + basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + const allocator_type& __a) + : basic_istringstream(__str, ios_base::in, __a) + { } + + template + basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + ios_base::openmode __mode, + const allocator_type& __a) + : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in, __a) + { this->init(std::__addressof(_M_stringbuf)); } + + template + explicit + basic_istringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + ios_base::openmode __mode = ios_base::in) + : basic_istringstream(__str, __mode, allocator_type()) + { } +#endif // C++20 + + // 27.8.3.2 Assign and swap: + + basic_istringstream& + operator=(const basic_istringstream&) = delete; + + basic_istringstream& + operator=(basic_istringstream&& __rhs) + { + __istream_type::operator=(std::move(__rhs)); + _M_stringbuf = std::move(__rhs._M_stringbuf); + return *this; + } + + void + swap(basic_istringstream& __rhs) + { + __istream_type::swap(__rhs); + _M_stringbuf.swap(__rhs._M_stringbuf); + } +#endif // C++11 + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_stringbuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + _GLIBCXX_NODISCARD + __stringbuf_type* + rdbuf() const + { return const_cast<__stringbuf_type*>(&_M_stringbuf); } + + /** + * @brief Copying out the string buffer. + * @return @c rdbuf()->str() + */ + _GLIBCXX_NODISCARD + __string_type + str() const _GLIBCXX_LVAL_REF_QUAL + { return _M_stringbuf.str(); } + +#if __cplusplus > 201703L +#if _GLIBCXX_USE_CXX11_ABI +#if __cpp_concepts + template<__allocator_like _SAlloc> + _GLIBCXX_NODISCARD + basic_string<_CharT, _Traits, _SAlloc> + str(const _SAlloc& __sa) const + { return _M_stringbuf.str(__sa); } +#endif + + _GLIBCXX_NODISCARD + __string_type + str() && + { return std::move(_M_stringbuf).str(); } +#endif // cxx11 ABI + + _GLIBCXX_SSTREAM_ALWAYS_INLINE + basic_string_view + view() const noexcept + { return _M_stringbuf.view(); } +#endif // C++20 + + /** + * @brief Setting a new buffer. + * @param __s The string to use as a new sequence. + * + * Calls @c rdbuf()->str(s). + */ + void + str(const __string_type& __s) + { _M_stringbuf.str(__s); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI +#if __cpp_concepts + template<__allocator_like _SAlloc> + requires (!is_same_v<_SAlloc, _Alloc>) + void + str(const basic_string<_CharT, _Traits, _SAlloc>& __s) + { _M_stringbuf.str(__s); } +#endif + + void + str(__string_type&& __s) + { _M_stringbuf.str(std::move(__s)); } +#endif + }; + + + // [27.7.3] Template class basic_ostringstream + /** + * @brief Controlling output for std::string. + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. + * + * This class supports writing to objects of type std::basic_string, + * using the inherited functions from std::basic_ostream. To control + * the associated sequence, an instance of std::basic_stringbuf is used, + * which this page refers to as @c sb. + */ + template + class basic_ostringstream : public basic_ostream<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 251. basic_stringbuf missing allocator_type + typedef _Alloc allocator_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // Non-standard types: + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; + typedef basic_ostream __ostream_type; + + private: + __stringbuf_type _M_stringbuf; + + public: + // Constructors/destructor: + + /** + * @brief Default constructor starts with an empty string buffer. + * + * Initializes @c sb using @c mode|out, and passes @c &sb to the base + * class initializer. Does not allocate any buffer. + * + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + */ + basic_ostringstream() + : __ostream_type(), _M_stringbuf(ios_base::out) + { this->init(&_M_stringbuf); } + + /** + * @brief Starts with an empty string buffer. + * @param __mode Whether the buffer can read, or write, or both. + * + * @c ios_base::out is automatically included in @a mode. + * + * Initializes @c sb using @c mode|out, and passes @c &sb to the base + * class initializer. Does not allocate any buffer. + * + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + */ + explicit + basic_ostringstream(ios_base::openmode __mode) + : __ostream_type(), _M_stringbuf(__mode | ios_base::out) + { this->init(&_M_stringbuf); } + + /** + * @brief Starts with an existing string buffer. + * @param __str A string to copy as a starting buffer. + * @param __mode Whether the buffer can read, or write, or both. + * + * @c ios_base::out is automatically included in @a mode. + * + * Initializes @c sb using @a str and @c mode|out, and passes @c &sb + * to the base class initializer. + * + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + */ + explicit + basic_ostringstream(const __string_type& __str, + ios_base::openmode __mode = ios_base::out) + : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out) + { this->init(&_M_stringbuf); } + + /** + * @brief The destructor does nothing. + * + * The buffer is deallocated by the stringbuf object, not the + * formatting stream. + */ + ~basic_ostringstream() + { } + +#if __cplusplus >= 201103L + basic_ostringstream(const basic_ostringstream&) = delete; + + basic_ostringstream(basic_ostringstream&& __rhs) + : __ostream_type(std::move(__rhs)), + _M_stringbuf(std::move(__rhs._M_stringbuf)) + { __ostream_type::set_rdbuf(&_M_stringbuf); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + basic_ostringstream(ios_base::openmode __mode, const allocator_type& __a) + : __ostream_type(), _M_stringbuf(__mode | ios_base::out, __a) + { this->init(std::__addressof(_M_stringbuf)); } + + explicit + basic_ostringstream(__string_type&& __str, + ios_base::openmode __mode = ios_base::out) + : __ostream_type(), _M_stringbuf(std::move(__str), __mode | ios_base::out) + { this->init(std::__addressof(_M_stringbuf)); } + + template + basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + const allocator_type& __a) + : basic_ostringstream(__str, ios_base::out, __a) + { } + + template + basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + ios_base::openmode __mode, + const allocator_type& __a) + : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out, __a) + { this->init(std::__addressof(_M_stringbuf)); } + + template + explicit + basic_ostringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + ios_base::openmode __mode = ios_base::out) + : basic_ostringstream(__str, __mode, allocator_type()) + { } +#endif // C++20 + + // 27.8.3.2 Assign and swap: + + basic_ostringstream& + operator=(const basic_ostringstream&) = delete; + + basic_ostringstream& + operator=(basic_ostringstream&& __rhs) + { + __ostream_type::operator=(std::move(__rhs)); + _M_stringbuf = std::move(__rhs._M_stringbuf); + return *this; + } + + void + swap(basic_ostringstream& __rhs) + { + __ostream_type::swap(__rhs); + _M_stringbuf.swap(__rhs._M_stringbuf); + } +#endif // C++11 + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_stringbuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + _GLIBCXX_NODISCARD + __stringbuf_type* + rdbuf() const + { return const_cast<__stringbuf_type*>(&_M_stringbuf); } + + /** + * @brief Copying out the string buffer. + * @return @c rdbuf()->str() + */ + _GLIBCXX_NODISCARD + __string_type + str() const _GLIBCXX_LVAL_REF_QUAL + { return _M_stringbuf.str(); } + +#if __cplusplus > 201703L +#if _GLIBCXX_USE_CXX11_ABI +#if __cpp_concepts + template<__allocator_like _SAlloc> + _GLIBCXX_NODISCARD + basic_string<_CharT, _Traits, _SAlloc> + str(const _SAlloc& __sa) const + { return _M_stringbuf.str(__sa); } +#endif + + _GLIBCXX_NODISCARD + __string_type + str() && + { return std::move(_M_stringbuf).str(); } +#endif // cxx11 ABI + + _GLIBCXX_SSTREAM_ALWAYS_INLINE + basic_string_view + view() const noexcept + { return _M_stringbuf.view(); } +#endif // C++20 + + /** + * @brief Setting a new buffer. + * @param __s The string to use as a new sequence. + * + * Calls @c rdbuf()->str(s). + */ + void + str(const __string_type& __s) + { _M_stringbuf.str(__s); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI +#if __cpp_concepts + template<__allocator_like _SAlloc> + requires (!is_same_v<_SAlloc, _Alloc>) + void + str(const basic_string<_CharT, _Traits, _SAlloc>& __s) + { _M_stringbuf.str(__s); } +#endif + + void + str(__string_type&& __s) + { _M_stringbuf.str(std::move(__s)); } +#endif + }; + + + // [27.7.4] Template class basic_stringstream + /** + * @brief Controlling input and output for std::string. + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. + * + * This class supports reading from and writing to objects of type + * std::basic_string, using the inherited functions from + * std::basic_iostream. To control the associated sequence, an instance + * of std::basic_stringbuf is used, which this page refers to as @c sb. + */ + template + class basic_stringstream : public basic_iostream<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 251. basic_stringbuf missing allocator_type + typedef _Alloc allocator_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // Non-standard Types: + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; + typedef basic_iostream __iostream_type; + + private: + __stringbuf_type _M_stringbuf; + + public: + // Constructors/destructors + + /** + * @brief Default constructor starts with an empty string buffer. + * + * Initializes @c sb using the mode @c in|out, and passes @c &sb + * to the base class initializer. Does not allocate any buffer. + * + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + */ + basic_stringstream() + : __iostream_type(), _M_stringbuf(ios_base::out | ios_base::in) + { this->init(&_M_stringbuf); } + + /** + * @brief Starts with an empty string buffer. + * @param __m Whether the buffer can read, or write, or both. + * + * Initializes @c sb using the mode from @c __m, and passes @c &sb + * to the base class initializer. Does not allocate any buffer. + * + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + */ + explicit + basic_stringstream(ios_base::openmode __m) + : __iostream_type(), _M_stringbuf(__m) + { this->init(&_M_stringbuf); } + + /** + * @brief Starts with an existing string buffer. + * @param __str A string to copy as a starting buffer. + * @param __m Whether the buffer can read, or write, or both. + * + * Initializes @c sb using @a __str and @c __m, and passes @c &sb + * to the base class initializer. + * + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + */ + explicit + basic_stringstream(const __string_type& __str, + ios_base::openmode __m = ios_base::out | ios_base::in) + : __iostream_type(), _M_stringbuf(__str, __m) + { this->init(&_M_stringbuf); } + + /** + * @brief The destructor does nothing. + * + * The buffer is deallocated by the stringbuf object, not the + * formatting stream. + */ + ~basic_stringstream() + { } + +#if __cplusplus >= 201103L + basic_stringstream(const basic_stringstream&) = delete; + + basic_stringstream(basic_stringstream&& __rhs) + : __iostream_type(std::move(__rhs)), + _M_stringbuf(std::move(__rhs._M_stringbuf)) + { __iostream_type::set_rdbuf(&_M_stringbuf); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI + basic_stringstream(ios_base::openmode __mode, const allocator_type& __a) + : __iostream_type(), _M_stringbuf(__mode, __a) + { this->init(&_M_stringbuf); } + + explicit + basic_stringstream(__string_type&& __str, + ios_base::openmode __mode = ios_base::in + | ios_base::out) + : __iostream_type(), _M_stringbuf(std::move(__str), __mode) + { this->init(std::__addressof(_M_stringbuf)); } + + template + basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + const allocator_type& __a) + : basic_stringstream(__str, ios_base::in | ios_base::out, __a) + { } + + template + basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + ios_base::openmode __mode, + const allocator_type& __a) + : __iostream_type(), _M_stringbuf(__str, __mode, __a) + { this->init(std::__addressof(_M_stringbuf)); } + + template + explicit + basic_stringstream(const basic_string<_CharT, _Traits, _SAlloc>& __str, + ios_base::openmode __mode = ios_base::in + | ios_base::out) + : basic_stringstream(__str, __mode, allocator_type()) + { } +#endif // C++20 + + // 27.8.3.2 Assign and swap: + + basic_stringstream& + operator=(const basic_stringstream&) = delete; + + basic_stringstream& + operator=(basic_stringstream&& __rhs) + { + __iostream_type::operator=(std::move(__rhs)); + _M_stringbuf = std::move(__rhs._M_stringbuf); + return *this; + } + + void + swap(basic_stringstream& __rhs) + { + __iostream_type::swap(__rhs); + _M_stringbuf.swap(__rhs._M_stringbuf); + } +#endif // C++11 + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_stringbuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + _GLIBCXX_NODISCARD + __stringbuf_type* + rdbuf() const + { return const_cast<__stringbuf_type*>(&_M_stringbuf); } + + /** + * @brief Copying out the string buffer. + * @return @c rdbuf()->str() + */ + _GLIBCXX_NODISCARD + __string_type + str() const _GLIBCXX_LVAL_REF_QUAL + { return _M_stringbuf.str(); } + +#if __cplusplus > 201703L +#if _GLIBCXX_USE_CXX11_ABI +#if __cpp_concepts + template<__allocator_like _SAlloc> + _GLIBCXX_NODISCARD + basic_string<_CharT, _Traits, _SAlloc> + str(const _SAlloc& __sa) const + { return _M_stringbuf.str(__sa); } +#endif + + _GLIBCXX_NODISCARD + __string_type + str() && + { return std::move(_M_stringbuf).str(); } +#endif // cxx11 ABI + + _GLIBCXX_SSTREAM_ALWAYS_INLINE + basic_string_view + view() const noexcept + { return _M_stringbuf.view(); } +#endif // C++20 + + /** + * @brief Setting a new buffer. + * @param __s The string to use as a new sequence. + * + * Calls @c rdbuf()->str(s). + */ + void + str(const __string_type& __s) + { _M_stringbuf.str(__s); } + +#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI +#if __cpp_concepts + template<__allocator_like _SAlloc> + requires (!is_same_v<_SAlloc, _Alloc>) + void + str(const basic_string<_CharT, _Traits, _SAlloc>& __s) + { _M_stringbuf.str(__s); } +#endif + + void + str(__string_type&& __s) + { _M_stringbuf.str(std::move(__s)); } +#endif + }; + +#if __cplusplus >= 201103L + /// Swap specialization for stringbufs. + template + inline void + swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, + basic_stringbuf<_CharT, _Traits, _Allocator>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + /// Swap specialization for istringstreams. + template + inline void + swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, + basic_istringstream<_CharT, _Traits, _Allocator>& __y) + { __x.swap(__y); } + + /// Swap specialization for ostringstreams. + template + inline void + swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, + basic_ostringstream<_CharT, _Traits, _Allocator>& __y) + { __x.swap(__y); } + + /// Swap specialization for stringstreams. + template + inline void + swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, + basic_stringstream<_CharT, _Traits, _Allocator>& __y) + { __x.swap(__y); } +#endif // C++11 + +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#undef _GLIBCXX_SSTREAM_ALWAYS_INLINE +#undef _GLIBCXX_LVAL_REF_QUAL + +#include + +#endif /* _GLIBCXX_SSTREAM */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@sstream.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@sstream.blob new file mode 100644 index 0000000..4f472bb Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@sstream.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@stdexcept b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@stdexcept new file mode 100644 index 0000000..ea19569 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@stdexcept @@ -0,0 +1,309 @@ +// Standard exception classes -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/stdexcept + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 19.1 Exception classes +// + +#ifndef _GLIBCXX_STDEXCEPT +#define _GLIBCXX_STDEXCEPT 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if _GLIBCXX_USE_DUAL_ABI +#if _GLIBCXX_USE_CXX11_ABI + // Emulates an old COW string when the new std::string is in use. + struct __cow_string + { + union { + const char* _M_p; + char _M_bytes[sizeof(const char*)]; + }; + + __cow_string(); + __cow_string(const std::string&); + __cow_string(const char*, size_t); + __cow_string(const __cow_string&) _GLIBCXX_NOTHROW; + __cow_string& operator=(const __cow_string&) _GLIBCXX_NOTHROW; + ~__cow_string(); +#if __cplusplus >= 201103L + __cow_string(__cow_string&&) noexcept; + __cow_string& operator=(__cow_string&&) noexcept; +#endif + }; + + typedef basic_string __sso_string; +#else // _GLIBCXX_USE_CXX11_ABI + typedef basic_string __cow_string; + + // Emulates a new SSO string when the old std::string is in use. + struct __sso_string + { + struct __str + { + const char* _M_p; + size_t _M_string_length; + char _M_local_buf[16]; + }; + + union { + __str _M_s; + char _M_bytes[sizeof(__str)]; + }; + + __sso_string() _GLIBCXX_NOTHROW; + __sso_string(const std::string&); + __sso_string(const char*, size_t); + __sso_string(const __sso_string&); + __sso_string& operator=(const __sso_string&); + ~__sso_string(); +#if __cplusplus >= 201103L + __sso_string(__sso_string&&) noexcept; + __sso_string& operator=(__sso_string&&) noexcept; +#endif + }; +#endif // _GLIBCXX_USE_CXX11_ABI +#else // _GLIBCXX_USE_DUAL_ABI + typedef basic_string __sso_string; + typedef basic_string __cow_string; +#endif + + /** + * @addtogroup exceptions + * @{ + */ + + /** Logic errors represent problems in the internal logic of a program; + * in theory, these are preventable, and even detectable before the + * program runs (e.g., violations of class invariants). + * @brief One of two subclasses of exception. + */ + class logic_error : public exception + { + __cow_string _M_msg; + + public: + /** Takes a character string describing the error. */ + explicit + logic_error(const string& __arg) _GLIBCXX_TXN_SAFE; + +#if __cplusplus >= 201103L + explicit + logic_error(const char*) _GLIBCXX_TXN_SAFE; + + logic_error(logic_error&&) noexcept; + logic_error& operator=(logic_error&&) noexcept; +#endif + +#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS + logic_error(const logic_error&) _GLIBCXX_NOTHROW; + logic_error& operator=(const logic_error&) _GLIBCXX_NOTHROW; +#elif __cplusplus >= 201103L + logic_error(const logic_error&) = default; + logic_error& operator=(const logic_error&) = default; +#endif + + virtual ~logic_error() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW; + + /** Returns a C-style character string describing the general cause of + * the current error (the same string passed to the ctor). */ + virtual const char* + what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW; + +# ifdef _GLIBCXX_TM_TS_INTERNAL + friend void* + ::_txnal_logic_error_get_msg(void* e); +# endif + }; + + /** Thrown by the library, or by you, to report domain errors (domain in + * the mathematical sense). */ + class domain_error : public logic_error + { + public: + explicit domain_error(const string& __arg) _GLIBCXX_TXN_SAFE; +#if __cplusplus >= 201103L + explicit domain_error(const char*) _GLIBCXX_TXN_SAFE; + domain_error(const domain_error&) = default; + domain_error& operator=(const domain_error&) = default; + domain_error(domain_error&&) = default; + domain_error& operator=(domain_error&&) = default; +#endif + virtual ~domain_error() _GLIBCXX_NOTHROW; + }; + + /** Thrown to report invalid arguments to functions. */ + class invalid_argument : public logic_error + { + public: + explicit invalid_argument(const string& __arg) _GLIBCXX_TXN_SAFE; +#if __cplusplus >= 201103L + explicit invalid_argument(const char*) _GLIBCXX_TXN_SAFE; + invalid_argument(const invalid_argument&) = default; + invalid_argument& operator=(const invalid_argument&) = default; + invalid_argument(invalid_argument&&) = default; + invalid_argument& operator=(invalid_argument&&) = default; +#endif + virtual ~invalid_argument() _GLIBCXX_NOTHROW; + }; + + /** Thrown when an object is constructed that would exceed its maximum + * permitted size (e.g., a basic_string instance). */ + class length_error : public logic_error + { + public: + explicit length_error(const string& __arg) _GLIBCXX_TXN_SAFE; +#if __cplusplus >= 201103L + explicit length_error(const char*) _GLIBCXX_TXN_SAFE; + length_error(const length_error&) = default; + length_error& operator=(const length_error&) = default; + length_error(length_error&&) = default; + length_error& operator=(length_error&&) = default; +#endif + virtual ~length_error() _GLIBCXX_NOTHROW; + }; + + /** This represents an argument whose value is not within the expected + * range (e.g., boundary checks in basic_string). */ + class out_of_range : public logic_error + { + public: + explicit out_of_range(const string& __arg) _GLIBCXX_TXN_SAFE; +#if __cplusplus >= 201103L + explicit out_of_range(const char*) _GLIBCXX_TXN_SAFE; + out_of_range(const out_of_range&) = default; + out_of_range& operator=(const out_of_range&) = default; + out_of_range(out_of_range&&) = default; + out_of_range& operator=(out_of_range&&) = default; +#endif + virtual ~out_of_range() _GLIBCXX_NOTHROW; + }; + + /** Runtime errors represent problems outside the scope of a program; + * they cannot be easily predicted and can generally only be caught as + * the program executes. + * @brief One of two subclasses of exception. + */ + class runtime_error : public exception + { + __cow_string _M_msg; + + public: + /** Takes a character string describing the error. */ + explicit + runtime_error(const string& __arg) _GLIBCXX_TXN_SAFE; + +#if __cplusplus >= 201103L + explicit + runtime_error(const char*) _GLIBCXX_TXN_SAFE; + + runtime_error(runtime_error&&) noexcept; + runtime_error& operator=(runtime_error&&) noexcept; +#endif + +#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS + runtime_error(const runtime_error&) _GLIBCXX_NOTHROW; + runtime_error& operator=(const runtime_error&) _GLIBCXX_NOTHROW; +#elif __cplusplus >= 201103L + runtime_error(const runtime_error&) = default; + runtime_error& operator=(const runtime_error&) = default; +#endif + + virtual ~runtime_error() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW; + + /** Returns a C-style character string describing the general cause of + * the current error (the same string passed to the ctor). */ + virtual const char* + what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_NOTHROW; + +# ifdef _GLIBCXX_TM_TS_INTERNAL + friend void* + ::_txnal_runtime_error_get_msg(void* e); +# endif + }; + + /** Thrown to indicate range errors in internal computations. */ + class range_error : public runtime_error + { + public: + explicit range_error(const string& __arg) _GLIBCXX_TXN_SAFE; +#if __cplusplus >= 201103L + explicit range_error(const char*) _GLIBCXX_TXN_SAFE; + range_error(const range_error&) = default; + range_error& operator=(const range_error&) = default; + range_error(range_error&&) = default; + range_error& operator=(range_error&&) = default; +#endif + virtual ~range_error() _GLIBCXX_NOTHROW; + }; + + /** Thrown to indicate arithmetic overflow. */ + class overflow_error : public runtime_error + { + public: + explicit overflow_error(const string& __arg) _GLIBCXX_TXN_SAFE; +#if __cplusplus >= 201103L + explicit overflow_error(const char*) _GLIBCXX_TXN_SAFE; + overflow_error(const overflow_error&) = default; + overflow_error& operator=(const overflow_error&) = default; + overflow_error(overflow_error&&) = default; + overflow_error& operator=(overflow_error&&) = default; +#endif + virtual ~overflow_error() _GLIBCXX_NOTHROW; + }; + + /** Thrown to indicate arithmetic underflow. */ + class underflow_error : public runtime_error + { + public: + explicit underflow_error(const string& __arg) _GLIBCXX_TXN_SAFE; +#if __cplusplus >= 201103L + explicit underflow_error(const char*) _GLIBCXX_TXN_SAFE; + underflow_error(const underflow_error&) = default; + underflow_error& operator=(const underflow_error&) = default; + underflow_error(underflow_error&&) = default; + underflow_error& operator=(underflow_error&&) = default; +#endif + virtual ~underflow_error() _GLIBCXX_NOTHROW; + }; + + /// @} group exceptions + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _GLIBCXX_STDEXCEPT */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@stdexcept.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@stdexcept.blob new file mode 100644 index 0000000..0bf8671 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@stdexcept.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@streambuf b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@streambuf new file mode 100644 index 0000000..0d0f7a8 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@streambuf @@ -0,0 +1,864 @@ +// Stream buffer classes -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/streambuf + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.5 Stream buffers +// + +#ifndef _GLIBXX_STREAMBUF +#define _GLIBXX_STREAMBUF 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // iostreams + +#include +#include +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#define _IsUnused __attribute__ ((__unused__)) + + template + streamsize + __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*, + basic_streambuf<_CharT, _Traits>*, bool&); + + /** + * @brief The actual work of input and output (interface). + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * + * This is a base class. Derived stream buffers each control a + * pair of character sequences: one for input, and one for output. + * + * Section [27.5.1] of the standard describes the requirements and + * behavior of stream buffer classes. That section (three paragraphs) + * is reproduced here, for simplicity and accuracy. + * + * -# Stream buffers can impose various constraints on the sequences + * they control. Some constraints are: + * - The controlled input sequence can be not readable. + * - The controlled output sequence can be not writable. + * - The controlled sequences can be associated with the contents of + * other representations for character sequences, such as external + * files. + * - The controlled sequences can support operations @e directly to or + * from associated sequences. + * - The controlled sequences can impose limitations on how the + * program can read characters from a sequence, write characters to + * a sequence, put characters back into an input sequence, or alter + * the stream position. + * . + * -# Each sequence is characterized by three pointers which, if non-null, + * all point into the same @c charT array object. The array object + * represents, at any moment, a (sub)sequence of characters from the + * sequence. Operations performed on a sequence alter the values + * stored in these pointers, perform reads and writes directly to or + * from associated sequences, and alter the stream position and + * conversion state as needed to maintain this subsequence relationship. + * The three pointers are: + * - the beginning pointer, or lowest element address in the + * array (called @e xbeg here); + * - the next pointer, or next element address that is a + * current candidate for reading or writing (called @e xnext here); + * - the end pointer, or first element address beyond the + * end of the array (called @e xend here). + * . + * -# The following semantic constraints shall always apply for any set + * of three pointers for a sequence, using the pointer names given + * immediately above: + * - If @e xnext is not a null pointer, then @e xbeg and @e xend shall + * also be non-null pointers into the same @c charT array, as + * described above; otherwise, @e xbeg and @e xend shall also be null. + * - If @e xnext is not a null pointer and @e xnext < @e xend for an + * output sequence, then a write position is available. + * In this case, @e *xnext shall be assignable as the next element + * to write (to put, or to store a character value, into the sequence). + * - If @e xnext is not a null pointer and @e xbeg < @e xnext for an + * input sequence, then a putback position is available. + * In this case, @e xnext[-1] shall have a defined value and is the + * next (preceding) element to store a character that is put back + * into the input sequence. + * - If @e xnext is not a null pointer and @e xnext< @e xend for an + * input sequence, then a read position is available. + * In this case, @e *xnext shall have a defined value and is the + * next element to read (to get, or to obtain a character value, + * from the sequence). + */ + template + class basic_streambuf + { + public: + ///@{ + /** + * These are standard types. They permit a standardized way of + * referring to names of (or names dependent on) the template + * parameters, which are specific to the implementation. + */ + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + ///@} + + ///@{ + /// This is a non-standard type. + typedef basic_streambuf __streambuf_type; + ///@} + + friend class basic_ios; + friend class basic_istream; + friend class basic_ostream; + friend class istreambuf_iterator; + friend class ostreambuf_iterator; + + friend streamsize + __copy_streambufs_eof<>(basic_streambuf*, basic_streambuf*, bool&); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + _CharT2*>::__type + __copy_move_a2(istreambuf_iterator<_CharT2>, + istreambuf_iterator<_CharT2>, _CharT2*); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + istreambuf_iterator<_CharT2> >::__type + find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, + const _CharT2&); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + void>::__type + advance(istreambuf_iterator<_CharT2>&, _Distance); + + friend void __istream_extract(istream&, char*, streamsize); + + template + friend basic_istream<_CharT2, _Traits2>& + operator>>(basic_istream<_CharT2, _Traits2>&, + basic_string<_CharT2, _Traits2, _Alloc>&); + + template + friend basic_istream<_CharT2, _Traits2>& + getline(basic_istream<_CharT2, _Traits2>&, + basic_string<_CharT2, _Traits2, _Alloc>&, _CharT2); + + protected: + /* + * This is based on _IO_FILE, just reordered to be more consistent, + * and is intended to be the most minimal abstraction for an + * internal buffer. + * - get == input == read + * - put == output == write + */ + char_type* _M_in_beg; ///< Start of get area. + char_type* _M_in_cur; ///< Current read area. + char_type* _M_in_end; ///< End of get area. + char_type* _M_out_beg; ///< Start of put area. + char_type* _M_out_cur; ///< Current put area. + char_type* _M_out_end; ///< End of put area. + + /// Current locale setting. + locale _M_buf_locale; + + public: + /// Destructor deallocates no buffer space. + virtual + ~basic_streambuf() + { } + + // [27.5.2.2.1] locales + /** + * @brief Entry point for imbue(). + * @param __loc The new locale. + * @return The previous locale. + * + * Calls the derived imbue(__loc). + */ + locale + pubimbue(const locale& __loc) + { + locale __tmp(this->getloc()); + this->imbue(__loc); + _M_buf_locale = __loc; + return __tmp; + } + + /** + * @brief Locale access. + * @return The current locale in effect. + * + * If pubimbue(loc) has been called, then the most recent @c loc + * is returned. Otherwise the global locale in effect at the time + * of construction is returned. + */ + locale + getloc() const + { return _M_buf_locale; } + + // [27.5.2.2.2] buffer management and positioning + ///@{ + /** + * @brief Entry points for derived buffer functions. + * + * The public versions of @c pubfoo dispatch to the protected + * derived @c foo member functions, passing the arguments (if any) + * and returning the result unchanged. + */ + basic_streambuf* + pubsetbuf(char_type* __s, streamsize __n) + { return this->setbuf(__s, __n); } + + /** + * @brief Alters the stream position. + * @param __off Offset. + * @param __way Value for ios_base::seekdir. + * @param __mode Value for ios_base::openmode. + * + * Calls virtual seekoff function. + */ + pos_type + pubseekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __mode = ios_base::in | ios_base::out) + { return this->seekoff(__off, __way, __mode); } + + /** + * @brief Alters the stream position. + * @param __sp Position + * @param __mode Value for ios_base::openmode. + * + * Calls virtual seekpos function. + */ + pos_type + pubseekpos(pos_type __sp, + ios_base::openmode __mode = ios_base::in | ios_base::out) + { return this->seekpos(__sp, __mode); } + + /** + * @brief Calls virtual sync function. + */ + int + pubsync() { return this->sync(); } + ///@} + + // [27.5.2.2.3] get area + /** + * @brief Looking ahead into the stream. + * @return The number of characters available. + * + * If a read position is available, returns the number of characters + * available for reading before the buffer must be refilled. + * Otherwise returns the derived @c showmanyc(). + */ + streamsize + in_avail() + { + const streamsize __ret = this->egptr() - this->gptr(); + return __ret ? __ret : this->showmanyc(); + } + + /** + * @brief Getting the next character. + * @return The next character, or eof. + * + * Calls @c sbumpc(), and if that function returns + * @c traits::eof(), so does this function. Otherwise, @c sgetc(). + */ + int_type + snextc() + { + int_type __ret = traits_type::eof(); + if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(), + __ret), true)) + __ret = this->sgetc(); + return __ret; + } + + /** + * @brief Getting the next character. + * @return The next character, or eof. + * + * If the input read position is available, returns that character + * and increments the read pointer, otherwise calls and returns + * @c uflow(). + */ + int_type + sbumpc() + { + int_type __ret; + if (__builtin_expect(this->gptr() < this->egptr(), true)) + { + __ret = traits_type::to_int_type(*this->gptr()); + this->gbump(1); + } + else + __ret = this->uflow(); + return __ret; + } + + /** + * @brief Getting the next character. + * @return The next character, or eof. + * + * If the input read position is available, returns that character, + * otherwise calls and returns @c underflow(). Does not move the + * read position after fetching the character. + */ + int_type + sgetc() + { + int_type __ret; + if (__builtin_expect(this->gptr() < this->egptr(), true)) + __ret = traits_type::to_int_type(*this->gptr()); + else + __ret = this->underflow(); + return __ret; + } + + /** + * @brief Entry point for xsgetn. + * @param __s A buffer area. + * @param __n A count. + * + * Returns xsgetn(__s,__n). The effect is to fill @a __s[0] through + * @a __s[__n-1] with characters from the input sequence, if possible. + */ + streamsize + sgetn(char_type* __s, streamsize __n) + { return this->xsgetn(__s, __n); } + + // [27.5.2.2.4] putback + /** + * @brief Pushing characters back into the input stream. + * @param __c The character to push back. + * @return The previous character, if possible. + * + * Similar to sungetc(), but @a __c is pushed onto the stream + * instead of the previous character. If successful, + * the next character fetched from the input stream will be @a + * __c. + */ + int_type + sputbackc(char_type __c) + { + int_type __ret; + const bool __testpos = this->eback() < this->gptr(); + if (__builtin_expect(!__testpos || + !traits_type::eq(__c, this->gptr()[-1]), false)) + __ret = this->pbackfail(traits_type::to_int_type(__c)); + else + { + this->gbump(-1); + __ret = traits_type::to_int_type(*this->gptr()); + } + return __ret; + } + + /** + * @brief Moving backwards in the input stream. + * @return The previous character, if possible. + * + * If a putback position is available, this function decrements + * the input pointer and returns that character. Otherwise, + * calls and returns pbackfail(). The effect is to @a unget + * the last character @a gotten. + */ + int_type + sungetc() + { + int_type __ret; + if (__builtin_expect(this->eback() < this->gptr(), true)) + { + this->gbump(-1); + __ret = traits_type::to_int_type(*this->gptr()); + } + else + __ret = this->pbackfail(); + return __ret; + } + + // [27.5.2.2.5] put area + /** + * @brief Entry point for all single-character output functions. + * @param __c A character to output. + * @return @a __c, if possible. + * + * One of two public output functions. + * + * If a write position is available for the output sequence (i.e., + * the buffer is not full), stores @a __c in that position, increments + * the position, and returns @c traits::to_int_type(__c). If a write + * position is not available, returns @c overflow(__c). + */ + int_type + sputc(char_type __c) + { + int_type __ret; + if (__builtin_expect(this->pptr() < this->epptr(), true)) + { + *this->pptr() = __c; + this->pbump(1); + __ret = traits_type::to_int_type(__c); + } + else + __ret = this->overflow(traits_type::to_int_type(__c)); + return __ret; + } + + /** + * @brief Entry point for all single-character output functions. + * @param __s A buffer read area. + * @param __n A count. + * + * One of two public output functions. + * + * + * Returns xsputn(__s,__n). The effect is to write @a __s[0] through + * @a __s[__n-1] to the output sequence, if possible. + */ + streamsize + sputn(const char_type* __s, streamsize __n) + { return this->xsputn(__s, __n); } + + protected: + /** + * @brief Base constructor. + * + * Only called from derived constructors, and sets up all the + * buffer data to zero, including the pointers described in the + * basic_streambuf class description. Note that, as a result, + * - the class starts with no read nor write positions available, + * - this is not an error + */ + basic_streambuf() + : _M_in_beg(0), _M_in_cur(0), _M_in_end(0), + _M_out_beg(0), _M_out_cur(0), _M_out_end(0), + _M_buf_locale(locale()) + { } + + // [27.5.2.3.1] get area access + ///@{ + /** + * @brief Access to the get area. + * + * These functions are only available to other protected functions, + * including derived classes. + * + * - eback() returns the beginning pointer for the input sequence + * - gptr() returns the next pointer for the input sequence + * - egptr() returns the end pointer for the input sequence + */ + char_type* + eback() const { return _M_in_beg; } + + char_type* + gptr() const { return _M_in_cur; } + + char_type* + egptr() const { return _M_in_end; } + ///@} + + /** + * @brief Moving the read position. + * @param __n The delta by which to move. + * + * This just advances the read position without returning any data. + */ + void + gbump(int __n) { _M_in_cur += __n; } + + /** + * @brief Setting the three read area pointers. + * @param __gbeg A pointer. + * @param __gnext A pointer. + * @param __gend A pointer. + * @post @a __gbeg == @c eback(), @a __gnext == @c gptr(), and + * @a __gend == @c egptr() + */ + void + setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) + { + _M_in_beg = __gbeg; + _M_in_cur = __gnext; + _M_in_end = __gend; + } + + // [27.5.2.3.2] put area access + ///@{ + /** + * @brief Access to the put area. + * + * These functions are only available to other protected functions, + * including derived classes. + * + * - pbase() returns the beginning pointer for the output sequence + * - pptr() returns the next pointer for the output sequence + * - epptr() returns the end pointer for the output sequence + */ + char_type* + pbase() const { return _M_out_beg; } + + char_type* + pptr() const { return _M_out_cur; } + + char_type* + epptr() const { return _M_out_end; } + ///@} + + /** + * @brief Moving the write position. + * @param __n The delta by which to move. + * + * This just advances the write position without returning any data. + */ + void + pbump(int __n) { _M_out_cur += __n; } + + /** + * @brief Setting the three write area pointers. + * @param __pbeg A pointer. + * @param __pend A pointer. + * @post @a __pbeg == @c pbase(), @a __pbeg == @c pptr(), and + * @a __pend == @c epptr() + */ + void + setp(char_type* __pbeg, char_type* __pend) + { + _M_out_beg = _M_out_cur = __pbeg; + _M_out_end = __pend; + } + + // [27.5.2.4] virtual functions + // [27.5.2.4.1] locales + /** + * @brief Changes translations. + * @param __loc A new locale. + * + * Translations done during I/O which depend on the current + * locale are changed by this call. The standard adds, + * Between invocations of this function a class derived + * from streambuf can safely cache results of calls to locale + * functions and to members of facets so obtained. + * + * @note Base class version does nothing. + */ + virtual void + imbue(const locale& __loc _IsUnused) + { } + + // [27.5.2.4.2] buffer management and positioning + /** + * @brief Manipulates the buffer. + * + * Each derived class provides its own appropriate behavior. See + * the next-to-last paragraph of + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html#io.streambuf.buffering + * for more on this function. + * + * @note Base class version does nothing, returns @c this. + */ + virtual basic_streambuf* + setbuf(char_type*, streamsize) + { return this; } + + /** + * @brief Alters the stream positions. + * + * Each derived class provides its own appropriate behavior. + * @note Base class version does nothing, returns a @c pos_type + * that represents an invalid stream position. + */ + virtual pos_type + seekoff(off_type, ios_base::seekdir, + ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out) + { return pos_type(off_type(-1)); } + + /** + * @brief Alters the stream positions. + * + * Each derived class provides its own appropriate behavior. + * @note Base class version does nothing, returns a @c pos_type + * that represents an invalid stream position. + */ + virtual pos_type + seekpos(pos_type, + ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out) + { return pos_type(off_type(-1)); } + + /** + * @brief Synchronizes the buffer arrays with the controlled sequences. + * @return -1 on failure. + * + * Each derived class provides its own appropriate behavior, + * including the definition of @a failure. + * @note Base class version does nothing, returns zero. + */ + virtual int + sync() { return 0; } + + // [27.5.2.4.3] get area + /** + * @brief Investigating the data available. + * @return An estimate of the number of characters available in the + * input sequence, or -1. + * + * If it returns a positive value, then successive calls to + * @c underflow() will not return @c traits::eof() until at + * least that number of characters have been supplied. If @c + * showmanyc() returns -1, then calls to @c underflow() or @c + * uflow() will fail. [27.5.2.4.3]/1 + * + * @note Base class version does nothing, returns zero. + * @note The standard adds that the intention is not only that the + * calls [to underflow or uflow] will not return @c eof() but + * that they will return immediately. + * @note The standard adds that the morphemes of @c showmanyc are + * @b es-how-many-see, not @b show-manic. + */ + virtual streamsize + showmanyc() { return 0; } + + /** + * @brief Multiple character extraction. + * @param __s A buffer area. + * @param __n Maximum number of characters to assign. + * @return The number of characters assigned. + * + * Fills @a __s[0] through @a __s[__n-1] with characters from the input + * sequence, as if by @c sbumpc(). Stops when either @a __n characters + * have been copied, or when @c traits::eof() would be copied. + * + * It is expected that derived classes provide a more efficient + * implementation by overriding this definition. + */ + virtual streamsize + xsgetn(char_type* __s, streamsize __n); + + /** + * @brief Fetches more data from the controlled sequence. + * @return The first character from the pending sequence. + * + * Informally, this function is called when the input buffer is + * exhausted (or does not exist, as buffering need not actually be + * done). If a buffer exists, it is @a refilled. In either case, the + * next available character is returned, or @c traits::eof() to + * indicate a null pending sequence. + * + * For a formal definition of the pending sequence, see a good text + * such as Langer & Kreft, or [27.5.2.4.3]/7-14. + * + * A functioning input streambuf can be created by overriding only + * this function (no buffer area will be used). For an example, see + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/streambufs.html + * + * @note Base class version does nothing, returns eof(). + */ + virtual int_type + underflow() + { return traits_type::eof(); } + + /** + * @brief Fetches more data from the controlled sequence. + * @return The first character from the pending sequence. + * + * Informally, this function does the same thing as @c underflow(), + * and in fact is required to call that function. It also returns + * the new character, like @c underflow() does. However, this + * function also moves the read position forward by one. + */ + virtual int_type + uflow() + { + int_type __ret = traits_type::eof(); + const bool __testeof = traits_type::eq_int_type(this->underflow(), + __ret); + if (!__testeof) + { + __ret = traits_type::to_int_type(*this->gptr()); + this->gbump(1); + } + return __ret; + } + + // [27.5.2.4.4] putback + /** + * @brief Tries to back up the input sequence. + * @param __c The character to be inserted back into the sequence. + * @return eof() on failure, some other value on success + * @post The constraints of @c gptr(), @c eback(), and @c pptr() + * are the same as for @c underflow(). + * + * @note Base class version does nothing, returns eof(). + */ + virtual int_type + pbackfail(int_type __c _IsUnused = traits_type::eof()) + { return traits_type::eof(); } + + // Put area: + /** + * @brief Multiple character insertion. + * @param __s A buffer area. + * @param __n Maximum number of characters to write. + * @return The number of characters written. + * + * Writes @a __s[0] through @a __s[__n-1] to the output sequence, as if + * by @c sputc(). Stops when either @a n characters have been + * copied, or when @c sputc() would return @c traits::eof(). + * + * It is expected that derived classes provide a more efficient + * implementation by overriding this definition. + */ + virtual streamsize + xsputn(const char_type* __s, streamsize __n); + + /** + * @brief Consumes data from the buffer; writes to the + * controlled sequence. + * @param __c An additional character to consume. + * @return eof() to indicate failure, something else (usually + * @a __c, or not_eof()) + * + * Informally, this function is called when the output buffer + * is full (or does not exist, as buffering need not actually + * be done). If a buffer exists, it is @a consumed, with + * some effect on the controlled sequence. + * (Typically, the buffer is written out to the sequence + * verbatim.) In either case, the character @a c is also + * written out, if @a __c is not @c eof(). + * + * For a formal definition of this function, see a good text + * such as Langer & Kreft, or [27.5.2.4.5]/3-7. + * + * A functioning output streambuf can be created by overriding only + * this function (no buffer area will be used). + * + * @note Base class version does nothing, returns eof(). + */ + virtual int_type + overflow(int_type __c _IsUnused = traits_type::eof()) + { return traits_type::eof(); } + +#if _GLIBCXX_USE_DEPRECATED && __cplusplus <= 201402L + // Annex D.6 (removed in C++17) + public: + /** + * @brief Tosses a character. + * + * Advances the read pointer, ignoring the character that would have + * been read. + * + * See http://gcc.gnu.org/ml/libstdc++/2002-05/msg00168.html + */ + _GLIBCXX_DEPRECATED_SUGGEST("std::basic_streambuf::sbumpc") + void + stossc() + { + if (this->gptr() < this->egptr()) + this->gbump(1); + else + this->uflow(); + } +#endif + + // Also used by specializations for char and wchar_t in src. + void + __safe_gbump(streamsize __n) { _M_in_cur += __n; } + + void + __safe_pbump(streamsize __n) { _M_out_cur += __n; } + +#if __cplusplus < 201103L + private: +#else + protected: +#endif + basic_streambuf(const basic_streambuf&); + + basic_streambuf& + operator=(const basic_streambuf&); + +#if __cplusplus >= 201103L + void + swap(basic_streambuf& __sb) + { + std::swap(_M_in_beg, __sb._M_in_beg); + std::swap(_M_in_cur, __sb._M_in_cur); + std::swap(_M_in_end, __sb._M_in_end); + std::swap(_M_out_beg, __sb._M_out_beg); + std::swap(_M_out_cur, __sb._M_out_cur); + std::swap(_M_out_end, __sb._M_out_end); + std::swap(_M_buf_locale, __sb._M_buf_locale); + } +#endif + }; + +#if __cplusplus >= 201103L + template + std::basic_streambuf<_CharT, _Traits>:: + basic_streambuf(const basic_streambuf&) = default; + + template + std::basic_streambuf<_CharT, _Traits>& + std::basic_streambuf<_CharT, _Traits>:: + operator=(const basic_streambuf&) = default; +#endif + + // Explicit specialization declarations, defined in src/streambuf.cc. + template<> + streamsize + __copy_streambufs_eof(basic_streambuf* __sbin, + basic_streambuf* __sbout, bool& __ineof); +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + streamsize + __copy_streambufs_eof(basic_streambuf* __sbin, + basic_streambuf* __sbout, bool& __ineof); +#endif + +#undef _IsUnused + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#include + +#endif /* _GLIBCXX_STREAMBUF */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@streambuf.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@streambuf.blob new file mode 100644 index 0000000..87dd9fa Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@streambuf.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string new file mode 100644 index 0000000..7186471 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string @@ -0,0 +1,130 @@ +// Components for manipulating sequences of characters -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/string + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 21 Strings library +// + +#ifndef _GLIBCXX_STRING +#define _GLIBCXX_STRING 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // containers + +#include +#include +#include +#include +#include +#include // For operators >>, <<, and getline. +#include +#include +#include +#include // For less +#include +#include +#include +#include +#include +#include + +#define __glibcxx_want_algorithm_default_value_type +#define __glibcxx_want_allocator_traits_is_always_equal +#define __glibcxx_want_constexpr_char_traits +#define __glibcxx_want_constexpr_string +#define __glibcxx_want_containers_ranges +#define __glibcxx_want_erase_if +#define __glibcxx_want_nonmember_container_access +#define __glibcxx_want_string_resize_and_overwrite +#define __glibcxx_want_string_udls +#define __glibcxx_want_to_string +#include + +#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI +#include +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr { + template> + using basic_string = std::basic_string<_CharT, _Traits, + polymorphic_allocator<_CharT>>; + using string = basic_string; +#ifdef _GLIBCXX_USE_CHAR8_T + using u8string = basic_string; +#endif + using u16string = basic_string; + using u32string = basic_string; + using wstring = basic_string; + } // namespace pmr +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 + +#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + _GLIBCXX20_CONSTEXPR + inline typename basic_string<_CharT, _Traits, _Alloc>::size_type + erase_if(basic_string<_CharT, _Traits, _Alloc>& __cont, _Predicate __pred) + { + using namespace __gnu_cxx; + const auto __osz = __cont.size(); + const auto __end = __cont.end(); + auto __removed = std::__remove_if(__cont.begin(), __end, + __ops::__pred_iter(std::ref(__pred))); + __cont.erase(__removed, __end); + return __osz - __cont.size(); + } + + template + _GLIBCXX20_CONSTEXPR + inline typename basic_string<_CharT, _Traits, _Alloc>::size_type + erase(basic_string<_CharT, _Traits, _Alloc>& __cont, const _Up& __value) + { + using namespace __gnu_cxx; + const auto __osz = __cont.size(); + const auto __end = __cont.end(); + auto __removed = std::__remove_if(__cont.begin(), __end, + __ops::__iter_equals_val(__value)); + __cont.erase(__removed, __end); + return __osz - __cont.size(); + } +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // __cpp_lib_erase_if + +#endif /* _GLIBCXX_STRING */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string.blob new file mode 100644 index 0000000..09628a5 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string_view b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string_view new file mode 100644 index 0000000..842f6ad --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string_view @@ -0,0 +1,915 @@ +// Components for manipulating non-owning sequences of characters -*- C++ -*- + +// Copyright (C) 2013-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/string_view + * This is a Standard C++ Library header. + */ + +// +// N3762 basic_string_view library +// + +#ifndef _GLIBCXX_STRING_VIEW +#define _GLIBCXX_STRING_VIEW 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#define __glibcxx_want_constexpr_char_traits +#define __glibcxx_want_constexpr_string_view +#define __glibcxx_want_freestanding_string_view +#define __glibcxx_want_string_view +#define __glibcxx_want_starts_ends_with +#define __glibcxx_want_string_contains +#include + +#if __cplusplus >= 201703L + +#include +#include +#include +#include +#include +#include + +#if __cplusplus >= 202002L +# include +#endif + +#if _GLIBCXX_HOSTED +# include +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Helper for basic_string and basic_string_view members. + constexpr size_t + __sv_check(size_t __size, size_t __pos, const char* __s) + { + if (__pos > __size) + __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > __size " + "(which is %zu)"), __s, __pos, __size); + return __pos; + } + + // Helper for basic_string members. + // NB: __sv_limit doesn't check for a bad __pos value. + constexpr size_t + __sv_limit(size_t __size, size_t __pos, size_t __off) noexcept + { + const bool __testoff = __off < __size - __pos; + return __testoff ? __off : __size - __pos; + } + + /** + * @class basic_string_view + * @brief A non-owning reference to a string. + * + * @ingroup strings + * @ingroup sequences + * + * @tparam _CharT Type of character + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * + * A basic_string_view looks like this: + * + * @code + * _CharT* _M_str + * size_t _M_len + * @endcode + */ + template> + class basic_string_view + { + static_assert(!is_array_v<_CharT>); + static_assert(is_trivially_copyable_v<_CharT> + && is_trivially_default_constructible_v<_CharT> + && is_standard_layout_v<_CharT>); + static_assert(is_same_v<_CharT, typename _Traits::char_type>); + + public: + + // types + using traits_type = _Traits; + using value_type = _CharT; + using pointer = value_type*; + using const_pointer = const value_type*; + using reference = value_type&; + using const_reference = const value_type&; + using const_iterator = const value_type*; + using iterator = const_iterator; + using const_reverse_iterator = std::reverse_iterator; + using reverse_iterator = const_reverse_iterator; + using size_type = size_t; + using difference_type = ptrdiff_t; + static constexpr size_type npos = size_type(-1); + + // [string.view.cons], construction and assignment + + constexpr + basic_string_view() noexcept + : _M_len{0}, _M_str{nullptr} + { } + + constexpr basic_string_view(const basic_string_view&) noexcept = default; + + [[__gnu__::__nonnull__]] + constexpr + basic_string_view(const _CharT* __str) noexcept + : _M_len{traits_type::length(__str)}, + _M_str{__str} + { } + + constexpr + basic_string_view(const _CharT* __str, size_type __len) noexcept + : _M_len{__len}, _M_str{__str} + { } + +#if __cplusplus >= 202002L && __cpp_lib_concepts + template _End> + requires same_as, _CharT> + && (!convertible_to<_End, size_type>) + constexpr + basic_string_view(_It __first, _End __last) + noexcept(noexcept(__last - __first)) + : _M_len(__last - __first), _M_str(std::to_address(__first)) + { } + +#if __cplusplus > 202002L + template> + requires (!is_same_v<_DRange, basic_string_view>) + && ranges::contiguous_range<_Range> + && ranges::sized_range<_Range> + && is_same_v, _CharT> + && (!is_convertible_v<_Range, const _CharT*>) + && (!requires (_DRange& __d) { + __d.operator ::std::basic_string_view<_CharT, _Traits>(); + }) + constexpr explicit + basic_string_view(_Range&& __r) + noexcept(noexcept(ranges::size(__r)) && noexcept(ranges::data(__r))) + : _M_len(ranges::size(__r)), _M_str(ranges::data(__r)) + { } + + basic_string_view(nullptr_t) = delete; +#endif // C++23 +#endif // C++20 + + constexpr basic_string_view& + operator=(const basic_string_view&) noexcept = default; + + // [string.view.iterators], iterator support + + [[nodiscard]] + constexpr const_iterator + begin() const noexcept + { return this->_M_str; } + + [[nodiscard]] + constexpr const_iterator + end() const noexcept + { return this->_M_str + this->_M_len; } + + [[nodiscard]] + constexpr const_iterator + cbegin() const noexcept + { return this->_M_str; } + + [[nodiscard]] + constexpr const_iterator + cend() const noexcept + { return this->_M_str + this->_M_len; } + + [[nodiscard]] + constexpr const_reverse_iterator + rbegin() const noexcept + { return const_reverse_iterator(this->end()); } + + [[nodiscard]] + constexpr const_reverse_iterator + rend() const noexcept + { return const_reverse_iterator(this->begin()); } + + [[nodiscard]] + constexpr const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(this->end()); } + + [[nodiscard]] + constexpr const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(this->begin()); } + + // [string.view.capacity], capacity + + [[nodiscard]] + constexpr size_type + size() const noexcept + { return this->_M_len; } + + [[nodiscard]] + constexpr size_type + length() const noexcept + { return _M_len; } + + [[nodiscard]] + constexpr size_type + max_size() const noexcept + { + return (npos - sizeof(size_type) - sizeof(void*)) + / sizeof(value_type) / 4; + } + + [[nodiscard]] + constexpr bool + empty() const noexcept + { return this->_M_len == 0; } + + // [string.view.access], element access + + [[nodiscard]] + constexpr const_reference + operator[](size_type __pos) const noexcept + { + __glibcxx_assert(__pos < this->_M_len); + return *(this->_M_str + __pos); + } + + [[nodiscard]] + constexpr const_reference + at(size_type __pos) const + { + if (__pos >= _M_len) + __throw_out_of_range_fmt(__N("basic_string_view::at: __pos " + "(which is %zu) >= this->size() " + "(which is %zu)"), __pos, this->size()); + return *(this->_M_str + __pos); + } + + [[nodiscard]] + constexpr const_reference + front() const noexcept + { + __glibcxx_assert(this->_M_len > 0); + return *this->_M_str; + } + + [[nodiscard]] + constexpr const_reference + back() const noexcept + { + __glibcxx_assert(this->_M_len > 0); + return *(this->_M_str + this->_M_len - 1); + } + + [[nodiscard]] + constexpr const_pointer + data() const noexcept + { return this->_M_str; } + + // [string.view.modifiers], modifiers: + + constexpr void + remove_prefix(size_type __n) noexcept + { + __glibcxx_assert(this->_M_len >= __n); + this->_M_str += __n; + this->_M_len -= __n; + } + + constexpr void + remove_suffix(size_type __n) noexcept + { + __glibcxx_assert(this->_M_len >= __n); + this->_M_len -= __n; + } + + constexpr void + swap(basic_string_view& __sv) noexcept + { + auto __tmp = *this; + *this = __sv; + __sv = __tmp; + } + + // [string.view.ops], string operations: + + _GLIBCXX20_CONSTEXPR + size_type + copy(_CharT* __str, size_type __n, size_type __pos = 0) const + { + __glibcxx_requires_string_len(__str, __n); + __pos = std::__sv_check(size(), __pos, "basic_string_view::copy"); + const size_type __rlen = std::min(__n, _M_len - __pos); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2777. basic_string_view::copy should use char_traits::copy + traits_type::copy(__str, data() + __pos, __rlen); + return __rlen; + } + + [[nodiscard]] + constexpr basic_string_view + substr(size_type __pos = 0, size_type __n = npos) const noexcept(false) + { + __pos = std::__sv_check(size(), __pos, "basic_string_view::substr"); + const size_type __rlen = std::min(__n, _M_len - __pos); + return basic_string_view{_M_str + __pos, __rlen}; + } + + [[nodiscard]] + constexpr int + compare(basic_string_view __str) const noexcept + { + const size_type __rlen = std::min(this->_M_len, __str._M_len); + int __ret = traits_type::compare(this->_M_str, __str._M_str, __rlen); + if (__ret == 0) + __ret = _S_compare(this->_M_len, __str._M_len); + return __ret; + } + + [[nodiscard]] + constexpr int + compare(size_type __pos1, size_type __n1, basic_string_view __str) const + { return this->substr(__pos1, __n1).compare(__str); } + + [[nodiscard]] + constexpr int + compare(size_type __pos1, size_type __n1, + basic_string_view __str, size_type __pos2, size_type __n2) const + { + return this->substr(__pos1, __n1).compare(__str.substr(__pos2, __n2)); + } + + [[nodiscard, __gnu__::__nonnull__]] + constexpr int + compare(const _CharT* __str) const noexcept + { return this->compare(basic_string_view{__str}); } + + [[nodiscard, __gnu__::__nonnull__]] + constexpr int + compare(size_type __pos1, size_type __n1, const _CharT* __str) const + { return this->substr(__pos1, __n1).compare(basic_string_view{__str}); } + + [[nodiscard]] + constexpr int + compare(size_type __pos1, size_type __n1, + const _CharT* __str, size_type __n2) const noexcept(false) + { + return this->substr(__pos1, __n1) + .compare(basic_string_view(__str, __n2)); + } + +#ifdef __cpp_lib_starts_ends_with // C++ >= 20 + [[nodiscard]] + constexpr bool + starts_with(basic_string_view __x) const noexcept + { + return _M_len >= __x._M_len + && traits_type::compare(_M_str, __x._M_str, __x._M_len) == 0; + } + + [[nodiscard]] + constexpr bool + starts_with(_CharT __x) const noexcept + { return !this->empty() && traits_type::eq(this->front(), __x); } + + [[nodiscard, __gnu__::__nonnull__]] + constexpr bool + starts_with(const _CharT* __x) const noexcept + { return this->starts_with(basic_string_view(__x)); } + + [[nodiscard]] + constexpr bool + ends_with(basic_string_view __x) const noexcept + { + const auto __len = this->size(); + const auto __xlen = __x.size(); + return __len >= __xlen + && traits_type::compare(end() - __xlen, __x.data(), __xlen) == 0; + } + + [[nodiscard]] + constexpr bool + ends_with(_CharT __x) const noexcept + { return !this->empty() && traits_type::eq(this->back(), __x); } + + [[nodiscard, __gnu__::__nonnull__]] + constexpr bool + ends_with(const _CharT* __x) const noexcept + { return this->ends_with(basic_string_view(__x)); } +#endif // __cpp_lib_starts_ends_with + +#if __cplusplus > 202002L +#if _GLIBCXX_HOSTED && !defined(__cpp_lib_string_contains) + // This FTM is not freestanding as it also implies matching + // support, and is omitted from the freestanding subset. +# error "libstdc++ bug: string_contains not defined when it should be" +#endif // HOSTED + [[nodiscard]] + constexpr bool + contains(basic_string_view __x) const noexcept + { return this->find(__x) != npos; } + + [[nodiscard]] + constexpr bool + contains(_CharT __x) const noexcept + { return this->find(__x) != npos; } + + [[nodiscard, __gnu__::__nonnull__]] + constexpr bool + contains(const _CharT* __x) const noexcept + { return this->find(__x) != npos; } +#endif // C++23 + + // [string.view.find], searching + + [[nodiscard]] + constexpr size_type + find(basic_string_view __str, size_type __pos = 0) const noexcept + { return this->find(__str._M_str, __pos, __str._M_len); } + + [[nodiscard]] + constexpr size_type + find(_CharT __c, size_type __pos = 0) const noexcept; + + [[nodiscard]] + constexpr size_type + find(const _CharT* __str, size_type __pos, size_type __n) const noexcept; + + [[nodiscard, __gnu__::__nonnull__]] + constexpr size_type + find(const _CharT* __str, size_type __pos = 0) const noexcept + { return this->find(__str, __pos, traits_type::length(__str)); } + + [[nodiscard]] + constexpr size_type + rfind(basic_string_view __str, size_type __pos = npos) const noexcept + { return this->rfind(__str._M_str, __pos, __str._M_len); } + + [[nodiscard]] + constexpr size_type + rfind(_CharT __c, size_type __pos = npos) const noexcept; + + [[nodiscard]] + constexpr size_type + rfind(const _CharT* __str, size_type __pos, size_type __n) const noexcept; + + [[nodiscard, __gnu__::__nonnull__]] + constexpr size_type + rfind(const _CharT* __str, size_type __pos = npos) const noexcept + { return this->rfind(__str, __pos, traits_type::length(__str)); } + + [[nodiscard]] + constexpr size_type + find_first_of(basic_string_view __str, size_type __pos = 0) const noexcept + { return this->find_first_of(__str._M_str, __pos, __str._M_len); } + + [[nodiscard]] + constexpr size_type + find_first_of(_CharT __c, size_type __pos = 0) const noexcept + { return this->find(__c, __pos); } + + [[nodiscard]] + constexpr size_type + find_first_of(const _CharT* __str, size_type __pos, + size_type __n) const noexcept; + + [[nodiscard, __gnu__::__nonnull__]] + constexpr size_type + find_first_of(const _CharT* __str, size_type __pos = 0) const noexcept + { return this->find_first_of(__str, __pos, traits_type::length(__str)); } + + [[nodiscard]] + constexpr size_type + find_last_of(basic_string_view __str, + size_type __pos = npos) const noexcept + { return this->find_last_of(__str._M_str, __pos, __str._M_len); } + + [[nodiscard]] + constexpr size_type + find_last_of(_CharT __c, size_type __pos=npos) const noexcept + { return this->rfind(__c, __pos); } + + [[nodiscard]] + constexpr size_type + find_last_of(const _CharT* __str, size_type __pos, + size_type __n) const noexcept; + + [[nodiscard, __gnu__::__nonnull__]] + constexpr size_type + find_last_of(const _CharT* __str, size_type __pos = npos) const noexcept + { return this->find_last_of(__str, __pos, traits_type::length(__str)); } + + [[nodiscard]] + constexpr size_type + find_first_not_of(basic_string_view __str, + size_type __pos = 0) const noexcept + { return this->find_first_not_of(__str._M_str, __pos, __str._M_len); } + + [[nodiscard]] + constexpr size_type + find_first_not_of(_CharT __c, size_type __pos = 0) const noexcept; + + [[nodiscard]] + constexpr size_type + find_first_not_of(const _CharT* __str, + size_type __pos, size_type __n) const noexcept; + + [[nodiscard, __gnu__::__nonnull__]] + constexpr size_type + find_first_not_of(const _CharT* __str, size_type __pos = 0) const noexcept + { + return this->find_first_not_of(__str, __pos, + traits_type::length(__str)); + } + + [[nodiscard]] + constexpr size_type + find_last_not_of(basic_string_view __str, + size_type __pos = npos) const noexcept + { return this->find_last_not_of(__str._M_str, __pos, __str._M_len); } + + [[nodiscard]] + constexpr size_type + find_last_not_of(_CharT __c, size_type __pos = npos) const noexcept; + + [[nodiscard]] + constexpr size_type + find_last_not_of(const _CharT* __str, + size_type __pos, size_type __n) const noexcept; + + [[nodiscard, __gnu__::__nonnull__]] + constexpr size_type + find_last_not_of(const _CharT* __str, + size_type __pos = npos) const noexcept + { + return this->find_last_not_of(__str, __pos, + traits_type::length(__str)); + } + + private: + + static constexpr int + _S_compare(size_type __n1, size_type __n2) noexcept + { + using __limits = __gnu_cxx::__int_traits; + const difference_type __diff = __n1 - __n2; + if (__diff > __limits::__max) + return __limits::__max; + if (__diff < __limits::__min) + return __limits::__min; + return static_cast(__diff); + } + + size_t _M_len; + const _CharT* _M_str; + }; + +#if __cplusplus > 201703L && __cpp_lib_concepts && __cpp_deduction_guides + template _End> + basic_string_view(_It, _End) -> basic_string_view>; + +#if __cplusplus > 202002L + template + basic_string_view(_Range&&) + -> basic_string_view>; +#endif +#endif + + // [string.view.comparison], non-member basic_string_view comparison function + + // Several of these functions use type_identity_t to create a non-deduced + // context, so that only one argument participates in template argument + // deduction and the other argument gets implicitly converted to the deduced + // type (see N3766). + +#if __cpp_lib_three_way_comparison + template + [[nodiscard]] + constexpr bool + operator==(basic_string_view<_CharT, _Traits> __x, + type_identity_t> __y) + noexcept + { return __x.size() == __y.size() && __x.compare(__y) == 0; } + + template + [[nodiscard]] + constexpr auto + operator<=>(basic_string_view<_CharT, _Traits> __x, + __type_identity_t> __y) + noexcept + -> decltype(__detail::__char_traits_cmp_cat<_Traits>(0)) + { return __detail::__char_traits_cmp_cat<_Traits>(__x.compare(__y)); } +#else + template + [[nodiscard]] + constexpr bool + operator==(basic_string_view<_CharT, _Traits> __x, + __type_identity_t> __y) + noexcept + { return __x.size() == __y.size() && __x.compare(__y) == 0; } + + template + [[nodiscard]] + constexpr bool + operator==(basic_string_view<_CharT, _Traits> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.size() == __y.size() && __x.compare(__y) == 0; } + + template + [[nodiscard]] + constexpr bool + operator==(__type_identity_t> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.size() == __y.size() && __x.compare(__y) == 0; } + + template + [[nodiscard]] + constexpr bool + operator!=(basic_string_view<_CharT, _Traits> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return !(__x == __y); } + + template + [[nodiscard]] + constexpr bool + operator!=(basic_string_view<_CharT, _Traits> __x, + __type_identity_t> __y) + noexcept + { return !(__x == __y); } + + template + [[nodiscard]] + constexpr bool + operator!=(__type_identity_t> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return !(__x == __y); } + + template + [[nodiscard]] + constexpr bool + operator< (basic_string_view<_CharT, _Traits> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.compare(__y) < 0; } + + template + [[nodiscard]] + constexpr bool + operator< (basic_string_view<_CharT, _Traits> __x, + __type_identity_t> __y) + noexcept + { return __x.compare(__y) < 0; } + + template + [[nodiscard]] + constexpr bool + operator< (__type_identity_t> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.compare(__y) < 0; } + + template + [[nodiscard]] + constexpr bool + operator> (basic_string_view<_CharT, _Traits> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.compare(__y) > 0; } + + template + [[nodiscard]] + constexpr bool + operator> (basic_string_view<_CharT, _Traits> __x, + __type_identity_t> __y) + noexcept + { return __x.compare(__y) > 0; } + + template + [[nodiscard]] + constexpr bool + operator> (__type_identity_t> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.compare(__y) > 0; } + + template + [[nodiscard]] + constexpr bool + operator<=(basic_string_view<_CharT, _Traits> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.compare(__y) <= 0; } + + template + [[nodiscard]] + constexpr bool + operator<=(basic_string_view<_CharT, _Traits> __x, + __type_identity_t> __y) + noexcept + { return __x.compare(__y) <= 0; } + + template + [[nodiscard]] + constexpr bool + operator<=(__type_identity_t> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.compare(__y) <= 0; } + + template + [[nodiscard]] + constexpr bool + operator>=(basic_string_view<_CharT, _Traits> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.compare(__y) >= 0; } + + template + [[nodiscard]] + constexpr bool + operator>=(basic_string_view<_CharT, _Traits> __x, + __type_identity_t> __y) + noexcept + { return __x.compare(__y) >= 0; } + + template + [[nodiscard]] + constexpr bool + operator>=(__type_identity_t> __x, + basic_string_view<_CharT, _Traits> __y) noexcept + { return __x.compare(__y) >= 0; } +#endif // three-way comparison + +#if _GLIBCXX_HOSTED + // [string.view.io], Inserters and extractors + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, + basic_string_view<_CharT,_Traits> __str) + { return __ostream_insert(__os, __str.data(), __str.size()); } +#endif // HOSTED + + // basic_string_view typedef names + + using string_view = basic_string_view; + using wstring_view = basic_string_view; +#ifdef _GLIBCXX_USE_CHAR8_T + using u8string_view = basic_string_view; +#endif + using u16string_view = basic_string_view; + using u32string_view = basic_string_view; + + // [string.view.hash], hash support: + + template + struct hash; + + template<> + struct hash + : public __hash_base + { + [[nodiscard]] + size_t + operator()(const string_view& __str) const noexcept + { return std::_Hash_impl::hash(__str.data(), __str.length()); } + }; + + template<> + struct __is_fast_hash> : std::false_type + { }; + + template<> + struct hash + : public __hash_base + { + [[nodiscard]] + size_t + operator()(const wstring_view& __s) const noexcept + { return std::_Hash_impl::hash(__s.data(), + __s.length() * sizeof(wchar_t)); } + }; + + template<> + struct __is_fast_hash> : std::false_type + { }; + +#ifdef _GLIBCXX_USE_CHAR8_T + template<> + struct hash + : public __hash_base + { + [[nodiscard]] + size_t + operator()(const u8string_view& __str) const noexcept + { return std::_Hash_impl::hash(__str.data(), __str.length()); } + }; + + template<> + struct __is_fast_hash> : std::false_type + { }; +#endif + + template<> + struct hash + : public __hash_base + { + [[nodiscard]] + size_t + operator()(const u16string_view& __s) const noexcept + { return std::_Hash_impl::hash(__s.data(), + __s.length() * sizeof(char16_t)); } + }; + + template<> + struct __is_fast_hash> : std::false_type + { }; + + template<> + struct hash + : public __hash_base + { + [[nodiscard]] + size_t + operator()(const u32string_view& __s) const noexcept + { return std::_Hash_impl::hash(__s.data(), + __s.length() * sizeof(char32_t)); } + }; + + template<> + struct __is_fast_hash> : std::false_type + { }; + + inline namespace literals + { + inline namespace string_view_literals + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wliteral-suffix" + inline constexpr basic_string_view + operator""sv(const char* __str, size_t __len) noexcept + { return basic_string_view{__str, __len}; } + + inline constexpr basic_string_view + operator""sv(const wchar_t* __str, size_t __len) noexcept + { return basic_string_view{__str, __len}; } + +#ifdef _GLIBCXX_USE_CHAR8_T + inline constexpr basic_string_view + operator""sv(const char8_t* __str, size_t __len) noexcept + { return basic_string_view{__str, __len}; } +#endif + + inline constexpr basic_string_view + operator""sv(const char16_t* __str, size_t __len) noexcept + { return basic_string_view{__str, __len}; } + + inline constexpr basic_string_view + operator""sv(const char32_t* __str, size_t __len) noexcept + { return basic_string_view{__str, __len}; } + +#pragma GCC diagnostic pop + } // namespace string_literals + } // namespace literals + +#if __cpp_lib_concepts + namespace ranges + { + // Opt-in to borrowed_range concept + template + inline constexpr bool + enable_borrowed_range> = true; + + // Opt-in to view concept + template + inline constexpr bool + enable_view> = true; + } +#endif +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#include + +#endif // __cplusplus <= 201402L + +#endif // _GLIBCXX_EXPERIMENTAL_STRING_VIEW diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string_view.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string_view.blob new file mode 100644 index 0000000..e680998 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@string_view.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@system_error b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@system_error new file mode 100644 index 0000000..d16ed7a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@system_error @@ -0,0 +1,643 @@ +// -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/system_error + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_SYSTEM_ERROR +#define _GLIBCXX_SYSTEM_ERROR 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // OS-dependent + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include +#include +#if __cplusplus > 201703L +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** @addtogroup diagnostics + * @{ + */ + + class error_code; + class error_condition; + class system_error; + + /// is_error_code_enum + template + struct is_error_code_enum : public false_type { }; + + /// is_error_condition_enum + template + struct is_error_condition_enum : public false_type { }; + + template<> + struct is_error_condition_enum + : public true_type { }; + +#if __cplusplus > 201402L + template + inline constexpr bool is_error_code_enum_v = + is_error_code_enum<_Tp>::value; + template + inline constexpr bool is_error_condition_enum_v = + is_error_condition_enum<_Tp>::value; +#endif // C++17 + /// @} + +_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2) + + /** @addtogroup diagnostics + * @{ + */ + + /** Abstract base class for types defining a category of error codes. + * + * An error category defines a context that gives meaning to the integer + * stored in an `error_code` or `error_condition` object. For example, + * the standard `errno` constants such a `EINVAL` and `ENOMEM` are + * associated with the "generic" category and other OS-specific error + * numbers are associated with the "system" category, but a user-defined + * category might give different meanings to the same numerical values. + * + * A user-defined category can override the `equivalent` member functions + * to define correspondence between errors in different categories. + * For example, a category for errors from disk I/O could consider some + * of its error numbers equivalent to ENOSPC and ENOENT in the generic + * category. + * + * @headerfile system_error + * @since C++11 + */ + class error_category + { + public: + constexpr error_category() noexcept = default; + + virtual ~error_category(); + + error_category(const error_category&) = delete; + error_category& operator=(const error_category&) = delete; + + /// A string that identifies the error category. + virtual const char* + name() const noexcept = 0; + + // We need two different virtual functions here, one returning a + // COW string and one returning an SSO string. Their positions in the + // vtable must be consistent for dynamic dispatch to work, but which one + // the name "message()" finds depends on which ABI the caller is using. +#if _GLIBCXX_USE_CXX11_ABI + private: + _GLIBCXX_DEFAULT_ABI_TAG + virtual __cow_string + _M_message(int) const; + + public: + /// A description of the error condition corresponding to the number. + _GLIBCXX_DEFAULT_ABI_TAG + virtual string + message(int) const = 0; +#else + virtual string + message(int) const = 0; + + private: + virtual __sso_string + _M_message(int) const; +#endif + + public: + /// Return an error_condition corresponding to `i` in this category. + virtual error_condition + default_error_condition(int __i) const noexcept; + + /// Test whether `cond` corresponds to `i` for this category. + virtual bool + equivalent(int __i, const error_condition& __cond) const noexcept; + + /// Test whether `code` corresponds to `i` for this category. + virtual bool + equivalent(const error_code& __code, int __i) const noexcept; + + /// An error_category only compares equal to itself. + [[__nodiscard__]] + bool + operator==(const error_category& __other) const noexcept + { return this == &__other; } + + /// Ordered comparison that defines a total order for error categories. +#if __cpp_lib_three_way_comparison + [[nodiscard]] + strong_ordering + operator<=>(const error_category& __rhs) const noexcept + { return std::compare_three_way()(this, &__rhs); } +#else + bool + operator<(const error_category& __other) const noexcept + { return less()(this, &__other); } + + bool + operator!=(const error_category& __other) const noexcept + { return this != &__other; } +#endif + }; + + // DR 890. + + /// Error category for `errno` error codes. + [[__nodiscard__, __gnu__::__const__]] + const error_category& + generic_category() noexcept; + + /// Error category for other error codes defined by the OS. + [[__nodiscard__, __gnu__::__const__]] + const error_category& + system_category() noexcept; + + /// @} + +_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) + + /** @addtogroup diagnostics + * @{ + */ + +namespace __adl_only +{ + void make_error_code() = delete; + void make_error_condition() = delete; +} + + /** Class error_code + * + * This class is a value type storing an integer error number and a + * category that gives meaning to the error number. Typically this is done + * close the the point where the error happens, to capture the original + * error value. + * + * An `error_code` object can be used to store the original error value + * emitted by some subsystem, with a category relevant to the subsystem. + * For example, errors from POSIX library functions can be represented by + * an `errno` value and the "generic" category, but errors from an HTTP + * library might be represented by an HTTP response status code (e.g. 404) + * and a custom category defined by the library. + * + * @headerfile system_error + * @since C++11 + */ + class error_code + { + template + using _Check + = __enable_if_t::value>; + + public: + error_code() noexcept + : _M_value(0), _M_cat(&system_category()) { } + + error_code(int __v, const error_category& __cat) noexcept + : _M_value(__v), _M_cat(&__cat) { } + + /// Initialize with a user-defined type, by calling make_error_code. + template> + error_code(_ErrorCodeEnum __e) noexcept + { + using __adl_only::make_error_code; + *this = make_error_code(__e); + } + + error_code(const error_code&) = default; + error_code& operator=(const error_code&) = default; + + void + assign(int __v, const error_category& __cat) noexcept + { + _M_value = __v; + _M_cat = &__cat; + } + + void + clear() noexcept + { assign(0, system_category()); } + + /// The error value. + [[__nodiscard__]] + int + value() const noexcept { return _M_value; } + + /// The error category that this error belongs to. + [[__nodiscard__]] + const error_category& + category() const noexcept { return *_M_cat; } + + /// An `error_condition` for this error's category and value. + error_condition + default_error_condition() const noexcept; + + /// The category's description of the value. + _GLIBCXX_DEFAULT_ABI_TAG + string + message() const + { return category().message(value()); } + + /// Test whether `value()` is non-zero. + [[__nodiscard__]] + explicit operator bool() const noexcept + { return _M_value != 0; } + + // DR 804. + private: + int _M_value; + const error_category* _M_cat; + }; + + // C++11 19.5.2.5 non-member functions + + /** Create an `error_code` representing a standard `errc` condition. + * + * The `std::errc` constants correspond to `errno` macros and so use the + * generic category. + * + * @relates error_code + * @since C++11 + */ + [[__nodiscard__]] + inline error_code + make_error_code(errc __e) noexcept + { return error_code(static_cast(__e), generic_category()); } + + /** Ordered comparison for std::error_code. + * + * This defines a total order by comparing the categories, and then + * if they are equal comparing the values. + * + * @relates error_code + * @since C++11 + */ +#if __cpp_lib_three_way_comparison + [[nodiscard]] + inline strong_ordering + operator<=>(const error_code& __lhs, const error_code& __rhs) noexcept + { + if (auto __c = __lhs.category() <=> __rhs.category(); __c != 0) + return __c; + return __lhs.value() <=> __rhs.value(); + } +#else + inline bool + operator<(const error_code& __lhs, const error_code& __rhs) noexcept + { + return (__lhs.category() < __rhs.category() + || (__lhs.category() == __rhs.category() + && __lhs.value() < __rhs.value())); + } +#endif + + /** Write a std::error_code to an ostream. + * + * @relates error_code + * @since C++11 + */ + template + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) + { return (__os << __e.category().name() << ':' << __e.value()); } + + /** Class error_condition + * + * This class represents error conditions that may be visible at an API + * boundary. Different `error_code` values that can occur within a library + * or module might map to the same `error_condition`. + * + * An `error_condition` represents something that the program can test for, + * and subsequently take appropriate action. + * + * @headerfile system_error + * @since C++11 + */ + class error_condition + { + template + using _Check + = __enable_if_t::value>; + + public: + /// Initialize with a zero (no error) value and the generic category. + error_condition() noexcept + : _M_value(0), _M_cat(&generic_category()) { } + + /// Initialize with the specified value and category. + error_condition(int __v, const error_category& __cat) noexcept + : _M_value(__v), _M_cat(&__cat) { } + + /// Initialize with a user-defined type, by calling make_error_condition. + template> + error_condition(_ErrorConditionEnum __e) noexcept + { + using __adl_only::make_error_condition; + *this = make_error_condition(__e); + } + + error_condition(const error_condition&) = default; + error_condition& operator=(const error_condition&) = default; + + /// Set the value and category. + void + assign(int __v, const error_category& __cat) noexcept + { + _M_value = __v; + _M_cat = &__cat; + } + + /// Reset the value and category to the default-constructed state. + void + clear() noexcept + { assign(0, generic_category()); } + + // C++11 19.5.3.4 observers + + /// The error value. + [[__nodiscard__]] + int + value() const noexcept { return _M_value; } + + /// The error category that this error belongs to. + [[__nodiscard__]] + const error_category& + category() const noexcept { return *_M_cat; } + + /// The category's description of the value. + _GLIBCXX_DEFAULT_ABI_TAG + string + message() const + { return category().message(value()); } + + /// Test whether `value()` is non-zero. + [[__nodiscard__]] + explicit operator bool() const noexcept + { return _M_value != 0; } + + // DR 804. + private: + int _M_value; + const error_category* _M_cat; + }; + + // C++11 19.5.3.5 non-member functions + + /** Create an `error_condition` representing a standard `errc` condition. + * + * The `std::errc` constants correspond to `errno` macros and so use the + * generic category. + * + * @relates error_condition + * @since C++11 + */ + [[__nodiscard__]] + inline error_condition + make_error_condition(errc __e) noexcept + { return error_condition(static_cast(__e), generic_category()); } + + // C++11 19.5.4 Comparison operators + + /** Equality comparison for std::error_code. + * + * Returns true only if they have the same category and the same value. + * + * @relates error_condition + * @since C++11 + */ + [[__nodiscard__]] + inline bool + operator==(const error_code& __lhs, const error_code& __rhs) noexcept + { + return __lhs.category() == __rhs.category() + && __lhs.value() == __rhs.value(); + } + + /** Equality comparison for std::error_code and std::error_condition. + * + * Uses each category's `equivalent` member function to check whether + * the values correspond to an equivalent error in that category. + * + * @relates error_condition + * @since C++11 + */ + [[__nodiscard__]] + inline bool + operator==(const error_code& __lhs, const error_condition& __rhs) noexcept + { + return __lhs.category().equivalent(__lhs.value(), __rhs) + || __rhs.category().equivalent(__lhs, __rhs.value()); + } + + /** Equality comparison for std::error_condition. + * + * Returns true only if they have the same category and the same value. + * + * @relates error_condition + * @since C++11 + */ + [[__nodiscard__]] + inline bool + operator==(const error_condition& __lhs, + const error_condition& __rhs) noexcept + { + return __lhs.category() == __rhs.category() + && __lhs.value() == __rhs.value(); + } + + /** Ordered comparison for std::error_condition. + * + * This defines a total order by comparing the categories, and then + * if they are equal comparing the values. + * + * @relates error_condition + * @since C++11 + */ +#if __cpp_lib_three_way_comparison + [[nodiscard]] + inline strong_ordering + operator<=>(const error_condition& __lhs, + const error_condition& __rhs) noexcept + { + if (auto __c = __lhs.category() <=> __rhs.category(); __c != 0) + return __c; + return __lhs.value() <=> __rhs.value(); + } +#else + inline bool + operator<(const error_condition& __lhs, + const error_condition& __rhs) noexcept + { + return (__lhs.category() < __rhs.category() + || (__lhs.category() == __rhs.category() + && __lhs.value() < __rhs.value())); + } + + /// @relates error_condition + inline bool + operator==(const error_condition& __lhs, const error_code& __rhs) noexcept + { + return (__rhs.category().equivalent(__rhs.value(), __lhs) + || __lhs.category().equivalent(__rhs, __lhs.value())); + } + + /// @relates error_code + inline bool + operator!=(const error_code& __lhs, const error_code& __rhs) noexcept + { return !(__lhs == __rhs); } + + /// @relates error_code + inline bool + operator!=(const error_code& __lhs, const error_condition& __rhs) noexcept + { return !(__lhs == __rhs); } + + /// @relates error_condition + inline bool + operator!=(const error_condition& __lhs, const error_code& __rhs) noexcept + { return !(__lhs == __rhs); } + + /// @relates error_condition + inline bool + operator!=(const error_condition& __lhs, + const error_condition& __rhs) noexcept + { return !(__lhs == __rhs); } +#endif // three_way_comparison + /// @} + + /** + * @brief An exception type that includes an `error_code` value. + * + * Typically used to report errors from the operating system and other + * low-level APIs. + * + * @headerfile system_error + * @since C++11 + * @ingroup exceptions + */ + class system_error : public std::runtime_error + { + private: + error_code _M_code; + + public: + system_error(error_code __ec = error_code()) + : runtime_error(__ec.message()), _M_code(__ec) { } + + system_error(error_code __ec, const string& __what) + : runtime_error(__what + (": " + __ec.message())), _M_code(__ec) { } + + system_error(error_code __ec, const char* __what) + : runtime_error(__what + (": " + __ec.message())), _M_code(__ec) { } + + system_error(int __v, const error_category& __ecat, const char* __what) + : system_error(error_code(__v, __ecat), __what) { } + + system_error(int __v, const error_category& __ecat) + : runtime_error(error_code(__v, __ecat).message()), + _M_code(__v, __ecat) { } + + system_error(int __v, const error_category& __ecat, const string& __what) + : runtime_error(__what + (": " + error_code(__v, __ecat).message())), + _M_code(__v, __ecat) { } + +#if __cplusplus >= 201103L + system_error (const system_error &) = default; + system_error &operator= (const system_error &) = default; +#endif + + virtual ~system_error() noexcept; + + const error_code& + code() const noexcept { return _M_code; } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#ifndef _GLIBCXX_COMPATIBILITY_CXX0X + // DR 1182. + /// std::hash specialization for error_code. + /// @relates error_code + template<> + struct hash + : public __hash_base + { + size_t + operator()(const error_code& __e) const noexcept + { + const size_t __tmp = std::_Hash_impl::hash(__e.value()); + return std::_Hash_impl::__hash_combine(&__e.category(), __tmp); + } + }; +#endif // _GLIBCXX_COMPATIBILITY_CXX0X + +#if __cplusplus >= 201703L + // DR 2686. + /// std::hash specialization for error_condition. + /// @relates error_condition + template<> + struct hash + : public __hash_base + { + size_t + operator()(const error_condition& __e) const noexcept + { + const size_t __tmp = std::_Hash_impl::hash(__e.value()); + return std::_Hash_impl::__hash_combine(&__e.category(), __tmp); + } + }; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // C++11 + +#endif // _GLIBCXX_SYSTEM_ERROR diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@system_error.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@system_error.blob new file mode 100644 index 0000000..c030999 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@system_error.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@tuple b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@tuple new file mode 100644 index 0000000..2e69af1 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@tuple @@ -0,0 +1,3034 @@ +// -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/tuple + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_TUPLE +#define _GLIBCXX_TUPLE 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus < 201103L +# include +#else + +#include // for std::pair +#include // for std::allocator_arg_t +#include // for std::tuple_size etc. +#include // for std::__invoke +#if __cplusplus > 201703L +# include +# include // for std::ranges::subrange +#endif + +#define __glibcxx_want_constexpr_tuple +#define __glibcxx_want_tuple_element_t +#define __glibcxx_want_tuples_by_type +#define __glibcxx_want_apply +#define __glibcxx_want_make_from_tuple +#define __glibcxx_want_ranges_zip +#define __glibcxx_want_tuple_like +#define __glibcxx_want_constrained_equality +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup utilities + * @{ + */ + + template + class tuple; + + /// @cond undocumented + template + struct __is_empty_non_tuple : is_empty<_Tp> { }; + + // Using EBO for elements that are tuples causes ambiguous base errors. + template + struct __is_empty_non_tuple> : false_type { }; + + // Use the Empty Base-class Optimization for empty, non-final types. + template + using __empty_not_final + = __conditional_t<__is_final(_Tp), false_type, + __is_empty_non_tuple<_Tp>>; + + template::value> + struct _Head_base; + +#if __has_cpp_attribute(__no_unique_address__) + template + struct _Head_base<_Idx, _Head, true> + { + constexpr _Head_base() + : _M_head_impl() { } + + constexpr _Head_base(const _Head& __h) + : _M_head_impl(__h) { } + + constexpr _Head_base(const _Head_base&) = default; + constexpr _Head_base(_Head_base&&) = default; + + template + constexpr _Head_base(_UHead&& __h) + : _M_head_impl(std::forward<_UHead>(__h)) { } + + _GLIBCXX20_CONSTEXPR + _Head_base(allocator_arg_t, __uses_alloc0) + : _M_head_impl() { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a) + : _M_head_impl(allocator_arg, *__a._M_a) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a) + : _M_head_impl(*__a._M_a) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(__uses_alloc0, _UHead&& __uhead) + : _M_head_impl(std::forward<_UHead>(__uhead)) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead) + : _M_head_impl(allocator_arg, *__a._M_a, std::forward<_UHead>(__uhead)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead) + : _M_head_impl(std::forward<_UHead>(__uhead), *__a._M_a) { } + + static constexpr _Head& + _M_head(_Head_base& __b) noexcept { return __b._M_head_impl; } + + static constexpr const _Head& + _M_head(const _Head_base& __b) noexcept { return __b._M_head_impl; } + + [[__no_unique_address__]] _Head _M_head_impl; + }; +#else + template + struct _Head_base<_Idx, _Head, true> + : public _Head + { + constexpr _Head_base() + : _Head() { } + + constexpr _Head_base(const _Head& __h) + : _Head(__h) { } + + constexpr _Head_base(const _Head_base&) = default; + constexpr _Head_base(_Head_base&&) = default; + + template + constexpr _Head_base(_UHead&& __h) + : _Head(std::forward<_UHead>(__h)) { } + + _GLIBCXX20_CONSTEXPR + _Head_base(allocator_arg_t, __uses_alloc0) + : _Head() { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a) + : _Head(allocator_arg, *__a._M_a) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a) + : _Head(*__a._M_a) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(__uses_alloc0, _UHead&& __uhead) + : _Head(std::forward<_UHead>(__uhead)) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead) + : _Head(allocator_arg, *__a._M_a, std::forward<_UHead>(__uhead)) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead) + : _Head(std::forward<_UHead>(__uhead), *__a._M_a) { } + + static constexpr _Head& + _M_head(_Head_base& __b) noexcept { return __b; } + + static constexpr const _Head& + _M_head(const _Head_base& __b) noexcept { return __b; } + }; +#endif + + template + struct _Head_base<_Idx, _Head, false> + { + constexpr _Head_base() + : _M_head_impl() { } + + constexpr _Head_base(const _Head& __h) + : _M_head_impl(__h) { } + + constexpr _Head_base(const _Head_base&) = default; + constexpr _Head_base(_Head_base&&) = default; + + template + constexpr _Head_base(_UHead&& __h) + : _M_head_impl(std::forward<_UHead>(__h)) { } + + _GLIBCXX20_CONSTEXPR + _Head_base(allocator_arg_t, __uses_alloc0) + : _M_head_impl() { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(allocator_arg_t, __uses_alloc1<_Alloc> __a) + : _M_head_impl(allocator_arg, *__a._M_a) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(allocator_arg_t, __uses_alloc2<_Alloc> __a) + : _M_head_impl(*__a._M_a) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(__uses_alloc0, _UHead&& __uhead) + : _M_head_impl(std::forward<_UHead>(__uhead)) { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(__uses_alloc1<_Alloc> __a, _UHead&& __uhead) + : _M_head_impl(allocator_arg, *__a._M_a, std::forward<_UHead>(__uhead)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Head_base(__uses_alloc2<_Alloc> __a, _UHead&& __uhead) + : _M_head_impl(std::forward<_UHead>(__uhead), *__a._M_a) { } + + static constexpr _Head& + _M_head(_Head_base& __b) noexcept { return __b._M_head_impl; } + + static constexpr const _Head& + _M_head(const _Head_base& __b) noexcept { return __b._M_head_impl; } + + _Head _M_head_impl; + }; + +#if __cpp_lib_tuple_like // >= C++23 + struct __tuple_like_tag_t { explicit __tuple_like_tag_t() = default; }; + + // This forward declaration is used by the operator<=> overload for + // tuple-like types. + template + constexpr _Cat + __tuple_cmp(const _Tp& __t, const _Up& __u, _IndexSeq); +#endif // C++23 + + /** + * Contains the actual implementation of the @c tuple template, stored + * as a recursive inheritance hierarchy from the first element (most + * derived class) to the last (least derived class). The @c Idx + * parameter gives the 0-based index of the element stored at this + * point in the hierarchy; we use it to implement a constant-time + * get() operation. + */ + template + struct _Tuple_impl; + + /** + * Recursive tuple implementation. Here we store the @c Head element + * and derive from a @c Tuple_impl containing the remaining elements + * (which contains the @c Tail). + */ + template + struct _Tuple_impl<_Idx, _Head, _Tail...> + : public _Tuple_impl<_Idx + 1, _Tail...>, + private _Head_base<_Idx, _Head> + { + template friend struct _Tuple_impl; + + typedef _Tuple_impl<_Idx + 1, _Tail...> _Inherited; + typedef _Head_base<_Idx, _Head> _Base; + + static constexpr _Head& + _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); } + + static constexpr const _Head& + _M_head(const _Tuple_impl& __t) noexcept { return _Base::_M_head(__t); } + + static constexpr _Inherited& + _M_tail(_Tuple_impl& __t) noexcept { return __t; } + + static constexpr const _Inherited& + _M_tail(const _Tuple_impl& __t) noexcept { return __t; } + + constexpr _Tuple_impl() + : _Inherited(), _Base() { } + + explicit constexpr + _Tuple_impl(const _Head& __head, const _Tail&... __tail) + : _Inherited(__tail...), _Base(__head) + { } + + template> + explicit constexpr + _Tuple_impl(_UHead&& __head, _UTail&&... __tail) + : _Inherited(std::forward<_UTail>(__tail)...), + _Base(std::forward<_UHead>(__head)) + { } + + constexpr _Tuple_impl(const _Tuple_impl&) = default; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2729. Missing SFINAE on std::pair::operator= + _Tuple_impl& operator=(const _Tuple_impl&) = delete; + + _Tuple_impl(_Tuple_impl&&) = default; + + template + constexpr + _Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in) + : _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)), + _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) + { } + + template + constexpr + _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in) + : _Inherited(std::move + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))), + _Base(std::forward<_UHead> + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) + { } + +#if __cpp_lib_ranges_zip // >= C++23 + template + constexpr + _Tuple_impl(_Tuple_impl<_Idx, _UElements...>& __in) + : _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)), + _Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) + { } + + template + constexpr + _Tuple_impl(const _Tuple_impl<_Idx, _UHead, _UTails...>&& __in) + : _Inherited(std::move + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))), + _Base(std::forward + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) + { } +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template + constexpr + _Tuple_impl(__tuple_like_tag_t, _UTuple&& __u, index_sequence<_Is...>) + : _Tuple_impl(std::get<_Is>(std::forward<_UTuple>(__u))...) + { } +#endif // C++23 + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a) + : _Inherited(__tag, __a), + _Base(__tag, __use_alloc<_Head>(__a)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, + const _Head& __head, const _Tail&... __tail) + : _Inherited(__tag, __a, __tail...), + _Base(__use_alloc<_Head, _Alloc, _Head>(__a), __head) + { } + + template> + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, + _UHead&& __head, _UTail&&... __tail) + : _Inherited(__tag, __a, std::forward<_UTail>(__tail)...), + _Base(__use_alloc<_Head, _Alloc, _UHead>(__a), + std::forward<_UHead>(__head)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, + const _Tuple_impl& __in) + : _Inherited(__tag, __a, _M_tail(__in)), + _Base(__use_alloc<_Head, _Alloc, _Head>(__a), _M_head(__in)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, + _Tuple_impl&& __in) + : _Inherited(__tag, __a, std::move(_M_tail(__in))), + _Base(__use_alloc<_Head, _Alloc, _Head>(__a), + std::forward<_Head>(_M_head(__in))) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, + const _Tuple_impl<_Idx, _UHead, _UTails...>& __in) + : _Inherited(__tag, __a, + _Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)), + _Base(__use_alloc<_Head, _Alloc, const _UHead&>(__a), + _Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, + _Tuple_impl<_Idx, _UHead, _UTails...>&& __in) + : _Inherited(__tag, __a, std::move + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))), + _Base(__use_alloc<_Head, _Alloc, _UHead>(__a), + std::forward<_UHead> + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) + { } + +#if __cpp_lib_ranges_zip // >= C++23 + template + constexpr + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, + _Tuple_impl<_Idx, _UHead, _UTails...>& __in) + : _Inherited(__tag, __a, + _Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in)), + _Base(__use_alloc<_Head, _Alloc, _UHead&>(__a), + _Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)) + { } + + template + constexpr + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a, + const _Tuple_impl<_Idx, _UHead, _UTails...>&& __in) + : _Inherited(__tag, __a, std::move + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))), + _Base(__use_alloc<_Head, _Alloc, const _UHead>(__a), + std::forward + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in))) + { } +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template + constexpr + _Tuple_impl(__tuple_like_tag_t, allocator_arg_t __tag, const _Alloc& __a, + _UTuple&& __u, index_sequence<_Is...>) + : _Tuple_impl(__tag, __a, std::get<_Is>(std::forward<_UTuple>(__u))...) + { } +#endif // C++23 + + template + _GLIBCXX20_CONSTEXPR + void + _M_assign(const _Tuple_impl<_Idx, _UElements...>& __in) + { + _M_head(*this) = _Tuple_impl<_Idx, _UElements...>::_M_head(__in); + _M_tail(*this)._M_assign( + _Tuple_impl<_Idx, _UElements...>::_M_tail(__in)); + } + + template + _GLIBCXX20_CONSTEXPR + void + _M_assign(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in) + { + _M_head(*this) = std::forward<_UHead> + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)); + _M_tail(*this)._M_assign( + std::move(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))); + } + +#if __cpp_lib_ranges_zip // >= C++23 + template + constexpr void + _M_assign(const _Tuple_impl<_Idx, _UElements...>& __in) const + { + _M_head(*this) = _Tuple_impl<_Idx, _UElements...>::_M_head(__in); + _M_tail(*this)._M_assign( + _Tuple_impl<_Idx, _UElements...>::_M_tail(__in)); + } + + template + constexpr void + _M_assign(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in) const + { + _M_head(*this) = std::forward<_UHead> + (_Tuple_impl<_Idx, _UHead, _UTails...>::_M_head(__in)); + _M_tail(*this)._M_assign( + std::move(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))); + } +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template + constexpr void + _M_assign(__tuple_like_tag_t __tag, _UTuple&& __u) + { + _M_head(*this) = std::get<_Idx>(std::forward<_UTuple>(__u)); + _M_tail(*this)._M_assign(__tag, std::forward<_UTuple>(__u)); + } + + template + constexpr void + _M_assign(__tuple_like_tag_t __tag, _UTuple&& __u) const + { + _M_head(*this) = std::get<_Idx>(std::forward<_UTuple>(__u)); + _M_tail(*this)._M_assign(__tag, std::forward<_UTuple>(__u)); + } +#endif // C++23 + + protected: + _GLIBCXX20_CONSTEXPR + void + _M_swap(_Tuple_impl& __in) + { + using std::swap; + swap(_M_head(*this), _M_head(__in)); + _Inherited::_M_swap(_M_tail(__in)); + } + +#if __cpp_lib_ranges_zip // >= C++23 + constexpr void + _M_swap(const _Tuple_impl& __in) const + { + using std::swap; + swap(_M_head(*this), _M_head(__in)); + _Inherited::_M_swap(_M_tail(__in)); + } +#endif // C++23 + }; + + // Basis case of inheritance recursion. + template + struct _Tuple_impl<_Idx, _Head> + : private _Head_base<_Idx, _Head> + { + template friend struct _Tuple_impl; + + typedef _Head_base<_Idx, _Head> _Base; + + static constexpr _Head& + _M_head(_Tuple_impl& __t) noexcept { return _Base::_M_head(__t); } + + static constexpr const _Head& + _M_head(const _Tuple_impl& __t) noexcept { return _Base::_M_head(__t); } + + constexpr + _Tuple_impl() + : _Base() { } + + explicit constexpr + _Tuple_impl(const _Head& __head) + : _Base(__head) + { } + + template + explicit constexpr + _Tuple_impl(_UHead&& __head) + : _Base(std::forward<_UHead>(__head)) + { } + + constexpr _Tuple_impl(const _Tuple_impl&) = default; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2729. Missing SFINAE on std::pair::operator= + _Tuple_impl& operator=(const _Tuple_impl&) = delete; + +#if _GLIBCXX_INLINE_VERSION + _Tuple_impl(_Tuple_impl&&) = default; +#else + constexpr + _Tuple_impl(_Tuple_impl&& __in) + noexcept(is_nothrow_move_constructible<_Head>::value) + : _Base(static_cast<_Base&&>(__in)) + { } +#endif + + template + constexpr + _Tuple_impl(const _Tuple_impl<_Idx, _UHead>& __in) + : _Base(_Tuple_impl<_Idx, _UHead>::_M_head(__in)) + { } + + template + constexpr + _Tuple_impl(_Tuple_impl<_Idx, _UHead>&& __in) + : _Base(std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in))) + { } + +#if __cpp_lib_ranges_zip // >= C++23 + template + constexpr + _Tuple_impl(_Tuple_impl<_Idx, _UHead>& __in) + : _Base(_Tuple_impl<_Idx, _UHead>::_M_head(__in)) + { } + + template + constexpr + _Tuple_impl(const _Tuple_impl<_Idx, _UHead>&& __in) + : _Base(std::forward(_Tuple_impl<_Idx, _UHead>::_M_head(__in))) + { } +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template + constexpr + _Tuple_impl(__tuple_like_tag_t, _UTuple&& __u, index_sequence<0>) + : _Tuple_impl(std::get<0>(std::forward<_UTuple>(__u))) + { } +#endif // C++23 + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a) + : _Base(__tag, __use_alloc<_Head>(__a)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t, const _Alloc& __a, + const _Head& __head) + : _Base(__use_alloc<_Head, _Alloc, const _Head&>(__a), __head) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t, const _Alloc& __a, + _UHead&& __head) + : _Base(__use_alloc<_Head, _Alloc, _UHead>(__a), + std::forward<_UHead>(__head)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t, const _Alloc& __a, + const _Tuple_impl& __in) + : _Base(__use_alloc<_Head, _Alloc, const _Head&>(__a), _M_head(__in)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t, const _Alloc& __a, + _Tuple_impl&& __in) + : _Base(__use_alloc<_Head, _Alloc, _Head>(__a), + std::forward<_Head>(_M_head(__in))) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t, const _Alloc& __a, + const _Tuple_impl<_Idx, _UHead>& __in) + : _Base(__use_alloc<_Head, _Alloc, const _UHead&>(__a), + _Tuple_impl<_Idx, _UHead>::_M_head(__in)) + { } + + template + _GLIBCXX20_CONSTEXPR + _Tuple_impl(allocator_arg_t, const _Alloc& __a, + _Tuple_impl<_Idx, _UHead>&& __in) + : _Base(__use_alloc<_Head, _Alloc, _UHead>(__a), + std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in))) + { } + +#if __cpp_lib_ranges_zip // >= C++23 + template + constexpr + _Tuple_impl(allocator_arg_t, const _Alloc& __a, + _Tuple_impl<_Idx, _UHead>& __in) + : _Base(__use_alloc<_Head, _Alloc, _UHead&>(__a), + _Tuple_impl<_Idx, _UHead>::_M_head(__in)) + { } + + template + constexpr + _Tuple_impl(allocator_arg_t, const _Alloc& __a, + const _Tuple_impl<_Idx, _UHead>&& __in) + : _Base(__use_alloc<_Head, _Alloc, const _UHead>(__a), + std::forward(_Tuple_impl<_Idx, _UHead>::_M_head(__in))) + { } +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template + constexpr + _Tuple_impl(__tuple_like_tag_t, allocator_arg_t __tag, const _Alloc& __a, + _UTuple&& __u, index_sequence<0>) + : _Tuple_impl(__tag, __a, std::get<0>(std::forward<_UTuple>(__u))) + { } +#endif // C++23 + + template + _GLIBCXX20_CONSTEXPR + void + _M_assign(const _Tuple_impl<_Idx, _UHead>& __in) + { + _M_head(*this) = _Tuple_impl<_Idx, _UHead>::_M_head(__in); + } + + template + _GLIBCXX20_CONSTEXPR + void + _M_assign(_Tuple_impl<_Idx, _UHead>&& __in) + { + _M_head(*this) + = std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)); + } + +#if __cpp_lib_ranges_zip // >= C++23 + template + constexpr void + _M_assign(const _Tuple_impl<_Idx, _UHead>& __in) const + { + _M_head(*this) = _Tuple_impl<_Idx, _UHead>::_M_head(__in); + } + + template + constexpr void + _M_assign(_Tuple_impl<_Idx, _UHead>&& __in) const + { + _M_head(*this) + = std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)); + } +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template + constexpr void + _M_assign(__tuple_like_tag_t, _UTuple&& __u) + { _M_head(*this) = std::get<_Idx>(std::forward<_UTuple>(__u)); } + + template + constexpr void + _M_assign(__tuple_like_tag_t, _UTuple&& __u) const + { _M_head(*this) = std::get<_Idx>(std::forward<_UTuple>(__u)); } +#endif // C++23 + + protected: + _GLIBCXX20_CONSTEXPR + void + _M_swap(_Tuple_impl& __in) + { + using std::swap; + swap(_M_head(*this), _M_head(__in)); + } + +#if __cpp_lib_ranges_zip // >= C++23 + constexpr void + _M_swap(const _Tuple_impl& __in) const + { + using std::swap; + swap(_M_head(*this), _M_head(__in)); + } +#endif // C++23 + }; + + // Concept utility functions, reused in conditionally-explicit + // constructors. + template + struct _TupleConstraints + { + template + using __constructible = __and_...>; + + template + using __convertible = __and_...>; + + // Constraint for a non-explicit constructor. + // True iff each Ti in _Types... can be constructed from Ui in _UTypes... + // and every Ui is implicitly convertible to Ti. + template + static constexpr bool __is_implicitly_constructible() + { + return __and_<__constructible<_UTypes...>, + __convertible<_UTypes...> + >::value; + } + + // Constraint for a non-explicit constructor. + // True iff each Ti in _Types... can be constructed from Ui in _UTypes... + // but not every Ui is implicitly convertible to Ti. + template + static constexpr bool __is_explicitly_constructible() + { + return __and_<__constructible<_UTypes...>, + __not_<__convertible<_UTypes...>> + >::value; + } + + static constexpr bool __is_implicitly_default_constructible() + { + return __and_... + >::value; + } + + static constexpr bool __is_explicitly_default_constructible() + { + return __and_..., + __not_<__and_< + std::__is_implicitly_default_constructible<_Types>...> + >>::value; + } + }; + + // Partial specialization used when a required precondition isn't met, + // e.g. when sizeof...(_Types) != sizeof...(_UTypes). + template + struct _TupleConstraints + { + template + static constexpr bool __is_implicitly_constructible() + { return false; } + + template + static constexpr bool __is_explicitly_constructible() + { return false; } + }; + /// @endcond + + /// Primary class template, tuple + template + class tuple : public _Tuple_impl<0, _Elements...> + { + using _Inherited = _Tuple_impl<0, _Elements...>; + +#if __cpp_concepts && __cpp_consteval && __cpp_conditional_explicit // >= C++20 + template + static consteval bool + __constructible() + { + if constexpr (sizeof...(_UTypes) == sizeof...(_Elements)) + return __and_v...>; + else + return false; + } + + template + static consteval bool + __nothrow_constructible() + { + if constexpr (sizeof...(_UTypes) == sizeof...(_Elements)) + return __and_v...>; + else + return false; + } + + template + static consteval bool + __convertible() + { + if constexpr (sizeof...(_UTypes) == sizeof...(_Elements)) + return __and_v...>; + else + return false; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3121. tuple constructor constraints for UTypes&&... overloads + template + static consteval bool + __disambiguating_constraint() + { + if constexpr (sizeof...(_Elements) != sizeof...(_UTypes)) + return false; + else if constexpr (sizeof...(_Elements) == 1) + { + using _U0 = typename _Nth_type<0, _UTypes...>::type; + return !is_same_v, tuple>; + } + else if constexpr (sizeof...(_Elements) < 4) + { + using _U0 = typename _Nth_type<0, _UTypes...>::type; + if constexpr (!is_same_v, allocator_arg_t>) + return true; + else + { + using _T0 = typename _Nth_type<0, _Elements...>::type; + return is_same_v, allocator_arg_t>; + } + } + return true; + } + + // Return true iff sizeof...(Types) == 1 && tuple_size_v == 1 + // and the single element in Types can be initialized from TUPLE, + // or is the same type as tuple_element_t<0, TUPLE>. + template + static consteval bool + __use_other_ctor() + { + if constexpr (sizeof...(_Elements) != 1) + return false; + else if constexpr (is_same_v, tuple>) + return true; // Should use a copy/move constructor instead. + else + { + using _Tp = typename _Nth_type<0, _Elements...>::type; + if constexpr (is_convertible_v<_Tuple, _Tp>) + return true; + else if constexpr (is_constructible_v<_Tp, _Tuple>) + return true; + } + return false; + } + + template + static consteval bool + __dangles() + { +#if __has_builtin(__reference_constructs_from_temporary) + return (__reference_constructs_from_temporary(_Elements, _Up&&) + || ...); +#else + return false; +#endif + } + +#if __cpp_lib_tuple_like // >= C++23 + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 4045. tuple can create dangling references from tuple-like + template + static consteval bool + __dangles_from_tuple_like() + { + return [](index_sequence<_Is...>) { + return __dangles(std::declval<_UTuple>()))...>(); + }(index_sequence_for<_Elements...>{}); + } + + template + static consteval bool + __constructible_from_tuple_like() + { + return [](index_sequence<_Is...>) { + return __constructible(std::declval<_UTuple>()))...>(); + }(index_sequence_for<_Elements...>{}); + } + + template + static consteval bool + __convertible_from_tuple_like() + { + return [](index_sequence<_Is...>) { + return __convertible(std::declval<_UTuple>()))...>(); + }(index_sequence_for<_Elements...>{}); + } +#endif // C++23 + + public: + constexpr + explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...)) + tuple() + noexcept((is_nothrow_default_constructible_v<_Elements> && ...)) + requires (is_default_constructible_v<_Elements> && ...) + : _Inherited() + { } + + // Defined as a template to work around PR libstdc++/116440. + template + constexpr explicit(!__convertible()) + tuple(const _Elements&... __elements) + noexcept(__nothrow_constructible()) + requires (__constructible()) + : _Inherited(__elements...) + { } + + template + requires (__disambiguating_constraint<_UTypes...>()) + && (__constructible<_UTypes...>()) + && (!__dangles<_UTypes...>()) + constexpr explicit(!__convertible<_UTypes...>()) + tuple(_UTypes&&... __u) + noexcept(__nothrow_constructible<_UTypes...>()) + : _Inherited(std::forward<_UTypes>(__u)...) + { } + + template + requires (__disambiguating_constraint<_UTypes...>()) + && (__constructible<_UTypes...>()) + && (__dangles<_UTypes...>()) + tuple(_UTypes&&...) = delete; + + constexpr tuple(const tuple&) = default; + + constexpr tuple(tuple&&) = default; + + template + requires (__constructible()) + && (!__use_other_ctor&>()) + && (!__dangles()) + constexpr explicit(!__convertible()) + tuple(const tuple<_UTypes...>& __u) + noexcept(__nothrow_constructible()) + : _Inherited(static_cast&>(__u)) + { } + + template + requires (__constructible()) + && (!__use_other_ctor&>()) + && (__dangles()) + tuple(const tuple<_UTypes...>&) = delete; + + template + requires (__constructible<_UTypes...>()) + && (!__use_other_ctor>()) + && (!__dangles<_UTypes...>()) + constexpr explicit(!__convertible<_UTypes...>()) + tuple(tuple<_UTypes...>&& __u) + noexcept(__nothrow_constructible<_UTypes...>()) + : _Inherited(static_cast<_Tuple_impl<0, _UTypes...>&&>(__u)) + { } + + template + requires (__constructible<_UTypes...>()) + && (!__use_other_ctor>()) + && (__dangles<_UTypes...>()) + tuple(tuple<_UTypes...>&&) = delete; + +#if __cpp_lib_ranges_zip // >= C++23 + template + requires (__constructible<_UTypes&...>()) + && (!__use_other_ctor&>()) + && (!__dangles<_UTypes&...>()) + constexpr explicit(!__convertible<_UTypes&...>()) + tuple(tuple<_UTypes...>& __u) + noexcept(__nothrow_constructible<_UTypes&...>()) + : _Inherited(static_cast<_Tuple_impl<0, _UTypes...>&>(__u)) + { } + + template + requires (__constructible<_UTypes&...>()) + && (!__use_other_ctor&>()) + && (__dangles<_UTypes&...>()) + tuple(tuple<_UTypes...>&) = delete; + + template + requires (__constructible()) + && (!__use_other_ctor>()) + && (!__dangles()) + constexpr explicit(!__convertible()) + tuple(const tuple<_UTypes...>&& __u) + noexcept(__nothrow_constructible()) + : _Inherited(static_cast&&>(__u)) + { } + + template + requires (__constructible()) + && (!__use_other_ctor>()) + && (__dangles()) + tuple(const tuple<_UTypes...>&&) = delete; +#endif // C++23 + + template + requires (sizeof...(_Elements) == 2) + && (__constructible()) + && (!__dangles()) + constexpr explicit(!__convertible()) + tuple(const pair<_U1, _U2>& __u) + noexcept(__nothrow_constructible()) + : _Inherited(__u.first, __u.second) + { } + + template + requires (sizeof...(_Elements) == 2) + && (__constructible()) + && (__dangles()) + tuple(const pair<_U1, _U2>&) = delete; + + template + requires (sizeof...(_Elements) == 2) + && (__constructible<_U1, _U2>()) + && (!__dangles<_U1, _U2>()) + constexpr explicit(!__convertible<_U1, _U2>()) + tuple(pair<_U1, _U2>&& __u) + noexcept(__nothrow_constructible<_U1, _U2>()) + : _Inherited(std::forward<_U1>(__u.first), + std::forward<_U2>(__u.second)) + { } + + template + requires (sizeof...(_Elements) == 2) + && (__constructible<_U1, _U2>()) + && (__dangles<_U1, _U2>()) + tuple(pair<_U1, _U2>&&) = delete; + +#if __cpp_lib_ranges_zip // >= C++23 + template + requires (sizeof...(_Elements) == 2) + && (__constructible<_U1&, _U2&>()) + && (!__dangles<_U1&, _U2&>()) + constexpr explicit(!__convertible<_U1&, _U2&>()) + tuple(pair<_U1, _U2>& __u) + noexcept(__nothrow_constructible<_U1&, _U2&>()) + : _Inherited(__u.first, __u.second) + { } + + template + requires (sizeof...(_Elements) == 2) + && (__constructible<_U1&, _U2&>()) + && (__dangles<_U1&, _U2&>()) + tuple(pair<_U1, _U2>&) = delete; + + template + requires (sizeof...(_Elements) == 2) + && (__constructible()) + && (!__dangles()) + constexpr explicit(!__convertible()) + tuple(const pair<_U1, _U2>&& __u) + noexcept(__nothrow_constructible()) + : _Inherited(std::forward(__u.first), + std::forward(__u.second)) + { } + + template + requires (sizeof...(_Elements) == 2) + && (__constructible()) + && (__dangles()) + tuple(const pair<_U1, _U2>&&) = delete; +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template<__eligible_tuple_like _UTuple> + requires (__constructible_from_tuple_like<_UTuple>()) + && (!__use_other_ctor<_UTuple>()) + && (!__dangles_from_tuple_like<_UTuple>()) + constexpr explicit(!__convertible_from_tuple_like<_UTuple>()) + tuple(_UTuple&& __u) + : _Inherited(__tuple_like_tag_t{}, + std::forward<_UTuple>(__u), + index_sequence_for<_Elements...>{}) + { } + + template<__eligible_tuple_like _UTuple> + requires (__constructible_from_tuple_like<_UTuple>()) + && (!__use_other_ctor<_UTuple>()) + && (__dangles_from_tuple_like<_UTuple>()) + tuple(_UTuple&&) = delete; +#endif // C++23 + + // Allocator-extended constructors. + + template + constexpr + explicit(!(__is_implicitly_default_constructible_v<_Elements> && ...)) + tuple(allocator_arg_t __tag, const _Alloc& __a) + requires (is_default_constructible_v<_Elements> && ...) + : _Inherited(__tag, __a) + { } + + template + constexpr explicit(!__convertible()) + tuple(allocator_arg_t __tag, const _Alloc& __a, + const _Elements&... __elements) + requires (__constructible()) + : _Inherited(__tag, __a, __elements...) + { } + + template + requires (__disambiguating_constraint<_UTypes...>()) + && (__constructible<_UTypes...>()) + && (!__dangles<_UTypes...>()) + constexpr explicit(!__convertible<_UTypes...>()) + tuple(allocator_arg_t __tag, const _Alloc& __a, _UTypes&&... __u) + : _Inherited(__tag, __a, std::forward<_UTypes>(__u)...) + { } + + template + requires (__disambiguating_constraint<_UTypes...>()) + && (__constructible<_UTypes...>()) + && (__dangles<_UTypes...>()) + tuple(allocator_arg_t, const _Alloc&, _UTypes&&...) = delete; + + template + constexpr + tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __u) + : _Inherited(__tag, __a, static_cast(__u)) + { } + + template + requires (__constructible<_Elements...>()) + constexpr + tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __u) + : _Inherited(__tag, __a, static_cast<_Inherited&&>(__u)) + { } + + template + requires (__constructible()) + && (!__use_other_ctor&>()) + && (!__dangles()) + constexpr explicit(!__convertible()) + tuple(allocator_arg_t __tag, const _Alloc& __a, + const tuple<_UTypes...>& __u) + : _Inherited(__tag, __a, + static_cast&>(__u)) + { } + + template + requires (__constructible()) + && (!__use_other_ctor&>()) + && (__dangles()) + tuple(allocator_arg_t, const _Alloc&, const tuple<_UTypes...>&) = delete; + + template + requires (__constructible<_UTypes...>()) + && (!__use_other_ctor>()) + && (!__dangles<_UTypes...>()) + constexpr explicit(!__use_other_ctor>()) + tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_UTypes...>&& __u) + : _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _UTypes...>&&>(__u)) + { } + + template + requires (__constructible<_UTypes...>()) + && (!__use_other_ctor>()) + && (__dangles<_UTypes...>()) + tuple(allocator_arg_t, const _Alloc&, tuple<_UTypes...>&&) = delete; + +#if __cpp_lib_ranges_zip // >= C++23 + template + requires (__constructible<_UTypes&...>()) + && (!__use_other_ctor&>()) + && (!__dangles<_UTypes&...>()) + constexpr explicit(!__convertible<_UTypes&...>()) + tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_UTypes...>& __u) + : _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _UTypes...>&>(__u)) + { } + + template + requires (__constructible<_UTypes&...>()) + && (!__use_other_ctor&>()) + && (__dangles<_UTypes&...>()) + tuple(allocator_arg_t, const _Alloc&, tuple<_UTypes...>&) = delete; + + template + requires (__constructible()) + && (!__use_other_ctor>()) + && (!__dangles()) + constexpr explicit(!__convertible()) + tuple(allocator_arg_t __tag, const _Alloc& __a, + const tuple<_UTypes...>&& __u) + : _Inherited(__tag, __a, + static_cast&&>(__u)) + { } + + template + requires (__constructible()) + && (!__use_other_ctor>()) + && (__dangles()) + tuple(allocator_arg_t, const _Alloc&, const tuple<_UTypes...>&&) = delete; +#endif // C++23 + + template + requires (sizeof...(_Elements) == 2) + && (__constructible()) + && (!__dangles()) + constexpr explicit(!__convertible()) + tuple(allocator_arg_t __tag, const _Alloc& __a, + const pair<_U1, _U2>& __u) + noexcept(__nothrow_constructible()) + : _Inherited(__tag, __a, __u.first, __u.second) + { } + + template + requires (sizeof...(_Elements) == 2) + && (__constructible()) + && (__dangles()) + tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&) = delete; + + template + requires (sizeof...(_Elements) == 2) + && (__constructible<_U1, _U2>()) + && (!__dangles<_U1, _U2>()) + constexpr explicit(!__convertible<_U1, _U2>()) + tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>&& __u) + noexcept(__nothrow_constructible<_U1, _U2>()) + : _Inherited(__tag, __a, std::move(__u.first), std::move(__u.second)) + { } + + template + requires (sizeof...(_Elements) == 2) + && (__constructible<_U1, _U2>()) + && (__dangles<_U1, _U2>()) + tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&&) = delete; + +#if __cpp_lib_ranges_zip // >= C++23 + template + requires (sizeof...(_Elements) == 2) + && (__constructible<_U1&, _U2&>()) + && (!__dangles<_U1&, _U2&>()) + constexpr explicit(!__convertible<_U1&, _U2&>()) + tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>& __u) + noexcept(__nothrow_constructible<_U1&, _U2&>()) + : _Inherited(__tag, __a, __u.first, __u.second) + { } + + template + requires (sizeof...(_Elements) == 2) + && (__constructible<_U1&, _U2&>()) + && (__dangles<_U1&, _U2&>()) + tuple(allocator_arg_t, const _Alloc&, pair<_U1, _U2>&) = delete; + + template + requires (sizeof...(_Elements) == 2) + && (__constructible()) + && (!__dangles()) + constexpr explicit(!__convertible()) + tuple(allocator_arg_t __tag, const _Alloc& __a, + const pair<_U1, _U2>&& __u) + noexcept(__nothrow_constructible()) + : _Inherited(__tag, __a, std::move(__u.first), std::move(__u.second)) + { } + + template + requires (sizeof...(_Elements) == 2) + && (__constructible()) + && (__dangles()) + tuple(allocator_arg_t, const _Alloc&, const pair<_U1, _U2>&&) = delete; +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template _UTuple> + requires (__constructible_from_tuple_like<_UTuple>()) + && (!__use_other_ctor<_UTuple>()) + && (!__dangles_from_tuple_like<_UTuple>()) + constexpr explicit(!__convertible_from_tuple_like<_UTuple>()) + tuple(allocator_arg_t __tag, const _Alloc& __a, _UTuple&& __u) + : _Inherited(__tuple_like_tag_t{}, + __tag, __a, std::forward<_UTuple>(__u), + index_sequence_for<_Elements...>{}) + { } + + template _UTuple> + requires (__constructible_from_tuple_like<_UTuple>()) + && (!__use_other_ctor<_UTuple>()) + && (__dangles_from_tuple_like<_UTuple>()) + tuple(allocator_arg_t, const _Alloc&, _UTuple&&) = delete; +#endif // C++23 + +#else // !(concepts && conditional_explicit) + + template + using _TCC = _TupleConstraints<_Cond, _Elements...>; + + // Constraint for non-explicit default constructor + template + using _ImplicitDefaultCtor = __enable_if_t< + _TCC<_Dummy>::__is_implicitly_default_constructible(), + bool>; + + // Constraint for explicit default constructor + template + using _ExplicitDefaultCtor = __enable_if_t< + _TCC<_Dummy>::__is_explicitly_default_constructible(), + bool>; + + // Constraint for non-explicit constructors + template + using _ImplicitCtor = __enable_if_t< + _TCC<_Cond>::template __is_implicitly_constructible<_Args...>(), + bool>; + + // Constraint for non-explicit constructors + template + using _ExplicitCtor = __enable_if_t< + _TCC<_Cond>::template __is_explicitly_constructible<_Args...>(), + bool>; + + // Condition for noexcept-specifier of a constructor. + template + static constexpr bool __nothrow_constructible() + { + return + __and_...>::value; + } + + // Constraint for tuple(_UTypes&&...) where sizeof...(_UTypes) == 1. + template + static constexpr bool __valid_args() + { + return sizeof...(_Elements) == 1 + && !is_same>::value; + } + + // Constraint for tuple(_UTypes&&...) where sizeof...(_UTypes) > 1. + template + static constexpr bool __valid_args() + { return (sizeof...(_Tail) + 2) == sizeof...(_Elements); } + + /* Constraint for constructors with a tuple parameter ensures + * that the constructor is only viable when it would not interfere with + * tuple(UTypes&&...) or tuple(const tuple&) or tuple(tuple&&). + * Such constructors are only viable if: + * either sizeof...(Types) != 1, + * or (when Types... expands to T and UTypes... expands to U) + * is_convertible_v, is_constructible_v, + * and is_same_v are all false. + */ + template> + struct _UseOtherCtor + : false_type + { }; + // If TUPLE is convertible to the single element in *this, + // then TUPLE should match tuple(UTypes&&...) instead. + template + struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>> + : __or_, is_constructible<_Tp, _Tuple>>::type + { }; + // If TUPLE and *this each have a single element of the same type, + // then TUPLE should match a copy/move constructor instead. + template + struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Tp>> + : true_type + { }; + + // Return true iff sizeof...(Types) == 1 && tuple_size_v == 1 + // and the single element in Types can be initialized from TUPLE, + // or is the same type as tuple_element_t<0, TUPLE>. + template + static constexpr bool __use_other_ctor() + { return _UseOtherCtor<_Tuple>::value; } + + /// @cond undocumented +#undef __glibcxx_no_dangling_refs +#if __has_builtin(__reference_constructs_from_temporary) \ + && defined _GLIBCXX_DEBUG + // Error if construction from U... would create a dangling ref. +# if __cpp_fold_expressions +# define __glibcxx_dangling_refs(U) \ + (__reference_constructs_from_temporary(_Elements, U) || ...) +# else +# define __glibcxx_dangling_refs(U) \ + __or_<__bool_constant<__reference_constructs_from_temporary(_Elements, U) \ + >...>::value +# endif +# define __glibcxx_no_dangling_refs(U) \ + static_assert(!__glibcxx_dangling_refs(U), \ + "std::tuple constructor creates a dangling reference") +#else +# define __glibcxx_no_dangling_refs(U) +#endif + /// @endcond + + public: + template::value> = true> + constexpr + tuple() + noexcept(__and_...>::value) + : _Inherited() { } + + template::value> = false> + explicit constexpr + tuple() + noexcept(__and_...>::value) + : _Inherited() { } + + template= 1), + _ImplicitCtor<_NotEmpty, const _Elements&...> = true> + constexpr + tuple(const _Elements&... __elements) + noexcept(__nothrow_constructible()) + : _Inherited(__elements...) { } + + template= 1), + _ExplicitCtor<_NotEmpty, const _Elements&...> = false> + explicit constexpr + tuple(const _Elements&... __elements) + noexcept(__nothrow_constructible()) + : _Inherited(__elements...) { } + + template(), + _ImplicitCtor<_Valid, _UElements...> = true> + constexpr + tuple(_UElements&&... __elements) + noexcept(__nothrow_constructible<_UElements...>()) + : _Inherited(std::forward<_UElements>(__elements)...) + { __glibcxx_no_dangling_refs(_UElements&&); } + + template(), + _ExplicitCtor<_Valid, _UElements...> = false> + explicit constexpr + tuple(_UElements&&... __elements) + noexcept(__nothrow_constructible<_UElements...>()) + : _Inherited(std::forward<_UElements>(__elements)...) + { __glibcxx_no_dangling_refs(_UElements&&); } + + constexpr tuple(const tuple&) = default; + + constexpr tuple(tuple&&) = default; + + template&>(), + _ImplicitCtor<_Valid, const _UElements&...> = true> + constexpr + tuple(const tuple<_UElements...>& __in) + noexcept(__nothrow_constructible()) + : _Inherited(static_cast&>(__in)) + { __glibcxx_no_dangling_refs(const _UElements&); } + + template&>(), + _ExplicitCtor<_Valid, const _UElements&...> = false> + explicit constexpr + tuple(const tuple<_UElements...>& __in) + noexcept(__nothrow_constructible()) + : _Inherited(static_cast&>(__in)) + { __glibcxx_no_dangling_refs(const _UElements&); } + + template&&>(), + _ImplicitCtor<_Valid, _UElements...> = true> + constexpr + tuple(tuple<_UElements...>&& __in) + noexcept(__nothrow_constructible<_UElements...>()) + : _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) + { __glibcxx_no_dangling_refs(_UElements&&); } + + template&&>(), + _ExplicitCtor<_Valid, _UElements...> = false> + explicit constexpr + tuple(tuple<_UElements...>&& __in) + noexcept(__nothrow_constructible<_UElements...>()) + : _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) + { __glibcxx_no_dangling_refs(_UElements&&); } + + // Allocator-extended constructors. + + template::value> = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a) + : _Inherited(__tag, __a) { } + + template::value> = false> + _GLIBCXX20_CONSTEXPR + explicit + tuple(allocator_arg_t __tag, const _Alloc& __a) + : _Inherited(__tag, __a) { } + + template= 1), + _ImplicitCtor<_NotEmpty, const _Elements&...> = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + const _Elements&... __elements) + : _Inherited(__tag, __a, __elements...) { } + + template= 1), + _ExplicitCtor<_NotEmpty, const _Elements&...> = false> + _GLIBCXX20_CONSTEXPR + explicit + tuple(allocator_arg_t __tag, const _Alloc& __a, + const _Elements&... __elements) + : _Inherited(__tag, __a, __elements...) { } + + template(), + _ImplicitCtor<_Valid, _UElements...> = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + _UElements&&... __elements) + : _Inherited(__tag, __a, std::forward<_UElements>(__elements)...) + { __glibcxx_no_dangling_refs(_UElements&&); } + + template(), + _ExplicitCtor<_Valid, _UElements...> = false> + _GLIBCXX20_CONSTEXPR + explicit + tuple(allocator_arg_t __tag, const _Alloc& __a, + _UElements&&... __elements) + : _Inherited(__tag, __a, std::forward<_UElements>(__elements)...) + { __glibcxx_no_dangling_refs(_UElements&&); } + + template + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in) + : _Inherited(__tag, __a, static_cast(__in)) { } + + template + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in) + : _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { } + + template&>(), + _ImplicitCtor<_Valid, const _UElements&...> = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + const tuple<_UElements...>& __in) + : _Inherited(__tag, __a, + static_cast&>(__in)) + { __glibcxx_no_dangling_refs(const _UElements&); } + + template&>(), + _ExplicitCtor<_Valid, const _UElements&...> = false> + _GLIBCXX20_CONSTEXPR + explicit + tuple(allocator_arg_t __tag, const _Alloc& __a, + const tuple<_UElements...>& __in) + : _Inherited(__tag, __a, + static_cast&>(__in)) + { __glibcxx_no_dangling_refs(const _UElements&); } + + template&&>(), + _ImplicitCtor<_Valid, _UElements...> = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + tuple<_UElements...>&& __in) + : _Inherited(__tag, __a, + static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) + { __glibcxx_no_dangling_refs(_UElements&&); } + + template&&>(), + _ExplicitCtor<_Valid, _UElements...> = false> + _GLIBCXX20_CONSTEXPR + explicit + tuple(allocator_arg_t __tag, const _Alloc& __a, + tuple<_UElements...>&& __in) + : _Inherited(__tag, __a, + static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) + { __glibcxx_no_dangling_refs(_UElements&&); } +#endif // concepts && conditional_explicit + + // tuple assignment + +#if __cpp_concepts && __cpp_consteval // >= C++20 + private: + template + static consteval bool + __assignable() + { + if constexpr (sizeof...(_UTypes) == sizeof...(_Elements)) + return __and_v...>; + else + return false; + } + + template + static consteval bool + __nothrow_assignable() + { + if constexpr (sizeof...(_UTypes) == sizeof...(_Elements)) + return __and_v...>; + else + return false; + } + +#if __cpp_lib_ranges_zip // >= C++23 + template + static consteval bool + __const_assignable() + { + if constexpr (sizeof...(_UTypes) == sizeof...(_Elements)) + return __and_v...>; + else + return false; + } +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template + static consteval bool + __assignable_from_tuple_like() + { + return [](index_sequence<_Is...>) { + return __assignable(std::declval<_UTuple>()))...>(); + }(index_sequence_for<_Elements...>{}); + } + + template + static consteval bool + __const_assignable_from_tuple_like() + { + return [](index_sequence<_Is...>) { + return __const_assignable(std::declval<_UTuple>()))...>(); + }(index_sequence_for<_Elements...>{}); + } +#endif // C++23 + + public: + + tuple& operator=(const tuple& __u) = delete; + + constexpr tuple& + operator=(const tuple& __u) + noexcept(__nothrow_assignable()) + requires (__assignable()) + { + this->_M_assign(__u); + return *this; + } + + constexpr tuple& + operator=(tuple&& __u) + noexcept(__nothrow_assignable<_Elements...>()) + requires (__assignable<_Elements...>()) + { + this->_M_assign(std::move(__u)); + return *this; + } + + template + requires (__assignable()) + constexpr tuple& + operator=(const tuple<_UTypes...>& __u) + noexcept(__nothrow_assignable()) + { + this->_M_assign(__u); + return *this; + } + + template + requires (__assignable<_UTypes...>()) + constexpr tuple& + operator=(tuple<_UTypes...>&& __u) + noexcept(__nothrow_assignable<_UTypes...>()) + { + this->_M_assign(std::move(__u)); + return *this; + } + +#if __cpp_lib_ranges_zip // >= C++23 + constexpr const tuple& + operator=(const tuple& __u) const + requires (__const_assignable()) + { + this->_M_assign(__u); + return *this; + } + + constexpr const tuple& + operator=(tuple&& __u) const + requires (__const_assignable<_Elements...>()) + { + this->_M_assign(std::move(__u)); + return *this; + } + + template + constexpr const tuple& + operator=(const tuple<_UTypes...>& __u) const + requires (__const_assignable()) + { + this->_M_assign(__u); + return *this; + } + + template + constexpr const tuple& + operator=(tuple<_UTypes...>&& __u) const + requires (__const_assignable<_UTypes...>()) + { + this->_M_assign(std::move(__u)); + return *this; + } +#endif // C++23 + + template + requires (__assignable()) + constexpr tuple& + operator=(const pair<_U1, _U2>& __u) + noexcept(__nothrow_assignable()) + { + this->_M_head(*this) = __u.first; + this->_M_tail(*this)._M_head(*this) = __u.second; + return *this; + } + + template + requires (__assignable<_U1, _U2>()) + constexpr tuple& + operator=(pair<_U1, _U2>&& __u) + noexcept(__nothrow_assignable<_U1, _U2>()) + { + this->_M_head(*this) = std::forward<_U1>(__u.first); + this->_M_tail(*this)._M_head(*this) = std::forward<_U2>(__u.second); + return *this; + } + +#if __cpp_lib_ranges_zip // >= C++23 + template + requires (__const_assignable()) + constexpr const tuple& + operator=(const pair<_U1, _U2>& __u) const + { + this->_M_head(*this) = __u.first; + this->_M_tail(*this)._M_head(*this) = __u.second; + return *this; + } + + template + requires (__const_assignable<_U1, _U2>()) + constexpr const tuple& + operator=(pair<_U1, _U2>&& __u) const + { + this->_M_head(*this) = std::forward<_U1>(__u.first); + this->_M_tail(*this)._M_head(*this) = std::forward<_U2>(__u.second); + return *this; + } +#endif // C++23 + +#if __cpp_lib_tuple_like // >= C++23 + template<__eligible_tuple_like _UTuple> + requires (__assignable_from_tuple_like<_UTuple>()) + constexpr tuple& + operator=(_UTuple&& __u) + { + this->_M_assign(__tuple_like_tag_t{}, std::forward<_UTuple>(__u)); + return *this; + } + + template<__eligible_tuple_like _UTuple> + requires (__const_assignable_from_tuple_like<_UTuple>()) + constexpr const tuple& + operator=(_UTuple&& __u) const + { + this->_M_assign(__tuple_like_tag_t{}, std::forward<_UTuple>(__u)); + return *this; + } + + template<__tuple_like _UTuple> + requires (!__is_tuple_v<_UTuple>) + friend constexpr bool + operator== [[nodiscard]] (const tuple& __t, const _UTuple& __u) + { + static_assert(sizeof...(_Elements) == tuple_size_v<_UTuple>, + "tuple objects can only be compared if they have equal sizes."); + return [&](index_sequence<_Is...>) { + return (bool(std::get<_Is>(__t) == std::get<_Is>(__u)) + && ...); + }(index_sequence_for<_Elements...>{}); + } + + template<__tuple_like _UTuple, + typename = make_index_sequence>> + struct __tuple_like_common_comparison_category; + + template<__tuple_like _UTuple, size_t... _Is> + requires requires + { typename void_t<__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>; } + struct __tuple_like_common_comparison_category<_UTuple, index_sequence<_Is...>> + { + using type = common_comparison_category_t + <__detail::__synth3way_t<_Elements, tuple_element_t<_Is, _UTuple>>...>; + }; + + template<__tuple_like _UTuple> + requires (!__is_tuple_v<_UTuple>) + friend constexpr typename __tuple_like_common_comparison_category<_UTuple>::type + operator<=>(const tuple& __t, const _UTuple& __u) + { + using _Cat = typename __tuple_like_common_comparison_category<_UTuple>::type; + return std::__tuple_cmp<_Cat>(__t, __u, index_sequence_for<_Elements...>()); + } +#endif // C++23 + +#else // ! (concepts && consteval) + + private: + template + static constexpr + __enable_if_t + __assignable() + { return __and_...>::value; } + + // Condition for noexcept-specifier of an assignment operator. + template + static constexpr bool __nothrow_assignable() + { + return + __and_...>::value; + } + + public: + + _GLIBCXX20_CONSTEXPR + tuple& + operator=(__conditional_t<__assignable(), + const tuple&, + const __nonesuch&> __in) + noexcept(__nothrow_assignable()) + { + this->_M_assign(__in); + return *this; + } + + _GLIBCXX20_CONSTEXPR + tuple& + operator=(__conditional_t<__assignable<_Elements...>(), + tuple&&, + __nonesuch&&> __in) + noexcept(__nothrow_assignable<_Elements...>()) + { + this->_M_assign(std::move(__in)); + return *this; + } + + template + _GLIBCXX20_CONSTEXPR + __enable_if_t<__assignable(), tuple&> + operator=(const tuple<_UElements...>& __in) + noexcept(__nothrow_assignable()) + { + this->_M_assign(__in); + return *this; + } + + template + _GLIBCXX20_CONSTEXPR + __enable_if_t<__assignable<_UElements...>(), tuple&> + operator=(tuple<_UElements...>&& __in) + noexcept(__nothrow_assignable<_UElements...>()) + { + this->_M_assign(std::move(__in)); + return *this; + } +#endif // concepts && consteval + + // tuple swap + _GLIBCXX20_CONSTEXPR + void + swap(tuple& __in) + noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value) + { _Inherited::_M_swap(__in); } + +#if __cpp_lib_ranges_zip // >= C++23 + // As an extension, we constrain the const swap member function in order + // to continue accepting explicit instantiation of tuples whose elements + // are not all const swappable. Without this constraint, such an + // explicit instantiation would also instantiate the ill-formed body of + // this function and yield a hard error. This constraint shouldn't + // affect the behavior of valid programs. + constexpr void + swap(const tuple& __in) const + noexcept(__and_v<__is_nothrow_swappable...>) + requires (is_swappable_v && ...) + { _Inherited::_M_swap(__in); } +#endif // C++23 + }; + +#if __cpp_deduction_guides >= 201606 + template + tuple(_UTypes...) -> tuple<_UTypes...>; + template + tuple(pair<_T1, _T2>) -> tuple<_T1, _T2>; + template + tuple(allocator_arg_t, _Alloc, _UTypes...) -> tuple<_UTypes...>; + template + tuple(allocator_arg_t, _Alloc, pair<_T1, _T2>) -> tuple<_T1, _T2>; + template + tuple(allocator_arg_t, _Alloc, tuple<_UTypes...>) -> tuple<_UTypes...>; +#endif + + // Explicit specialization, zero-element tuple. + template<> + class tuple<> + { + public: + _GLIBCXX20_CONSTEXPR + void swap(tuple&) noexcept { /* no-op */ } +#if __cpp_lib_ranges_zip // >= C++23 + constexpr void swap(const tuple&) const noexcept { /* no-op */ } +#endif + // We need the default since we're going to define no-op + // allocator constructors. + tuple() = default; + // No-op allocator constructors. + template + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t, const _Alloc&) noexcept { } + template + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept { } + }; + +#if !(__cpp_concepts && __cpp_consteval && __cpp_conditional_explicit) // !C++20 + /// Partial specialization, 2-element tuple. + /// Includes construction and assignment from a pair. + template + class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2> + { + typedef _Tuple_impl<0, _T1, _T2> _Inherited; + + // Constraint for non-explicit default constructor + template + using _ImplicitDefaultCtor = __enable_if_t< + _TupleConstraints<_Dummy, _U1, _U2>:: + __is_implicitly_default_constructible(), + bool>; + + // Constraint for explicit default constructor + template + using _ExplicitDefaultCtor = __enable_if_t< + _TupleConstraints<_Dummy, _U1, _U2>:: + __is_explicitly_default_constructible(), + bool>; + + template + using _TCC = _TupleConstraints<_Dummy, _T1, _T2>; + + // Constraint for non-explicit constructors + template + using _ImplicitCtor = __enable_if_t< + _TCC<_Cond>::template __is_implicitly_constructible<_U1, _U2>(), + bool>; + + // Constraint for non-explicit constructors + template + using _ExplicitCtor = __enable_if_t< + _TCC<_Cond>::template __is_explicitly_constructible<_U1, _U2>(), + bool>; + + template + static constexpr bool __assignable() + { + return __and_, + is_assignable<_T2&, _U2>>::value; + } + + template + static constexpr bool __nothrow_assignable() + { + return __and_, + is_nothrow_assignable<_T2&, _U2>>::value; + } + + template + static constexpr bool __nothrow_constructible() + { + return __and_, + is_nothrow_constructible<_T2, _U2>>::value; + } + + static constexpr bool __nothrow_default_constructible() + { + return __and_, + is_nothrow_default_constructible<_T2>>::value; + } + + template + static constexpr bool __is_alloc_arg() + { return is_same<__remove_cvref_t<_U1>, allocator_arg_t>::value; } + + /// @cond undocumented +#undef __glibcxx_no_dangling_refs + // Error if construction from _U1 and _U2 would create a dangling ref. +#if __has_builtin(__reference_constructs_from_temporary) \ + && defined _GLIBCXX_DEBUG +# define __glibcxx_no_dangling_refs(_U1, _U2) \ + static_assert(!__reference_constructs_from_temporary(_T1, _U1) \ + && !__reference_constructs_from_temporary(_T2, _U2), \ + "std::tuple constructor creates a dangling reference") +#else +# define __glibcxx_no_dangling_refs(_U1, _U2) +#endif + /// @endcond + + public: + template = true> + constexpr + tuple() + noexcept(__nothrow_default_constructible()) + : _Inherited() { } + + template = false> + explicit constexpr + tuple() + noexcept(__nothrow_default_constructible()) + : _Inherited() { } + + template = true> + constexpr + tuple(const _T1& __a1, const _T2& __a2) + noexcept(__nothrow_constructible()) + : _Inherited(__a1, __a2) { } + + template = false> + explicit constexpr + tuple(const _T1& __a1, const _T2& __a2) + noexcept(__nothrow_constructible()) + : _Inherited(__a1, __a2) { } + + template(), _U1, _U2> = true> + constexpr + tuple(_U1&& __a1, _U2&& __a2) + noexcept(__nothrow_constructible<_U1, _U2>()) + : _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template(), _U1, _U2> = false> + explicit constexpr + tuple(_U1&& __a1, _U2&& __a2) + noexcept(__nothrow_constructible<_U1, _U2>()) + : _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + constexpr tuple(const tuple&) = default; + + constexpr tuple(tuple&&) = default; + + template = true> + constexpr + tuple(const tuple<_U1, _U2>& __in) + noexcept(__nothrow_constructible()) + : _Inherited(static_cast&>(__in)) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + + template = false> + explicit constexpr + tuple(const tuple<_U1, _U2>& __in) + noexcept(__nothrow_constructible()) + : _Inherited(static_cast&>(__in)) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + + template = true> + constexpr + tuple(tuple<_U1, _U2>&& __in) + noexcept(__nothrow_constructible<_U1, _U2>()) + : _Inherited(static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template = false> + explicit constexpr + tuple(tuple<_U1, _U2>&& __in) + noexcept(__nothrow_constructible<_U1, _U2>()) + : _Inherited(static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template = true> + constexpr + tuple(const pair<_U1, _U2>& __in) + noexcept(__nothrow_constructible()) + : _Inherited(__in.first, __in.second) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + + template = false> + explicit constexpr + tuple(const pair<_U1, _U2>& __in) + noexcept(__nothrow_constructible()) + : _Inherited(__in.first, __in.second) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + + template = true> + constexpr + tuple(pair<_U1, _U2>&& __in) + noexcept(__nothrow_constructible<_U1, _U2>()) + : _Inherited(std::forward<_U1>(__in.first), + std::forward<_U2>(__in.second)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template = false> + explicit constexpr + tuple(pair<_U1, _U2>&& __in) + noexcept(__nothrow_constructible<_U1, _U2>()) + : _Inherited(std::forward<_U1>(__in.first), + std::forward<_U2>(__in.second)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + // Allocator-extended constructors. + + template::value, _T1, _T2> = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a) + : _Inherited(__tag, __a) { } + + template::value, _T1, _T2> = false> + _GLIBCXX20_CONSTEXPR + explicit + tuple(allocator_arg_t __tag, const _Alloc& __a) + : _Inherited(__tag, __a) { } + + template = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + const _T1& __a1, const _T2& __a2) + : _Inherited(__tag, __a, __a1, __a2) { } + + template = false> + explicit + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + const _T1& __a1, const _T2& __a2) + : _Inherited(__tag, __a, __a1, __a2) { } + + template = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, _U1&& __a1, _U2&& __a2) + : _Inherited(__tag, __a, std::forward<_U1>(__a1), + std::forward<_U2>(__a2)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template = false> + explicit + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + _U1&& __a1, _U2&& __a2) + : _Inherited(__tag, __a, std::forward<_U1>(__a1), + std::forward<_U2>(__a2)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in) + : _Inherited(__tag, __a, static_cast(__in)) { } + + template + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in) + : _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { } + + template = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + const tuple<_U1, _U2>& __in) + : _Inherited(__tag, __a, + static_cast&>(__in)) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + + template = false> + explicit + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + const tuple<_U1, _U2>& __in) + : _Inherited(__tag, __a, + static_cast&>(__in)) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + + template = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1, _U2>&& __in) + : _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template = false> + explicit + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1, _U2>&& __in) + : _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + const pair<_U1, _U2>& __in) + : _Inherited(__tag, __a, __in.first, __in.second) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + + template = false> + explicit + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, + const pair<_U1, _U2>& __in) + : _Inherited(__tag, __a, __in.first, __in.second) + { __glibcxx_no_dangling_refs(const _U1&, const _U2&); } + + template = true> + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>&& __in) + : _Inherited(__tag, __a, std::forward<_U1>(__in.first), + std::forward<_U2>(__in.second)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + template = false> + explicit + _GLIBCXX20_CONSTEXPR + tuple(allocator_arg_t __tag, const _Alloc& __a, pair<_U1, _U2>&& __in) + : _Inherited(__tag, __a, std::forward<_U1>(__in.first), + std::forward<_U2>(__in.second)) + { __glibcxx_no_dangling_refs(_U1&&, _U2&&); } + + // Tuple assignment. + + _GLIBCXX20_CONSTEXPR + tuple& + operator=(__conditional_t<__assignable(), + const tuple&, + const __nonesuch&> __in) + noexcept(__nothrow_assignable()) + { + this->_M_assign(__in); + return *this; + } + + _GLIBCXX20_CONSTEXPR + tuple& + operator=(__conditional_t<__assignable<_T1, _T2>(), + tuple&&, + __nonesuch&&> __in) + noexcept(__nothrow_assignable<_T1, _T2>()) + { + this->_M_assign(std::move(__in)); + return *this; + } + + template + _GLIBCXX20_CONSTEXPR + __enable_if_t<__assignable(), tuple&> + operator=(const tuple<_U1, _U2>& __in) + noexcept(__nothrow_assignable()) + { + this->_M_assign(__in); + return *this; + } + + template + _GLIBCXX20_CONSTEXPR + __enable_if_t<__assignable<_U1, _U2>(), tuple&> + operator=(tuple<_U1, _U2>&& __in) + noexcept(__nothrow_assignable<_U1, _U2>()) + { + this->_M_assign(std::move(__in)); + return *this; + } + + template + _GLIBCXX20_CONSTEXPR + __enable_if_t<__assignable(), tuple&> + operator=(const pair<_U1, _U2>& __in) + noexcept(__nothrow_assignable()) + { + this->_M_head(*this) = __in.first; + this->_M_tail(*this)._M_head(*this) = __in.second; + return *this; + } + + template + _GLIBCXX20_CONSTEXPR + __enable_if_t<__assignable<_U1, _U2>(), tuple&> + operator=(pair<_U1, _U2>&& __in) + noexcept(__nothrow_assignable<_U1, _U2>()) + { + this->_M_head(*this) = std::forward<_U1>(__in.first); + this->_M_tail(*this)._M_head(*this) = std::forward<_U2>(__in.second); + return *this; + } + + _GLIBCXX20_CONSTEXPR + void + swap(tuple& __in) + noexcept(__and_<__is_nothrow_swappable<_T1>, + __is_nothrow_swappable<_T2>>::value) + { _Inherited::_M_swap(__in); } + }; +#endif // concepts && conditional_explicit + + /// class tuple_size + template + struct tuple_size> + : public integral_constant { }; + +#if __cplusplus >= 201703L + template + inline constexpr size_t tuple_size_v> + = sizeof...(_Types); + + template + inline constexpr size_t tuple_size_v> + = sizeof...(_Types); +#endif + + /// Trait to get the Ith element type from a tuple. + template + struct tuple_element<__i, tuple<_Types...>> + { + static_assert(__i < sizeof...(_Types), "tuple index must be in range"); + + using type = typename _Nth_type<__i, _Types...>::type; + }; + + template + constexpr _Head& + __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept + { return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); } + + template + constexpr const _Head& + __get_helper(const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept + { return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); } + + // Deleted overload to improve diagnostics for invalid indices + template + __enable_if_t<(__i >= sizeof...(_Types))> + __get_helper(const tuple<_Types...>&) = delete; + + /// Return a reference to the ith element of a tuple. + template + constexpr __tuple_element_t<__i, tuple<_Elements...>>& + get(tuple<_Elements...>& __t) noexcept + { return std::__get_helper<__i>(__t); } + + /// Return a const reference to the ith element of a const tuple. + template + constexpr const __tuple_element_t<__i, tuple<_Elements...>>& + get(const tuple<_Elements...>& __t) noexcept + { return std::__get_helper<__i>(__t); } + + /// Return an rvalue reference to the ith element of a tuple rvalue. + template + constexpr __tuple_element_t<__i, tuple<_Elements...>>&& + get(tuple<_Elements...>&& __t) noexcept + { + typedef __tuple_element_t<__i, tuple<_Elements...>> __element_type; + return std::forward<__element_type>(std::__get_helper<__i>(__t)); + } + + /// Return a const rvalue reference to the ith element of a const tuple rvalue. + template + constexpr const __tuple_element_t<__i, tuple<_Elements...>>&& + get(const tuple<_Elements...>&& __t) noexcept + { + typedef __tuple_element_t<__i, tuple<_Elements...>> __element_type; + return std::forward(std::__get_helper<__i>(__t)); + } + + /// @cond undocumented + // Deleted overload chosen for invalid indices. + template + constexpr __enable_if_t<(__i >= sizeof...(_Elements))> + get(const tuple<_Elements...>&) = delete; + /// @endcond + +#ifdef __cpp_lib_tuples_by_type // C++ >= 14 + /// Return a reference to the unique element of type _Tp of a tuple. + template + constexpr _Tp& + get(tuple<_Types...>& __t) noexcept + { + constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>(); + static_assert(__idx < sizeof...(_Types), + "the type T in std::get must occur exactly once in the tuple"); + return std::__get_helper<__idx>(__t); + } + + /// Return a reference to the unique element of type _Tp of a tuple rvalue. + template + constexpr _Tp&& + get(tuple<_Types...>&& __t) noexcept + { + constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>(); + static_assert(__idx < sizeof...(_Types), + "the type T in std::get must occur exactly once in the tuple"); + return std::forward<_Tp>(std::__get_helper<__idx>(__t)); + } + + /// Return a const reference to the unique element of type _Tp of a tuple. + template + constexpr const _Tp& + get(const tuple<_Types...>& __t) noexcept + { + constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>(); + static_assert(__idx < sizeof...(_Types), + "the type T in std::get must occur exactly once in the tuple"); + return std::__get_helper<__idx>(__t); + } + + /// Return a const reference to the unique element of type _Tp of + /// a const tuple rvalue. + template + constexpr const _Tp&& + get(const tuple<_Types...>&& __t) noexcept + { + constexpr size_t __idx = __find_uniq_type_in_pack<_Tp, _Types...>(); + static_assert(__idx < sizeof...(_Types), + "the type T in std::get must occur exactly once in the tuple"); + return std::forward(std::__get_helper<__idx>(__t)); + } +#endif + +#if __cpp_lib_three_way_comparison + template + requires (sizeof...(_Tps) == sizeof...(_Ups)) + && (requires (const _Tps& __t, const _Ups& __u) { + { __t == __u } -> __detail::__boolean_testable; + } && ...) + constexpr bool + operator== [[nodiscard]] (const tuple<_Tps...>& __t, + const tuple<_Ups...>& __u) + { + return [&](index_sequence<_Inds...>) { + // Fold == over the tuples until non-equal elements are found. + return (bool(std::get<_Inds>(__t) == std::get<_Inds>(__u)) && ...); + }(index_sequence_for<_Tps...>{}); + } + + template + [[nodiscard]] + constexpr _Cat + __tuple_cmp(const _Tp& __t, const _Up& __u, _IndexSeq __indices) + { + _Cat __c = _Cat::equivalent; + + // Set __c to the comparison result of two corresponding elements. + // Return true they are equivalent. + auto __cmp = [&](integral_constant) { + __c = __detail::__synth3way(std::get<_Ind>(__t), std::get<_Ind>(__u)); + return __c == 0; + }; + + [&](index_sequence<_Inds...>) { + // Fold __cmp over the tuples until non-equivalent elements are found. + (void)(__cmp(integral_constant{}) && ...); + }(__indices); + + return __c; + } + + template + requires (sizeof...(_Tps) == sizeof...(_Ups)) + && (requires { typename __detail::__synth3way_t<_Tps, _Ups>; } && ...) + constexpr + common_comparison_category_t<__detail::__synth3way_t<_Tps, _Ups>...> + operator<=> [[nodiscard]] (const tuple<_Tps...>& __t, + const tuple<_Ups...>& __u) + { + using _Cat + = common_comparison_category_t<__detail::__synth3way_t<_Tps, _Ups>...>; + return std::__tuple_cmp<_Cat>(__t, __u, index_sequence_for<_Tps...>()); + } +#else + + // This class performs the comparison operations on tuples + template + struct __tuple_compare + { + static constexpr bool + __eq(const _Tp& __t, const _Up& __u) + { + return bool(std::get<__i>(__t) == std::get<__i>(__u)) + && __tuple_compare<_Tp, _Up, __i + 1, __size>::__eq(__t, __u); + } + + static constexpr bool + __less(const _Tp& __t, const _Up& __u) + { + return bool(std::get<__i>(__t) < std::get<__i>(__u)) + || (!bool(std::get<__i>(__u) < std::get<__i>(__t)) + && __tuple_compare<_Tp, _Up, __i + 1, __size>::__less(__t, __u)); + } + }; + + template + struct __tuple_compare<_Tp, _Up, __size, __size> + { + static constexpr bool + __eq(const _Tp&, const _Up&) { return true; } + + static constexpr bool + __less(const _Tp&, const _Up&) { return false; } + }; + + template + _GLIBCXX_NODISCARD + constexpr bool + operator==(const tuple<_TElements...>& __t, + const tuple<_UElements...>& __u) + { + static_assert(sizeof...(_TElements) == sizeof...(_UElements), + "tuple objects can only be compared if they have equal sizes."); + using __compare = __tuple_compare, + tuple<_UElements...>, + 0, sizeof...(_TElements)>; + return __compare::__eq(__t, __u); + } + + template + _GLIBCXX_NODISCARD + constexpr bool + operator<(const tuple<_TElements...>& __t, + const tuple<_UElements...>& __u) + { + static_assert(sizeof...(_TElements) == sizeof...(_UElements), + "tuple objects can only be compared if they have equal sizes."); + using __compare = __tuple_compare, + tuple<_UElements...>, + 0, sizeof...(_TElements)>; + return __compare::__less(__t, __u); + } + + template + _GLIBCXX_NODISCARD + constexpr bool + operator!=(const tuple<_TElements...>& __t, + const tuple<_UElements...>& __u) + { return !(__t == __u); } + + template + _GLIBCXX_NODISCARD + constexpr bool + operator>(const tuple<_TElements...>& __t, + const tuple<_UElements...>& __u) + { return __u < __t; } + + template + _GLIBCXX_NODISCARD + constexpr bool + operator<=(const tuple<_TElements...>& __t, + const tuple<_UElements...>& __u) + { return !(__u < __t); } + + template + _GLIBCXX_NODISCARD + constexpr bool + operator>=(const tuple<_TElements...>& __t, + const tuple<_UElements...>& __u) + { return !(__t < __u); } +#endif // three_way_comparison + + // NB: DR 705. + /// Create a tuple containing copies of the arguments + template + constexpr tuple::__type...> + make_tuple(_Elements&&... __args) + { + typedef tuple::__type...> + __result_type; + return __result_type(std::forward<_Elements>(__args)...); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2275. Why is forward_as_tuple not constexpr? + /// Create a tuple of lvalue or rvalue references to the arguments + template + constexpr tuple<_Elements&&...> + forward_as_tuple(_Elements&&... __args) noexcept + { return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); } + + /// @cond undocumented + template + struct __make_tuple_impl; + + template + struct __make_tuple_impl<_Idx, tuple<_Tp...>, _Tuple, _Nm> + : __make_tuple_impl<_Idx + 1, + tuple<_Tp..., __tuple_element_t<_Idx, _Tuple>>, + _Tuple, _Nm> + { }; + + template + struct __make_tuple_impl<_Nm, tuple<_Tp...>, _Tuple, _Nm> + { + typedef tuple<_Tp...> __type; + }; + + template + struct __do_make_tuple + : __make_tuple_impl<0, tuple<>, _Tuple, tuple_size<_Tuple>::value> + { }; + + // Returns the std::tuple equivalent of a tuple-like type. + template + struct __make_tuple + : public __do_make_tuple<__remove_cvref_t<_Tuple>> + { }; + + // Combines several std::tuple's into a single one. + template + struct __combine_tuples; + + template<> + struct __combine_tuples<> + { + typedef tuple<> __type; + }; + + template + struct __combine_tuples> + { + typedef tuple<_Ts...> __type; + }; + + template + struct __combine_tuples, tuple<_T2s...>, _Rem...> + { + typedef typename __combine_tuples, + _Rem...>::__type __type; + }; + + // Computes the result type of tuple_cat given a set of tuple-like types. + template + struct __tuple_cat_result + { + typedef typename __combine_tuples + ::__type...>::__type __type; + }; + + // Helper to determine the index set for the first tuple-like + // type of a given set. + template + struct __make_1st_indices; + + template<> + struct __make_1st_indices<> + { + typedef _Index_tuple<> __type; + }; + + template + struct __make_1st_indices<_Tp, _Tpls...> + { + typedef typename _Build_index_tuple::type>::value>::__type __type; + }; + + // Performs the actual concatenation by step-wise expanding tuple-like + // objects into the elements, which are finally forwarded into the + // result tuple. + template + struct __tuple_concater; + + template + struct __tuple_concater<_Ret, _Index_tuple<_Is...>, _Tp, _Tpls...> + { + template + static constexpr _Ret + _S_do(_Tp&& __tp, _Tpls&&... __tps, _Us&&... __us) + { + typedef typename __make_1st_indices<_Tpls...>::__type __idx; + typedef __tuple_concater<_Ret, __idx, _Tpls...> __next; + return __next::_S_do(std::forward<_Tpls>(__tps)..., + std::forward<_Us>(__us)..., + std::get<_Is>(std::forward<_Tp>(__tp))...); + } + }; + + template + struct __tuple_concater<_Ret, _Index_tuple<>> + { + template + static constexpr _Ret + _S_do(_Us&&... __us) + { + return _Ret(std::forward<_Us>(__us)...); + } + }; + + template + struct __is_tuple_like_impl> : true_type + { }; + /// @endcond + + /// Create a `tuple` containing all elements from multiple tuple-like objects +#if __cpp_lib_tuple_like // >= C++23 + template<__tuple_like... _Tpls> +#else + template...>::value>::type> +#endif + constexpr auto + tuple_cat(_Tpls&&... __tpls) + -> typename __tuple_cat_result<_Tpls...>::__type + { + typedef typename __tuple_cat_result<_Tpls...>::__type __ret; + typedef typename __make_1st_indices<_Tpls...>::__type __idx; + typedef __tuple_concater<__ret, __idx, _Tpls...> __concater; + return __concater::_S_do(std::forward<_Tpls>(__tpls)...); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2301. Why is tie not constexpr? + /// Return a tuple of lvalue references bound to the arguments + template + constexpr tuple<_Elements&...> + tie(_Elements&... __args) noexcept + { return tuple<_Elements&...>(__args...); } + + /// Exchange the values of two tuples + template + _GLIBCXX20_CONSTEXPR + inline +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + // Constrained free swap overload, see p0185r1 + typename enable_if<__and_<__is_swappable<_Elements>...>::value + >::type +#else + void +#endif + swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +#if __cpp_lib_ranges_zip // >= C++23 + template + requires (is_swappable_v && ...) + constexpr void + swap(const tuple<_Elements...>& __x, const tuple<_Elements...>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } +#endif // C++23 + +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + /// Exchange the values of two const tuples (if const elements can be swapped) + template + _GLIBCXX20_CONSTEXPR + typename enable_if...>::value>::type + swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete; +#endif + + /// Partial specialization for tuples + template + struct uses_allocator, _Alloc> : true_type { }; + + // See stl_pair.h... + /** "piecewise construction" using a tuple of arguments for each member. + * + * @param __first Arguments for the first member of the pair. + * @param __second Arguments for the second member of the pair. + * + * The elements of each tuple will be used as the constructor arguments + * for the data members of the pair. + */ + template + template + _GLIBCXX20_CONSTEXPR + inline + pair<_T1, _T2>:: + pair(piecewise_construct_t, + tuple<_Args1...> __first, tuple<_Args2...> __second) + : pair(__first, __second, + typename _Build_index_tuple::__type(), + typename _Build_index_tuple::__type()) + { } + + template + template + _GLIBCXX20_CONSTEXPR inline + pair<_T1, _T2>:: + pair(tuple<_Args1...>& __tuple1, tuple<_Args2...>& __tuple2, + _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>) + : first(std::forward<_Args1>(std::get<_Indexes1>(__tuple1))...), + second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...) + { } + +#if defined(__cpp_lib_apply) || defined(__cpp_lib_make_from_tuple) // C++ >= 17 + // Unpack a std::tuple into a type trait and use its value. + // For cv std::tuple<_Up> the result is _Trait<_Tp, cv _Up...>::value. + // For cv std::tuple<_Up>& the result is _Trait<_Tp, cv _Up&...>::value. + // Otherwise the result is false (because we don't know if std::get throws). + template class _Trait, typename _Tp, typename _Tuple> + inline constexpr bool __unpack_std_tuple = false; + + template class _Trait, typename _Tp, typename... _Up> + inline constexpr bool __unpack_std_tuple<_Trait, _Tp, tuple<_Up...>> + = _Trait<_Tp, _Up...>::value; + + template class _Trait, typename _Tp, typename... _Up> + inline constexpr bool __unpack_std_tuple<_Trait, _Tp, tuple<_Up...>&> + = _Trait<_Tp, _Up&...>::value; + + template class _Trait, typename _Tp, typename... _Up> + inline constexpr bool __unpack_std_tuple<_Trait, _Tp, const tuple<_Up...>> + = _Trait<_Tp, const _Up...>::value; + + template class _Trait, typename _Tp, typename... _Up> + inline constexpr bool __unpack_std_tuple<_Trait, _Tp, const tuple<_Up...>&> + = _Trait<_Tp, const _Up&...>::value; +#endif + +#ifdef __cpp_lib_apply // C++ >= 17 + template + constexpr decltype(auto) + __apply_impl(_Fn&& __f, _Tuple&& __t, index_sequence<_Idx...>) + { + return std::__invoke(std::forward<_Fn>(__f), + std::get<_Idx>(std::forward<_Tuple>(__t))...); + } + +#if __cpp_lib_tuple_like // >= C++23 + template +#else + template +#endif + constexpr decltype(auto) + apply(_Fn&& __f, _Tuple&& __t) + noexcept(__unpack_std_tuple) + { + using _Indices + = make_index_sequence>>; + return std::__apply_impl(std::forward<_Fn>(__f), + std::forward<_Tuple>(__t), + _Indices{}); + } +#endif + +#ifdef __cpp_lib_make_from_tuple // C++ >= 17 + template + constexpr _Tp + __make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>) + { return _Tp(std::get<_Idx>(std::forward<_Tuple>(__t))...); } + +#if __cpp_lib_tuple_like // >= C++23 + template +#else + template +#endif + constexpr _Tp + make_from_tuple(_Tuple&& __t) + noexcept(__unpack_std_tuple) + { + constexpr size_t __n = tuple_size_v>; +#if __has_builtin(__reference_constructs_from_temporary) + if constexpr (__n == 1) + { + using _Elt = decltype(std::get<0>(std::declval<_Tuple>())); + static_assert(!__reference_constructs_from_temporary(_Tp, _Elt)); + } +#endif + return __make_from_tuple_impl<_Tp>(std::forward<_Tuple>(__t), + make_index_sequence<__n>{}); + } +#endif + +#if __cpp_lib_tuple_like // >= C++23 + template<__tuple_like _TTuple, __tuple_like _UTuple, + template class _TQual, template class _UQual, + typename = make_index_sequence>> + struct __tuple_like_common_reference; + + template<__tuple_like _TTuple, __tuple_like _UTuple, + template class _TQual, template class _UQual, + size_t... _Is> + requires requires + { typename tuple>, + _UQual>>...>; } + struct __tuple_like_common_reference<_TTuple, _UTuple, _TQual, _UQual, index_sequence<_Is...>> + { + using type = tuple>, + _UQual>>...>; + }; + + template<__tuple_like _TTuple, __tuple_like _UTuple, + template class _TQual, template class _UQual> + requires (__is_tuple_v<_TTuple> || __is_tuple_v<_UTuple>) + && is_same_v<_TTuple, decay_t<_TTuple>> + && is_same_v<_UTuple, decay_t<_UTuple>> + && (tuple_size_v<_TTuple> == tuple_size_v<_UTuple>) + && requires { typename __tuple_like_common_reference<_TTuple, _UTuple, _TQual, _UQual>::type; } + struct basic_common_reference<_TTuple, _UTuple, _TQual, _UQual> + { + using type = typename __tuple_like_common_reference<_TTuple, _UTuple, _TQual, _UQual>::type; + }; + + template<__tuple_like _TTuple, __tuple_like _UTuple, + typename = make_index_sequence>> + struct __tuple_like_common_type; + + template<__tuple_like _TTuple, __tuple_like _UTuple, size_t... _Is> + requires requires + { typename tuple, + tuple_element_t<_Is, _UTuple>>...>; } + struct __tuple_like_common_type<_TTuple, _UTuple, index_sequence<_Is...>> + { + using type = tuple, + tuple_element_t<_Is, _UTuple>>...>; + }; + + template<__tuple_like _TTuple, __tuple_like _UTuple> + requires (__is_tuple_v<_TTuple> || __is_tuple_v<_UTuple>) + && is_same_v<_TTuple, decay_t<_TTuple>> + && is_same_v<_UTuple, decay_t<_UTuple>> + && (tuple_size_v<_TTuple> == tuple_size_v<_UTuple>) + && requires { typename __tuple_like_common_type<_TTuple, _UTuple>::type; } + struct common_type<_TTuple, _UTuple> + { + using type = typename __tuple_like_common_type<_TTuple, _UTuple>::type; + }; +#endif // C++23 + + /// @} + +#undef __glibcxx_no_dangling_refs + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_TUPLE diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@tuple.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@tuple.blob new file mode 100644 index 0000000..b9539e0 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@tuple.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@type_traits b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@type_traits new file mode 100644 index 0000000..5340941 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@type_traits @@ -0,0 +1,4190 @@ +// C++11 -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/type_traits + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_TYPE_TRAITS +#define _GLIBCXX_TYPE_TRAITS 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#if __cplusplus < 201103L +# include +#else + +#include + +#define __glibcxx_want_bool_constant +#define __glibcxx_want_bounded_array_traits +#define __glibcxx_want_common_reference +#define __glibcxx_want_has_unique_object_representations +#define __glibcxx_want_integral_constant_callable +#define __glibcxx_want_is_aggregate +#define __glibcxx_want_is_constant_evaluated +#define __glibcxx_want_is_final +#define __glibcxx_want_is_invocable +#define __glibcxx_want_is_layout_compatible +#define __glibcxx_want_is_nothrow_convertible +#define __glibcxx_want_is_null_pointer +#define __glibcxx_want_is_pointer_interconvertible +#define __glibcxx_want_is_scoped_enum +#define __glibcxx_want_is_swappable +#define __glibcxx_want_is_virtual_base_of +#define __glibcxx_want_logical_traits +#define __glibcxx_want_reference_from_temporary +#define __glibcxx_want_remove_cvref +#define __glibcxx_want_result_of_sfinae +#define __glibcxx_want_transformation_trait_aliases +#define __glibcxx_want_type_identity +#define __glibcxx_want_type_trait_variable_templates +#define __glibcxx_want_unwrap_ref +#define __glibcxx_want_void_t +#include + +extern "C++" +{ +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + class reference_wrapper; + + /** + * @defgroup metaprogramming Metaprogramming + * @ingroup utilities + * + * Template utilities for compile-time introspection and modification, + * including type classification traits, type property inspection traits + * and type transformation traits. + * + * @since C++11 + * + * @{ + */ + + /// integral_constant + template + struct integral_constant + { + static constexpr _Tp value = __v; + using value_type = _Tp; + using type = integral_constant<_Tp, __v>; + constexpr operator value_type() const noexcept { return value; } + +#ifdef __cpp_lib_integral_constant_callable // C++ >= 14 + constexpr value_type operator()() const noexcept { return value; } +#endif + }; + +#if ! __cpp_inline_variables + template + constexpr _Tp integral_constant<_Tp, __v>::value; +#endif + + /// @cond undocumented + /// bool_constant for C++11 + template + using __bool_constant = integral_constant; + /// @endcond + + /// The type used as a compile-time boolean with true value. + using true_type = __bool_constant; + + /// The type used as a compile-time boolean with false value. + using false_type = __bool_constant; + +#ifdef __cpp_lib_bool_constant // C++ >= 17 + /// Alias template for compile-time boolean constant types. + /// @since C++17 + template + using bool_constant = __bool_constant<__v>; +#endif + + // Metaprogramming helper types. + + // Primary template. + /// Define a member typedef `type` only if a boolean constant is true. + template + struct enable_if + { }; + + // Partial specialization for true. + template + struct enable_if + { using type = _Tp; }; + + // __enable_if_t (std::enable_if_t for C++11) + template + using __enable_if_t = typename enable_if<_Cond, _Tp>::type; + + template + struct __conditional + { + template + using type = _Tp; + }; + + template<> + struct __conditional + { + template + using type = _Up; + }; + + // More efficient version of std::conditional_t for internal use (and C++11) + template + using __conditional_t + = typename __conditional<_Cond>::template type<_If, _Else>; + + /// @cond undocumented + template + struct __type_identity + { using type = _Type; }; + + template + using __type_identity_t = typename __type_identity<_Tp>::type; + + namespace __detail + { + // A variadic alias template that resolves to its first argument. + template + using __first_t = _Tp; + + // These are deliberately not defined. + template + auto __or_fn(int) -> __first_t...>; + + template + auto __or_fn(...) -> true_type; + + template + auto __and_fn(int) -> __first_t...>; + + template + auto __and_fn(...) -> false_type; + } // namespace detail + + // Like C++17 std::dis/conjunction, but usable in C++11 and resolves + // to either true_type or false_type which allows for a more efficient + // implementation that avoids recursive class template instantiation. + template + struct __or_ + : decltype(__detail::__or_fn<_Bn...>(0)) + { }; + + template + struct __and_ + : decltype(__detail::__and_fn<_Bn...>(0)) + { }; + + template + struct __not_ + : __bool_constant + { }; + /// @endcond + +#ifdef __cpp_lib_logical_traits // C++ >= 17 + + /// @cond undocumented + template + inline constexpr bool __or_v = __or_<_Bn...>::value; + template + inline constexpr bool __and_v = __and_<_Bn...>::value; + + namespace __detail + { + template + struct __disjunction_impl + { using type = _B1; }; + + template + struct __disjunction_impl<__enable_if_t, _B1, _B2, _Bn...> + { using type = typename __disjunction_impl::type; }; + + template + struct __conjunction_impl + { using type = _B1; }; + + template + struct __conjunction_impl<__enable_if_t, _B1, _B2, _Bn...> + { using type = typename __conjunction_impl::type; }; + } // namespace __detail + /// @endcond + + template + struct conjunction + : __detail::__conjunction_impl::type + { }; + + template<> + struct conjunction<> + : true_type + { }; + + template + struct disjunction + : __detail::__disjunction_impl::type + { }; + + template<> + struct disjunction<> + : false_type + { }; + + template + struct negation + : __not_<_Pp>::type + { }; + + /** @ingroup variable_templates + * @{ + */ + template + inline constexpr bool conjunction_v = conjunction<_Bn...>::value; + + template + inline constexpr bool disjunction_v = disjunction<_Bn...>::value; + + template + inline constexpr bool negation_v = negation<_Pp>::value; + /// @} + +#endif // __cpp_lib_logical_traits + + // Forward declarations + template + struct is_reference; + template + struct is_function; + template + struct is_void; + template + struct remove_cv; + template + struct is_const; + + /// @cond undocumented + template + struct __is_array_unknown_bounds; + + // Helper functions that return false_type for incomplete classes, + // incomplete unions and arrays of known bound from those. + + template + constexpr true_type __is_complete_or_unbounded(__type_identity<_Tp>) + { return {}; } + + template + constexpr typename __or_< + is_reference<_NestedType>, + is_function<_NestedType>, + is_void<_NestedType>, + __is_array_unknown_bounds<_NestedType> + >::type __is_complete_or_unbounded(_TypeIdentity) + { return {}; } + + // __remove_cv_t (std::remove_cv_t for C++11). + template + using __remove_cv_t = typename remove_cv<_Tp>::type; + /// @endcond + + // Primary type categories. + + /// is_void + template + struct is_void + : public false_type { }; + + template<> + struct is_void + : public true_type { }; + + template<> + struct is_void + : public true_type { }; + + template<> + struct is_void + : public true_type { }; + + template<> + struct is_void + : public true_type { }; + + /// @cond undocumented + template + struct __is_integral_helper + : public false_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + // We want is_integral to be true (and make_signed/unsigned to work) + // even when libc doesn't provide working and related functions, + // so don't check _GLIBCXX_USE_WCHAR_T here. + template<> + struct __is_integral_helper + : public true_type { }; + +#ifdef _GLIBCXX_USE_CHAR8_T + template<> + struct __is_integral_helper + : public true_type { }; +#endif + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + template<> + struct __is_integral_helper + : public true_type { }; + + // Conditionalizing on __STRICT_ANSI__ here will break any port that + // uses one of these types for size_t. +#if defined(__GLIBCXX_TYPE_INT_N_0) + __extension__ + template<> + struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0> + : public true_type { }; + + __extension__ + template<> + struct __is_integral_helper + : public true_type { }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_1) + __extension__ + template<> + struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1> + : public true_type { }; + + __extension__ + template<> + struct __is_integral_helper + : public true_type { }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_2) + __extension__ + template<> + struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2> + : public true_type { }; + + __extension__ + template<> + struct __is_integral_helper + : public true_type { }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_3) + __extension__ + template<> + struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3> + : public true_type { }; + + __extension__ + template<> + struct __is_integral_helper + : public true_type { }; +#endif + /// @endcond + + /// is_integral + template + struct is_integral + : public __is_integral_helper<__remove_cv_t<_Tp>>::type + { }; + + /// @cond undocumented + template + struct __is_floating_point_helper + : public false_type { }; + + template<> + struct __is_floating_point_helper + : public true_type { }; + + template<> + struct __is_floating_point_helper + : public true_type { }; + + template<> + struct __is_floating_point_helper + : public true_type { }; + +#ifdef __STDCPP_FLOAT16_T__ + template<> + struct __is_floating_point_helper<_Float16> + : public true_type { }; +#endif + +#ifdef __STDCPP_FLOAT32_T__ + template<> + struct __is_floating_point_helper<_Float32> + : public true_type { }; +#endif + +#ifdef __STDCPP_FLOAT64_T__ + template<> + struct __is_floating_point_helper<_Float64> + : public true_type { }; +#endif + +#ifdef __STDCPP_FLOAT128_T__ + template<> + struct __is_floating_point_helper<_Float128> + : public true_type { }; +#endif + +#ifdef __STDCPP_BFLOAT16_T__ + template<> + struct __is_floating_point_helper<__gnu_cxx::__bfloat16_t> + : public true_type { }; +#endif + +#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) + template<> + struct __is_floating_point_helper<__float128> + : public true_type { }; +#endif + /// @endcond + + /// is_floating_point + template + struct is_floating_point + : public __is_floating_point_helper<__remove_cv_t<_Tp>>::type + { }; + + /// is_array +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array) + template + struct is_array + : public __bool_constant<__is_array(_Tp)> + { }; +#else + template + struct is_array + : public false_type { }; + + template + struct is_array<_Tp[_Size]> + : public true_type { }; + + template + struct is_array<_Tp[]> + : public true_type { }; +#endif + + /// is_pointer +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer) + template + struct is_pointer + : public __bool_constant<__is_pointer(_Tp)> + { }; +#else + template + struct is_pointer + : public false_type { }; + + template + struct is_pointer<_Tp*> + : public true_type { }; + + template + struct is_pointer<_Tp* const> + : public true_type { }; + + template + struct is_pointer<_Tp* volatile> + : public true_type { }; + + template + struct is_pointer<_Tp* const volatile> + : public true_type { }; +#endif + + /// is_lvalue_reference + template + struct is_lvalue_reference + : public false_type { }; + + template + struct is_lvalue_reference<_Tp&> + : public true_type { }; + + /// is_rvalue_reference + template + struct is_rvalue_reference + : public false_type { }; + + template + struct is_rvalue_reference<_Tp&&> + : public true_type { }; + + /// is_member_object_pointer +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer) + template + struct is_member_object_pointer + : public __bool_constant<__is_member_object_pointer(_Tp)> + { }; +#else + template + struct __is_member_object_pointer_helper + : public false_type { }; + + template + struct __is_member_object_pointer_helper<_Tp _Cp::*> + : public __not_>::type { }; + + + template + struct is_member_object_pointer + : public __is_member_object_pointer_helper<__remove_cv_t<_Tp>>::type + { }; +#endif + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer) + /// is_member_function_pointer + template + struct is_member_function_pointer + : public __bool_constant<__is_member_function_pointer(_Tp)> + { }; +#else + template + struct __is_member_function_pointer_helper + : public false_type { }; + + template + struct __is_member_function_pointer_helper<_Tp _Cp::*> + : public is_function<_Tp>::type { }; + + /// is_member_function_pointer + template + struct is_member_function_pointer + : public __is_member_function_pointer_helper<__remove_cv_t<_Tp>>::type + { }; +#endif + + /// is_enum + template + struct is_enum + : public __bool_constant<__is_enum(_Tp)> + { }; + + /// is_union + template + struct is_union + : public __bool_constant<__is_union(_Tp)> + { }; + + /// is_class + template + struct is_class + : public __bool_constant<__is_class(_Tp)> + { }; + + /// is_function +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function) + template + struct is_function + : public __bool_constant<__is_function(_Tp)> + { }; +#else + template + struct is_function + : public __bool_constant::value> { }; + + template + struct is_function<_Tp&> + : public false_type { }; + + template + struct is_function<_Tp&&> + : public false_type { }; +#endif + +#ifdef __cpp_lib_is_null_pointer // C++ >= 11 + /// is_null_pointer (LWG 2247). + template + struct is_null_pointer + : public false_type { }; + + template<> + struct is_null_pointer + : public true_type { }; + + template<> + struct is_null_pointer + : public true_type { }; + + template<> + struct is_null_pointer + : public true_type { }; + + template<> + struct is_null_pointer + : public true_type { }; + + /// __is_nullptr_t (deprecated extension). + /// @deprecated Non-standard. Use `is_null_pointer` instead. + template + struct __is_nullptr_t + : public is_null_pointer<_Tp> + { } _GLIBCXX_DEPRECATED_SUGGEST("std::is_null_pointer"); +#endif // __cpp_lib_is_null_pointer + + // Composite type categories. + + /// is_reference +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference) + template + struct is_reference + : public __bool_constant<__is_reference(_Tp)> + { }; +#else + template + struct is_reference + : public false_type + { }; + + template + struct is_reference<_Tp&> + : public true_type + { }; + + template + struct is_reference<_Tp&&> + : public true_type + { }; +#endif + + /// is_arithmetic + template + struct is_arithmetic + : public __or_, is_floating_point<_Tp>>::type + { }; + + /// is_fundamental + template + struct is_fundamental + : public __or_, is_void<_Tp>, + is_null_pointer<_Tp>>::type + { }; + + /// is_object +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object) + template + struct is_object + : public __bool_constant<__is_object(_Tp)> + { }; +#else + template + struct is_object + : public __not_<__or_, is_reference<_Tp>, + is_void<_Tp>>>::type + { }; +#endif + + template + struct is_member_pointer; + + /// is_scalar + template + struct is_scalar + : public __or_, is_enum<_Tp>, is_pointer<_Tp>, + is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type + { }; + + /// is_compound + template + struct is_compound + : public __bool_constant::value> { }; + + /// is_member_pointer +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer) + template + struct is_member_pointer + : public __bool_constant<__is_member_pointer(_Tp)> + { }; +#else + /// @cond undocumented + template + struct __is_member_pointer_helper + : public false_type { }; + + template + struct __is_member_pointer_helper<_Tp _Cp::*> + : public true_type { }; + /// @endcond + + template + struct is_member_pointer + : public __is_member_pointer_helper<__remove_cv_t<_Tp>>::type + { }; +#endif + + template + struct is_same; + + /// @cond undocumented + template + using __is_one_of = __or_...>; + + // Check if a type is one of the signed integer types. + __extension__ + template + using __is_signed_integer = __is_one_of<__remove_cv_t<_Tp>, + signed char, signed short, signed int, signed long, + signed long long +#if defined(__GLIBCXX_TYPE_INT_N_0) + , signed __GLIBCXX_TYPE_INT_N_0 +#endif +#if defined(__GLIBCXX_TYPE_INT_N_1) + , signed __GLIBCXX_TYPE_INT_N_1 +#endif +#if defined(__GLIBCXX_TYPE_INT_N_2) + , signed __GLIBCXX_TYPE_INT_N_2 +#endif +#if defined(__GLIBCXX_TYPE_INT_N_3) + , signed __GLIBCXX_TYPE_INT_N_3 +#endif + >; + + // Check if a type is one of the unsigned integer types. + __extension__ + template + using __is_unsigned_integer = __is_one_of<__remove_cv_t<_Tp>, + unsigned char, unsigned short, unsigned int, unsigned long, + unsigned long long +#if defined(__GLIBCXX_TYPE_INT_N_0) + , unsigned __GLIBCXX_TYPE_INT_N_0 +#endif +#if defined(__GLIBCXX_TYPE_INT_N_1) + , unsigned __GLIBCXX_TYPE_INT_N_1 +#endif +#if defined(__GLIBCXX_TYPE_INT_N_2) + , unsigned __GLIBCXX_TYPE_INT_N_2 +#endif +#if defined(__GLIBCXX_TYPE_INT_N_3) + , unsigned __GLIBCXX_TYPE_INT_N_3 +#endif + >; + + // Check if a type is one of the signed or unsigned integer types. + template + using __is_standard_integer + = __or_<__is_signed_integer<_Tp>, __is_unsigned_integer<_Tp>>; + + // __void_t (std::void_t for C++11) + template using __void_t = void; + /// @endcond + + // Type properties. + + /// is_const +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const) + template + struct is_const + : public __bool_constant<__is_const(_Tp)> + { }; +#else + template + struct is_const + : public false_type { }; + + template + struct is_const<_Tp const> + : public true_type { }; +#endif + + /// is_volatile +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile) + template + struct is_volatile + : public __bool_constant<__is_volatile(_Tp)> + { }; +#else + template + struct is_volatile + : public false_type { }; + + template + struct is_volatile<_Tp volatile> + : public true_type { }; +#endif + + /** is_trivial + * @deprecated Deprecated in C++26. + * Use a combination of one or more more specialized type traits instead, + * such as `is_trivially_default_constructible`, + * `is_trivially_copy_constructible`, `is_trivially_copy_assignable`, + * etc., depending on the exact check(s) needed. + */ + template + struct + _GLIBCXX26_DEPRECATED_SUGGEST("is_trivially_default_constructible && is_trivially_copyable") + is_trivial + : public __bool_constant<__is_trivial(_Tp)> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_trivially_copyable + template + struct is_trivially_copyable + : public __bool_constant<__is_trivially_copyable(_Tp)> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_standard_layout + template + struct is_standard_layout + : public __bool_constant<__is_standard_layout(_Tp)> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /** is_pod + * @deprecated Deprecated in C++20. + * Use `is_standard_layout && is_trivial` instead. + */ + // Could use is_standard_layout && is_trivial instead of the builtin. + template + struct + _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout && is_trivial") + is_pod + : public __bool_constant<__is_pod(_Tp)> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /** is_literal_type + * @deprecated Deprecated in C++17, removed in C++20. + * The idea of a literal type isn't useful. + */ + template + struct + _GLIBCXX17_DEPRECATED + is_literal_type + : public __bool_constant<__is_literal_type(_Tp)> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_empty + template + struct is_empty + : public __bool_constant<__is_empty(_Tp)> + { }; + + /// is_polymorphic + template + struct is_polymorphic + : public __bool_constant<__is_polymorphic(_Tp)> + { }; + +#ifdef __cpp_lib_is_final // C++ >= 14 + /// is_final + /// @since C++14 + template + struct is_final + : public __bool_constant<__is_final(_Tp)> + { }; +#endif + + /// is_abstract + template + struct is_abstract + : public __bool_constant<__is_abstract(_Tp)> + { }; + + /// @cond undocumented + template::value> + struct __is_signed_helper + : public false_type { }; + + template + struct __is_signed_helper<_Tp, true> + : public __bool_constant<_Tp(-1) < _Tp(0)> + { }; + /// @endcond + + /// is_signed + template + struct is_signed + : public __is_signed_helper<_Tp>::type + { }; + + /// is_unsigned + template + struct is_unsigned + : public __and_, __not_>>::type + { }; + + /// @cond undocumented + template + _Up + __declval(int); + + template + _Tp + __declval(long); + /// @endcond + + template + auto declval() noexcept -> decltype(__declval<_Tp>(0)); + + template + struct remove_all_extents; + + /// @cond undocumented + template + struct __is_array_known_bounds + : public false_type + { }; + + template + struct __is_array_known_bounds<_Tp[_Size]> + : public true_type + { }; + + template + struct __is_array_unknown_bounds + : public false_type + { }; + + template + struct __is_array_unknown_bounds<_Tp[]> + : public true_type + { }; + + // Destructible and constructible type properties. + + // In N3290 is_destructible does not say anything about function + // types and abstract types, see LWG 2049. This implementation + // describes function types as non-destructible and all complete + // object types as destructible, iff the explicit destructor + // call expression is wellformed. + struct __do_is_destructible_impl + { + template().~_Tp())> + static true_type __test(int); + + template + static false_type __test(...); + }; + + template + struct __is_destructible_impl + : public __do_is_destructible_impl + { + using type = decltype(__test<_Tp>(0)); + }; + + template, + __is_array_unknown_bounds<_Tp>, + is_function<_Tp>>::value, + bool = __or_, is_scalar<_Tp>>::value> + struct __is_destructible_safe; + + template + struct __is_destructible_safe<_Tp, false, false> + : public __is_destructible_impl::type>::type + { }; + + template + struct __is_destructible_safe<_Tp, true, false> + : public false_type { }; + + template + struct __is_destructible_safe<_Tp, false, true> + : public true_type { }; + /// @endcond + + /// is_destructible + template + struct is_destructible + : public __is_destructible_safe<_Tp>::type + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @cond undocumented + + // is_nothrow_destructible requires that is_destructible is + // satisfied as well. We realize that by mimicing the + // implementation of is_destructible but refer to noexcept(expr) + // instead of decltype(expr). + struct __do_is_nt_destructible_impl + { + template + static __bool_constant().~_Tp())> + __test(int); + + template + static false_type __test(...); + }; + + template + struct __is_nt_destructible_impl + : public __do_is_nt_destructible_impl + { + using type = decltype(__test<_Tp>(0)); + }; + + template, + __is_array_unknown_bounds<_Tp>, + is_function<_Tp>>::value, + bool = __or_, is_scalar<_Tp>>::value> + struct __is_nt_destructible_safe; + + template + struct __is_nt_destructible_safe<_Tp, false, false> + : public __is_nt_destructible_impl::type>::type + { }; + + template + struct __is_nt_destructible_safe<_Tp, true, false> + : public false_type { }; + + template + struct __is_nt_destructible_safe<_Tp, false, true> + : public true_type { }; + /// @endcond + + /// is_nothrow_destructible + template + struct is_nothrow_destructible + : public __is_nt_destructible_safe<_Tp>::type + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @cond undocumented + template + using __is_constructible_impl + = __bool_constant<__is_constructible(_Tp, _Args...)>; + /// @endcond + + /// is_constructible + template + struct is_constructible + : public __is_constructible_impl<_Tp, _Args...> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_default_constructible + template + struct is_default_constructible + : public __is_constructible_impl<_Tp> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @cond undocumented +#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_lvalue_reference) + template + using __add_lval_ref_t = __add_lvalue_reference(_Tp); +#else + template + struct __add_lvalue_reference_helper + { using type = _Tp; }; + + template + struct __add_lvalue_reference_helper<_Tp, __void_t<_Tp&>> + { using type = _Tp&; }; + + template + using __add_lval_ref_t = typename __add_lvalue_reference_helper<_Tp>::type; +#endif + /// @endcond + + /// is_copy_constructible + template + struct is_copy_constructible + : public __is_constructible_impl<_Tp, __add_lval_ref_t> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @cond undocumented +#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_rvalue_reference) + template + using __add_rval_ref_t = __add_rvalue_reference(_Tp); +#else + template + struct __add_rvalue_reference_helper + { using type = _Tp; }; + + template + struct __add_rvalue_reference_helper<_Tp, __void_t<_Tp&&>> + { using type = _Tp&&; }; + + template + using __add_rval_ref_t = typename __add_rvalue_reference_helper<_Tp>::type; +#endif + /// @endcond + + /// is_move_constructible + template + struct is_move_constructible + : public __is_constructible_impl<_Tp, __add_rval_ref_t<_Tp>> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @cond undocumented + template + using __is_nothrow_constructible_impl + = __bool_constant<__is_nothrow_constructible(_Tp, _Args...)>; + /// @endcond + + /// is_nothrow_constructible + template + struct is_nothrow_constructible + : public __is_nothrow_constructible_impl<_Tp, _Args...> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_nothrow_default_constructible + template + struct is_nothrow_default_constructible + : public __is_nothrow_constructible_impl<_Tp> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_nothrow_copy_constructible + template + struct is_nothrow_copy_constructible + : public __is_nothrow_constructible_impl<_Tp, __add_lval_ref_t> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_nothrow_move_constructible + template + struct is_nothrow_move_constructible + : public __is_nothrow_constructible_impl<_Tp, __add_rval_ref_t<_Tp>> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @cond undocumented + template + using __is_assignable_impl = __bool_constant<__is_assignable(_Tp, _Up)>; + /// @endcond + + /// is_assignable + template + struct is_assignable + : public __is_assignable_impl<_Tp, _Up> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_copy_assignable + template + struct is_copy_assignable + : public __is_assignable_impl<__add_lval_ref_t<_Tp>, + __add_lval_ref_t> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_move_assignable + template + struct is_move_assignable + : public __is_assignable_impl<__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @cond undocumented + template + using __is_nothrow_assignable_impl + = __bool_constant<__is_nothrow_assignable(_Tp, _Up)>; + /// @endcond + + /// is_nothrow_assignable + template + struct is_nothrow_assignable + : public __is_nothrow_assignable_impl<_Tp, _Up> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_nothrow_copy_assignable + template + struct is_nothrow_copy_assignable + : public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>, + __add_lval_ref_t> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_nothrow_move_assignable + template + struct is_nothrow_move_assignable + : public __is_nothrow_assignable_impl<__add_lval_ref_t<_Tp>, + __add_rval_ref_t<_Tp>> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @cond undocumented + template + using __is_trivially_constructible_impl + = __bool_constant<__is_trivially_constructible(_Tp, _Args...)>; + /// @endcond + + /// is_trivially_constructible + template + struct is_trivially_constructible + : public __is_trivially_constructible_impl<_Tp, _Args...> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_trivially_default_constructible + template + struct is_trivially_default_constructible + : public __is_trivially_constructible_impl<_Tp> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + +#if __cpp_variable_templates && __cpp_concepts + template + constexpr bool __is_implicitly_default_constructible_v + = requires (void(&__f)(_Tp)) { __f({}); }; + + template + struct __is_implicitly_default_constructible + : __bool_constant<__is_implicitly_default_constructible_v<_Tp>> + { }; +#else + struct __do_is_implicitly_default_constructible_impl + { + template + static void __helper(const _Tp&); + + template + static true_type __test(const _Tp&, + decltype(__helper({}))* = 0); + + static false_type __test(...); + }; + + template + struct __is_implicitly_default_constructible_impl + : public __do_is_implicitly_default_constructible_impl + { + using type = decltype(__test(declval<_Tp>())); + }; + + template + struct __is_implicitly_default_constructible_safe + : public __is_implicitly_default_constructible_impl<_Tp>::type + { }; + + template + struct __is_implicitly_default_constructible + : public __and_<__is_constructible_impl<_Tp>, + __is_implicitly_default_constructible_safe<_Tp>>::type + { }; +#endif + + /// is_trivially_copy_constructible + template + struct is_trivially_copy_constructible + : public __is_trivially_constructible_impl<_Tp, __add_lval_ref_t> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_trivially_move_constructible + template + struct is_trivially_move_constructible + : public __is_trivially_constructible_impl<_Tp, __add_rval_ref_t<_Tp>> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @cond undocumented + template + using __is_trivially_assignable_impl + = __bool_constant<__is_trivially_assignable(_Tp, _Up)>; + /// @endcond + + /// is_trivially_assignable + template + struct is_trivially_assignable + : public __is_trivially_assignable_impl<_Tp, _Up> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_trivially_copy_assignable + template + struct is_trivially_copy_assignable + : public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>, + __add_lval_ref_t> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_trivially_move_assignable + template + struct is_trivially_move_assignable + : public __is_trivially_assignable_impl<__add_lval_ref_t<_Tp>, + __add_rval_ref_t<_Tp>> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_trivially_destructible + template + struct is_trivially_destructible + : public __and_<__is_destructible_safe<_Tp>, + __bool_constant<__has_trivial_destructor(_Tp)>>::type + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + + /// has_virtual_destructor + template + struct has_virtual_destructor + : public __bool_constant<__has_virtual_destructor(_Tp)> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + + // type property queries. + + /// alignment_of + template + struct alignment_of + : public integral_constant + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// rank +#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank) \ + && (!defined(__clang__) || __clang_major__ >= 20) // PR118559 + template + struct rank + : public integral_constant { }; +#else + template + struct rank + : public integral_constant { }; + + template + struct rank<_Tp[_Size]> + : public integral_constant::value> { }; + + template + struct rank<_Tp[]> + : public integral_constant::value> { }; +#endif + + /// extent + template + struct extent + : public integral_constant { }; + + template + struct extent<_Tp[_Size], 0> + : public integral_constant { }; + + template + struct extent<_Tp[_Size], _Uint> + : public extent<_Tp, _Uint - 1>::type { }; + + template + struct extent<_Tp[], 0> + : public integral_constant { }; + + template + struct extent<_Tp[], _Uint> + : public extent<_Tp, _Uint - 1>::type { }; + + + // Type relations. + + /// is_same +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same) + template + struct is_same + : public __bool_constant<__is_same(_Tp, _Up)> + { }; +#else + template + struct is_same + : public false_type + { }; + + template + struct is_same<_Tp, _Tp> + : public true_type + { }; +#endif + + /// is_base_of + template + struct is_base_of + : public __bool_constant<__is_base_of(_Base, _Derived)> + { }; + +#ifdef __cpp_lib_is_virtual_base_of // C++ >= 26 + /// is_virtual_base_of + /// @since C++26 + template + struct is_virtual_base_of + : public bool_constant<__builtin_is_virtual_base_of(_Base, _Derived)> + { }; +#endif + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible) + template + struct is_convertible + : public __bool_constant<__is_convertible(_From, _To)> + { }; +#else + template, is_function<_To>, + is_array<_To>>::value> + struct __is_convertible_helper + { + using type = typename is_void<_To>::type; + }; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" + template + class __is_convertible_helper<_From, _To, false> + { + template + static void __test_aux(_To1) noexcept; + + template(std::declval<_From1>()))> + static true_type + __test(int); + + template + static false_type + __test(...); + + public: + using type = decltype(__test<_From, _To>(0)); + }; +#pragma GCC diagnostic pop + + /// is_convertible + template + struct is_convertible + : public __is_convertible_helper<_From, _To>::type + { }; +#endif + + // helper trait for unique_ptr, shared_ptr, and span + template + using __is_array_convertible + = is_convertible<_FromElementType(*)[], _ToElementType(*)[]>; + +#ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20 + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_convertible) + /// is_nothrow_convertible_v + template + inline constexpr bool is_nothrow_convertible_v + = __is_nothrow_convertible(_From, _To); + + /// is_nothrow_convertible + template + struct is_nothrow_convertible + : public bool_constant> + { }; +#else + template, is_function<_To>, + is_array<_To>>::value> + struct __is_nt_convertible_helper + : is_void<_To> + { }; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" + template + class __is_nt_convertible_helper<_From, _To, false> + { + template + static void __test_aux(_To1) noexcept; + + template + static + __bool_constant(std::declval<_From1>()))> + __test(int); + + template + static false_type + __test(...); + + public: + using type = decltype(__test<_From, _To>(0)); + }; +#pragma GCC diagnostic pop + + /// is_nothrow_convertible + template + struct is_nothrow_convertible + : public __is_nt_convertible_helper<_From, _To>::type + { }; + + /// is_nothrow_convertible_v + template + inline constexpr bool is_nothrow_convertible_v + = is_nothrow_convertible<_From, _To>::value; +#endif +#endif // __cpp_lib_is_nothrow_convertible + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++14-extensions" // for variable templates + template + struct __is_nothrow_new_constructible_impl + : __bool_constant< + noexcept(::new(std::declval()) _Tp(std::declval<_Args>()...)) + > + { }; + + template + _GLIBCXX17_INLINE constexpr bool __is_nothrow_new_constructible + = __and_, + __is_nothrow_new_constructible_impl<_Tp, _Args...>>::value; +#pragma GCC diagnostic pop + + // Const-volatile modifications. + + /// remove_const + template + struct remove_const + { using type = _Tp; }; + + template + struct remove_const<_Tp const> + { using type = _Tp; }; + + /// remove_volatile + template + struct remove_volatile + { using type = _Tp; }; + + template + struct remove_volatile<_Tp volatile> + { using type = _Tp; }; + + /// remove_cv +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cv) + template + struct remove_cv + { using type = __remove_cv(_Tp); }; +#else + template + struct remove_cv + { using type = _Tp; }; + + template + struct remove_cv + { using type = _Tp; }; + + template + struct remove_cv + { using type = _Tp; }; + + template + struct remove_cv + { using type = _Tp; }; +#endif + + /// add_const + template + struct add_const + { using type = _Tp const; }; + + /// add_volatile + template + struct add_volatile + { using type = _Tp volatile; }; + + /// add_cv + template + struct add_cv + { using type = _Tp const volatile; }; + +#ifdef __cpp_lib_transformation_trait_aliases // C++ >= 14 + /// Alias template for remove_const + template + using remove_const_t = typename remove_const<_Tp>::type; + + /// Alias template for remove_volatile + template + using remove_volatile_t = typename remove_volatile<_Tp>::type; + + /// Alias template for remove_cv + template + using remove_cv_t = typename remove_cv<_Tp>::type; + + /// Alias template for add_const + template + using add_const_t = typename add_const<_Tp>::type; + + /// Alias template for add_volatile + template + using add_volatile_t = typename add_volatile<_Tp>::type; + + /// Alias template for add_cv + template + using add_cv_t = typename add_cv<_Tp>::type; +#endif + + // Reference transformations. + + /// remove_reference +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_reference) + template + struct remove_reference + { using type = __remove_reference(_Tp); }; +#else + template + struct remove_reference + { using type = _Tp; }; + + template + struct remove_reference<_Tp&> + { using type = _Tp; }; + + template + struct remove_reference<_Tp&&> + { using type = _Tp; }; +#endif + + /// add_lvalue_reference + template + struct add_lvalue_reference + { using type = __add_lval_ref_t<_Tp>; }; + + /// add_rvalue_reference + template + struct add_rvalue_reference + { using type = __add_rval_ref_t<_Tp>; }; + +#if __cplusplus > 201103L + /// Alias template for remove_reference + template + using remove_reference_t = typename remove_reference<_Tp>::type; + + /// Alias template for add_lvalue_reference + template + using add_lvalue_reference_t = typename add_lvalue_reference<_Tp>::type; + + /// Alias template for add_rvalue_reference + template + using add_rvalue_reference_t = typename add_rvalue_reference<_Tp>::type; +#endif + + // Sign modifications. + + /// @cond undocumented + + // Utility for constructing identically cv-qualified types. + template + struct __cv_selector; + + template + struct __cv_selector<_Unqualified, false, false> + { using __type = _Unqualified; }; + + template + struct __cv_selector<_Unqualified, false, true> + { using __type = volatile _Unqualified; }; + + template + struct __cv_selector<_Unqualified, true, false> + { using __type = const _Unqualified; }; + + template + struct __cv_selector<_Unqualified, true, true> + { using __type = const volatile _Unqualified; }; + + template::value, + bool _IsVol = is_volatile<_Qualified>::value> + class __match_cv_qualifiers + { + using __match = __cv_selector<_Unqualified, _IsConst, _IsVol>; + + public: + using __type = typename __match::__type; + }; + + // Utility for finding the unsigned versions of signed integral types. + template + struct __make_unsigned + { using __type = _Tp; }; + + template<> + struct __make_unsigned + { using __type = unsigned char; }; + + template<> + struct __make_unsigned + { using __type = unsigned char; }; + + template<> + struct __make_unsigned + { using __type = unsigned short; }; + + template<> + struct __make_unsigned + { using __type = unsigned int; }; + + template<> + struct __make_unsigned + { using __type = unsigned long; }; + + template<> + struct __make_unsigned + { using __type = unsigned long long; }; + +#if defined(__GLIBCXX_TYPE_INT_N_0) + __extension__ + template<> + struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0> + { using __type = unsigned __GLIBCXX_TYPE_INT_N_0; }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_1) + __extension__ + template<> + struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1> + { using __type = unsigned __GLIBCXX_TYPE_INT_N_1; }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_2) + __extension__ + template<> + struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2> + { using __type = unsigned __GLIBCXX_TYPE_INT_N_2; }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_3) + __extension__ + template<> + struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3> + { using __type = unsigned __GLIBCXX_TYPE_INT_N_3; }; +#endif + + // Select between integral and enum: not possible to be both. + template::value, + bool _IsEnum = __is_enum(_Tp)> + class __make_unsigned_selector; + + template + class __make_unsigned_selector<_Tp, true, false> + { + using __unsigned_type + = typename __make_unsigned<__remove_cv_t<_Tp>>::__type; + + public: + using __type + = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type; + }; + + class __make_unsigned_selector_base + { + protected: + template struct _List { }; + + template + struct _List<_Tp, _Up...> : _List<_Up...> + { static constexpr size_t __size = sizeof(_Tp); }; + + template + struct __select; + + template + struct __select<_Sz, _List<_Uint, _UInts...>, true> + { using __type = _Uint; }; + + template + struct __select<_Sz, _List<_Uint, _UInts...>, false> + : __select<_Sz, _List<_UInts...>> + { }; + }; + + // Choose unsigned integer type with the smallest rank and same size as _Tp + template + class __make_unsigned_selector<_Tp, false, true> + : __make_unsigned_selector_base + { + // With -fshort-enums, an enum may be as small as a char. + using _UInts = _List; + + using __unsigned_type = typename __select::__type; + + public: + using __type + = typename __match_cv_qualifiers<_Tp, __unsigned_type>::__type; + }; + + // wchar_t, char8_t, char16_t and char32_t are integral types but are + // neither signed integer types nor unsigned integer types, so must be + // transformed to the unsigned integer type with the smallest rank. + // Use the partial specialization for enumeration types to do that. + template<> + struct __make_unsigned + { + using __type + = typename __make_unsigned_selector::__type; + }; + +#ifdef _GLIBCXX_USE_CHAR8_T + template<> + struct __make_unsigned + { + using __type + = typename __make_unsigned_selector::__type; + }; +#endif + + template<> + struct __make_unsigned + { + using __type + = typename __make_unsigned_selector::__type; + }; + + template<> + struct __make_unsigned + { + using __type + = typename __make_unsigned_selector::__type; + }; + /// @endcond + + // Given an integral/enum type, return the corresponding unsigned + // integer type. + // Primary template. + /// make_unsigned + template + struct make_unsigned + { using type = typename __make_unsigned_selector<_Tp>::__type; }; + + // Integral, but don't define. + template<> struct make_unsigned; + template<> struct make_unsigned; + template<> struct make_unsigned; + template<> struct make_unsigned; + + /// @cond undocumented + + // Utility for finding the signed versions of unsigned integral types. + template + struct __make_signed + { using __type = _Tp; }; + + template<> + struct __make_signed + { using __type = signed char; }; + + template<> + struct __make_signed + { using __type = signed char; }; + + template<> + struct __make_signed + { using __type = signed short; }; + + template<> + struct __make_signed + { using __type = signed int; }; + + template<> + struct __make_signed + { using __type = signed long; }; + + template<> + struct __make_signed + { using __type = signed long long; }; + +#if defined(__GLIBCXX_TYPE_INT_N_0) + __extension__ + template<> + struct __make_signed + { using __type = __GLIBCXX_TYPE_INT_N_0; }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_1) + __extension__ + template<> + struct __make_signed + { using __type = __GLIBCXX_TYPE_INT_N_1; }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_2) + __extension__ + template<> + struct __make_signed + { using __type = __GLIBCXX_TYPE_INT_N_2; }; +#endif +#if defined(__GLIBCXX_TYPE_INT_N_3) + __extension__ + template<> + struct __make_signed + { using __type = __GLIBCXX_TYPE_INT_N_3; }; +#endif + + // Select between integral and enum: not possible to be both. + template::value, + bool _IsEnum = __is_enum(_Tp)> + class __make_signed_selector; + + template + class __make_signed_selector<_Tp, true, false> + { + using __signed_type + = typename __make_signed<__remove_cv_t<_Tp>>::__type; + + public: + using __type + = typename __match_cv_qualifiers<_Tp, __signed_type>::__type; + }; + + // Choose signed integer type with the smallest rank and same size as _Tp + template + class __make_signed_selector<_Tp, false, true> + { + using __unsigned_type = typename __make_unsigned_selector<_Tp>::__type; + + public: + using __type = typename __make_signed_selector<__unsigned_type>::__type; + }; + + // wchar_t, char16_t and char32_t are integral types but are neither + // signed integer types nor unsigned integer types, so must be + // transformed to the signed integer type with the smallest rank. + // Use the partial specialization for enumeration types to do that. + template<> + struct __make_signed + { + using __type + = typename __make_signed_selector::__type; + }; + +#if defined(_GLIBCXX_USE_CHAR8_T) + template<> + struct __make_signed + { + using __type + = typename __make_signed_selector::__type; + }; +#endif + + template<> + struct __make_signed + { + using __type + = typename __make_signed_selector::__type; + }; + + template<> + struct __make_signed + { + using __type + = typename __make_signed_selector::__type; + }; + /// @endcond + + // Given an integral/enum type, return the corresponding signed + // integer type. + // Primary template. + /// make_signed + template + struct make_signed + { using type = typename __make_signed_selector<_Tp>::__type; }; + + // Integral, but don't define. + template<> struct make_signed; + template<> struct make_signed; + template<> struct make_signed; + template<> struct make_signed; + +#if __cplusplus > 201103L + /// Alias template for make_signed + template + using make_signed_t = typename make_signed<_Tp>::type; + + /// Alias template for make_unsigned + template + using make_unsigned_t = typename make_unsigned<_Tp>::type; +#endif + + // Array modifications. + + /// remove_extent +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_extent) + template + struct remove_extent + { using type = __remove_extent(_Tp); }; +#else + template + struct remove_extent + { using type = _Tp; }; + + template + struct remove_extent<_Tp[_Size]> + { using type = _Tp; }; + + template + struct remove_extent<_Tp[]> + { using type = _Tp; }; +#endif + + /// remove_all_extents +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_all_extents) + template + struct remove_all_extents + { using type = __remove_all_extents(_Tp); }; +#else + template + struct remove_all_extents + { using type = _Tp; }; + + template + struct remove_all_extents<_Tp[_Size]> + { using type = typename remove_all_extents<_Tp>::type; }; + + template + struct remove_all_extents<_Tp[]> + { using type = typename remove_all_extents<_Tp>::type; }; +#endif + +#if __cplusplus > 201103L + /// Alias template for remove_extent + template + using remove_extent_t = typename remove_extent<_Tp>::type; + + /// Alias template for remove_all_extents + template + using remove_all_extents_t = typename remove_all_extents<_Tp>::type; +#endif + + // Pointer modifications. + + /// remove_pointer +#if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_pointer) + template + struct remove_pointer + { using type = __remove_pointer(_Tp); }; +#else + template + struct __remove_pointer_helper + { using type = _Tp; }; + + template + struct __remove_pointer_helper<_Tp, _Up*> + { using type = _Up; }; + + template + struct remove_pointer + : public __remove_pointer_helper<_Tp, __remove_cv_t<_Tp>> + { }; +#endif + + /// add_pointer +#if _GLIBCXX_USE_BUILTIN_TRAIT(__add_pointer) + template + struct add_pointer + { using type = __add_pointer(_Tp); }; +#else + template + struct __add_pointer_helper + { using type = _Tp; }; + + template + struct __add_pointer_helper<_Tp, __void_t<_Tp*>> + { using type = _Tp*; }; + + template + struct add_pointer + : public __add_pointer_helper<_Tp> + { }; + + template + struct add_pointer<_Tp&> + { using type = _Tp*; }; + + template + struct add_pointer<_Tp&&> + { using type = _Tp*; }; +#endif + +#if __cplusplus > 201103L + /// Alias template for remove_pointer + template + using remove_pointer_t = typename remove_pointer<_Tp>::type; + + /// Alias template for add_pointer + template + using add_pointer_t = typename add_pointer<_Tp>::type; +#endif + + /// @cond undocumented + + // Aligned to maximum fundamental alignment + struct __attribute__((__aligned__)) __aligned_storage_max_align_t + { }; + + constexpr size_t + __aligned_storage_default_alignment([[__maybe_unused__]] size_t __len) + { +#if _GLIBCXX_INLINE_VERSION + using _Max_align + = integral_constant; + + return __len > (_Max_align::value / 2) + ? _Max_align::value +# if _GLIBCXX_USE_BUILTIN_TRAIT(__builtin_clzg) + : 1 << (__SIZE_WIDTH__ - __builtin_clzg(__len - 1u)); +# else + : 1 << (__LLONG_WIDTH__ - __builtin_clzll(__len - 1ull)); +# endif +#else + // Returning a fixed value is incorrect, but kept for ABI compatibility. + // XXX GLIBCXX_ABI Deprecated + return alignof(__aligned_storage_max_align_t); +#endif + } + /// @endcond + + /** + * @brief Aligned storage + * + * The member typedef `type` is be a POD type suitable for use as + * uninitialized storage for any object whose size is at most `_Len` + * and whose alignment is a divisor of `_Align`. + * + * It is important to use the nested `type` as uninitialized storage, + * not the `std::aligned_storage` type itself which is an empty class + * with 1-byte alignment. So this is correct: + * + * `typename std::aligned_storage::type m_xobj;` + * + * This is wrong: + * + * `std::aligned_storage m_xobj;` + * + * In C++14 and later `std::aligned_storage_t` + * can be used to refer to the `type` member typedef. + * + * The default value of _Align is supposed to be the most stringent + * fundamental alignment requirement for any C++ object type whose size + * is no greater than `_Len` (see [basic.align] in the C++ standard). + * + * @bug In this implementation the default value for _Align is always the + * maximum fundamental alignment, i.e. `alignof(max_align_t)`, which is + * incorrect. It should be an alignment value no greater than `_Len`. + * + * @deprecated Deprecated in C++23. Uses can be replaced by an + * array `std::byte[_Len]` declared with `alignas(_Align)`. + */ + template + struct + _GLIBCXX23_DEPRECATED + aligned_storage + { + struct type + { + alignas(_Align) unsigned char __data[_Len]; + }; + }; + + template + struct __strictest_alignment + { + static const size_t _S_alignment = 0; + static const size_t _S_size = 0; + }; + + template + struct __strictest_alignment<_Tp, _Types...> + { + static const size_t _S_alignment = + alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment + ? alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment; + static const size_t _S_size = + sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size + ? sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size; + }; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + + /** + * @brief Provide aligned storage for types. + * + * [meta.trans.other] + * + * Provides aligned storage for any of the provided types of at + * least size _Len. + * + * @see aligned_storage + * + * @deprecated Deprecated in C++23. + */ + template + struct + _GLIBCXX23_DEPRECATED + aligned_union + { + private: + static_assert(sizeof...(_Types) != 0, "At least one type is required"); + + using __strictest = __strictest_alignment<_Types...>; + static const size_t _S_len = _Len > __strictest::_S_size + ? _Len : __strictest::_S_size; + public: + /// The value of the strictest alignment of _Types. + static const size_t alignment_value = __strictest::_S_alignment; + /// The storage. + using type = typename aligned_storage<_S_len, alignment_value>::type; + }; + + template + const size_t aligned_union<_Len, _Types...>::alignment_value; +#pragma GCC diagnostic pop + + /// @cond undocumented + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__decay) + template + struct decay + { using type = __decay(_Tp); }; +#else + // Decay trait for arrays and functions, used for perfect forwarding + // in make_pair, make_tuple, etc. + template + struct __decay_selector + : __conditional_t::value, // false for functions + remove_cv<_Up>, // N.B. DR 705. + add_pointer<_Up>> // function decays to pointer + { }; + + template + struct __decay_selector<_Up[_Nm]> + { using type = _Up*; }; + + template + struct __decay_selector<_Up[]> + { using type = _Up*; }; + + /// @endcond + + /// decay + template + struct decay + { using type = typename __decay_selector<_Tp>::type; }; + + template + struct decay<_Tp&> + { using type = typename __decay_selector<_Tp>::type; }; + + template + struct decay<_Tp&&> + { using type = typename __decay_selector<_Tp>::type; }; +#endif + + /// @cond undocumented + + // Helper which adds a reference to a type when given a reference_wrapper + template + struct __strip_reference_wrapper + { + using __type = _Tp; + }; + + template + struct __strip_reference_wrapper > + { + using __type = _Tp&; + }; + + // __decay_t (std::decay_t for C++11). + template + using __decay_t = typename decay<_Tp>::type; + + template + using __decay_and_strip = __strip_reference_wrapper<__decay_t<_Tp>>; + /// @endcond + + /// @cond undocumented + + // Helper for SFINAE constraints + template + using _Require = __enable_if_t<__and_<_Cond...>::value>; + + // __remove_cvref_t (std::remove_cvref_t for C++11). + template + using __remove_cvref_t + = typename remove_cv::type>::type; + /// @endcond + + // Primary template. + /// Define a member typedef @c type to one of two argument types. + template + struct conditional + { using type = _Iftrue; }; + + // Partial specialization for false. + template + struct conditional + { using type = _Iffalse; }; + + /// common_type + template + struct common_type; + + // Sfinae-friendly common_type implementation: + + /// @cond undocumented + + // For several sfinae-friendly trait implementations we transport both the + // result information (as the member type) and the failure information (no + // member type). This is very similar to std::enable_if, but we cannot use + // that, because we need to derive from them as an implementation detail. + + template + struct __success_type + { using type = _Tp; }; + + struct __failure_type + { }; + + struct __do_common_type_impl + { + template + using __cond_t + = decltype(true ? std::declval<_Tp>() : std::declval<_Up>()); + + // if decay_t() : declval())> + // denotes a valid type, let C denote that type. + template + static __success_type<__decay_t<__cond_t<_Tp, _Up>>> + _S_test(int); + +#if __cplusplus > 201703L + // Otherwise, if COND-RES(CREF(D1), CREF(D2)) denotes a type, + // let C denote the type decay_t. + template + static __success_type<__remove_cvref_t<__cond_t>> + _S_test_2(int); +#endif + + template + static __failure_type + _S_test_2(...); + + template + static decltype(_S_test_2<_Tp, _Up>(0)) + _S_test(...); + }; + + // If sizeof...(T) is zero, there shall be no member type. + template<> + struct common_type<> + { }; + + // If sizeof...(T) is one, the same type, if any, as common_type_t. + template + struct common_type<_Tp0> + : public common_type<_Tp0, _Tp0> + { }; + + // If sizeof...(T) is two, ... + template, typename _Dp2 = __decay_t<_Tp2>> + struct __common_type_impl + { + // If is_same_v is false or is_same_v is false, + // let C denote the same type, if any, as common_type_t. + using type = common_type<_Dp1, _Dp2>; + }; + + template + struct __common_type_impl<_Tp1, _Tp2, _Tp1, _Tp2> + : private __do_common_type_impl + { + // Otherwise, if decay_t() : declval())> + // denotes a valid type, let C denote that type. + using type = decltype(_S_test<_Tp1, _Tp2>(0)); + }; + + // If sizeof...(T) is two, ... + template + struct common_type<_Tp1, _Tp2> + : public __common_type_impl<_Tp1, _Tp2>::type + { }; + + template + struct __common_type_pack + { }; + + template + struct __common_type_fold; + + // If sizeof...(T) is greater than two, ... + template + struct common_type<_Tp1, _Tp2, _Rp...> + : public __common_type_fold, + __common_type_pack<_Rp...>> + { }; + + // Let C denote the same type, if any, as common_type_t. + // If there is such a type C, type shall denote the same type, if any, + // as common_type_t. + template + struct __common_type_fold<_CTp, __common_type_pack<_Rp...>, + __void_t> + : public common_type + { }; + + // Otherwise, there shall be no member type. + template + struct __common_type_fold<_CTp, _Rp, void> + { }; + + template + struct __underlying_type_impl + { + using type = __underlying_type(_Tp); + }; + + template + struct __underlying_type_impl<_Tp, false> + { }; + /// @endcond + + /// The underlying type of an enum. + template + struct underlying_type + : public __underlying_type_impl<_Tp> + { }; + + /// @cond undocumented + template + struct __declval_protector + { + static const bool __stop = false; + }; + /// @endcond + + /** Utility to simplify expressions used in unevaluated operands + * @since C++11 + * @ingroup utilities + */ + template + auto declval() noexcept -> decltype(__declval<_Tp>(0)) + { + static_assert(__declval_protector<_Tp>::__stop, + "declval() must not be used!"); + return __declval<_Tp>(0); + } + + /// result_of + template + struct result_of; + + // Sfinae-friendly result_of implementation: + + /// @cond undocumented + struct __invoke_memfun_ref { }; + struct __invoke_memfun_deref { }; + struct __invoke_memobj_ref { }; + struct __invoke_memobj_deref { }; + struct __invoke_other { }; + + // Associate a tag type with a specialization of __success_type. + template + struct __result_of_success : __success_type<_Tp> + { using __invoke_type = _Tag; }; + + // [func.require] paragraph 1 bullet 1: + struct __result_of_memfun_ref_impl + { + template + static __result_of_success().*std::declval<_Fp>())(std::declval<_Args>()...) + ), __invoke_memfun_ref> _S_test(int); + + template + static __failure_type _S_test(...); + }; + + template + struct __result_of_memfun_ref + : private __result_of_memfun_ref_impl + { + using type = decltype(_S_test<_MemPtr, _Arg, _Args...>(0)); + }; + + // [func.require] paragraph 1 bullet 2: + struct __result_of_memfun_deref_impl + { + template + static __result_of_success()).*std::declval<_Fp>())(std::declval<_Args>()...) + ), __invoke_memfun_deref> _S_test(int); + + template + static __failure_type _S_test(...); + }; + + template + struct __result_of_memfun_deref + : private __result_of_memfun_deref_impl + { + using type = decltype(_S_test<_MemPtr, _Arg, _Args...>(0)); + }; + + // [func.require] paragraph 1 bullet 3: + struct __result_of_memobj_ref_impl + { + template + static __result_of_success().*std::declval<_Fp>() + ), __invoke_memobj_ref> _S_test(int); + + template + static __failure_type _S_test(...); + }; + + template + struct __result_of_memobj_ref + : private __result_of_memobj_ref_impl + { + using type = decltype(_S_test<_MemPtr, _Arg>(0)); + }; + + // [func.require] paragraph 1 bullet 4: + struct __result_of_memobj_deref_impl + { + template + static __result_of_success()).*std::declval<_Fp>() + ), __invoke_memobj_deref> _S_test(int); + + template + static __failure_type _S_test(...); + }; + + template + struct __result_of_memobj_deref + : private __result_of_memobj_deref_impl + { + using type = decltype(_S_test<_MemPtr, _Arg>(0)); + }; + + template + struct __result_of_memobj; + + template + struct __result_of_memobj<_Res _Class::*, _Arg> + { + using _Argval = __remove_cvref_t<_Arg>; + using _MemPtr = _Res _Class::*; + using type = typename __conditional_t<__or_, + is_base_of<_Class, _Argval>>::value, + __result_of_memobj_ref<_MemPtr, _Arg>, + __result_of_memobj_deref<_MemPtr, _Arg> + >::type; + }; + + template + struct __result_of_memfun; + + template + struct __result_of_memfun<_Res _Class::*, _Arg, _Args...> + { + using _Argval = typename remove_reference<_Arg>::type; + using _MemPtr = _Res _Class::*; + using type = typename __conditional_t::value, + __result_of_memfun_ref<_MemPtr, _Arg, _Args...>, + __result_of_memfun_deref<_MemPtr, _Arg, _Args...> + >::type; + }; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2219. INVOKE-ing a pointer to member with a reference_wrapper + // as the object expression + + // Used by result_of, invoke etc. to unwrap a reference_wrapper. + template> + struct __inv_unwrap + { + using type = _Tp; + }; + + template + struct __inv_unwrap<_Tp, reference_wrapper<_Up>> + { + using type = _Up&; + }; + + template + struct __result_of_impl + { + using type = __failure_type; + }; + + template + struct __result_of_impl + : public __result_of_memobj<__decay_t<_MemPtr>, + typename __inv_unwrap<_Arg>::type> + { }; + + template + struct __result_of_impl + : public __result_of_memfun<__decay_t<_MemPtr>, + typename __inv_unwrap<_Arg>::type, _Args...> + { }; + + // [func.require] paragraph 1 bullet 5: + struct __result_of_other_impl + { + template + static __result_of_success()(std::declval<_Args>()...) + ), __invoke_other> _S_test(int); + + template + static __failure_type _S_test(...); + }; + + template + struct __result_of_impl + : private __result_of_other_impl + { + using type = decltype(_S_test<_Functor, _ArgTypes...>(0)); + }; + + // __invoke_result (std::invoke_result for C++11) + template + struct __invoke_result + : public __result_of_impl< + is_member_object_pointer< + typename remove_reference<_Functor>::type + >::value, + is_member_function_pointer< + typename remove_reference<_Functor>::type + >::value, + _Functor, _ArgTypes... + >::type + { }; + + // __invoke_result_t (std::invoke_result_t for C++11) + template + using __invoke_result_t = typename __invoke_result<_Fn, _Args...>::type; + /// @endcond + + template + struct result_of<_Functor(_ArgTypes...)> + : public __invoke_result<_Functor, _ArgTypes...> + { } _GLIBCXX17_DEPRECATED_SUGGEST("std::invoke_result"); + +#if __cplusplus >= 201402L +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + /// Alias template for aligned_storage + template + using aligned_storage_t _GLIBCXX23_DEPRECATED = typename aligned_storage<_Len, _Align>::type; + + template + using aligned_union_t _GLIBCXX23_DEPRECATED = typename aligned_union<_Len, _Types...>::type; +#pragma GCC diagnostic pop + + /// Alias template for decay + template + using decay_t = typename decay<_Tp>::type; + + /// Alias template for enable_if + template + using enable_if_t = typename enable_if<_Cond, _Tp>::type; + + /// Alias template for conditional + template + using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type; + + /// Alias template for common_type + template + using common_type_t = typename common_type<_Tp...>::type; + + /// Alias template for underlying_type + template + using underlying_type_t = typename underlying_type<_Tp>::type; + + /// Alias template for result_of + template + using result_of_t = typename result_of<_Tp>::type; +#endif // C++14 + +#ifdef __cpp_lib_void_t // C++ >= 17 || GNU++ >= 11 + /// A metafunction that always yields void, used for detecting valid types. + template using void_t = void; +#endif + + /// @cond undocumented + + // Detection idiom. + // Detect whether _Op<_Args...> is a valid type, use default _Def if not. + +#if __cpp_concepts + // Implementation of the detection idiom (negative case). + template class _Op, typename... _Args> + struct __detected_or + { + using type = _Def; + using __is_detected = false_type; + }; + + // Implementation of the detection idiom (positive case). + template class _Op, typename... _Args> + requires requires { typename _Op<_Args...>; } + struct __detected_or<_Def, _Op, _Args...> + { + using type = _Op<_Args...>; + using __is_detected = true_type; + }; +#else + /// Implementation of the detection idiom (negative case). + template class _Op, typename... _Args> + struct __detector + { + using type = _Default; + using __is_detected = false_type; + }; + + /// Implementation of the detection idiom (positive case). + template class _Op, + typename... _Args> + struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...> + { + using type = _Op<_Args...>; + using __is_detected = true_type; + }; + + template class _Op, + typename... _Args> + using __detected_or = __detector<_Default, void, _Op, _Args...>; +#endif // __cpp_concepts + + // _Op<_Args...> if that is a valid type, otherwise _Default. + template class _Op, + typename... _Args> + using __detected_or_t + = typename __detected_or<_Default, _Op, _Args...>::type; + + /** + * Use SFINAE to determine if the type _Tp has a publicly-accessible + * member type _NTYPE. + */ +#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \ + template> \ + struct __has_##_NTYPE \ + : false_type \ + { }; \ + template \ + struct __has_##_NTYPE<_Tp, __void_t> \ + : true_type \ + { }; + + template + struct __is_swappable; + + template + struct __is_nothrow_swappable; + + template + struct __is_tuple_like_impl : false_type + { }; + + // Internal type trait that allows us to sfinae-protect tuple_cat. + template + struct __is_tuple_like + : public __is_tuple_like_impl<__remove_cvref_t<_Tp>>::type + { }; + /// @endcond + + template + _GLIBCXX20_CONSTEXPR + inline + _Require<__not_<__is_tuple_like<_Tp>>, + is_move_constructible<_Tp>, + is_move_assignable<_Tp>> + swap(_Tp&, _Tp&) + noexcept(__and_, + is_nothrow_move_assignable<_Tp>>::value); + + template + _GLIBCXX20_CONSTEXPR + inline + __enable_if_t<__is_swappable<_Tp>::value> + swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) + noexcept(__is_nothrow_swappable<_Tp>::value); + + /// @cond undocumented + namespace __swappable_details { + using std::swap; + + struct __do_is_swappable_impl + { + template(), std::declval<_Tp&>()))> + static true_type __test(int); + + template + static false_type __test(...); + }; + + struct __do_is_nothrow_swappable_impl + { + template + static __bool_constant< + noexcept(swap(std::declval<_Tp&>(), std::declval<_Tp&>())) + > __test(int); + + template + static false_type __test(...); + }; + + } // namespace __swappable_details + + template + struct __is_swappable_impl + : public __swappable_details::__do_is_swappable_impl + { + using type = decltype(__test<_Tp>(0)); + }; + + template + struct __is_nothrow_swappable_impl + : public __swappable_details::__do_is_nothrow_swappable_impl + { + using type = decltype(__test<_Tp>(0)); + }; + + template + struct __is_swappable + : public __is_swappable_impl<_Tp>::type + { }; + + template + struct __is_nothrow_swappable + : public __is_nothrow_swappable_impl<_Tp>::type + { }; + /// @endcond + +#ifdef __cpp_lib_is_swappable // C++ >= 17 || GNU++ >= 11 + /// Metafunctions used for detecting swappable types: p0185r1 + + /// is_swappable + template + struct is_swappable + : public __is_swappable_impl<_Tp>::type + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// is_nothrow_swappable + template + struct is_nothrow_swappable + : public __is_nothrow_swappable_impl<_Tp>::type + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + +#if __cplusplus >= 201402L + /// is_swappable_v + template + _GLIBCXX17_INLINE constexpr bool is_swappable_v = + is_swappable<_Tp>::value; + + /// is_nothrow_swappable_v + template + _GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_v = + is_nothrow_swappable<_Tp>::value; +#endif // __cplusplus >= 201402L + + /// @cond undocumented + namespace __swappable_with_details { + using std::swap; + + struct __do_is_swappable_with_impl + { + template(), std::declval<_Up>())), + typename + = decltype(swap(std::declval<_Up>(), std::declval<_Tp>()))> + static true_type __test(int); + + template + static false_type __test(...); + }; + + struct __do_is_nothrow_swappable_with_impl + { + template + static __bool_constant< + noexcept(swap(std::declval<_Tp>(), std::declval<_Up>())) + && + noexcept(swap(std::declval<_Up>(), std::declval<_Tp>())) + > __test(int); + + template + static false_type __test(...); + }; + + } // namespace __swappable_with_details + + template + struct __is_swappable_with_impl + : public __swappable_with_details::__do_is_swappable_with_impl + { + using type = decltype(__test<_Tp, _Up>(0)); + }; + + // Optimization for the homogenous lvalue case, not required: + template + struct __is_swappable_with_impl<_Tp&, _Tp&> + : public __swappable_details::__do_is_swappable_impl + { + using type = decltype(__test<_Tp&>(0)); + }; + + template + struct __is_nothrow_swappable_with_impl + : public __swappable_with_details::__do_is_nothrow_swappable_with_impl + { + using type = decltype(__test<_Tp, _Up>(0)); + }; + + // Optimization for the homogenous lvalue case, not required: + template + struct __is_nothrow_swappable_with_impl<_Tp&, _Tp&> + : public __swappable_details::__do_is_nothrow_swappable_impl + { + using type = decltype(__test<_Tp&>(0)); + }; + /// @endcond + + /// is_swappable_with + template + struct is_swappable_with + : public __is_swappable_with_impl<_Tp, _Up>::type + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "first template argument must be a complete class or an unbounded array"); + static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}), + "second template argument must be a complete class or an unbounded array"); + }; + + /// is_nothrow_swappable_with + template + struct is_nothrow_swappable_with + : public __is_nothrow_swappable_with_impl<_Tp, _Up>::type + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "first template argument must be a complete class or an unbounded array"); + static_assert(std::__is_complete_or_unbounded(__type_identity<_Up>{}), + "second template argument must be a complete class or an unbounded array"); + }; + +#if __cplusplus >= 201402L + /// is_swappable_with_v + template + _GLIBCXX17_INLINE constexpr bool is_swappable_with_v = + is_swappable_with<_Tp, _Up>::value; + + /// is_nothrow_swappable_with_v + template + _GLIBCXX17_INLINE constexpr bool is_nothrow_swappable_with_v = + is_nothrow_swappable_with<_Tp, _Up>::value; +#endif // __cplusplus >= 201402L + +#endif // __cpp_lib_is_swappable + + /// @cond undocumented + + // __is_invocable (std::is_invocable for C++11) + + // The primary template is used for invalid INVOKE expressions. + template::value, typename = void> + struct __is_invocable_impl + : false_type + { + using __nothrow_conv = false_type; // For is_nothrow_invocable_r + }; + + // Used for valid INVOKE and INVOKE expressions. + template + struct __is_invocable_impl<_Result, _Ret, + /* is_void<_Ret> = */ true, + __void_t> + : true_type + { + using __nothrow_conv = true_type; // For is_nothrow_invocable_r + }; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" + // Used for INVOKE expressions to check the implicit conversion to R. + template + struct __is_invocable_impl<_Result, _Ret, + /* is_void<_Ret> = */ false, + __void_t> + { + private: + // The type of the INVOKE expression. + using _Res_t = typename _Result::type; + + // Unlike declval, this doesn't add_rvalue_reference, so it respects + // guaranteed copy elision. + static _Res_t _S_get() noexcept; + + // Used to check if _Res_t can implicitly convert to _Tp. + template + static void _S_conv(__type_identity_t<_Tp>) noexcept; + + // This overload is viable if INVOKE(f, args...) can convert to _Tp. + template(_S_get())), + typename = decltype(_S_conv<_Tp>(_S_get())), +#if __has_builtin(__reference_converts_from_temporary) + bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t) +#else + bool _Dangle = false +#endif + > + static __bool_constant<_Nothrow && !_Dangle> + _S_test(int); + + template + static false_type + _S_test(...); + + public: + // For is_invocable_r + using type = decltype(_S_test<_Ret, /* Nothrow = */ true>(1)); + + // For is_nothrow_invocable_r + using __nothrow_conv = decltype(_S_test<_Ret>(1)); + }; +#pragma GCC diagnostic pop + + template + struct __is_invocable + : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type + { }; + + template + constexpr bool __call_is_nt(__invoke_memfun_ref) + { + using _Up = typename __inv_unwrap<_Tp>::type; + return noexcept((std::declval<_Up>().*std::declval<_Fn>())( + std::declval<_Args>()...)); + } + + template + constexpr bool __call_is_nt(__invoke_memfun_deref) + { + return noexcept(((*std::declval<_Tp>()).*std::declval<_Fn>())( + std::declval<_Args>()...)); + } + + template + constexpr bool __call_is_nt(__invoke_memobj_ref) + { + using _Up = typename __inv_unwrap<_Tp>::type; + return noexcept(std::declval<_Up>().*std::declval<_Fn>()); + } + + template + constexpr bool __call_is_nt(__invoke_memobj_deref) + { + return noexcept((*std::declval<_Tp>()).*std::declval<_Fn>()); + } + + template + constexpr bool __call_is_nt(__invoke_other) + { + return noexcept(std::declval<_Fn>()(std::declval<_Args>()...)); + } + + template + struct __call_is_nothrow + : __bool_constant< + std::__call_is_nt<_Fn, _Args...>(typename _Result::__invoke_type{}) + > + { }; + + template + using __call_is_nothrow_ + = __call_is_nothrow<__invoke_result<_Fn, _Args...>, _Fn, _Args...>; + + // __is_nothrow_invocable (std::is_nothrow_invocable for C++11) + template + struct __is_nothrow_invocable + : __and_<__is_invocable<_Fn, _Args...>, + __call_is_nothrow_<_Fn, _Args...>>::type + { }; + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wctor-dtor-privacy" + struct __nonesuchbase {}; + struct __nonesuch : private __nonesuchbase { + ~__nonesuch() = delete; + __nonesuch(__nonesuch const&) = delete; + void operator=(__nonesuch const&) = delete; + }; +#pragma GCC diagnostic pop + /// @endcond + +#ifdef __cpp_lib_is_invocable // C++ >= 17 + /// std::invoke_result + template + struct invoke_result + : public __invoke_result<_Functor, _ArgTypes...> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Functor>{}), + "_Functor must be a complete class or an unbounded array"); + static_assert((std::__is_complete_or_unbounded( + __type_identity<_ArgTypes>{}) && ...), + "each argument type must be a complete class or an unbounded array"); + }; + + /// std::invoke_result_t + template + using invoke_result_t = typename invoke_result<_Fn, _Args...>::type; + + /// std::is_invocable + template + struct is_invocable +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_invocable) + : public __bool_constant<__is_invocable(_Fn, _ArgTypes...)> +#else + : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>::type +#endif + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}), + "_Fn must be a complete class or an unbounded array"); + static_assert((std::__is_complete_or_unbounded( + __type_identity<_ArgTypes>{}) && ...), + "each argument type must be a complete class or an unbounded array"); + }; + + /// std::is_invocable_r + template + struct is_invocable_r + : __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>::type + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}), + "_Fn must be a complete class or an unbounded array"); + static_assert((std::__is_complete_or_unbounded( + __type_identity<_ArgTypes>{}) && ...), + "each argument type must be a complete class or an unbounded array"); + static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}), + "_Ret must be a complete class or an unbounded array"); + }; + + /// std::is_nothrow_invocable + template + struct is_nothrow_invocable +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable) + : public __bool_constant<__is_nothrow_invocable(_Fn, _ArgTypes...)> +#else + : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>, + __call_is_nothrow_<_Fn, _ArgTypes...>>::type +#endif + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}), + "_Fn must be a complete class or an unbounded array"); + static_assert((std::__is_complete_or_unbounded( + __type_identity<_ArgTypes>{}) && ...), + "each argument type must be a complete class or an unbounded array"); + }; + + /// @cond undocumented + // This checks that the INVOKE expression is well-formed and that the + // conversion to R does not throw. It does *not* check whether the INVOKE + // expression itself can throw. That is done by __call_is_nothrow_ instead. + template + using __is_nt_invocable_impl + = typename __is_invocable_impl<_Result, _Ret>::__nothrow_conv; + /// @endcond + + /// std::is_nothrow_invocable_r + template + struct is_nothrow_invocable_r + : __and_<__is_nt_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, _Ret>, + __call_is_nothrow_<_Fn, _ArgTypes...>>::type + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}), + "_Fn must be a complete class or an unbounded array"); + static_assert((std::__is_complete_or_unbounded( + __type_identity<_ArgTypes>{}) && ...), + "each argument type must be a complete class or an unbounded array"); + static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}), + "_Ret must be a complete class or an unbounded array"); + }; +#endif // __cpp_lib_is_invocable + +#if __cpp_lib_type_trait_variable_templates // C++ >= 17 + /** + * @defgroup variable_templates Variable templates for type traits + * @ingroup metaprogramming + * + * Each variable `is_xxx_v` is a boolean constant with the same value + * as the `value` member of the corresponding type trait `is_xxx`. + * + * @since C++17 unless noted otherwise. + */ + + /** + * @{ + * @ingroup variable_templates + */ +template + inline constexpr bool is_void_v = is_void<_Tp>::value; +template + inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; +template + inline constexpr bool is_integral_v = is_integral<_Tp>::value; +template + inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array) +template + inline constexpr bool is_array_v = __is_array(_Tp); +#else +template + inline constexpr bool is_array_v = false; +template + inline constexpr bool is_array_v<_Tp[]> = true; +template + inline constexpr bool is_array_v<_Tp[_Num]> = true; +#endif + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_pointer) +template + inline constexpr bool is_pointer_v = __is_pointer(_Tp); +#else +template + inline constexpr bool is_pointer_v = false; +template + inline constexpr bool is_pointer_v<_Tp*> = true; +template + inline constexpr bool is_pointer_v<_Tp* const> = true; +template + inline constexpr bool is_pointer_v<_Tp* volatile> = true; +template + inline constexpr bool is_pointer_v<_Tp* const volatile> = true; +#endif + +template + inline constexpr bool is_lvalue_reference_v = false; +template + inline constexpr bool is_lvalue_reference_v<_Tp&> = true; +template + inline constexpr bool is_rvalue_reference_v = false; +template + inline constexpr bool is_rvalue_reference_v<_Tp&&> = true; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_object_pointer) +template + inline constexpr bool is_member_object_pointer_v = + __is_member_object_pointer(_Tp); +#else +template + inline constexpr bool is_member_object_pointer_v = + is_member_object_pointer<_Tp>::value; +#endif + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_function_pointer) +template + inline constexpr bool is_member_function_pointer_v = + __is_member_function_pointer(_Tp); +#else +template + inline constexpr bool is_member_function_pointer_v = + is_member_function_pointer<_Tp>::value; +#endif + +template + inline constexpr bool is_enum_v = __is_enum(_Tp); +template + inline constexpr bool is_union_v = __is_union(_Tp); +template + inline constexpr bool is_class_v = __is_class(_Tp); +// is_function_v is defined below, after is_const_v. + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_reference) +template + inline constexpr bool is_reference_v = __is_reference(_Tp); +#else +template + inline constexpr bool is_reference_v = false; +template + inline constexpr bool is_reference_v<_Tp&> = true; +template + inline constexpr bool is_reference_v<_Tp&&> = true; +#endif + +template + inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; +template + inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object) +template + inline constexpr bool is_object_v = __is_object(_Tp); +#else +template + inline constexpr bool is_object_v = is_object<_Tp>::value; +#endif + +template + inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; +template + inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer) +template + inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); +#else +template + inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; +#endif + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_const) +template + inline constexpr bool is_const_v = __is_const(_Tp); +#else +template + inline constexpr bool is_const_v = false; +template + inline constexpr bool is_const_v = true; +#endif + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_function) +template + inline constexpr bool is_function_v = __is_function(_Tp); +#else +template + inline constexpr bool is_function_v = !is_const_v; +template + inline constexpr bool is_function_v<_Tp&> = false; +template + inline constexpr bool is_function_v<_Tp&&> = false; +#endif + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_volatile) +template + inline constexpr bool is_volatile_v = __is_volatile(_Tp); +#else +template + inline constexpr bool is_volatile_v = false; +template + inline constexpr bool is_volatile_v = true; +#endif + +template + _GLIBCXX26_DEPRECATED_SUGGEST("is_trivially_default_constructible_v && is_trivially_copyable_v") + inline constexpr bool is_trivial_v = __is_trivial(_Tp); +template + inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp); +template + inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); +template + _GLIBCXX20_DEPRECATED_SUGGEST("is_standard_layout_v && is_trivial_v") + inline constexpr bool is_pod_v = __is_pod(_Tp); +template + _GLIBCXX17_DEPRECATED + inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); +template + inline constexpr bool is_empty_v = __is_empty(_Tp); +template + inline constexpr bool is_polymorphic_v = __is_polymorphic(_Tp); +template + inline constexpr bool is_abstract_v = __is_abstract(_Tp); +template + inline constexpr bool is_final_v = __is_final(_Tp); + +template + inline constexpr bool is_signed_v = is_signed<_Tp>::value; +template + inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; + +template + inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...); +template + inline constexpr bool is_default_constructible_v = __is_constructible(_Tp); +template + inline constexpr bool is_copy_constructible_v + = __is_constructible(_Tp, __add_lval_ref_t); +template + inline constexpr bool is_move_constructible_v + = __is_constructible(_Tp, __add_rval_ref_t<_Tp>); + +template + inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Up); +template + inline constexpr bool is_copy_assignable_v + = __is_assignable(__add_lval_ref_t<_Tp>, __add_lval_ref_t); +template + inline constexpr bool is_move_assignable_v + = __is_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>); + +template + inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; + +template + inline constexpr bool is_trivially_constructible_v + = __is_trivially_constructible(_Tp, _Args...); +template + inline constexpr bool is_trivially_default_constructible_v + = __is_trivially_constructible(_Tp); +template + inline constexpr bool is_trivially_copy_constructible_v + = __is_trivially_constructible(_Tp, __add_lval_ref_t); +template + inline constexpr bool is_trivially_move_constructible_v + = __is_trivially_constructible(_Tp, __add_rval_ref_t<_Tp>); + +template + inline constexpr bool is_trivially_assignable_v + = __is_trivially_assignable(_Tp, _Up); +template + inline constexpr bool is_trivially_copy_assignable_v + = __is_trivially_assignable(__add_lval_ref_t<_Tp>, + __add_lval_ref_t); +template + inline constexpr bool is_trivially_move_assignable_v + = __is_trivially_assignable(__add_lval_ref_t<_Tp>, + __add_rval_ref_t<_Tp>); + +#if __cpp_concepts +template + inline constexpr bool is_trivially_destructible_v = false; + +template + requires (!is_reference_v<_Tp>) && requires (_Tp& __t) { __t.~_Tp(); } + inline constexpr bool is_trivially_destructible_v<_Tp> + = __has_trivial_destructor(_Tp); +template + inline constexpr bool is_trivially_destructible_v<_Tp&> = true; +template + inline constexpr bool is_trivially_destructible_v<_Tp&&> = true; +template + inline constexpr bool is_trivially_destructible_v<_Tp[_Nm]> + = is_trivially_destructible_v<_Tp>; +#else +template + inline constexpr bool is_trivially_destructible_v = + is_trivially_destructible<_Tp>::value; +#endif + +template + inline constexpr bool is_nothrow_constructible_v + = __is_nothrow_constructible(_Tp, _Args...); +template + inline constexpr bool is_nothrow_default_constructible_v + = __is_nothrow_constructible(_Tp); +template + inline constexpr bool is_nothrow_copy_constructible_v + = __is_nothrow_constructible(_Tp, __add_lval_ref_t); +template + inline constexpr bool is_nothrow_move_constructible_v + = __is_nothrow_constructible(_Tp, __add_rval_ref_t<_Tp>); + +template + inline constexpr bool is_nothrow_assignable_v + = __is_nothrow_assignable(_Tp, _Up); +template + inline constexpr bool is_nothrow_copy_assignable_v + = __is_nothrow_assignable(__add_lval_ref_t<_Tp>, + __add_lval_ref_t); +template + inline constexpr bool is_nothrow_move_assignable_v + = __is_nothrow_assignable(__add_lval_ref_t<_Tp>, __add_rval_ref_t<_Tp>); + +template + inline constexpr bool is_nothrow_destructible_v = + is_nothrow_destructible<_Tp>::value; + +template + inline constexpr bool has_virtual_destructor_v + = __has_virtual_destructor(_Tp); + +template + inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank) \ + && (!defined(__clang__) || __clang_major__ >= 20) // PR118559 +template + inline constexpr size_t rank_v = __array_rank(_Tp); +#else +template + inline constexpr size_t rank_v = 0; +template + inline constexpr size_t rank_v<_Tp[_Size]> = 1 + rank_v<_Tp>; +template + inline constexpr size_t rank_v<_Tp[]> = 1 + rank_v<_Tp>; +#endif + +template + inline constexpr size_t extent_v = 0; +template + inline constexpr size_t extent_v<_Tp[_Size], 0> = _Size; +template + inline constexpr size_t extent_v<_Tp[_Size], _Idx> = extent_v<_Tp, _Idx - 1>; +template + inline constexpr size_t extent_v<_Tp[], 0> = 0; +template + inline constexpr size_t extent_v<_Tp[], _Idx> = extent_v<_Tp, _Idx - 1>; + +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same) +template + inline constexpr bool is_same_v = __is_same(_Tp, _Up); +#else +template + inline constexpr bool is_same_v = false; +template + inline constexpr bool is_same_v<_Tp, _Tp> = true; +#endif +template + inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived); +#ifdef __cpp_lib_is_virtual_base_of // C++ >= 26 +template + inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived); +#endif +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_convertible) +template + inline constexpr bool is_convertible_v = __is_convertible(_From, _To); +#else +template + inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value; +#endif +template + inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value; +template + inline constexpr bool is_nothrow_invocable_v + = is_nothrow_invocable<_Fn, _Args...>::value; +template + inline constexpr bool is_invocable_r_v + = is_invocable_r<_Ret, _Fn, _Args...>::value; +template + inline constexpr bool is_nothrow_invocable_r_v + = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value; +/// @} +#endif // __cpp_lib_type_trait_variable_templates + +#ifdef __cpp_lib_has_unique_object_representations // C++ >= 17 && HAS_UNIQ_OBJ_REP + /// has_unique_object_representations + /// @since C++17 + template + struct has_unique_object_representations + : bool_constant<__has_unique_object_representations( + remove_cv_t> + )> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), + "template argument must be a complete class or an unbounded array"); + }; + +# if __cpp_lib_type_trait_variable_templates // C++ >= 17 + /// @ingroup variable_templates + template + inline constexpr bool has_unique_object_representations_v + = has_unique_object_representations<_Tp>::value; +# endif +#endif + +#ifdef __cpp_lib_is_aggregate // C++ >= 17 && builtin_is_aggregate + /// is_aggregate - true if the type is an aggregate. + /// @since C++17 + template + struct is_aggregate + : bool_constant<__is_aggregate(remove_cv_t<_Tp>)> + { }; + +# if __cpp_lib_type_trait_variable_templates // C++ >= 17 + /** is_aggregate_v - true if the type is an aggregate. + * @ingroup variable_templates + * @since C++17 + */ + template + inline constexpr bool is_aggregate_v = __is_aggregate(remove_cv_t<_Tp>); +# endif +#endif + + /** * Remove references and cv-qualifiers. + * @since C++20 + * @{ + */ +#ifdef __cpp_lib_remove_cvref // C++ >= 20 +# if _GLIBCXX_USE_BUILTIN_TRAIT(__remove_cvref) + template + struct remove_cvref + { using type = __remove_cvref(_Tp); }; +# else + template + struct remove_cvref + { using type = typename remove_cv<_Tp>::type; }; + + template + struct remove_cvref<_Tp&> + { using type = typename remove_cv<_Tp>::type; }; + + template + struct remove_cvref<_Tp&&> + { using type = typename remove_cv<_Tp>::type; }; +# endif + + template + using remove_cvref_t = typename remove_cvref<_Tp>::type; + /// @} +#endif // __cpp_lib_remove_cvref + +#ifdef __cpp_lib_type_identity // C++ >= 20 + /** * Identity metafunction. + * @since C++20 + * @{ + */ + template + struct type_identity { using type = _Tp; }; + + template + using type_identity_t = typename type_identity<_Tp>::type; + /// @} +#endif + +#ifdef __cpp_lib_unwrap_ref // C++ >= 20 + /** Unwrap a reference_wrapper + * @since C++20 + * @{ + */ + template + struct unwrap_reference { using type = _Tp; }; + + template + struct unwrap_reference> { using type = _Tp&; }; + + template + using unwrap_reference_t = typename unwrap_reference<_Tp>::type; + /// @} + + /** Decay type and if it's a reference_wrapper, unwrap it + * @since C++20 + * @{ + */ + template + struct unwrap_ref_decay { using type = unwrap_reference_t>; }; + + template + using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; + /// @} +#endif // __cpp_lib_unwrap_ref + +#ifdef __cpp_lib_bounded_array_traits // C++ >= 20 + /// True for a type that is an array of known bound. + /// @ingroup variable_templates + /// @since C++20 +# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_bounded_array) + template + inline constexpr bool is_bounded_array_v = __is_bounded_array(_Tp); +# else + template + inline constexpr bool is_bounded_array_v = false; + + template + inline constexpr bool is_bounded_array_v<_Tp[_Size]> = true; +# endif + + /// True for a type that is an array of unknown bound. + /// @ingroup variable_templates + /// @since C++20 +# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unbounded_array) + template + inline constexpr bool is_unbounded_array_v = __is_unbounded_array(_Tp); +# else + template + inline constexpr bool is_unbounded_array_v = false; + + template + inline constexpr bool is_unbounded_array_v<_Tp[]> = true; +# endif + + /// True for a type that is an array of known bound. + /// @since C++20 + template + struct is_bounded_array + : public bool_constant> + { }; + + /// True for a type that is an array of unknown bound. + /// @since C++20 + template + struct is_unbounded_array + : public bool_constant> + { }; +#endif // __cpp_lib_bounded_array_traits + +#if __has_builtin(__is_layout_compatible) && __cplusplus >= 202002L + + /// @since C++20 + template + struct is_layout_compatible + : bool_constant<__is_layout_compatible(_Tp, _Up)> + { }; + + /// @ingroup variable_templates + /// @since C++20 + template + constexpr bool is_layout_compatible_v + = __is_layout_compatible(_Tp, _Up); + +#if __has_builtin(__builtin_is_corresponding_member) +# ifndef __cpp_lib_is_layout_compatible +# error "libstdc++ bug: is_corresponding_member and is_layout_compatible are provided but their FTM is not set" +# endif + + /// @since C++20 + template + constexpr bool + is_corresponding_member(_M1 _S1::*__m1, _M2 _S2::*__m2) noexcept + { return __builtin_is_corresponding_member(__m1, __m2); } +#endif +#endif + +#if __has_builtin(__is_pointer_interconvertible_base_of) \ + && __cplusplus >= 202002L + /// True if `_Derived` is standard-layout and has a base class of type `_Base` + /// @since C++20 + template + struct is_pointer_interconvertible_base_of + : bool_constant<__is_pointer_interconvertible_base_of(_Base, _Derived)> + { }; + + /// @ingroup variable_templates + /// @since C++20 + template + constexpr bool is_pointer_interconvertible_base_of_v + = __is_pointer_interconvertible_base_of(_Base, _Derived); + +#if __has_builtin(__builtin_is_pointer_interconvertible_with_class) +# ifndef __cpp_lib_is_pointer_interconvertible +# error "libstdc++ bug: is_pointer_interconvertible available but FTM is not set" +# endif + + /// True if `__mp` points to the first member of a standard-layout type + /// @returns true if `s.*__mp` is pointer-interconvertible with `s` + /// @since C++20 + template + constexpr bool + is_pointer_interconvertible_with_class(_Mem _Tp::*__mp) noexcept + { return __builtin_is_pointer_interconvertible_with_class(__mp); } +#endif +#endif + +#ifdef __cpp_lib_is_scoped_enum // C++ >= 23 + /// True if the type is a scoped enumeration type. + /// @since C++23 + +# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum) + template + struct is_scoped_enum + : bool_constant<__is_scoped_enum(_Tp)> + { }; +# else + template + struct is_scoped_enum + : false_type + { }; + + template + requires __is_enum(_Tp) + && requires(remove_cv_t<_Tp> __t) { __t = __t; } // fails if incomplete + struct is_scoped_enum<_Tp> + : bool_constant + { }; +# endif + + /// @ingroup variable_templates + /// @since C++23 +# if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scoped_enum) + template + inline constexpr bool is_scoped_enum_v = __is_scoped_enum(_Tp); +# else + template + inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; +# endif +#endif + +#ifdef __cpp_lib_reference_from_temporary // C++ >= 23 && ref_{converts,constructs}_from_temp + /// True if _Tp is a reference type, a _Up value can be bound to _Tp in + /// direct-initialization, and a temporary object would be bound to + /// the reference, false otherwise. + /// @since C++23 + template + struct reference_constructs_from_temporary + : public bool_constant<__reference_constructs_from_temporary(_Tp, _Up)> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}) + && std::__is_complete_or_unbounded(__type_identity<_Up>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// True if _Tp is a reference type, a _Up value can be bound to _Tp in + /// copy-initialization, and a temporary object would be bound to + /// the reference, false otherwise. + /// @since C++23 + template + struct reference_converts_from_temporary + : public bool_constant<__reference_converts_from_temporary(_Tp, _Up)> + { + static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}) + && std::__is_complete_or_unbounded(__type_identity<_Up>{}), + "template argument must be a complete class or an unbounded array"); + }; + + /// @ingroup variable_templates + /// @since C++23 + template + inline constexpr bool reference_constructs_from_temporary_v + = reference_constructs_from_temporary<_Tp, _Up>::value; + + /// @ingroup variable_templates + /// @since C++23 + template + inline constexpr bool reference_converts_from_temporary_v + = reference_converts_from_temporary<_Tp, _Up>::value; +#endif // __cpp_lib_reference_from_temporary + +#ifdef __cpp_lib_is_constant_evaluated // C++ >= 20 && HAVE_IS_CONST_EVAL + /// Returns true only when called during constant evaluation. + /// @since C++20 + constexpr inline bool + is_constant_evaluated() noexcept + { +#if __cpp_if_consteval >= 202106L + if consteval { return true; } else { return false; } +#else + return __builtin_is_constant_evaluated(); +#endif + } +#endif + +#if __cplusplus >= 202002L + /// @cond undocumented + template + using __copy_cv = typename __match_cv_qualifiers<_From, _To>::__type; + + template + using __cond_res + = decltype(false ? declval<_Xp(&)()>()() : declval<_Yp(&)()>()()); + + template + struct __common_ref_impl + { }; + + // [meta.trans.other], COMMON-REF(A, B) + template + using __common_ref = typename __common_ref_impl<_Ap, _Bp>::type; + + // COND-RES(COPYCV(X, Y) &, COPYCV(Y, X) &) + template + using __condres_cvref + = __cond_res<__copy_cv<_Xp, _Yp>&, __copy_cv<_Yp, _Xp>&>; + + // If A and B are both lvalue reference types, ... + template + struct __common_ref_impl<_Xp&, _Yp&, __void_t<__condres_cvref<_Xp, _Yp>>> + : enable_if>, + __condres_cvref<_Xp, _Yp>> + { }; + + // let C be remove_reference_t&& + template + using __common_ref_C = remove_reference_t<__common_ref<_Xp&, _Yp&>>&&; + + // If A and B are both rvalue reference types, ... + template + struct __common_ref_impl<_Xp&&, _Yp&&, + _Require>, + is_convertible<_Yp&&, __common_ref_C<_Xp, _Yp>>>> + { using type = __common_ref_C<_Xp, _Yp>; }; + + // let D be COMMON-REF(const X&, Y&) + template + using __common_ref_D = __common_ref; + + // If A is an rvalue reference and B is an lvalue reference, ... + template + struct __common_ref_impl<_Xp&&, _Yp&, + _Require>>> + { using type = __common_ref_D<_Xp, _Yp>; }; + + // If A is an lvalue reference and B is an rvalue reference, ... + template + struct __common_ref_impl<_Xp&, _Yp&&> + : __common_ref_impl<_Yp&&, _Xp&> + { }; + /// @endcond + + template class _TQual, template class _UQual> + struct basic_common_reference + { }; + + /// @cond undocumented + template + struct __xref + { template using __type = __copy_cv<_Tp, _Up>; }; + + template + struct __xref<_Tp&> + { template using __type = __copy_cv<_Tp, _Up>&; }; + + template + struct __xref<_Tp&&> + { template using __type = __copy_cv<_Tp, _Up>&&; }; + + template + using __basic_common_ref + = typename basic_common_reference, + remove_cvref_t<_Tp2>, + __xref<_Tp1>::template __type, + __xref<_Tp2>::template __type>::type; + /// @endcond + + template + struct common_reference; + + template + using common_reference_t = typename common_reference<_Tp...>::type; + + // If sizeof...(T) is zero, there shall be no member type. + template<> + struct common_reference<> + { }; + + // If sizeof...(T) is one ... + template + struct common_reference<_Tp0> + { using type = _Tp0; }; + + /// @cond undocumented + template + struct __common_reference_impl + : __common_reference_impl<_Tp1, _Tp2, _Bullet + 1> + { }; + + // If sizeof...(T) is two ... + template + struct common_reference<_Tp1, _Tp2> + : __common_reference_impl<_Tp1, _Tp2> + { }; + + // If T1 and T2 are reference types and COMMON-REF(T1, T2) is well-formed, ... + template + requires is_reference_v<_Tp1> && is_reference_v<_Tp2> + && requires { typename __common_ref<_Tp1, _Tp2>; } +#if __cpp_lib_common_reference // C++ >= 20 + && is_convertible_v, + add_pointer_t<__common_ref<_Tp1, _Tp2>>> + && is_convertible_v, + add_pointer_t<__common_ref<_Tp1, _Tp2>>> +#endif + struct __common_reference_impl<_Tp1, _Tp2, 1> + { using type = __common_ref<_Tp1, _Tp2>; }; + + // Otherwise, if basic_common_reference<...>::type is well-formed, ... + template + requires requires { typename __basic_common_ref<_Tp1, _Tp2>; } + struct __common_reference_impl<_Tp1, _Tp2, 2> + { using type = __basic_common_ref<_Tp1, _Tp2>; }; + + // Otherwise, if COND-RES(T1, T2) is well-formed, ... + template + requires requires { typename __cond_res<_Tp1, _Tp2>; } + struct __common_reference_impl<_Tp1, _Tp2, 3> + { using type = __cond_res<_Tp1, _Tp2>; }; + + // Otherwise, if common_type_t is well-formed, ... + template + requires requires { typename common_type_t<_Tp1, _Tp2>; } + struct __common_reference_impl<_Tp1, _Tp2, 4> + { using type = common_type_t<_Tp1, _Tp2>; }; + + // Otherwise, there shall be no member type. + template + struct __common_reference_impl<_Tp1, _Tp2, 5> + { }; + + // Otherwise, if sizeof...(T) is greater than two, ... + template + struct common_reference<_Tp1, _Tp2, _Rest...> + : __common_type_fold, + __common_type_pack<_Rest...>> + { }; + + // Reuse __common_type_fold for common_reference + template + struct __common_type_fold, + __common_type_pack<_Rest...>, + void_t>> + : public common_reference, _Rest...> + { }; + /// @endcond + +#endif // C++20 + + /// @} group metaprogramming + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +} // extern "C++" + +#endif // C++11 + +#endif // _GLIBCXX_TYPE_TRAITS diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@type_traits.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@type_traits.blob new file mode 100644 index 0000000..a7bd9af Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@type_traits.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@typeinfo b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@typeinfo new file mode 100644 index 0000000..0a94b86 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@typeinfo @@ -0,0 +1,259 @@ +// RTTI support for -*- C++ -*- +// Copyright (C) 1994-2025 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file typeinfo + * This is a Standard C++ Library header. + */ + +#ifndef _TYPEINFO +#define _TYPEINFO + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include +#if __cplusplus >= 201103L +#include +#endif + +#define __glibcxx_want_constexpr_typeinfo +#include + +#pragma GCC visibility push(default) + +extern "C++" { + +namespace __cxxabiv1 +{ + class __class_type_info; +} // namespace __cxxabiv1 + +// Determine whether typeinfo names for the same type are merged (in which +// case comparison can just compare pointers) or not (in which case strings +// must be compared), and whether comparison is to be implemented inline or +// not. We used to do inline pointer comparison by default if weak symbols +// are available, but even with weak symbols sometimes names are not merged +// when objects are loaded with RTLD_LOCAL, so now we always use strcmp by +// default. For ABI compatibility, we do the strcmp inline if weak symbols +// are available, and out-of-line if not. Out-of-line pointer comparison +// is used where the object files are to be portable to multiple systems, +// some of which may not be able to use pointer comparison, but the +// particular system for which libstdc++ is being built can use pointer +// comparison; in particular for most ARM EABI systems, where the ABI +// specifies out-of-line comparison. The compiler's target configuration +// can override the defaults by defining __GXX_TYPEINFO_EQUALITY_INLINE to +// 1 or 0 to indicate whether or not comparison is inline, and +// __GXX_MERGED_TYPEINFO_NAMES to 1 or 0 to indicate whether or not pointer +// comparison can be used. + +#ifndef __GXX_MERGED_TYPEINFO_NAMES +// By default, typeinfo names are not merged. +#define __GXX_MERGED_TYPEINFO_NAMES 0 +#endif + +// By default follow the old inline rules to avoid ABI changes. +#ifndef __GXX_TYPEINFO_EQUALITY_INLINE +# if !__GXX_WEAK__ +# define __GXX_TYPEINFO_EQUALITY_INLINE 0 +# else +# define __GXX_TYPEINFO_EQUALITY_INLINE 1 +# endif +#endif + +namespace std +{ + /** + * @brief Part of RTTI. + * + * The @c type_info class describes type information generated by + * an implementation. + */ + class type_info + { + public: + /** Destructor first. Being the first non-inline virtual function, this + * controls in which translation unit the vtable is emitted. The + * compiler makes use of that information to know where to emit + * the runtime-mandated type_info structures in the new-abi. */ + virtual ~type_info(); + + /** Returns an @e implementation-defined byte string; this is not + * portable between compilers! */ + const char* name() const _GLIBCXX_NOEXCEPT + { return __name[0] == '*' ? __name + 1 : __name; } + + /** Returns true if `*this` precedes `__arg` in the implementation's + * collation order. */ + bool before(const type_info& __arg) const _GLIBCXX_NOEXCEPT; + + _GLIBCXX23_CONSTEXPR + bool operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT; + +#if __cpp_impl_three_way_comparison < 201907L + bool operator!=(const type_info& __arg) const _GLIBCXX_NOEXCEPT + { return !operator==(__arg); } +#endif + +#if __cplusplus >= 201103L + size_t hash_code() const noexcept + { +# if !__GXX_MERGED_TYPEINFO_NAMES + return _Hash_bytes(name(), __builtin_strlen(name()), + static_cast(0xc70f6907UL)); +# else + return reinterpret_cast(__name); +# endif + } +#endif // C++11 + + // Return true if this is a pointer type of some kind + virtual bool __is_pointer_p() const; + + // Return true if this is a function type + virtual bool __is_function_p() const; + + // Try and catch a thrown type. Store an adjusted pointer to the + // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then + // THR_OBJ points to the thrown object. If THR_TYPE is a pointer + // type, then THR_OBJ is the pointer itself. OUTER indicates the + // number of outer pointers, and whether they were const + // qualified. + virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj, + unsigned __outer) const; + + // Internally used during catch matching + virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target, + void **__obj_ptr) const; + + protected: + const char *__name; + + explicit type_info(const char *__n): __name(__n) { } + + private: + // type_info objects cannot be copied. +#if __cplusplus >= 201103L + type_info& operator=(const type_info&) = delete; + type_info(const type_info&) = delete; +#else + type_info& operator=(const type_info&); + type_info(const type_info&); +#endif + +#if ! __GXX_TYPEINFO_EQUALITY_INLINE + bool __equal(const type_info&) const _GLIBCXX_NOEXCEPT; +#endif + }; + +#if __GXX_TYPEINFO_EQUALITY_INLINE + inline bool + type_info::before(const type_info& __arg) const _GLIBCXX_NOEXCEPT + { +#if !__GXX_MERGED_TYPEINFO_NAMES + // Even with the new abi, on systems that support dlopen + // we can run into cases where type_info names aren't merged, + // so we still need to do string comparison. + if (__name[0] != '*' || __arg.__name[0] != '*') + return __builtin_strcmp (__name, __arg.__name) < 0; +#else + // On some targets we can rely on type_info's NTBS being unique, + // and therefore address comparisons are sufficient. +#endif + + // In old abi, or when weak symbols are not supported, there can + // be multiple instances of a type_info object for one + // type. Uniqueness must use the __name value, not object address. + return __name < __arg.__name; + } +#endif + +#if __GXX_TYPEINFO_EQUALITY_INLINE || __cplusplus > 202002L +# if ! __GXX_TYPEINFO_EQUALITY_INLINE + [[__gnu__::__always_inline__]] +# endif + _GLIBCXX23_CONSTEXPR inline bool + type_info::operator==(const type_info& __arg) const _GLIBCXX_NOEXCEPT + { + if (std::__is_constant_evaluated()) + return this == &__arg; + + if (__name == __arg.__name) + return true; + +#if !__GXX_TYPEINFO_EQUALITY_INLINE + // ABI requires comparisons to be non-inline. + return __equal(__arg); +#elif !__GXX_MERGED_TYPEINFO_NAMES + // Need to do string comparison. + return __name[0] != '*' && __builtin_strcmp (__name, __arg.name()) == 0; +#else + return false; +#endif + } +#endif + + + /** + * @brief Thrown during incorrect typecasting. + * @ingroup exceptions + * + * If you attempt an invalid @c dynamic_cast expression, an instance of + * this class (or something derived from this class) is thrown. */ + class bad_cast : public exception + { + public: + bad_cast() _GLIBCXX_USE_NOEXCEPT { } + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 + virtual ~bad_cast() _GLIBCXX_USE_NOEXCEPT; + + // See comment in eh_exception.cc. + virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; + }; + + /** + * @brief Thrown when a NULL pointer in a @c typeid expression is used. + * @ingroup exceptions + */ + class bad_typeid : public exception + { + public: + bad_typeid () _GLIBCXX_USE_NOEXCEPT { } + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 + virtual ~bad_typeid() _GLIBCXX_USE_NOEXCEPT; + + // See comment in eh_exception.cc. + virtual const char* what() const _GLIBCXX_USE_NOEXCEPT; + }; +} // namespace std + +} // extern "C++" + +#pragma GCC visibility pop + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@typeinfo.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@typeinfo.blob new file mode 100644 index 0000000..1301fed Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@typeinfo.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@vector b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@vector new file mode 100644 index 0000000..a98ffb1 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@vector @@ -0,0 +1,193 @@ +// -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/vector + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_VECTOR +#define _GLIBCXX_VECTOR 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#include // container + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#ifdef _GLIBCXX_DEBUG +# include +#endif + +#define __glibcxx_want_algorithm_default_value_type +#define __glibcxx_want_allocator_traits_is_always_equal +#define __glibcxx_want_constexpr_vector +#define __glibcxx_want_containers_ranges +#define __glibcxx_want_erase_if +#define __glibcxx_want_incomplete_container_elements +#define __glibcxx_want_nonmember_container_access +#include + +#if __cplusplus >= 201703L +#include +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + namespace pmr { + template + using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; + } // namespace pmr +# ifdef _GLIBCXX_DEBUG + namespace _GLIBCXX_STD_C::pmr { + template + using vector + = _GLIBCXX_STD_C::vector<_Tp, std::pmr::polymorphic_allocator<_Tp>>; + } // namespace _GLIBCXX_STD_C::pmr +# endif +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // C++17 + +#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + _GLIBCXX20_CONSTEXPR + inline typename vector<_Tp, _Alloc>::size_type + erase_if(vector<_Tp, _Alloc>& __cont, _Predicate __pred) + { + using namespace __gnu_cxx; + _GLIBCXX_STD_C::vector<_Tp, _Alloc>& __ucont = __cont; + const auto __osz = __cont.size(); + const auto __end = __ucont.end(); + auto __removed = std::__remove_if(__ucont.begin(), __end, + __ops::__pred_iter(std::ref(__pred))); + if (__removed != __end) + { + __cont.erase(__niter_wrap(__cont.begin(), __removed), + __cont.end()); + return __osz - __cont.size(); + } + + return 0; + } + + template + _GLIBCXX20_CONSTEXPR + inline typename vector<_Tp, _Alloc>::size_type + erase(vector<_Tp, _Alloc>& __cont, const _Up& __value) + { + using namespace __gnu_cxx; + _GLIBCXX_STD_C::vector<_Tp, _Alloc>& __ucont = __cont; + const auto __osz = __cont.size(); + const auto __end = __ucont.end(); + auto __removed = std::__remove_if(__ucont.begin(), __end, + __ops::__iter_equals_val(__value)); + if (__removed != __end) + { + __cont.erase(__niter_wrap(__cont.begin(), __removed), + __cont.end()); + return __osz - __cont.size(); + } + + return 0; + } +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // __cpp_lib_erase_if + +#ifdef __glibcxx_format_ranges // C++ >= 20 && HOSTED +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + // Standard does not constrain accepted _CharT and declares it as formatter + // of Tp that statisfies is-vector-bool-reference, + template<__format::__char _CharT> + struct formatter<_GLIBCXX_STD_C::_Bit_reference, _CharT> + { + // Standard declares this as template accepting unconstrained + // ParseContext type. + constexpr typename basic_format_parse_context<_CharT>::iterator + parse(basic_format_parse_context<_CharT>& __pc) + { return _M_f.template _M_parse(__pc); } + + // Standard declares this as template accepting unconstrained + // FormatContext type. + template + typename basic_format_context<_Out, _CharT>::iterator + format(const _GLIBCXX_STD_C::_Bit_reference& __u, + basic_format_context<_Out, _CharT>& __fc) const + { return _M_f.format(static_cast(__u), __fc); } + + private: + __format::__formatter_int<_CharT> _M_f; + }; +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std +#endif // __glibcxx_format_ranges + +#endif /* _GLIBCXX_VECTOR */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@vector.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@vector.blob new file mode 100644 index 0000000..d03673b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@vector.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@atomic_word.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@atomic_word.h new file mode 100644 index 0000000..e52824b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@atomic_word.h @@ -0,0 +1,40 @@ +// Low-level type for atomic operations -*- C++ -*- + +// Copyright (C) 2004-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file atomic_word.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_ATOMIC_WORD_H +#define _GLIBCXX_ATOMIC_WORD_H 1 + +typedef int _Atomic_word; + + +// This is a memory order acquire fence. +#define _GLIBCXX_READ_MEM_BARRIER __atomic_thread_fence (__ATOMIC_ACQUIRE) +// This is a memory order release fence. +#define _GLIBCXX_WRITE_MEM_BARRIER __atomic_thread_fence (__ATOMIC_RELEASE) + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@atomic_word.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@atomic_word.h.blob new file mode 100644 index 0000000..ce22a5c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@atomic_word.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++allocator.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++allocator.h new file mode 100644 index 0000000..7f69320 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++allocator.h @@ -0,0 +1,64 @@ +// Base to std::allocator -*- C++ -*- + +// Copyright (C) 2004-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/c++allocator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _GLIBCXX_CXX_ALLOCATOR_H +#define _GLIBCXX_CXX_ALLOCATOR_H 1 + +#include + +#if __cplusplus >= 201103L +namespace std +{ + /** + * @brief An alias to the base class for std::allocator. + * + * Used to set the std::allocator base class to std::__new_allocator. + * + * @ingroup allocators + * @tparam _Tp Type of allocated object. + */ + template + using __allocator_base = __new_allocator<_Tp>; +} +#else +// Define __new_allocator as the base class to std::allocator. +# define __allocator_base __new_allocator +#endif + +#ifndef _GLIBCXX_SANITIZE_STD_ALLOCATOR +# if defined(__SANITIZE_ADDRESS__) +# define _GLIBCXX_SANITIZE_STD_ALLOCATOR 1 +# elif defined __has_feature +# if __has_feature(address_sanitizer) +# define _GLIBCXX_SANITIZE_STD_ALLOCATOR 1 +# endif +# endif +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++allocator.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++allocator.h.blob new file mode 100644 index 0000000..df98618 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++allocator.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++config.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++config.h new file mode 100644 index 0000000..ced5413 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++config.h @@ -0,0 +1,1909 @@ +// Predefined symbols and macros -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/c++config.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{version} + */ + +#ifndef _GLIBCXX_CXX_CONFIG_H +#define _GLIBCXX_CXX_CONFIG_H 1 + +#ifdef _GLIBCXX_SYSHDR +#pragma GCC system_header +#endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wvariadic-macros" +#if __cplusplus +#pragma GCC diagnostic ignored "-Wc++11-extensions" +#pragma GCC diagnostic ignored "-Wc++23-extensions" // bf16 +#endif + +// The major release number for the GCC release the C++ library belongs to. +#define _GLIBCXX_RELEASE 15 + +// The datestamp of the C++ library in compressed ISO date format. +#undef __GLIBCXX__ /* The testsuite defines it to 99999999 to block PCH. */ +#define __GLIBCXX__ 20260209 + +// Macros for various attributes. +// _GLIBCXX_PURE +// _GLIBCXX_CONST +// _GLIBCXX_NORETURN +// _GLIBCXX_NOTHROW +// _GLIBCXX_VISIBILITY +#ifndef _GLIBCXX_PURE +# define _GLIBCXX_PURE __attribute__ ((__pure__)) +#endif + +#ifndef _GLIBCXX_CONST +# define _GLIBCXX_CONST __attribute__ ((__const__)) +#endif + +#ifndef _GLIBCXX_NORETURN +# define _GLIBCXX_NORETURN __attribute__ ((__noreturn__)) +#endif + +// See below for C++ +#ifndef _GLIBCXX_NOTHROW +# ifndef __cplusplus +# define _GLIBCXX_NOTHROW __attribute__((__nothrow__)) +# endif +#endif + +// Macros for visibility attributes. +// _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY +// _GLIBCXX_VISIBILITY +# define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1 + +#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY +# define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V))) +#else +// If this is not supplied by the OS-specific or CPU-specific +// headers included below, it will be defined to an empty default. +# define _GLIBCXX_VISIBILITY(V) _GLIBCXX_PSEUDO_VISIBILITY(V) +#endif + +// Macros for deprecated attributes. +// _GLIBCXX_USE_DEPRECATED +// _GLIBCXX_DEPRECATED +// _GLIBCXX_DEPRECATED_SUGGEST( string-literal ) +// _GLIBCXX11_DEPRECATED +// _GLIBCXX11_DEPRECATED_SUGGEST( string-literal ) +// _GLIBCXX14_DEPRECATED +// _GLIBCXX14_DEPRECATED_SUGGEST( string-literal ) +// _GLIBCXX17_DEPRECATED +// _GLIBCXX17_DEPRECATED_SUGGEST( string-literal ) +// _GLIBCXX20_DEPRECATED +// _GLIBCXX20_DEPRECATED_SUGGEST( string-literal ) +// _GLIBCXX23_DEPRECATED +// _GLIBCXX23_DEPRECATED_SUGGEST( string-literal ) +// _GLIBCXX26_DEPRECATED +// _GLIBCXX26_DEPRECATED_SUGGEST( string-literal ) +#ifndef _GLIBCXX_USE_DEPRECATED +# define _GLIBCXX_USE_DEPRECATED 1 +#endif + +#if defined(__DEPRECATED) +# define _GLIBCXX_DEPRECATED __attribute__ ((__deprecated__)) +# define _GLIBCXX_DEPRECATED_SUGGEST(ALT) \ + __attribute__ ((__deprecated__ ("use '" ALT "' instead"))) +#else +# define _GLIBCXX_DEPRECATED +# define _GLIBCXX_DEPRECATED_SUGGEST(ALT) +#endif + +#if defined(__DEPRECATED) && (__cplusplus >= 201103L) +# define _GLIBCXX11_DEPRECATED _GLIBCXX_DEPRECATED +# define _GLIBCXX11_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) +#else +# define _GLIBCXX11_DEPRECATED +# define _GLIBCXX11_DEPRECATED_SUGGEST(ALT) +#endif + +#if defined(__DEPRECATED) && (__cplusplus >= 201402L) +# define _GLIBCXX14_DEPRECATED _GLIBCXX_DEPRECATED +# define _GLIBCXX14_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) +#else +# define _GLIBCXX14_DEPRECATED +# define _GLIBCXX14_DEPRECATED_SUGGEST(ALT) +#endif + +#if defined(__DEPRECATED) && (__cplusplus >= 201703L) +# define _GLIBCXX17_DEPRECATED [[__deprecated__]] +# define _GLIBCXX17_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) +#else +# define _GLIBCXX17_DEPRECATED +# define _GLIBCXX17_DEPRECATED_SUGGEST(ALT) +#endif + +#if defined(__DEPRECATED) && (__cplusplus >= 202002L) +# define _GLIBCXX20_DEPRECATED [[__deprecated__]] +# define _GLIBCXX20_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) +#else +# define _GLIBCXX20_DEPRECATED +# define _GLIBCXX20_DEPRECATED_SUGGEST(ALT) +#endif + +#if defined(__DEPRECATED) && (__cplusplus >= 202100L) +# define _GLIBCXX23_DEPRECATED [[__deprecated__]] +# define _GLIBCXX23_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) +#else +# define _GLIBCXX23_DEPRECATED +# define _GLIBCXX23_DEPRECATED_SUGGEST(ALT) +#endif + +#if defined(__DEPRECATED) && (__cplusplus >= 202400L) +# define _GLIBCXX26_DEPRECATED [[__deprecated__]] +# define _GLIBCXX26_DEPRECATED_SUGGEST(ALT) _GLIBCXX_DEPRECATED_SUGGEST(ALT) +#else +# define _GLIBCXX26_DEPRECATED +# define _GLIBCXX26_DEPRECATED_SUGGEST(ALT) +#endif + +// Macros for ABI tag attributes. +#ifndef _GLIBCXX_ABI_TAG_CXX11 +# define _GLIBCXX_ABI_TAG_CXX11 __attribute ((__abi_tag__ ("cxx11"))) +#endif + +// Macro to warn about unused results. +#if __cplusplus >= 201103L +# define _GLIBCXX_NODISCARD [[__nodiscard__]] +#else +# define _GLIBCXX_NODISCARD +#endif + + + +#if __cplusplus + +// Macro for constexpr, to support in mixed 03/0x mode. +#ifndef _GLIBCXX_CONSTEXPR +# if __cplusplus >= 201103L +# define _GLIBCXX_CONSTEXPR constexpr +# define _GLIBCXX_USE_CONSTEXPR constexpr +# else +# define _GLIBCXX_CONSTEXPR +# define _GLIBCXX_USE_CONSTEXPR const +# endif +#endif + +#ifndef _GLIBCXX14_CONSTEXPR +# if __cplusplus >= 201402L +# define _GLIBCXX14_CONSTEXPR constexpr +# else +# define _GLIBCXX14_CONSTEXPR +# endif +#endif + +#ifndef _GLIBCXX17_CONSTEXPR +# if __cplusplus >= 201703L +# define _GLIBCXX17_CONSTEXPR constexpr +# else +# define _GLIBCXX17_CONSTEXPR +# endif +#endif + +#ifndef _GLIBCXX20_CONSTEXPR +# if __cplusplus >= 202002L +# define _GLIBCXX20_CONSTEXPR constexpr +# else +# define _GLIBCXX20_CONSTEXPR +# endif +#endif + +#ifndef _GLIBCXX23_CONSTEXPR +# if __cplusplus >= 202100L +# define _GLIBCXX23_CONSTEXPR constexpr +# else +# define _GLIBCXX23_CONSTEXPR +# endif +#endif + +#ifndef _GLIBCXX26_CONSTEXPR +# if __cplusplus >= 202400L +# define _GLIBCXX26_CONSTEXPR constexpr +# else +# define _GLIBCXX26_CONSTEXPR +# endif +#endif + +#ifndef _GLIBCXX17_INLINE +# if __cplusplus >= 201703L +# define _GLIBCXX17_INLINE inline +# else +# define _GLIBCXX17_INLINE +# endif +#endif + +// Macro for noexcept, to support in mixed 03/0x mode. +#ifndef _GLIBCXX_NOEXCEPT +# if __cplusplus >= 201103L +# define _GLIBCXX_NOEXCEPT noexcept +# define _GLIBCXX_NOEXCEPT_IF(...) noexcept(__VA_ARGS__) +# define _GLIBCXX_USE_NOEXCEPT noexcept +# define _GLIBCXX_THROW(_EXC) +# else +# define _GLIBCXX_NOEXCEPT +# define _GLIBCXX_NOEXCEPT_IF(...) +# define _GLIBCXX_USE_NOEXCEPT throw() +# define _GLIBCXX_THROW(_EXC) throw(_EXC) +# endif +#endif + +#ifndef _GLIBCXX_NOTHROW +# define _GLIBCXX_NOTHROW _GLIBCXX_USE_NOEXCEPT +#endif + +#ifndef _GLIBCXX_THROW_OR_ABORT +# if __cpp_exceptions +# define _GLIBCXX_THROW_OR_ABORT(_EXC) (throw (_EXC)) +# else +# define _GLIBCXX_THROW_OR_ABORT(_EXC) (__builtin_abort(), (void)(_EXC)) +# endif +#endif + +#if __cpp_noexcept_function_type +#define _GLIBCXX_NOEXCEPT_PARM , bool _NE +#define _GLIBCXX_NOEXCEPT_QUAL noexcept (_NE) +#else +#define _GLIBCXX_NOEXCEPT_PARM +#define _GLIBCXX_NOEXCEPT_QUAL +#endif + +// Macro for extern template, ie controlling template linkage via use +// of extern keyword on template declaration. As documented in the g++ +// manual, it inhibits all implicit instantiations and is used +// throughout the library to avoid multiple weak definitions for +// required types that are already explicitly instantiated in the +// library binary. This substantially reduces the binary size of +// resulting executables. +// Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern +// templates only in basic_string, thus activating its debug-mode +// checks even at -O0. +# define _GLIBCXX_EXTERN_TEMPLATE 1 + +/* + Outline of libstdc++ namespaces. + + namespace std + { + namespace __debug { } + namespace __parallel { } + namespace __cxx1998 { } + + namespace __detail { + namespace __variant { } // C++17 + } + + namespace rel_ops { } + + namespace tr1 + { + namespace placeholders { } + namespace regex_constants { } + namespace __detail { } + } + + namespace tr2 { } + + namespace decimal { } + + namespace chrono { } // C++11 + namespace placeholders { } // C++11 + namespace regex_constants { } // C++11 + namespace this_thread { } // C++11 + inline namespace literals { // C++14 + inline namespace chrono_literals { } // C++14 + inline namespace complex_literals { } // C++14 + inline namespace string_literals { } // C++14 + inline namespace string_view_literals { } // C++17 + } + } + + namespace abi { } + + namespace __gnu_cxx + { + namespace __detail { } + } + + For full details see: + http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/namespaces.html +*/ +namespace std +{ + typedef __SIZE_TYPE__ size_t; + typedef __PTRDIFF_TYPE__ ptrdiff_t; + +#if __cplusplus >= 201103L + typedef decltype(nullptr) nullptr_t; +#endif + +#pragma GCC visibility push(default) + // This allows the library to terminate without including all of + // and without making the declaration of std::terminate visible to users. + extern "C++" __attribute__ ((__noreturn__, __always_inline__)) + inline void __terminate() _GLIBCXX_USE_NOEXCEPT + { + void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__,__cold__)); + terminate(); + } +#pragma GCC visibility pop +} + +# define _GLIBCXX_USE_DUAL_ABI 1 + +#if ! _GLIBCXX_USE_DUAL_ABI +// Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI +# undef _GLIBCXX_USE_CXX11_ABI +#endif + +#ifndef _GLIBCXX_USE_CXX11_ABI +# define _GLIBCXX_USE_CXX11_ABI 1 +#endif + +#if _GLIBCXX_USE_CXX11_ABI +namespace std +{ + inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } +} +namespace __gnu_cxx +{ + inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } +} +# define _GLIBCXX_NAMESPACE_CXX11 __cxx11:: +# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 namespace __cxx11 { +# define _GLIBCXX_END_NAMESPACE_CXX11 } +# define _GLIBCXX_DEFAULT_ABI_TAG _GLIBCXX_ABI_TAG_CXX11 +#else +# define _GLIBCXX_NAMESPACE_CXX11 +# define _GLIBCXX_BEGIN_NAMESPACE_CXX11 +# define _GLIBCXX_END_NAMESPACE_CXX11 +# define _GLIBCXX_DEFAULT_ABI_TAG +#endif + +// Non-zero if inline namespaces are used for versioning the entire library. +# define _GLIBCXX_INLINE_VERSION 0 + +#if _GLIBCXX_INLINE_VERSION +// Inline namespace for symbol versioning of (nearly) everything in std. +# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __8 { +# define _GLIBCXX_END_NAMESPACE_VERSION } +// Unused when everything in std is versioned anyway. +# define _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X) +# define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X) + +namespace std +{ +inline _GLIBCXX_BEGIN_NAMESPACE_VERSION +#if __cplusplus >= 201402L + inline namespace literals { + inline namespace chrono_literals { } + inline namespace complex_literals { } + inline namespace string_literals { } +#if __cplusplus > 201402L + inline namespace string_view_literals { } +#endif // C++17 + } +#endif // C++14 +_GLIBCXX_END_NAMESPACE_VERSION +} + +namespace __gnu_cxx +{ +inline _GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_END_NAMESPACE_VERSION +} + +#else +// Unused. +# define _GLIBCXX_BEGIN_NAMESPACE_VERSION +# define _GLIBCXX_END_NAMESPACE_VERSION +// Used to version individual components, e.g. std::_V2::error_category. +# define _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(X) inline namespace X { +# define _GLIBCXX_END_INLINE_ABI_NAMESPACE(X) } // inline namespace X +#endif + +// In the case that we don't have a hosted environment, we can't provide the +// debugging mode. Instead, we do our best and downgrade to assertions. +#if defined(_GLIBCXX_DEBUG) && !__STDC_HOSTED__ +#undef _GLIBCXX_DEBUG +#define _GLIBCXX_ASSERTIONS 1 +#endif + +// Inline namespaces for special modes: debug, parallel. +#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Non-inline namespace for components replaced by alternates in active mode. + namespace __cxx1998 + { +# if _GLIBCXX_USE_CXX11_ABI + inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } +# endif + } + +_GLIBCXX_END_NAMESPACE_VERSION + + // Inline namespace for debug mode. +# ifdef _GLIBCXX_DEBUG + inline namespace __debug { } +# endif + + // Inline namespaces for parallel mode. +# ifdef _GLIBCXX_PARALLEL + inline namespace __parallel { } +# endif +} + +// Check for invalid usage and unsupported mixed-mode use. +# if defined(_GLIBCXX_DEBUG) && defined(_GLIBCXX_PARALLEL) +# error illegal use of multiple inlined namespaces +# endif + +// Check for invalid use due to lack for weak symbols. +# if __NO_INLINE__ && !__GXX_WEAK__ +# warning currently using inlined namespace mode which may fail \ + without inlining due to lack of weak symbols +# endif +#endif + +// Macros for namespace scope. Either namespace std:: or the name +// of some nested namespace within it corresponding to the active mode. +// _GLIBCXX_STD_A +// _GLIBCXX_STD_C +// +// Macros for opening/closing conditional namespaces. +// _GLIBCXX_BEGIN_NAMESPACE_ALGO +// _GLIBCXX_END_NAMESPACE_ALGO +// _GLIBCXX_BEGIN_NAMESPACE_CONTAINER +// _GLIBCXX_END_NAMESPACE_CONTAINER +#if defined(_GLIBCXX_DEBUG) +# define _GLIBCXX_STD_C __cxx1998 +# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER \ + namespace _GLIBCXX_STD_C { +# define _GLIBCXX_END_NAMESPACE_CONTAINER } +#else +# define _GLIBCXX_STD_C std +# define _GLIBCXX_BEGIN_NAMESPACE_CONTAINER +# define _GLIBCXX_END_NAMESPACE_CONTAINER +#endif + +#ifdef _GLIBCXX_PARALLEL +# define _GLIBCXX_STD_A __cxx1998 +# define _GLIBCXX_BEGIN_NAMESPACE_ALGO \ + namespace _GLIBCXX_STD_A { +# define _GLIBCXX_END_NAMESPACE_ALGO } +#else +# define _GLIBCXX_STD_A std +# define _GLIBCXX_BEGIN_NAMESPACE_ALGO +# define _GLIBCXX_END_NAMESPACE_ALGO +#endif + +// GLIBCXX_ABI Deprecated +// Define if compatibility should be provided for -mlong-double-64. +#undef _GLIBCXX_LONG_DOUBLE_COMPAT + +// Use an alternate macro to test for clang, so as to provide an easy +// workaround for systems (such as vxworks) whose headers require +// __clang__ to be defined, even when compiling with GCC. +#if !defined _GLIBCXX_CLANG && defined __clang__ +# define _GLIBCXX_CLANG __clang__ +// Turn -D_GLIBCXX_CLANG=0 into -U_GLIBCXX_CLANG, so that +// _GLIBCXX_CLANG can be tested as defined, just like __clang__. +#elif !_GLIBCXX_CLANG +# undef _GLIBCXX_CLANG +#endif + +// Define if compatibility should be provided for alternative 128-bit long +// double formats. Not possible for Clang until __ibm128 is supported. +#ifndef _GLIBCXX_CLANG +#undef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT +#endif + +// Inline namespaces for long double 128 modes. +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ +namespace std +{ + // Namespaces for 128-bit IEEE long double format on 64-bit POWER LE. + inline namespace __gnu_cxx_ieee128 { } + inline namespace __gnu_cxx11_ieee128 { } +} +# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ieee128:: +# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ieee128 { +# define _GLIBCXX_END_NAMESPACE_LDBL } +# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 __gnu_cxx11_ieee128:: +# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 namespace __gnu_cxx11_ieee128 { +# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 } + +#else // _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && IEEE128 + +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ +namespace std +{ + inline namespace __gnu_cxx_ldbl128 { } +} +# define _GLIBCXX_NAMESPACE_LDBL __gnu_cxx_ldbl128:: +# define _GLIBCXX_BEGIN_NAMESPACE_LDBL namespace __gnu_cxx_ldbl128 { +# define _GLIBCXX_END_NAMESPACE_LDBL } +#else +# define _GLIBCXX_NAMESPACE_LDBL +# define _GLIBCXX_BEGIN_NAMESPACE_LDBL +# define _GLIBCXX_END_NAMESPACE_LDBL +#endif + +#if _GLIBCXX_USE_CXX11_ABI +# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_CXX11 +# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_CXX11 +# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_CXX11 +#else +# define _GLIBCXX_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_NAMESPACE_LDBL +# define _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_BEGIN_NAMESPACE_LDBL +# define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL +#endif + +#endif // _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && IEEE128 + +namespace std +{ +#pragma GCC visibility push(default) + // Internal version of std::is_constant_evaluated(). + // This can be used without checking if the compiler supports the feature. + // The macro _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED can be used to check if + // the compiler support is present to make this function work as expected. + __attribute__((__always_inline__)) + _GLIBCXX_CONSTEXPR inline bool + __is_constant_evaluated() _GLIBCXX_NOEXCEPT + { +#if __cpp_if_consteval >= 202106L +# define _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED 1 + if consteval { return true; } else { return false; } +#elif __cplusplus >= 201103L && __has_builtin(__builtin_is_constant_evaluated) +# define _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED 1 + return __builtin_is_constant_evaluated(); +#else + return false; +#endif + } +#pragma GCC visibility pop +} + +#ifndef _GLIBCXX_ASSERTIONS +# if defined(_GLIBCXX_DEBUG) +// Debug Mode implies checking assertions. +# define _GLIBCXX_ASSERTIONS 1 +# elif ! defined(__OPTIMIZE__) && ! defined(_GLIBCXX_NO_ASSERTIONS) +// Enable assertions for unoptimized builds. +# define _GLIBCXX_ASSERTIONS 1 +# endif +#endif + +// Disable std::string explicit instantiation declarations in order to assert. +#ifdef _GLIBCXX_ASSERTIONS +# undef _GLIBCXX_EXTERN_TEMPLATE +# define _GLIBCXX_EXTERN_TEMPLATE -1 +#endif + +#define _GLIBCXX_VERBOSE_ASSERT 1 + +// Assert. +#ifdef _GLIBCXX_VERBOSE_ASSERT +namespace std +{ +#pragma GCC visibility push(default) + // Don't use because this should be unaffected by NDEBUG. + extern "C++" _GLIBCXX_NORETURN __attribute__((__cold__)) + void + __glibcxx_assert_fail /* Called when a precondition violation is detected. */ + (const char* __file, int __line, const char* __function, + const char* __condition) + _GLIBCXX_NOEXCEPT; +#pragma GCC visibility pop +} +# define _GLIBCXX_ASSERT_FAIL(_Condition) \ + std::__glibcxx_assert_fail(__FILE__, __LINE__, __PRETTY_FUNCTION__, \ + #_Condition) +#else // ! VERBOSE_ASSERT +# define _GLIBCXX_ASSERT_FAIL(_Condition) __builtin_abort() +#endif + +#if defined(_GLIBCXX_ASSERTIONS) +// When _GLIBCXX_ASSERTIONS is defined we enable runtime assertion checks. +// These checks will also be done during constant evaluation. +# define __glibcxx_assert(cond) \ + do { \ + if (__builtin_expect(!bool(cond), false)) \ + _GLIBCXX_ASSERT_FAIL(cond); \ + } while (false) +#elif _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED +// _GLIBCXX_ASSERTIONS is not defined, so assertions checks are only enabled +// during constant evaluation. This ensures we diagnose undefined behaviour +// in constant expressions. +namespace std +{ + __attribute__((__always_inline__,__visibility__("default"))) + inline void + __glibcxx_assert_fail() + { } +} +# define __glibcxx_assert(cond) \ + do { \ + if (std::__is_constant_evaluated() && !bool(cond)) \ + std::__glibcxx_assert_fail(); \ + } while (false) +#else +// _GLIBCXX_ASSERTIONS is not defined and __is_constant_evaluated() doesn't +// work so don't check any assertions. +# define __glibcxx_assert(cond) +#endif + +// Macro indicating that TSAN is in use. +#if __SANITIZE_THREAD__ +# define _GLIBCXX_TSAN 1 +#elif defined __has_feature +# if __has_feature(thread_sanitizer) +# define _GLIBCXX_TSAN 1 +# endif +#endif + +// Macros for race detectors. +// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and +// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain +// atomic (lock-free) synchronization to race detectors: +// the race detector will infer a happens-before arc from the former to the +// latter when they share the same argument pointer. +// +// The most frequent use case for these macros (and the only case in the +// current implementation of the library) is atomic reference counting: +// void _M_remove_reference() +// { +// _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); +// if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) +// { +// _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); +// _M_destroy(__a); +// } +// } +// The annotations in this example tell the race detector that all memory +// accesses occurred when the refcount was positive do not race with +// memory accesses which occurred after the refcount became zero. +#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE +# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) +#endif +#ifndef _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER +# define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) +#endif + +// Macros for C linkage: define extern "C" linkage only when using C++. +# define _GLIBCXX_BEGIN_EXTERN_C extern "C" { +# define _GLIBCXX_END_EXTERN_C } + +# define _GLIBCXX_USE_ALLOCATOR_NEW 1 + +#ifdef __SIZEOF_INT128__ +#if ! defined __GLIBCXX_TYPE_INT_N_0 && ! defined __STRICT_ANSI__ +// If __int128 is supported, we expect __GLIBCXX_TYPE_INT_N_0 to be defined +// unless the compiler is in strict mode. If it's not defined and the strict +// macro is not defined, something is wrong. +#warning "__STRICT_ANSI__ seems to have been undefined; this is not supported" +#endif +#endif + +#else // !__cplusplus +# define _GLIBCXX_BEGIN_EXTERN_C +# define _GLIBCXX_END_EXTERN_C +#endif + + +// First includes. + +// Pick up any OS-specific definitions. +#include + +// Pick up any CPU-specific definitions. +#include + +// If platform uses neither visibility nor psuedo-visibility, +// specify empty default for namespace annotation macros. +#ifndef _GLIBCXX_PSEUDO_VISIBILITY +# define _GLIBCXX_PSEUDO_VISIBILITY(V) +#endif + +// Certain function definitions that are meant to be overridable from +// user code are decorated with this macro. For some targets, this +// macro causes these definitions to be weak. +#ifndef _GLIBCXX_WEAK_DEFINITION +# define _GLIBCXX_WEAK_DEFINITION +#endif + +// By default, we assume that __GXX_WEAK__ also means that there is support +// for declaring functions as weak while not defining such functions. This +// allows for referring to functions provided by other libraries (e.g., +// libitm) without depending on them if the respective features are not used. +#ifndef _GLIBCXX_USE_WEAK_REF +# define _GLIBCXX_USE_WEAK_REF __GXX_WEAK__ +#endif + +// Conditionally enable annotations for the Transactional Memory TS on C++11. +// Most of the following conditions are due to limitations in the current +// implementation. +#if __cplusplus >= 201103L && _GLIBCXX_USE_CXX11_ABI \ + && _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201500L \ + && !_GLIBCXX_FULLY_DYNAMIC_STRING && _GLIBCXX_USE_WEAK_REF \ + && _GLIBCXX_USE_ALLOCATOR_NEW +#define _GLIBCXX_TXN_SAFE transaction_safe +#define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic +#else +#define _GLIBCXX_TXN_SAFE +#define _GLIBCXX_TXN_SAFE_DYN +#endif + +#if __cplusplus > 201402L +// In C++17 mathematical special functions are in namespace std. +# define _GLIBCXX_USE_STD_SPEC_FUNCS 1 +#elif __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0 +// For C++11 and C++14 they are in namespace std when requested. +# define _GLIBCXX_USE_STD_SPEC_FUNCS 1 +#endif + +// The remainder of the prewritten config is automatic; all the +// user hooks are listed above. + +// Create a boolean flag to be used to determine if --fast-math is set. +#ifdef __FAST_MATH__ +# define _GLIBCXX_FAST_MATH 1 +#else +# define _GLIBCXX_FAST_MATH 0 +#endif + +// This marks string literals in header files to be extracted for eventual +// translation. It is primarily used for messages in thrown exceptions; see +// src/functexcept.cc. We use __N because the more traditional _N is used +// for something else under certain OSes (see BADNAMES). +#define __N(msgid) (msgid) + +// For example, is known to #define min and max as macros... +#undef min +#undef max + +// N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally +// so they should be tested with #if not with #ifdef. +#if __cplusplus >= 201103L +# ifndef _GLIBCXX_USE_C99_MATH +# define _GLIBCXX_USE_C99_MATH _GLIBCXX11_USE_C99_MATH +# endif +# ifndef _GLIBCXX_USE_C99_COMPLEX +# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX11_USE_C99_COMPLEX +# endif +# ifndef _GLIBCXX_USE_C99_STDIO +# define _GLIBCXX_USE_C99_STDIO _GLIBCXX11_USE_C99_STDIO +# endif +# ifndef _GLIBCXX_USE_C99_STDLIB +# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX11_USE_C99_STDLIB +# endif +# ifndef _GLIBCXX_USE_C99_WCHAR +# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX11_USE_C99_WCHAR +# endif +#else +# ifndef _GLIBCXX_USE_C99_MATH +# define _GLIBCXX_USE_C99_MATH _GLIBCXX98_USE_C99_MATH +# endif +# ifndef _GLIBCXX_USE_C99_COMPLEX +# define _GLIBCXX_USE_C99_COMPLEX _GLIBCXX98_USE_C99_COMPLEX +# endif +# ifndef _GLIBCXX_USE_C99_STDIO +# define _GLIBCXX_USE_C99_STDIO _GLIBCXX98_USE_C99_STDIO +# endif +# ifndef _GLIBCXX_USE_C99_STDLIB +# define _GLIBCXX_USE_C99_STDLIB _GLIBCXX98_USE_C99_STDLIB +# endif +# ifndef _GLIBCXX_USE_C99_WCHAR +# define _GLIBCXX_USE_C99_WCHAR _GLIBCXX98_USE_C99_WCHAR +# endif +#endif + +// Unless explicitly specified, enable char8_t extensions only if the core +// language char8_t feature macro is defined. +#ifndef _GLIBCXX_USE_CHAR8_T +# ifdef __cpp_char8_t +# define _GLIBCXX_USE_CHAR8_T 1 +# endif +#endif +#ifdef _GLIBCXX_USE_CHAR8_T +# define __cpp_lib_char8_t 201907L +#endif + +/* Define if __float128 is supported on this host. */ +#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) +/* For powerpc64 don't use __float128 when it's the same type as long double. */ +# if !(defined(_GLIBCXX_LONG_DOUBLE_ALT128_COMPAT) && defined(__LONG_DOUBLE_IEEE128__)) +# define _GLIBCXX_USE_FLOAT128 1 +# endif +#endif + +#if __FLT_MANT_DIG__ == 24 \ + && __FLT_MIN_EXP__ == -125 \ + && __FLT_MAX_EXP__ == 128 +// Define if float has the IEEE binary32 format. +# define _GLIBCXX_FLOAT_IS_IEEE_BINARY32 1 +#endif + +#if __DBL_MANT_DIG__ == 53 \ + && __DBL_MIN_EXP__ == -1021 \ + && __DBL_MAX_EXP__ == 1024 +// Define if double has the IEEE binary64 format. +# define _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 1 +#elif __FLT_MANT_DIG__ == 24 \ + && __FLT_MIN_EXP__ == -125 \ + && __FLT_MAX_EXP__ == 128 +// Define if double has the IEEE binary32 format. +# define _GLIBCXX_DOUBLE_IS_IEEE_BINARY32 1 +#endif + +#if __LDBL_MANT_DIG__ == 113 \ + && __LDBL_MIN_EXP__ == -16381 \ + && __LDBL_MAX_EXP__ == 16384 +// Define if long double has the IEEE binary128 format. +# define _GLIBCXX_LDOUBLE_IS_IEEE_BINARY128 1 +#elif __LDBL_MANT_DIG__ == 53 \ + && __LDBL_MIN_EXP__ == -1021 \ + && __LDBL_MAX_EXP__ == 1024 +// Define if long double has the IEEE binary64 format. +# define _GLIBCXX_LDOUBLE_IS_IEEE_BINARY64 1 +#elif __LDBL_MANT_DIG__ == 24 \ + && __LDBL_MIN_EXP__ == -125 \ + && __LDBL_MAX_EXP__ == 128 +// Define if long double has the IEEE binary32 format. +# define _GLIBCXX_LDOUBLE_IS_IEEE_BINARY32 1 +#endif + +#if defined __cplusplus && defined __BFLT16_DIG__ +namespace __gnu_cxx +{ + typedef __decltype(0.0bf16) __bfloat16_t; +} +#endif + +#ifdef __has_builtin +# ifdef __is_identifier +// Intel and older Clang require !__is_identifier for some built-ins: +# define _GLIBCXX_HAS_BUILTIN(B) (__has_builtin(B) || ! __is_identifier(B)) +# else +# define _GLIBCXX_HAS_BUILTIN(B) __has_builtin(B) +# endif +#endif + +#if _GLIBCXX_HAS_BUILTIN(__has_unique_object_representations) +# define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1 +#endif + +#if _GLIBCXX_HAS_BUILTIN(__is_aggregate) +# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 +#endif + +#if _GLIBCXX_HAS_BUILTIN(__builtin_launder) +# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 +#endif + +// Returns 1 if _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS is not defined and the +// compiler has a corresponding built-in type trait, 0 otherwise. +// _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS can be defined to disable the use of +// built-in traits. +#ifndef _GLIBCXX_DO_NOT_USE_BUILTIN_TRAITS +# define _GLIBCXX_USE_BUILTIN_TRAIT(BT) _GLIBCXX_HAS_BUILTIN(BT) +#else +# define _GLIBCXX_USE_BUILTIN_TRAIT(BT) 0 +#endif + +// Mark code that should be ignored by the compiler, but seen by Doxygen. +#define _GLIBCXX_DOXYGEN_ONLY(X) + +// PSTL configuration + +#if __cplusplus >= 201703L +// This header is not installed for freestanding: +#if __has_include() +// Preserved here so we have some idea which version of upstream we've pulled in +// #define PSTL_VERSION 9000 + +// For now this defaults to being based on the presence of Thread Building Blocks +# ifndef _GLIBCXX_USE_TBB_PAR_BACKEND +# define _GLIBCXX_USE_TBB_PAR_BACKEND __has_include() +# endif +// This section will need some rework when a new (default) backend type is added +# if _GLIBCXX_USE_TBB_PAR_BACKEND +# define _PSTL_PAR_BACKEND_TBB +# else +# define _PSTL_PAR_BACKEND_SERIAL +# endif + +# define _PSTL_ASSERT(_Condition) __glibcxx_assert(_Condition) +# define _PSTL_ASSERT_MSG(_Condition, _Message) __glibcxx_assert(_Condition) + +#include +#endif // __has_include +#endif // C++17 + +#pragma GCC diagnostic pop + +// End of prewritten config; the settings discovered at configure time follow. +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `acosf' function. */ +#define _GLIBCXX_HAVE_ACOSF 1 + +/* Define to 1 if you have the `acosl' function. */ +#define _GLIBCXX_HAVE_ACOSL 1 + +/* Define to 1 if you have the `aligned_alloc' function. */ +#define _GLIBCXX_HAVE_ALIGNED_ALLOC 1 + +/* Define if arc4random is available in . */ +#define _GLIBCXX_HAVE_ARC4RANDOM 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the `asinf' function. */ +#define _GLIBCXX_HAVE_ASINF 1 + +/* Define to 1 if you have the `asinl' function. */ +#define _GLIBCXX_HAVE_ASINL 1 + +/* Define to 1 if the target assembler supports .symver directive. */ +#define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1 + +/* Define to 1 if you have the `atan2f' function. */ +#define _GLIBCXX_HAVE_ATAN2F 1 + +/* Define to 1 if you have the `atan2l' function. */ +#define _GLIBCXX_HAVE_ATAN2L 1 + +/* Define to 1 if you have the `atanf' function. */ +#define _GLIBCXX_HAVE_ATANF 1 + +/* Define to 1 if you have the `atanl' function. */ +#define _GLIBCXX_HAVE_ATANL 1 + +/* Defined if shared_ptr reference counting should use atomic operations. */ +#define _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY 1 + +/* Define to 1 if you have the `at_quick_exit' function. */ +#define _GLIBCXX_HAVE_AT_QUICK_EXIT 1 + +/* Define if C99 float_t and double_t in should be imported in + in namespace std for C++11. */ +#define _GLIBCXX_HAVE_C99_FLT_EVAL_TYPES 1 + +/* Define to 1 if the target assembler supports thread-local storage. */ +/* #undef _GLIBCXX_HAVE_CC_TLS */ + +/* Define to 1 if you have the `ceilf' function. */ +#define _GLIBCXX_HAVE_CEILF 1 + +/* Define to 1 if you have the `ceill' function. */ +#define _GLIBCXX_HAVE_CEILL 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_COMPLEX_H 1 + +/* Define to 1 if you have the `cosf' function. */ +#define _GLIBCXX_HAVE_COSF 1 + +/* Define to 1 if you have the `coshf' function. */ +#define _GLIBCXX_HAVE_COSHF 1 + +/* Define to 1 if you have the `coshl' function. */ +#define _GLIBCXX_HAVE_COSHL 1 + +/* Define to 1 if you have the `cosl' function. */ +#define _GLIBCXX_HAVE_COSL 1 + +/* Define to 1 if you have the declaration of `strnlen', and to 0 if you + don't. */ +#define _GLIBCXX_HAVE_DECL_STRNLEN 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_DIRENT_H 1 + +/* Define if dirfd is available in . */ +#define _GLIBCXX_HAVE_DIRFD 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_ENDIAN_H 1 + +/* Define to 1 if GCC 4.6 supported std::exception_ptr for the target */ +#define _GLIBCXX_HAVE_EXCEPTION_PTR_SINCE_GCC46 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_EXECINFO_H 1 + +/* Define to 1 if you have the `expf' function. */ +#define _GLIBCXX_HAVE_EXPF 1 + +/* Define to 1 if you have the `expl' function. */ +#define _GLIBCXX_HAVE_EXPL 1 + +/* Define to 1 if you have the `fabsf' function. */ +#define _GLIBCXX_HAVE_FABSF 1 + +/* Define to 1 if you have the `fabsl' function. */ +#define _GLIBCXX_HAVE_FABSL 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_FCNTL_H 1 + +/* Define if fdopendir is available in . */ +#define _GLIBCXX_HAVE_FDOPENDIR 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_FENV_H 1 + +/* Define to 1 if you have the `finite' function. */ +#define _GLIBCXX_HAVE_FINITE 1 + +/* Define to 1 if you have the `finitef' function. */ +#define _GLIBCXX_HAVE_FINITEF 1 + +/* Define to 1 if you have the `finitel' function. */ +#define _GLIBCXX_HAVE_FINITEL 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_FLOAT_H 1 + +/* Define to 1 if you have the `floorf' function. */ +#define _GLIBCXX_HAVE_FLOORF 1 + +/* Define to 1 if you have the `floorl' function. */ +#define _GLIBCXX_HAVE_FLOORL 1 + +/* Define to 1 if you have the `fmodf' function. */ +#define _GLIBCXX_HAVE_FMODF 1 + +/* Define to 1 if you have the `fmodl' function. */ +#define _GLIBCXX_HAVE_FMODL 1 + +/* Define to 1 if you have the `fpclass' function. */ +/* #undef _GLIBCXX_HAVE_FPCLASS */ + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_FP_H */ + +/* Define to 1 if you have the `frexpf' function. */ +#define _GLIBCXX_HAVE_FREXPF 1 + +/* Define to 1 if you have the `frexpl' function. */ +#define _GLIBCXX_HAVE_FREXPL 1 + +/* Define if getentropy is available in . */ +#define _GLIBCXX_HAVE_GETENTROPY 1 + +/* Define if _Unwind_GetIPInfo is available. */ +#define _GLIBCXX_HAVE_GETIPINFO 1 + +/* Define if gets is available in before C++14. */ +#define _GLIBCXX_HAVE_GETS 1 + +/* Define to 1 if you have the `hypot' function. */ +#define _GLIBCXX_HAVE_HYPOT 1 + +/* Define to 1 if you have the `hypotf' function. */ +#define _GLIBCXX_HAVE_HYPOTF 1 + +/* Define to 1 if you have the `hypotl' function. */ +#define _GLIBCXX_HAVE_HYPOTL 1 + +/* Define if you have the iconv() function and it works. */ +#define _GLIBCXX_HAVE_ICONV 1 + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_IEEEFP_H */ + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `isinf' function. */ +/* #undef _GLIBCXX_HAVE_ISINF */ + +/* Define to 1 if you have the `isinff' function. */ +#define _GLIBCXX_HAVE_ISINFF 1 + +/* Define to 1 if you have the `isinfl' function. */ +#define _GLIBCXX_HAVE_ISINFL 1 + +/* Define to 1 if you have the `isnan' function. */ +/* #undef _GLIBCXX_HAVE_ISNAN */ + +/* Define to 1 if you have the `isnanf' function. */ +#define _GLIBCXX_HAVE_ISNANF 1 + +/* Define to 1 if you have the `isnanl' function. */ +#define _GLIBCXX_HAVE_ISNANL 1 + +/* Defined if iswblank exists. */ +#define _GLIBCXX_HAVE_ISWBLANK 1 + +/* Define if LC_MESSAGES is available in . */ +#define _GLIBCXX_HAVE_LC_MESSAGES 1 + +/* Define to 1 if you have the `ldexpf' function. */ +#define _GLIBCXX_HAVE_LDEXPF 1 + +/* Define to 1 if you have the `ldexpl' function. */ +#define _GLIBCXX_HAVE_LDEXPL 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_LIBINTL_H 1 + +/* Only used in build directory testsuite_hooks.h. */ +#define _GLIBCXX_HAVE_LIMIT_AS 1 + +/* Only used in build directory testsuite_hooks.h. */ +#define _GLIBCXX_HAVE_LIMIT_DATA 1 + +/* Only used in build directory testsuite_hooks.h. */ +#define _GLIBCXX_HAVE_LIMIT_FSIZE 1 + +/* Only used in build directory testsuite_hooks.h. */ +#define _GLIBCXX_HAVE_LIMIT_RSS 1 + +/* Only used in build directory testsuite_hooks.h. */ +#define _GLIBCXX_HAVE_LIMIT_VMEM 0 + +/* Define if link is available in . */ +#define _GLIBCXX_HAVE_LINK 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_LINK_H 1 + +/* Define if futex syscall is available. */ +#define _GLIBCXX_HAVE_LINUX_FUTEX 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_LINUX_RANDOM_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_LINUX_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `log10f' function. */ +#define _GLIBCXX_HAVE_LOG10F 1 + +/* Define to 1 if you have the `log10l' function. */ +#define _GLIBCXX_HAVE_LOG10L 1 + +/* Define to 1 if you have the `logf' function. */ +#define _GLIBCXX_HAVE_LOGF 1 + +/* Define to 1 if you have the `logl' function. */ +#define _GLIBCXX_HAVE_LOGL 1 + +/* Define if lseek is available in . */ +#define _GLIBCXX_HAVE_LSEEK 1 + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */ + +/* Define if mbstate_t exists in wchar.h. */ +#define _GLIBCXX_HAVE_MBSTATE_T 1 + +/* Define to 1 if you have the `memalign' function. */ +#define _GLIBCXX_HAVE_MEMALIGN 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `modf' function. */ +#define _GLIBCXX_HAVE_MODF 1 + +/* Define to 1 if you have the `modff' function. */ +#define _GLIBCXX_HAVE_MODFF 1 + +/* Define to 1 if you have the `modfl' function. */ +#define _GLIBCXX_HAVE_MODFL 1 + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_NAN_H */ + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_NETINET_TCP_H 1 + +/* Define if defines obsolete isinf function. */ +/* #undef _GLIBCXX_HAVE_OBSOLETE_ISINF */ + +/* Define if defines obsolete isnan function. */ +/* #undef _GLIBCXX_HAVE_OBSOLETE_ISNAN */ + +/* Define if openat is available in . */ +#define _GLIBCXX_HAVE_OPENAT 1 + +/* Define if O_NONBLOCK is defined in */ +#define _GLIBCXX_HAVE_O_NONBLOCK 1 + +/* Define if poll is available in . */ +#define _GLIBCXX_HAVE_POLL 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_POLL_H 1 + +/* Define to 1 if you have the `posix_memalign' function. */ +#define _GLIBCXX_HAVE_POSIX_MEMALIGN 1 + +/* Define to 1 if POSIX Semaphores with sem_timedwait are available in + . */ +#define _GLIBCXX_HAVE_POSIX_SEMAPHORE 1 + +/* Define to 1 if you have the `powf' function. */ +#define _GLIBCXX_HAVE_POWF 1 + +/* Define to 1 if you have the `powl' function. */ +#define _GLIBCXX_HAVE_POWL 1 + +/* Define to 1 if you have the `qfpclass' function. */ +/* #undef _GLIBCXX_HAVE_QFPCLASS */ + +/* Define to 1 if you have the `quick_exit' function. */ +#define _GLIBCXX_HAVE_QUICK_EXIT 1 + +/* Define if readlink is available in . */ +#define _GLIBCXX_HAVE_READLINK 1 + +/* Define to 1 if you have the `secure_getenv' function. */ +#define _GLIBCXX_HAVE_SECURE_GETENV 1 + +/* Define to 1 if you have the `setenv' function. */ +#define _GLIBCXX_HAVE_SETENV 1 + +/* Define to 1 if you have the `sincos' function. */ +#define _GLIBCXX_HAVE_SINCOS 1 + +/* Define to 1 if you have the `sincosf' function. */ +#define _GLIBCXX_HAVE_SINCOSF 1 + +/* Define to 1 if you have the `sincosl' function. */ +#define _GLIBCXX_HAVE_SINCOSL 1 + +/* Define to 1 if you have the `sinf' function. */ +#define _GLIBCXX_HAVE_SINF 1 + +/* Define to 1 if you have the `sinhf' function. */ +#define _GLIBCXX_HAVE_SINHF 1 + +/* Define to 1 if you have the `sinhl' function. */ +#define _GLIBCXX_HAVE_SINHL 1 + +/* Define to 1 if you have the `sinl' function. */ +#define _GLIBCXX_HAVE_SINL 1 + +/* Defined if sleep exists. */ +/* #undef _GLIBCXX_HAVE_SLEEP */ + +/* Define to 1 if you have the `sockatmark' function. */ +#define _GLIBCXX_HAVE_SOCKATMARK 1 + +/* Define to 1 if you have the `sqrtf' function. */ +#define _GLIBCXX_HAVE_SQRTF 1 + +/* Define to 1 if you have the `sqrtl' function. */ +#define _GLIBCXX_HAVE_SQRTL 1 + +/* Define if the header is supported. */ +#define _GLIBCXX_HAVE_STACKTRACE 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_STDALIGN_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_STDLIB_H 1 + +/* Define if strerror_l is available in . */ +#define _GLIBCXX_HAVE_STRERROR_L 1 + +/* Define if strerror_r is available in . */ +#define _GLIBCXX_HAVE_STRERROR_R 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtof' function. */ +#define _GLIBCXX_HAVE_STRTOF 1 + +/* Define to 1 if you have the `strtold' function. */ +#define _GLIBCXX_HAVE_STRTOLD 1 + +/* Define to 1 if `d_type' is a member of `struct dirent'. */ +#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 1 + +/* Define if strxfrm_l is available in . */ +#define _GLIBCXX_HAVE_STRXFRM_L 1 + +/* Define if symlink is available in . */ +#define _GLIBCXX_HAVE_SYMLINK 1 + +/* Define to 1 if the target runtime linker supports binding the same symbol + to different versions. */ +#define _GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT 1 + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_SYS_FILIO_H */ + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_IPC_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */ + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have a suitable header file */ +#define _GLIBCXX_HAVE_SYS_SDT_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_SEM_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_SYSINFO_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_SYS_UIO_H 1 + +/* Define if S_IFREG is available in . */ +/* #undef _GLIBCXX_HAVE_S_IFREG */ + +/* Define if S_ISREG is available in . */ +#define _GLIBCXX_HAVE_S_ISREG 1 + +/* Define to 1 if you have the `tanf' function. */ +#define _GLIBCXX_HAVE_TANF 1 + +/* Define to 1 if you have the `tanhf' function. */ +#define _GLIBCXX_HAVE_TANHF 1 + +/* Define to 1 if you have the `tanhl' function. */ +#define _GLIBCXX_HAVE_TANHL 1 + +/* Define to 1 if you have the `tanl' function. */ +#define _GLIBCXX_HAVE_TANL 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_TGMATH_H 1 + +/* Define to 1 if you have the `timespec_get' function. */ +#define _GLIBCXX_HAVE_TIMESPEC_GET 1 + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_TLHELP32_H */ + +/* Define to 1 if the target supports thread-local storage. */ +#define _GLIBCXX_HAVE_TLS 1 + +/* Define if truncate is available in . */ +#define _GLIBCXX_HAVE_TRUNCATE 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_UCHAR_H 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_UNISTD_H 1 + +/* Define if unlinkat is available in . */ +#define _GLIBCXX_HAVE_UNLINKAT 1 + +/* Define to 1 if you have the `uselocale' function. */ +#define _GLIBCXX_HAVE_USELOCALE 1 + +/* Defined if usleep exists. */ +/* #undef _GLIBCXX_HAVE_USLEEP */ + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_UTIME_H 1 + +/* Defined if vfwscanf exists. */ +#define _GLIBCXX_HAVE_VFWSCANF 1 + +/* Defined if vswscanf exists. */ +#define _GLIBCXX_HAVE_VSWSCANF 1 + +/* Defined if vwscanf exists. */ +#define _GLIBCXX_HAVE_VWSCANF 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_WCHAR_H 1 + +/* Defined if wcstof exists. */ +#define _GLIBCXX_HAVE_WCSTOF 1 + +/* Define to 1 if you have the header file. */ +#define _GLIBCXX_HAVE_WCTYPE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_WINDOWS_H */ + +/* Define if writev is available in . */ +#define _GLIBCXX_HAVE_WRITEV 1 + +/* Define to 1 if you have the header file. */ +/* #undef _GLIBCXX_HAVE_XLOCALE_H */ + +/* Define to 1 if you have the `_aligned_malloc' function. */ +/* #undef _GLIBCXX_HAVE__ALIGNED_MALLOC */ + +/* Define to 1 if you have the `_wfopen' function. */ +/* #undef _GLIBCXX_HAVE__WFOPEN */ + +/* Define to 1 if you have the `__cxa_thread_atexit' function. */ +/* #undef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT */ + +/* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */ +#define _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL 1 + +/* Define as const if the declaration of iconv() needs const. */ +#define _GLIBCXX_ICONV_CONST + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define _GLIBCXX_LT_OBJDIR ".libs/" + +/* Name of package */ +/* #undef _GLIBCXX_PACKAGE */ + +/* Define to the address where bug reports for this package should be sent. */ +#define _GLIBCXX_PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define _GLIBCXX_PACKAGE_NAME "package-unused" + +/* Define to the full name and version of this package. */ +#define _GLIBCXX_PACKAGE_STRING "package-unused version-unused" + +/* Define to the one symbol short name of this package. */ +#define _GLIBCXX_PACKAGE_TARNAME "libstdc++" + +/* Define to the home page for this package. */ +#define _GLIBCXX_PACKAGE_URL "" + +/* Define to the version of this package. */ +#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION "version-unused" + +/* Define to 1 if you have the ANSI C header files. */ +#define _GLIBCXX_STDC_HEADERS 1 + +/* Version number of package */ +/* #undef _GLIBCXX_VERSION */ + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _GLIBCXX_DARWIN_USE_64_BIT_INODE +# define _GLIBCXX_DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _GLIBCXX_FILE_OFFSET_BITS */ + +/* Define if C99 functions in should be used in for + C++11. Using compiler builtins for these functions requires corresponding + C99 library functions to be present. */ +#define _GLIBCXX11_USE_C99_COMPLEX 1 + +/* Define if C99 generic macros in should be imported in in + namespace std for C++11. */ +#define _GLIBCXX11_USE_C99_MATH 1 + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +#define _GLIBCXX11_USE_C99_STDIO 1 + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +#define _GLIBCXX11_USE_C99_STDLIB 1 + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +#define _GLIBCXX11_USE_C99_WCHAR 1 + +/* Define if C99 functions in should be used in for + C++98. Using compiler builtins for these functions requires corresponding + C99 library functions to be present. */ +#define _GLIBCXX98_USE_C99_COMPLEX 1 + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +#define _GLIBCXX98_USE_C99_MATH 1 + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +#define _GLIBCXX98_USE_C99_STDIO 1 + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +#define _GLIBCXX98_USE_C99_STDLIB 1 + +/* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +#define _GLIBCXX98_USE_C99_WCHAR 1 + +/* Define if the compiler supports C++11 atomics. */ +#define _GLIBCXX_ATOMIC_BUILTINS 1 + +/* Define if global objects can be aligned to + std::hardware_destructive_interference_size. */ +#define _GLIBCXX_CAN_ALIGNAS_DESTRUCTIVE_SIZE 1 + +/* Define to use concept checking code from the boost libraries. */ +/* #undef _GLIBCXX_CONCEPT_CHECKS */ + +/* Define to 1 if a fully dynamic basic_string is wanted, 0 to disable, + undefined for platform defaults */ +#define _GLIBCXX_FULLY_DYNAMIC_STRING 0 + +/* Define if gthreads library is available. */ +#define _GLIBCXX_HAS_GTHREADS 1 + +/* Define to 1 if a full hosted library is built, or 0 if freestanding. */ +#define _GLIBCXX_HOSTED __STDC_HOSTED__ + +/* Define if compatibility should be provided for alternative 128-bit long + double formats. */ + +/* Define if compatibility should be provided for -mlong-double-64. */ + +/* Define to the letter to which size_t is mangled. */ +#define _GLIBCXX_MANGLE_SIZE_T m + +/* Define if C99 llrint and llround functions are missing from . */ +/* #undef _GLIBCXX_NO_C99_ROUNDING_FUNCS */ + +/* Defined if no way to sleep is available. */ +/* #undef _GLIBCXX_NO_SLEEP */ + +/* Define if ptrdiff_t is int. */ +/* #undef _GLIBCXX_PTRDIFF_T_IS_INT */ + +/* Define if using setrlimit to set resource limits during "make check" */ +#define _GLIBCXX_RES_LIMITS 1 + +/* Define if size_t is unsigned int. */ +/* #undef _GLIBCXX_SIZE_T_IS_UINT */ + +/* Define if static tzdata should be compiled into the library. */ +#define _GLIBCXX_STATIC_TZDATA 1 + +/* Define to the value of the EOF integer constant. */ +#define _GLIBCXX_STDIO_EOF -1 + +/* Define to the value of the SEEK_CUR integer constant. */ +#define _GLIBCXX_STDIO_SEEK_CUR 1 + +/* Define to the value of the SEEK_END integer constant. */ +#define _GLIBCXX_STDIO_SEEK_END 2 + +/* Define to use symbol versioning in the shared library. */ +#define _GLIBCXX_SYMVER 1 + +/* Define to use darwin versioning in the shared library. */ +/* #undef _GLIBCXX_SYMVER_DARWIN */ + +/* Define to use GNU versioning in the shared library. */ +#define _GLIBCXX_SYMVER_GNU 1 + +/* Define to use GNU namespace versioning in the shared library. */ +/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */ + +/* Define to use Sun versioning in the shared library. */ +/* #undef _GLIBCXX_SYMVER_SUN */ + +/* Define if C11 functions in should be imported into namespace std + in . */ +#define _GLIBCXX_USE_C11_UCHAR_CXX11 1 + +/* Define if C99 functions or macros from , , , + , and can be used or exposed. */ +#define _GLIBCXX_USE_C99 1 + +/* Define if C99 inverse trig functions in should be used in + . Using compiler builtins for these functions requires + corresponding C99 library functions to be present. */ +#define _GLIBCXX_USE_C99_COMPLEX_ARC 1 + +/* Define if C99 functions in should be used in . + Using compiler builtins for these functions requires corresponding C99 + library functions to be present. */ +#define _GLIBCXX_USE_C99_COMPLEX_TR1 1 + +/* Define if C99 functions in should be imported in in + namespace std for C++11. */ +#define _GLIBCXX_USE_C99_CTYPE 1 + +/* Define if C99 functions in should be imported in in + namespace std::tr1. */ +#define _GLIBCXX_USE_C99_CTYPE_TR1 1 + +/* Define if C99 functions in should be imported in in + namespace std for C++11. */ +#define _GLIBCXX_USE_C99_FENV 1 + +/* Define if C99 functions in should be imported in in + namespace std::tr1. */ +#define _GLIBCXX_USE_C99_FENV_TR1 1 + +/* Define if C99 functions in should be imported in + in namespace std in C++11. */ +#define _GLIBCXX_USE_C99_INTTYPES 1 + +/* Define if C99 functions in should be imported in + in namespace std::tr1. */ +#define _GLIBCXX_USE_C99_INTTYPES_TR1 1 + +/* Define if wchar_t C99 functions in should be imported in + in namespace std in C++11. */ +#define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T 1 + +/* Define if wchar_t C99 functions in should be imported in + in namespace std::tr1. */ +#define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 1 + +/* Define if C99 functions in should be imported in in + namespace std for C++11. */ +#define _GLIBCXX_USE_C99_MATH_FUNCS 1 + +/* Define if C99 functions or macros in should be imported in + in namespace std::tr1. */ +#define _GLIBCXX_USE_C99_MATH_TR1 1 + +/* Define if C99 types in should be imported in in + namespace std for C++11. */ +#define _GLIBCXX_USE_C99_STDINT 1 + +/* Define if C99 types in should be imported in in + namespace std::tr1. */ +#define _GLIBCXX_USE_C99_STDINT_TR1 1 + +/* Define if usable chdir is available in . */ +#define _GLIBCXX_USE_CHDIR 1 + +/* Define if usable chmod is available in . */ +#define _GLIBCXX_USE_CHMOD 1 + +/* Defined if clock_gettime syscall has monotonic and realtime clock support. + */ +/* #undef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL */ + +/* Defined if clock_gettime has monotonic clock support. */ +#define _GLIBCXX_USE_CLOCK_MONOTONIC 1 + +/* Defined if clock_gettime has realtime clock support. */ +#define _GLIBCXX_USE_CLOCK_REALTIME 1 + +/* Define if copy_file_range is available in . */ +/* #undef _GLIBCXX_USE_COPY_FILE_RANGE */ + +/* Define if ISO/IEC TR 24733 decimal floating point types are supported on + this host. */ +#define _GLIBCXX_USE_DECIMAL_FLOAT 1 + +/* Define if /dev/random and /dev/urandom are available for + std::random_device. */ +#define _GLIBCXX_USE_DEV_RANDOM 1 + +/* Define if fchmod is available in . */ +#define _GLIBCXX_USE_FCHMOD 1 + +/* Define if fchmodat is available in . */ +#define _GLIBCXX_USE_FCHMODAT 1 + +/* Define if fseeko and ftello are available. */ +#define _GLIBCXX_USE_FSEEKO_FTELLO 1 + +/* Define if usable getcwd is available in . */ +#define _GLIBCXX_USE_GETCWD 1 + +/* Defined if gettimeofday is available. */ +#define _GLIBCXX_USE_GETTIMEOFDAY 1 + +/* Define if get_nprocs is available in . */ +#define _GLIBCXX_USE_GET_NPROCS 1 + +/* Define if init_priority should be used for iostream initialization. */ +#define _GLIBCXX_USE_INIT_PRIORITY_ATTRIBUTE 1 + +/* Define if LFS support is available. */ +#define _GLIBCXX_USE_LFS 1 + +/* Define if code specialized for long long should be used. */ +#define _GLIBCXX_USE_LONG_LONG 1 + +/* Define if lstat is available in . */ +#define _GLIBCXX_USE_LSTAT 1 + +/* Define if usable mkdir is available in . */ +#define _GLIBCXX_USE_MKDIR 1 + +/* Defined if nanosleep is available. */ +#define _GLIBCXX_USE_NANOSLEEP 1 + +/* Define if NLS translations are to be used. */ +#define _GLIBCXX_USE_NLS 1 + +/* Define if nl_langinfo_l should be used for std::text_encoding. */ +#define _GLIBCXX_USE_NL_LANGINFO_L 1 + +/* Define if pthreads_num_processors_np is available in . */ +/* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */ + +/* Define if pthread_cond_clockwait is available in . */ +#define _GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT 1 + +/* Define if pthread_mutex_clocklock is available in . */ +#define _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK (_GLIBCXX_TSAN==0) + +/* Define if pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock are + available in . */ +#define _GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK 1 + +/* Define if POSIX read/write locks are available in . */ +#define _GLIBCXX_USE_PTHREAD_RWLOCK_T 1 + +/* Define if /dev/random and /dev/urandom are available for the random_device + of TR1 (Chapter 5.1). */ +#define _GLIBCXX_USE_RANDOM_TR1 1 + +/* Define if usable realpath is available in . */ +#define _GLIBCXX_USE_REALPATH 1 + +/* Defined if sched_yield is available. */ +#define _GLIBCXX_USE_SCHED_YIELD 1 + +/* Define if _SC_NPROCESSORS_ONLN is available in . */ +#define _GLIBCXX_USE_SC_NPROCESSORS_ONLN 1 + +/* Define if _SC_NPROC_ONLN is available in . */ +/* #undef _GLIBCXX_USE_SC_NPROC_ONLN */ + +/* Define if sendfile is available in . */ +#define _GLIBCXX_USE_SENDFILE 1 + +/* Define to restrict std::__basic_file<> to stdio APIs. */ +/* #undef _GLIBCXX_USE_STDIO_PURE */ + +/* Define if struct tm has a tm_zone member. */ +#define _GLIBCXX_USE_STRUCT_TM_TM_ZONE 1 + +/* Define if struct stat has timespec members. */ +#define _GLIBCXX_USE_ST_MTIM 1 + +/* Define if sysctl(), CTL_HW and HW_NCPU are available in . */ +/* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */ + +/* Define if obsolescent tmpnam is available in . */ +#define _GLIBCXX_USE_TMPNAM 1 + +/* Define if c8rtomb and mbrtoc8 functions in should be imported + into namespace std in for C++20. */ +#define _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20 1 + +/* Define if c8rtomb and mbrtoc8 functions in should be imported + into namespace std in for -fchar8_t. */ +#define _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T 1 + +/* Define if utime is available in . */ +#define _GLIBCXX_USE_UTIME 1 + +/* Define if utimensat and UTIME_OMIT are available in and + AT_FDCWD in . */ +#define _GLIBCXX_USE_UTIMENSAT 1 + +/* Define if code specialized for wchar_t should be used. */ +#define _GLIBCXX_USE_WCHAR_T 1 + +/* Defined if Sleep exists. */ +/* #undef _GLIBCXX_USE_WIN32_SLEEP */ + +/* Define if _get_osfhandle should be used for filebuf::native_handle(). */ +/* #undef _GLIBCXX_USE__GET_OSFHANDLE */ + +/* Define to 1 if a verbose library is built, or 0 otherwise. */ +#define _GLIBCXX_VERBOSE 1 + +/* Defined if as can handle rdrand. */ +#define _GLIBCXX_X86_RDRAND 1 + +/* Defined if as can handle rdseed. */ +#define _GLIBCXX_X86_RDSEED 1 + +/* Define if a directory should be searched for tzdata files. */ +#define _GLIBCXX_ZONEINFO_DIR "/usr/share/zoneinfo" + +/* Define to 1 if mutex_timedlock is available. */ +#define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 + +/* Define for large files, on AIX-style hosts. */ +/* #undef _GLIBCXX_LARGE_FILES */ + +/* Define if all C++11 floating point overloads are available in . */ +#if __cplusplus >= 201103L +/* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP */ +#endif + +/* Define if all C++11 integral type overloads are available in . */ +#if __cplusplus >= 201103L +/* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT */ +#endif + +#endif // _GLIBCXX_CXX_CONFIG_H diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++config.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++config.h.blob new file mode 100644 index 0000000..45296a4 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++config.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++locale.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++locale.h new file mode 100644 index 0000000..d9a310b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++locale.h @@ -0,0 +1,124 @@ +// Wrapper for underlying C-language localization -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/c++locale.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.8 Standard locale categories. +// + +// Written by Benjamin Kosnik + +#ifndef _GLIBCXX_CXX_LOCALE_H +#define _GLIBCXX_CXX_LOCALE_H 1 + +#pragma GCC system_header + +#include + +#define _GLIBCXX_C_LOCALE_GNU 1 + +#define _GLIBCXX_NUM_CATEGORIES 6 + +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + extern "C" __typeof(uselocale) __uselocale; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + typedef __locale_t __c_locale; + +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ +namespace __gnu_cxx_ieee128 { +#endif + + // Convert numeric value of type double and long double to string and + // return length of string. If vsnprintf is available use it, otherwise + // fall back to the unsafe vsprintf which, in general, can be dangerous + // and should be avoided. + inline int + __convert_from_v(const __c_locale& __cloc __attribute__ ((__unused__)), + char* __out, + const int __size __attribute__ ((__unused__)), + const char* __fmt, ...) + { +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __c_locale __old = __gnu_cxx::__uselocale(__cloc); +#else + char* __old = std::setlocale(LC_NUMERIC, 0); + char* __sav = 0; + if (__builtin_strcmp(__old, "C")) + { + const size_t __len = __builtin_strlen(__old) + 1; + __sav = new char[__len]; + __builtin_memcpy(__sav, __old, __len); + std::setlocale(LC_NUMERIC, "C"); + } +#endif + + __builtin_va_list __args; + __builtin_va_start(__args, __fmt); + +#if _GLIBCXX_USE_C99_STDIO + const int __ret = __builtin_vsnprintf(__out, __size, __fmt, __args); +#else + const int __ret = __builtin_vsprintf(__out, __fmt, __args); +#endif + + __builtin_va_end(__args); + +#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) + __gnu_cxx::__uselocale(__old); +#else + if (__sav) + { + std::setlocale(LC_NUMERIC, __sav); + delete [] __sav; + } +#endif + return __ret; + } + +#if defined _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT \ + && defined __LONG_DOUBLE_IEEE128__ +} // namespace __gnu_cxx_ieee128 +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++locale.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++locale.h.blob new file mode 100644 index 0000000..fccbab8 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@c++locale.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@cpu_defines.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@cpu_defines.h new file mode 100644 index 0000000..c8a183a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@cpu_defines.h @@ -0,0 +1,33 @@ +// Specific definitions for generic platforms -*- C++ -*- + +// Copyright (C) 2005-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/cpu_defines.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iosfwd} + */ + +#ifndef _GLIBCXX_CPU_DEFINES +#define _GLIBCXX_CPU_DEFINES 1 + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@cpu_defines.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@cpu_defines.h.blob new file mode 100644 index 0000000..9eb33f8 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@cpu_defines.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_base.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_base.h new file mode 100644 index 0000000..a6f6fd0 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_base.h @@ -0,0 +1,66 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ctype_base.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +// Information as gleaned from /usr/include/ctype.h + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// @brief Base class for ctype. + struct ctype_base + { + // Non-standard typedefs. + typedef const int* __to_type; + + // NB: Offsets into ctype::_M_table force a particular size + // on the mask type. Because of this, we don't use an enum. + typedef unsigned short mask; + static const mask upper = _ISupper; + static const mask lower = _ISlower; + static const mask alpha = _ISalpha; + static const mask digit = _ISdigit; + static const mask xdigit = _ISxdigit; + static const mask space = _ISspace; + static const mask print = _ISprint; + static const mask graph = _ISalpha | _ISdigit | _ISpunct; + static const mask cntrl = _IScntrl; + static const mask punct = _ISpunct; + static const mask alnum = _ISalpha | _ISdigit; +#if __cplusplus >= 201103L + static const mask blank = _ISblank; +#endif + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_base.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_base.h.blob new file mode 100644 index 0000000..7992c15 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_base.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_inline.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_inline.h new file mode 100644 index 0000000..3a33155 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_inline.h @@ -0,0 +1,76 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2000-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ctype_inline.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*) +// functions go in ctype.cc + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + bool + ctype:: + is(mask __m, char __c) const + { return _M_table[static_cast(__c)] & __m; } + + const char* + ctype:: + is(const char* __low, const char* __high, mask* __vec) const + { + while (__low < __high) + *__vec++ = _M_table[static_cast(*__low++)]; + return __high; + } + + const char* + ctype:: + scan_is(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && !(_M_table[static_cast(*__low)] & __m)) + ++__low; + return __low; + } + + const char* + ctype:: + scan_not(mask __m, const char* __low, const char* __high) const + { + while (__low < __high + && (_M_table[static_cast(*__low)] & __m) != 0) + ++__low; + return __low; + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_inline.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_inline.h.blob new file mode 100644 index 0000000..f22d677 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@ctype_inline.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@error_constants.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@error_constants.h new file mode 100644 index 0000000..3eb6af2 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@error_constants.h @@ -0,0 +1,180 @@ +// Specific definitions for generic platforms -*- C++ -*- + +// Copyright (C) 2007-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/error_constants.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{system_error} + */ + +#ifndef _GLIBCXX_ERROR_CONSTANTS +#define _GLIBCXX_ERROR_CONSTANTS 1 + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + enum class errc + { + address_family_not_supported = EAFNOSUPPORT, + address_in_use = EADDRINUSE, + address_not_available = EADDRNOTAVAIL, + already_connected = EISCONN, + argument_list_too_long = E2BIG, + argument_out_of_domain = EDOM, + bad_address = EFAULT, + bad_file_descriptor = EBADF, + +#ifdef EBADMSG + bad_message = EBADMSG, +#endif + + broken_pipe = EPIPE, + connection_aborted = ECONNABORTED, + connection_already_in_progress = EALREADY, + connection_refused = ECONNREFUSED, + connection_reset = ECONNRESET, + cross_device_link = EXDEV, + destination_address_required = EDESTADDRREQ, + device_or_resource_busy = EBUSY, + directory_not_empty = ENOTEMPTY, + executable_format_error = ENOEXEC, + file_exists = EEXIST, + file_too_large = EFBIG, + filename_too_long = ENAMETOOLONG, + function_not_supported = ENOSYS, + host_unreachable = EHOSTUNREACH, + +#ifdef EIDRM + identifier_removed = EIDRM, +#endif + + illegal_byte_sequence = EILSEQ, + inappropriate_io_control_operation = ENOTTY, + interrupted = EINTR, + invalid_argument = EINVAL, + invalid_seek = ESPIPE, + io_error = EIO, + is_a_directory = EISDIR, + message_size = EMSGSIZE, + network_down = ENETDOWN, + network_reset = ENETRESET, + network_unreachable = ENETUNREACH, + no_buffer_space = ENOBUFS, + no_child_process = ECHILD, + +#ifdef ENOLINK + no_link = ENOLINK, +#endif + + no_lock_available = ENOLCK, + +#ifdef ENODATA + no_message_available = ENODATA, +#endif + + no_message = ENOMSG, + no_protocol_option = ENOPROTOOPT, + no_space_on_device = ENOSPC, + +#ifdef ENOSR + no_stream_resources = ENOSR, +#endif + + no_such_device_or_address = ENXIO, + no_such_device = ENODEV, + no_such_file_or_directory = ENOENT, + no_such_process = ESRCH, + not_a_directory = ENOTDIR, + not_a_socket = ENOTSOCK, + +#ifdef ENOSTR + not_a_stream = ENOSTR, +#endif + + not_connected = ENOTCONN, + not_enough_memory = ENOMEM, + +#ifdef ENOTSUP + not_supported = ENOTSUP, +#endif + +#ifdef ECANCELED + operation_canceled = ECANCELED, +#endif + + operation_in_progress = EINPROGRESS, + operation_not_permitted = EPERM, + operation_not_supported = EOPNOTSUPP, + operation_would_block = EWOULDBLOCK, + +#ifdef EOWNERDEAD + owner_dead = EOWNERDEAD, +#endif + + permission_denied = EACCES, + +#ifdef EPROTO + protocol_error = EPROTO, +#endif + + protocol_not_supported = EPROTONOSUPPORT, + read_only_file_system = EROFS, + resource_deadlock_would_occur = EDEADLK, + resource_unavailable_try_again = EAGAIN, + result_out_of_range = ERANGE, + +#ifdef ENOTRECOVERABLE + state_not_recoverable = ENOTRECOVERABLE, +#endif + +#ifdef ETIME + stream_timeout = ETIME, +#endif + +#ifdef ETXTBSY + text_file_busy = ETXTBSY, +#endif + + timed_out = ETIMEDOUT, + too_many_files_open_in_system = ENFILE, + too_many_files_open = EMFILE, + too_many_links = EMLINK, + too_many_symbolic_link_levels = ELOOP, + +#ifdef EOVERFLOW + value_too_large = EOVERFLOW, +#elif defined __AVR__ + value_too_large = 999, +#endif + + wrong_protocol_type = EPROTOTYPE + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@error_constants.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@error_constants.h.blob new file mode 100644 index 0000000..6797ee0 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@error_constants.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr-default.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr-default.h new file mode 100644 index 0000000..ff195ac --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr-default.h @@ -0,0 +1,986 @@ +/* Threads compatibility routines for libgcc2 and libobjc. */ +/* Compile this one with gcc. */ +/* Copyright (C) 1997-2025 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef _GLIBCXX_GCC_GTHR_POSIX_H +#define _GLIBCXX_GCC_GTHR_POSIX_H + +/* POSIX threads specific definitions. + Easy, since the interface is just one-to-one mapping. */ + +#define __GTHREADS 1 +#define __GTHREADS_CXX0X 1 + +#include + +#if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ + || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK)) +# include +# if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0 +# define _GTHREAD_USE_MUTEX_TIMEDLOCK 1 +# else +# define _GTHREAD_USE_MUTEX_TIMEDLOCK 0 +# endif +#endif + +#ifdef __has_attribute +# if __has_attribute(__always_inline__) +# define __GTHREAD_ALWAYS_INLINE __attribute__((__always_inline__)) +# endif +#endif +#ifndef __GTHREAD_ALWAYS_INLINE +# define __GTHREAD_ALWAYS_INLINE +#endif + +#ifdef __cplusplus +# define __GTHREAD_INLINE inline __GTHREAD_ALWAYS_INLINE +#else +# define __GTHREAD_INLINE static inline +#endif + +typedef pthread_t __gthread_t; +typedef pthread_key_t __gthread_key_t; +typedef pthread_once_t __gthread_once_t; +typedef pthread_mutex_t __gthread_mutex_t; +#ifndef __cplusplus +typedef pthread_rwlock_t __gthread_rwlock_t; +#endif +typedef pthread_mutex_t __gthread_recursive_mutex_t; +typedef pthread_cond_t __gthread_cond_t; +typedef struct timespec __gthread_time_t; + +/* POSIX like conditional variables are supported. Please look at comments + in gthr.h for details. */ +#define __GTHREAD_HAS_COND 1 + +#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER +#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function +#ifndef __cplusplus +#define __GTHREAD_RWLOCK_INIT PTHREAD_RWLOCK_INITIALIZER +#endif +#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT +#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) +#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER +#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) +#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +#else +#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function +#endif +#define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER +#define __GTHREAD_TIME_INIT {0,0} + +#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC +# undef __GTHREAD_MUTEX_INIT +#endif +#ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC +# undef __GTHREAD_RECURSIVE_MUTEX_INIT +# undef __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION +# define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function +#endif +#ifdef _GTHREAD_USE_COND_INIT_FUNC +# undef __GTHREAD_COND_INIT +# define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function +#endif + +#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK +# ifndef __gthrw_pragma +# define __gthrw_pragma(pragma) +# endif +# define __gthrw2(name,name2,type) \ + static __typeof(type) name \ + __attribute__ ((__weakref__(#name2), __copy__ (type))); \ + __gthrw_pragma(weak type) +# define __gthrw_(name) __gthrw_ ## name +#else +# define __gthrw2(name,name2,type) +# define __gthrw_(name) name +#endif + +/* Typically, __gthrw_foo is a weak reference to symbol foo. */ +#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) + +__gthrw(pthread_once) +__gthrw(pthread_getspecific) +__gthrw(pthread_setspecific) + +__gthrw(pthread_create) +__gthrw(pthread_join) +__gthrw(pthread_equal) +__gthrw(pthread_self) +__gthrw(pthread_detach) +#ifndef __BIONIC__ +__gthrw(pthread_cancel) +#endif +__gthrw(sched_yield) + +__gthrw(pthread_mutex_lock) +__gthrw(pthread_mutex_trylock) +#if _GTHREAD_USE_MUTEX_TIMEDLOCK +__gthrw(pthread_mutex_timedlock) +#endif +__gthrw(pthread_mutex_unlock) +__gthrw(pthread_mutex_init) +__gthrw(pthread_mutex_destroy) + +__gthrw(pthread_cond_init) +__gthrw(pthread_cond_broadcast) +__gthrw(pthread_cond_signal) +__gthrw(pthread_cond_wait) +__gthrw(pthread_cond_timedwait) +__gthrw(pthread_cond_destroy) + +__gthrw(pthread_key_create) +__gthrw(pthread_key_delete) +__gthrw(pthread_mutexattr_init) +__gthrw(pthread_mutexattr_settype) +__gthrw(pthread_mutexattr_destroy) + +#ifndef __cplusplus +__gthrw(pthread_rwlock_rdlock) +__gthrw(pthread_rwlock_tryrdlock) +__gthrw(pthread_rwlock_wrlock) +__gthrw(pthread_rwlock_trywrlock) +__gthrw(pthread_rwlock_unlock) +#endif + +#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) +/* Objective-C. */ +__gthrw(pthread_exit) +#ifdef _POSIX_PRIORITY_SCHEDULING +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +__gthrw(sched_get_priority_max) +__gthrw(sched_get_priority_min) +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +#endif /* _POSIX_PRIORITY_SCHEDULING */ +__gthrw(pthread_attr_destroy) +__gthrw(pthread_attr_init) +__gthrw(pthread_attr_setdetachstate) +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING +__gthrw(pthread_getschedparam) +__gthrw(pthread_setschedparam) +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +#endif /* _LIBOBJC || _LIBOBJC_WEAK */ + +#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK + +/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if + -pthreads is not specified. The functions are dummies and most return an + error value. However pthread_once returns 0 without invoking the routine + it is passed so we cannot pretend that the interface is active if -pthreads + is not specified. On Solaris 2.5.1, the interface is not exposed at all so + we need to play the usual game with weak symbols. On Solaris 10 and up, a + working interface is always exposed. On FreeBSD 6 and later, libc also + exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up + to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc, + which means the alternate __gthread_active_p below cannot be used there. */ + +#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__)) + +#pragma GCC visibility push(hidden) +__GTHREAD_INLINE volatile int * +__gthread_active (void) +{ + static volatile int __gthread_active_var = -1; + return &__gthread_active_var; +} +#pragma GCC visibility pop + +__GTHREAD_INLINE void +__gthread_trigger (void) +{ + *__gthread_active () = 1; +} + +#pragma GCC visibility push(hidden) +__GTHREAD_INLINE int +__gthread_active_p (void) +{ + static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER; + static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT; + + /* Avoid reading __gthread_active twice on the main code path. */ + int __gthread_active_latest_value = *__gthread_active (); + + /* This test is not protected to avoid taking a lock on the main code + path so every update of __gthread_active in a threaded program must + be atomic with regard to the result of the test. */ + if (__builtin_expect (__gthread_active_latest_value < 0, 0)) + { + if (__gthrw_(pthread_once)) + { + /* If this really is a threaded program, then we must ensure that + __gthread_active has been set to 1 before exiting this block. */ + __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex); + __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger); + __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex); + } + + /* Make sure we'll never enter this block again. */ + if (*__gthread_active () < 0) + *__gthread_active () = 0; + + __gthread_active_latest_value = *__gthread_active (); + } + + return __gthread_active_latest_value != 0; +} +#pragma GCC visibility pop + +#else /* neither FreeBSD nor Solaris */ + +/* For a program to be multi-threaded the only thing that it certainly must + be using is pthread_create. However, there may be other libraries that + intercept pthread_create with their own definitions to wrap pthreads + functionality for some purpose. In those cases, pthread_create being + defined might not necessarily mean that libpthread is actually linked + in. + + For the GNU C library, we can use a known internal name. This is always + available in the ABI, but no other library would define it. That is + ideal, since any public pthread function might be intercepted just as + pthread_create might be. __pthread_key_create is an "internal" + implementation symbol, but it is part of the public exported ABI. Also, + it's among the symbols that the static libpthread.a always links in + whenever pthread_create is used, so there is no danger of a false + negative result in any statically-linked, multi-threaded program. + + For others, we choose pthread_cancel as a function that seems unlikely + to be redefined by an interceptor library. The bionic (Android) C + library does not provide pthread_cancel, so we do use pthread_create + there (and interceptor libraries lose). */ + +#ifdef __GLIBC__ +__gthrw2(__gthrw_(__pthread_key_create), + __pthread_key_create, + pthread_key_create) +# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create) +#elif defined (__BIONIC__) +# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create) +#else +# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel) +#endif + +#pragma GCC visibility push(hidden) +__GTHREAD_INLINE int +__gthread_active_p (void) +{ + static void *const __gthread_active_ptr + = __extension__ (void *) >HR_ACTIVE_PROXY; + return __gthread_active_ptr != 0; +} +#pragma GCC visibility pop + +#endif /* FreeBSD or Solaris */ + +#else /* not __GXX_WEAK__ */ + +/* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread + calls in shared flavors of the HP-UX C library. Most of the stubs + have no functionality. The details are described in the "libc cumulative + patch" for each subversion of HP-UX 11. There are two special interfaces + provided for checking whether an application is linked to a shared pthread + library or not. However, these interfaces aren't available in early + libpthread libraries. We also need a test that works for archive + libraries. We can't use pthread_once as some libc versions call the + init function. We also can't use pthread_create or pthread_attr_init + as these create a thread and thereby prevent changing the default stack + size. The function pthread_default_stacksize_np is available in both + the archive and shared versions of libpthread. It can be used to + determine the default pthread stack size. There is a stub in some + shared libc versions which returns a zero size if pthreads are not + active. We provide an equivalent stub to handle cases where libc + doesn't provide one. */ + +#if defined(__hppa__) && defined(__hpux__) + +#pragma GCC visibility push(hidden) +__GTHREAD_INLINE volatile int * +__gthread_active (void) +{ + static volatile int __gthread_active_var = -1; + return &__gthread_active_var; +} +#pragma GCC visibility pop + +__GTHREAD_INLINE int +__gthread_active_p (void) +{ + /* Avoid reading __gthread_active twice on the main code path. */ + int __gthread_active_latest_value = *__gthread_active (); + size_t __s; + + if (__builtin_expect (__gthread_active_latest_value < 0, 0)) + { + pthread_default_stacksize_np (0, &__s); + *__gthread_active () = __s ? 1 : 0; + __gthread_active_latest_value = *__gthread_active (); + } + + return __gthread_active_latest_value != 0; +} + +#else /* not hppa-hpux */ + +__GTHREAD_INLINE int +__gthread_active_p (void) +{ + return 1; +} + +#endif /* hppa-hpux */ + +#endif /* __GXX_WEAK__ */ + +#ifdef _LIBOBJC + +/* This is the config.h file in libobjc/ */ +#include + +#ifdef HAVE_SCHED_H +# include +#endif + +/* Key structure for maintaining thread specific storage */ +static pthread_key_t _objc_thread_storage; +static pthread_attr_t _objc_thread_attribs; + +/* Thread local storage for a single thread */ +static void *thread_local_storage = NULL; + +/* Backend initialization functions */ + +/* Initialize the threads subsystem. */ +static inline int +__gthread_objc_init_thread_system (void) +{ + if (__gthread_active_p ()) + { + /* Initialize the thread storage key. */ + if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0) + { + /* The normal default detach state for threads is + * PTHREAD_CREATE_JOINABLE which causes threads to not die + * when you think they should. */ + if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0 + && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs, + PTHREAD_CREATE_DETACHED) == 0) + return 0; + } + } + + return -1; +} + +/* Close the threads subsystem. */ +static inline int +__gthread_objc_close_thread_system (void) +{ + if (__gthread_active_p () + && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0 + && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0) + return 0; + + return -1; +} + +/* Backend thread functions */ + +/* Create a new thread of execution. */ +static inline objc_thread_t +__gthread_objc_thread_detach (void (*func)(void *), void *arg) +{ + objc_thread_t thread_id; + pthread_t new_thread_handle; + + if (!__gthread_active_p ()) + return NULL; + + if (!(__gthrw_(pthread_create) (&new_thread_handle, &_objc_thread_attribs, + (void *) func, arg))) + thread_id = (objc_thread_t) new_thread_handle; + else + thread_id = NULL; + + return thread_id; +} + +/* Set the current thread's priority. */ +static inline int +__gthread_objc_thread_set_priority (int priority) +{ + if (!__gthread_active_p ()) + return -1; + else + { +#ifdef _POSIX_PRIORITY_SCHEDULING +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING + pthread_t thread_id = __gthrw_(pthread_self) (); + int policy; + struct sched_param params; + int priority_min, priority_max; + + if (__gthrw_(pthread_getschedparam) (thread_id, &policy, ¶ms) == 0) + { + if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1) + return -1; + + if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1) + return -1; + + if (priority > priority_max) + priority = priority_max; + else if (priority < priority_min) + priority = priority_min; + params.sched_priority = priority; + + /* + * The solaris 7 and several other man pages incorrectly state that + * this should be a pointer to policy but pthread.h is universally + * at odds with this. + */ + if (__gthrw_(pthread_setschedparam) (thread_id, policy, ¶ms) == 0) + return 0; + } +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +#endif /* _POSIX_PRIORITY_SCHEDULING */ + return -1; + } +} + +/* Return the current thread's priority. */ +static inline int +__gthread_objc_thread_get_priority (void) +{ +#ifdef _POSIX_PRIORITY_SCHEDULING +#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING + if (__gthread_active_p ()) + { + int policy; + struct sched_param params; + + if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, ¶ms) == 0) + return params.sched_priority; + else + return -1; + } + else +#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ +#endif /* _POSIX_PRIORITY_SCHEDULING */ + return OBJC_THREAD_INTERACTIVE_PRIORITY; +} + +/* Yield our process time to another thread. */ +static inline void +__gthread_objc_thread_yield (void) +{ + if (__gthread_active_p ()) + __gthrw_(sched_yield) (); +} + +/* Terminate the current thread. */ +static inline int +__gthread_objc_thread_exit (void) +{ + if (__gthread_active_p ()) + /* exit the thread */ + __gthrw_(pthread_exit) (&__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; +} + +/* Returns an integer value which uniquely describes a thread. */ +static inline objc_thread_t +__gthread_objc_thread_id (void) +{ + if (__gthread_active_p ()) + return (objc_thread_t) __gthrw_(pthread_self) (); + else + return (objc_thread_t) 1; +} + +/* Sets the thread's local storage pointer. */ +static inline int +__gthread_objc_thread_set_data (void *value) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_setspecific) (_objc_thread_storage, value); + else + { + thread_local_storage = value; + return 0; + } +} + +/* Returns the thread's local storage pointer. */ +static inline void * +__gthread_objc_thread_get_data (void) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_getspecific) (_objc_thread_storage); + else + return thread_local_storage; +} + +/* Backend mutex functions */ + +/* Allocate a mutex. */ +static inline int +__gthread_objc_mutex_allocate (objc_mutex_t mutex) +{ + if (__gthread_active_p ()) + { + mutex->backend = objc_malloc (sizeof (pthread_mutex_t)); + + if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL)) + { + objc_free (mutex->backend); + mutex->backend = NULL; + return -1; + } + } + + return 0; +} + +/* Deallocate a mutex. */ +static inline int +__gthread_objc_mutex_deallocate (objc_mutex_t mutex) +{ + if (__gthread_active_p ()) + { + int count; + + /* + * Posix Threads specifically require that the thread be unlocked + * for __gthrw_(pthread_mutex_destroy) to work. + */ + + do + { + count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend); + if (count < 0) + return -1; + } + while (count); + + if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend)) + return -1; + + objc_free (mutex->backend); + mutex->backend = NULL; + } + return 0; +} + +/* Grab a lock on a mutex. */ +static inline int +__gthread_objc_mutex_lock (objc_mutex_t mutex) +{ + if (__gthread_active_p () + && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0) + { + return -1; + } + + return 0; +} + +/* Try to grab a lock on a mutex. */ +static inline int +__gthread_objc_mutex_trylock (objc_mutex_t mutex) +{ + if (__gthread_active_p () + && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0) + { + return -1; + } + + return 0; +} + +/* Unlock the mutex */ +static inline int +__gthread_objc_mutex_unlock (objc_mutex_t mutex) +{ + if (__gthread_active_p () + && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0) + { + return -1; + } + + return 0; +} + +/* Backend condition mutex functions */ + +/* Allocate a condition. */ +static inline int +__gthread_objc_condition_allocate (objc_condition_t condition) +{ + if (__gthread_active_p ()) + { + condition->backend = objc_malloc (sizeof (pthread_cond_t)); + + if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL)) + { + objc_free (condition->backend); + condition->backend = NULL; + return -1; + } + } + + return 0; +} + +/* Deallocate a condition. */ +static inline int +__gthread_objc_condition_deallocate (objc_condition_t condition) +{ + if (__gthread_active_p ()) + { + if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend)) + return -1; + + objc_free (condition->backend); + condition->backend = NULL; + } + return 0; +} + +/* Wait on the condition */ +static inline int +__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend, + (pthread_mutex_t *) mutex->backend); + else + return 0; +} + +/* Wake up all threads waiting on this condition. */ +static inline int +__gthread_objc_condition_broadcast (objc_condition_t condition) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend); + else + return 0; +} + +/* Wake up one thread waiting on this condition. */ +static inline int +__gthread_objc_condition_signal (objc_condition_t condition) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend); + else + return 0; +} + +#else /* _LIBOBJC */ + +__GTHREAD_INLINE int +__gthread_create (__gthread_t *__threadid, void *(*__func) (void*), + void *__args) +{ + return __gthrw_(pthread_create) (__threadid, NULL, __func, __args); +} + +__GTHREAD_INLINE int +__gthread_join (__gthread_t __threadid, void **__value_ptr) +{ + return __gthrw_(pthread_join) (__threadid, __value_ptr); +} + +__GTHREAD_INLINE int +__gthread_detach (__gthread_t __threadid) +{ + return __gthrw_(pthread_detach) (__threadid); +} + +__GTHREAD_INLINE int +__gthread_equal (__gthread_t __t1, __gthread_t __t2) +{ + return __gthrw_(pthread_equal) (__t1, __t2); +} + +__GTHREAD_INLINE __gthread_t +__gthread_self (void) +{ + return __gthrw_(pthread_self) (); +} + +__GTHREAD_INLINE int +__gthread_yield (void) +{ + return __gthrw_(sched_yield) (); +} + +__GTHREAD_INLINE int +__gthread_once (__gthread_once_t *__once, void (*__func) (void)) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_once) (__once, __func); + else + return -1; +} + +__GTHREAD_INLINE int +__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) +{ + return __gthrw_(pthread_key_create) (__key, __dtor); +} + +__GTHREAD_INLINE int +__gthread_key_delete (__gthread_key_t __key) +{ + return __gthrw_(pthread_key_delete) (__key); +} + +__GTHREAD_INLINE void * +__gthread_getspecific (__gthread_key_t __key) +{ + return __gthrw_(pthread_getspecific) (__key); +} + +__GTHREAD_INLINE int +__gthread_setspecific (__gthread_key_t __key, const void *__ptr) +{ + return __gthrw_(pthread_setspecific) (__key, __ptr); +} + +__GTHREAD_INLINE void +__gthread_mutex_init_function (__gthread_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + __gthrw_(pthread_mutex_init) (__mutex, NULL); +} + +__GTHREAD_INLINE int +__gthread_mutex_destroy (__gthread_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_mutex_destroy) (__mutex); + else + return 0; +} + +__GTHREAD_INLINE int +__gthread_mutex_lock (__gthread_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_mutex_lock) (__mutex); + else + return 0; +} + +__GTHREAD_INLINE int +__gthread_mutex_trylock (__gthread_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_mutex_trylock) (__mutex); + else + return 0; +} + +#if _GTHREAD_USE_MUTEX_TIMEDLOCK +__GTHREAD_INLINE int +__gthread_mutex_timedlock (__gthread_mutex_t *__mutex, + const __gthread_time_t *__abs_timeout) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_mutex_timedlock) (__mutex, __abs_timeout); + else + return 0; +} +#endif + +__GTHREAD_INLINE int +__gthread_mutex_unlock (__gthread_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_mutex_unlock) (__mutex); + else + return 0; +} + +#if !defined( PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) \ + || defined(_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC) +__GTHREAD_INLINE int +__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex) +{ + if (__gthread_active_p ()) + { + pthread_mutexattr_t __attr; + int __r; + + __r = __gthrw_(pthread_mutexattr_init) (&__attr); + if (!__r) + __r = __gthrw_(pthread_mutexattr_settype) (&__attr, + PTHREAD_MUTEX_RECURSIVE); + if (!__r) + __r = __gthrw_(pthread_mutex_init) (__mutex, &__attr); + if (!__r) + __r = __gthrw_(pthread_mutexattr_destroy) (&__attr); + return __r; + } + return 0; +} +#endif + +__GTHREAD_INLINE int +__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) +{ + return __gthread_mutex_lock (__mutex); +} + +__GTHREAD_INLINE int +__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) +{ + return __gthread_mutex_trylock (__mutex); +} + +#if _GTHREAD_USE_MUTEX_TIMEDLOCK +__GTHREAD_INLINE int +__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, + const __gthread_time_t *__abs_timeout) +{ + return __gthread_mutex_timedlock (__mutex, __abs_timeout); +} +#endif + +__GTHREAD_INLINE int +__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) +{ + return __gthread_mutex_unlock (__mutex); +} + +__GTHREAD_INLINE int +__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) +{ + return __gthread_mutex_destroy (__mutex); +} + +#ifdef _GTHREAD_USE_COND_INIT_FUNC +__GTHREAD_INLINE void +__gthread_cond_init_function (__gthread_cond_t *__cond) +{ + if (__gthread_active_p ()) + __gthrw_(pthread_cond_init) (__cond, NULL); +} +#endif + +__GTHREAD_INLINE int +__gthread_cond_broadcast (__gthread_cond_t *__cond) +{ + return __gthrw_(pthread_cond_broadcast) (__cond); +} + +__GTHREAD_INLINE int +__gthread_cond_signal (__gthread_cond_t *__cond) +{ + return __gthrw_(pthread_cond_signal) (__cond); +} + +__GTHREAD_INLINE int +__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) +{ + return __gthrw_(pthread_cond_wait) (__cond, __mutex); +} + +__GTHREAD_INLINE int +__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, + const __gthread_time_t *__abs_timeout) +{ + return __gthrw_(pthread_cond_timedwait) (__cond, __mutex, __abs_timeout); +} + +__GTHREAD_INLINE int +__gthread_cond_wait_recursive (__gthread_cond_t *__cond, + __gthread_recursive_mutex_t *__mutex) +{ + return __gthread_cond_wait (__cond, __mutex); +} + +__GTHREAD_INLINE int +__gthread_cond_destroy (__gthread_cond_t* __cond) +{ + return __gthrw_(pthread_cond_destroy) (__cond); +} + +#ifndef __cplusplus +__GTHREAD_INLINE int +__gthread_rwlock_rdlock (__gthread_rwlock_t *__rwlock) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_rwlock_rdlock) (__rwlock); + else + return 0; +} + +__GTHREAD_INLINE int +__gthread_rwlock_tryrdlock (__gthread_rwlock_t *__rwlock) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_rwlock_tryrdlock) (__rwlock); + else + return 0; +} + +__GTHREAD_INLINE int +__gthread_rwlock_wrlock (__gthread_rwlock_t *__rwlock) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_rwlock_wrlock) (__rwlock); + else + return 0; +} + +__GTHREAD_INLINE int +__gthread_rwlock_trywrlock (__gthread_rwlock_t *__rwlock) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_rwlock_trywrlock) (__rwlock); + else + return 0; +} + +__GTHREAD_INLINE int +__gthread_rwlock_unlock (__gthread_rwlock_t *__rwlock) +{ + if (__gthread_active_p ()) + return __gthrw_(pthread_rwlock_unlock) (__rwlock); + else + return 0; +} +#endif + +#endif /* _LIBOBJC */ + +#undef __GTHREAD_INLINE +#undef __GTHREAD_ALWAYS_INLINE + +#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr-default.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr-default.h.blob new file mode 100644 index 0000000..3eb64f4 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr-default.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr.h new file mode 100644 index 0000000..14aae6c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr.h @@ -0,0 +1,163 @@ +/* Threads compatibility routines for libgcc2. */ +/* Compile this one with gcc. */ +/* Copyright (C) 1997-2025 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef _GLIBCXX_GCC_GTHR_H +#define _GLIBCXX_GCC_GTHR_H + +#ifndef _GLIBCXX_HIDE_EXPORTS +#pragma GCC visibility push(default) +#endif + +/* If this file is compiled with threads support, it must + #define __GTHREADS 1 + to indicate that threads support is present. Also it has define + function + int __gthread_active_p () + that returns 1 if thread system is active, 0 if not. + + The threads interface must define the following types: + __gthread_key_t + __gthread_once_t + __gthread_mutex_t + __gthread_recursive_mutex_t + + The threads interface must define the following macros: + + __GTHREAD_ONCE_INIT + to initialize __gthread_once_t + __GTHREAD_MUTEX_INIT + to initialize __gthread_mutex_t to get a fast + non-recursive mutex. + __GTHREAD_MUTEX_INIT_FUNCTION + to initialize __gthread_mutex_t to get a fast + non-recursive mutex. + Define this to a function which looks like this: + void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *) + Some systems can't initialize a mutex without a + function call. Don't define __GTHREAD_MUTEX_INIT in this case. + __GTHREAD_RECURSIVE_MUTEX_INIT + __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION + as above, but for a recursive mutex. + + The threads interface must define the following static functions: + + int __gthread_once (__gthread_once_t *once, void (*func) ()) + + int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *)) + int __gthread_key_delete (__gthread_key_t key) + + void *__gthread_getspecific (__gthread_key_t key) + int __gthread_setspecific (__gthread_key_t key, const void *ptr) + + int __gthread_mutex_destroy (__gthread_mutex_t *mutex); + int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex); + + int __gthread_mutex_lock (__gthread_mutex_t *mutex); + int __gthread_mutex_trylock (__gthread_mutex_t *mutex); + int __gthread_mutex_unlock (__gthread_mutex_t *mutex); + + int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex); + int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex); + int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex); + + The following are supported in POSIX threads only. They are required to + fix a deadlock in static initialization inside libsupc++. The header file + gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra + features are supported. + + Types: + __gthread_cond_t + + Macros: + __GTHREAD_COND_INIT + __GTHREAD_COND_INIT_FUNCTION + + Interface: + int __gthread_cond_broadcast (__gthread_cond_t *cond); + int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex); + int __gthread_cond_wait_recursive (__gthread_cond_t *cond, + __gthread_recursive_mutex_t *mutex); + + All functions returning int should return zero on success or the error + number. If the operation is not supported, -1 is returned. + + If the following are also defined, you should + #define __GTHREADS_CXX0X 1 + to enable the c++0x thread library. + + Types: + __gthread_t + __gthread_time_t + + Interface: + int __gthread_create (__gthread_t *thread, void *(*func) (void*), + void *args); + int __gthread_join (__gthread_t thread, void **value_ptr); + int __gthread_detach (__gthread_t thread); + int __gthread_equal (__gthread_t t1, __gthread_t t2); + __gthread_t __gthread_self (void); + int __gthread_yield (void); + + int __gthread_mutex_timedlock (__gthread_mutex_t *m, + const __gthread_time_t *abs_timeout); + int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m, + const __gthread_time_t *abs_time); + + int __gthread_cond_signal (__gthread_cond_t *cond); + int __gthread_cond_timedwait (__gthread_cond_t *cond, + __gthread_mutex_t *mutex, + const __gthread_time_t *abs_timeout); + +*/ + +#if __GXX_WEAK__ +/* The pe-coff weak support isn't fully compatible to ELF's weak. + For static libraries it might would work, but as we need to deal + with shared versions too, we disable it for mingw-targets. */ +#ifdef __MINGW32__ +#undef _GLIBCXX_GTHREAD_USE_WEAK +#define _GLIBCXX_GTHREAD_USE_WEAK 0 +#endif + +#ifdef _GLIBCXX___GLIBC_PREREQ +#if _GLIBCXX___GLIBC_PREREQ(2, 34) && !defined(_GLIBCXX___gnu_GLIBCXX__hurd_GLIBCXX___) +/* glibc 2.34 and later has all pthread_* APIs inside of libc, + no need to link separately with -lpthread. */ +#undef _GLIBCXX_GTHREAD_USE_WEAK +#define _GLIBCXX_GTHREAD_USE_WEAK 0 +#endif +#endif + +#ifndef _GLIBCXX_GTHREAD_USE_WEAK +#define _GLIBCXX_GTHREAD_USE_WEAK 1 +#endif +#endif +#include + +#ifndef _GLIBCXX_HIDE_EXPORTS +#pragma GCC visibility pop +#endif + +#endif /* ! _GLIBCXX_GCC_GTHR_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr.h.blob new file mode 100644 index 0000000..9ab4b84 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@gthr.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@messages_members.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@messages_members.h new file mode 100644 index 0000000..6569e9b --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@messages_members.h @@ -0,0 +1,151 @@ +// std::messages implementation details, GNU version -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/messages_members.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.2.7.1.2 messages functions +// + +// Written by Benjamin Kosnik + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Non-virtual member functions. + template + messages<_CharT>::messages(size_t __refs) + : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), + _M_name_messages(_S_get_c_name()) + { } + + template + messages<_CharT>::messages(__c_locale __cloc, const char* __s, + size_t __refs) + : facet(__refs), _M_c_locale_messages(0), _M_name_messages(0) + { + if (__builtin_strcmp(__s, _S_get_c_name()) != 0) + { + const size_t __len = __builtin_strlen(__s) + 1; + char* __tmp = new char[__len]; + __builtin_memcpy(__tmp, __s, __len); + _M_name_messages = __tmp; + } + else + _M_name_messages = _S_get_c_name(); + + // Last to avoid leaking memory if new throws. + _M_c_locale_messages = _S_clone_c_locale(__cloc); + } + + template + typename messages<_CharT>::catalog + messages<_CharT>::open(const basic_string& __s, const locale& __loc, + const char* __dir) const + { + bindtextdomain(__s.c_str(), __dir); + return this->do_open(__s, __loc); + } + + // Virtual member functions. + template + messages<_CharT>::~messages() + { + if (_M_name_messages != _S_get_c_name()) + delete [] _M_name_messages; + _S_destroy_c_locale(_M_c_locale_messages); + } + + template + typename messages<_CharT>::catalog + messages<_CharT>::do_open(const basic_string& __s, + const locale&) const + { + // No error checking is done, assume the catalog exists and can + // be used. + textdomain(__s.c_str()); + return 0; + } + + template + void + messages<_CharT>::do_close(catalog) const + { } + + // messages_byname + template + messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs) + : messages<_CharT>(__refs) + { + if (this->_M_name_messages != locale::facet::_S_get_c_name()) + { + delete [] this->_M_name_messages; + if (__builtin_strcmp(__s, locale::facet::_S_get_c_name()) != 0) + { + const size_t __len = __builtin_strlen(__s) + 1; + char* __tmp = new char[__len]; + __builtin_memcpy(__tmp, __s, __len); + this->_M_name_messages = __tmp; + } + else + this->_M_name_messages = locale::facet::_S_get_c_name(); + } + + if (__builtin_strcmp(__s, "C") != 0 + && __builtin_strcmp(__s, "POSIX") != 0) + { + this->_S_destroy_c_locale(this->_M_c_locale_messages); + this->_S_create_c_locale(this->_M_c_locale_messages, __s); + } + } + + //Specializations. + template<> + typename messages::catalog + messages::do_open(const basic_string&, + const locale&) const; + + template<> + void + messages::do_close(catalog) const; + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + typename messages::catalog + messages::do_open(const basic_string&, + const locale&) const; + + template<> + void + messages::do_close(catalog) const; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@messages_members.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@messages_members.h.blob new file mode 100644 index 0000000..48738b9 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@messages_members.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@os_defines.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@os_defines.h new file mode 100644 index 0000000..d55cc58 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@os_defines.h @@ -0,0 +1,90 @@ +// Specific definitions for GNU/Linux -*- C++ -*- + +// Copyright (C) 2000-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/os_defines.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iosfwd} + */ + +#ifndef _GLIBCXX_OS_DEFINES +#define _GLIBCXX_OS_DEFINES 1 + +// System-specific #define, typedefs, corrections, etc, go here. This +// file will come before all others. + +// This keeps isalnum, et al from being propagated as macros. +#define __NO_CTYPE 1 + +#include + +// Provide a declaration for the possibly deprecated gets function, as +// glibc 2.15 and later does not declare gets for ISO C11 when +// __GNU_SOURCE is defined. +#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE) +# undef _GLIBCXX_HAVE_GETS +#endif + +// Glibc 2.23 removed the obsolete isinf and isnan declarations. Check the +// version dynamically in case it has changed since libstdc++ was configured. +#define _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC __GLIBC_PREREQ(2,23) + +// Glibc 2.26 on i?86/x86-64/ia64/ppc64le added *f128 support. +// Glibc 2.27 added it also on many other arches but those have IEEE quad +// long double. +#if __GLIBC_PREREQ(2, 26) \ + && (defined(__i386__) || defined(__x86_64__) || defined (__ia64__) \ + || (defined(__powerpc__) && defined(_ARCH_PWR8) \ + && defined(__LITTLE_ENDIAN__) && (_CALL_ELF == 2) \ + && defined(__FLOAT128__))) +# define _GLIBCXX_HAVE_FLOAT128_MATH 1 +#endif + +// Enable __cxa_thread_atexit to rely on a (presumably libc-provided) +// __cxa_thread_atexit_impl, if it happens to be defined, even if +// configure couldn't find it during the build. +#define _GLIBCXX_MAY_HAVE___CXA_THREAD_ATEXIT_IMPL 1 + +#ifdef __linux__ +// The following libpthread properties only apply to Linux, not GNU/Hurd. + +# if __GLIBC_PREREQ(2, 27) +// Since glibc 2.27 pthread_self() is usable without linking to libpthread. +# define _GLIBCXX_NATIVE_THREAD_ID pthread_self() +# else +// Before then it was in libc.so.6 but not libc.a, and always returns 0, +// which breaks the invariant this_thread::get_id() != thread::id{}. +// So only use it if we know the libpthread version is available. +// Otherwise use (__gthread_t)1 as the ID of the main (and only) thread. +# define _GLIBCXX_NATIVE_THREAD_ID \ + (__gthread_active_p() ? __gthread_self() : (__gthread_t)1) +# endif + +# if __GLIBC_PREREQ(2, 34) +// Since glibc 2.34 all pthreads functions are usable without linking to +// libpthread. +# define _GLIBCXX_GTHREAD_USE_WEAK 0 +# endif +#endif // __linux__ + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@os_defines.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@os_defines.h.blob new file mode 100644 index 0000000..de088c9 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@os_defines.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@time_members.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@time_members.h new file mode 100644 index 0000000..81bd03a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@time_members.h @@ -0,0 +1,89 @@ +// std::time_get, std::time_put implementation, GNU version -*- C++ -*- + +// Copyright (C) 2001-2025 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/time_members.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.2.5.1.2 - time_get functions +// ISO C++ 14882: 22.2.5.3.2 - time_put functions +// + +// Written by Benjamin Kosnik + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + __timepunct<_CharT>::__timepunct(size_t __refs) + : facet(__refs), _M_data(0), _M_c_locale_timepunct(0), + _M_name_timepunct(_S_get_c_name()) + { _M_initialize_timepunct(); } + + template + __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) + : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(0), + _M_name_timepunct(_S_get_c_name()) + { _M_initialize_timepunct(); } + + template + __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, + size_t __refs) + : facet(__refs), _M_data(0), _M_c_locale_timepunct(0), + _M_name_timepunct(0) + { + if (__builtin_strcmp(__s, _S_get_c_name()) != 0) + { + const size_t __len = __builtin_strlen(__s) + 1; + char* __tmp = new char[__len]; + __builtin_memcpy(__tmp, __s, __len); + _M_name_timepunct = __tmp; + } + else + _M_name_timepunct = _S_get_c_name(); + + __try + { _M_initialize_timepunct(__cloc); } + __catch(...) + { + if (_M_name_timepunct != _S_get_c_name()) + delete [] _M_name_timepunct; + __throw_exception_again; + } + } + + template + __timepunct<_CharT>::~__timepunct() + { + if (_M_name_timepunct != _S_get_c_name()) + delete [] _M_name_timepunct; + delete _M_data; + _S_destroy_c_locale(_M_c_locale_timepunct); + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@time_members.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@time_members.h.blob new file mode 100644 index 0000000..5fc6c00 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@c++@15.2.1@x86_64-pc-linux-gnu@bits@time_members.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@ctype.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@ctype.h new file mode 100644 index 0000000..5ec9456 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@ctype.h @@ -0,0 +1,329 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard 7.4: Character handling + */ + +#ifndef _CTYPE_H +#define _CTYPE_H 1 + +#include +#include + +__BEGIN_DECLS + +#ifndef _ISbit +/* These are all the characteristics of characters. + If there get to be more than 16 distinct characteristics, + many things must be changed that use `unsigned short int's. + + The characteristics are stored always in network byte order (big + endian). We define the bit value interpretations here dependent on the + machine's byte order. */ + +# include +# if __BYTE_ORDER == __BIG_ENDIAN +# define _ISbit(bit) (1 << (bit)) +# else /* __BYTE_ORDER == __LITTLE_ENDIAN */ +# define _ISbit(bit) ((bit) < 8 ? ((1 << (bit)) << 8) : ((1 << (bit)) >> 8)) +# endif + +enum +{ + _ISupper = _ISbit (0), /* UPPERCASE. */ + _ISlower = _ISbit (1), /* lowercase. */ + _ISalpha = _ISbit (2), /* Alphabetic. */ + _ISdigit = _ISbit (3), /* Numeric. */ + _ISxdigit = _ISbit (4), /* Hexadecimal numeric. */ + _ISspace = _ISbit (5), /* Whitespace. */ + _ISprint = _ISbit (6), /* Printing. */ + _ISgraph = _ISbit (7), /* Graphical. */ + _ISblank = _ISbit (8), /* Blank (usually SPC and TAB). */ + _IScntrl = _ISbit (9), /* Control character. */ + _ISpunct = _ISbit (10), /* Punctuation. */ + _ISalnum = _ISbit (11) /* Alphanumeric. */ +}; +#endif /* ! _ISbit */ + +/* These are defined in ctype-info.c. + The declarations here must match those in localeinfo.h. + + In the thread-specific locale model (see `uselocale' in ) + we cannot use global variables for these as was done in the past. + Instead, the following accessor functions return the address of + each variable, which is local to the current thread if multithreaded. + + These point into arrays of 384, so they can be indexed by any `unsigned + char' value [0,255]; by EOF (-1); or by any `signed char' value + [-128,-1). ISO C requires that the ctype functions work for `unsigned + char' values and for EOF; we also support negative `signed char' values + for broken old programs. The case conversion arrays are of `int's + rather than `unsigned char's because tolower (EOF) must be EOF, which + doesn't fit into an `unsigned char'. But today more important is that + the arrays are also used for multi-byte character sets. */ +extern const unsigned short int **__ctype_b_loc (void) + __THROW __attribute__ ((__const__)); +extern const __int32_t **__ctype_tolower_loc (void) + __THROW __attribute__ ((__const__)); +extern const __int32_t **__ctype_toupper_loc (void) + __THROW __attribute__ ((__const__)); + + +#ifndef __cplusplus +# define __isctype(c, type) \ + ((*__ctype_b_loc ())[(int) (c)] & (unsigned short int) type) +#elif defined __USE_EXTERN_INLINES +# define __isctype_f(type) \ + __extern_inline int \ + is##type (int __c) __THROW \ + { \ + return (*__ctype_b_loc ())[(int) (__c)] & (unsigned short int) _IS##type; \ + } +#endif + +#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */ +#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */ + +#define __exctype(name) extern int name (int) __THROW + +/* The following names are all functions: + int isCHARACTERISTIC(int c); + which return nonzero iff C has CHARACTERISTIC. + For the meaning of the characteristic names, see the `enum' above. */ +__exctype (isalnum); +__exctype (isalpha); +__exctype (iscntrl); +__exctype (isdigit); +__exctype (islower); +__exctype (isgraph); +__exctype (isprint); +__exctype (ispunct); +__exctype (isspace); +__exctype (isupper); +__exctype (isxdigit); + + +/* Return the lowercase version of C. */ +extern int tolower (int __c) __THROW; + +/* Return the uppercase version of C. */ +extern int toupper (int __c) __THROW; + + +/* ISO C99 introduced one new function. */ +#ifdef __USE_ISOC99 +__exctype (isblank); +#endif + +#ifdef __USE_GNU +/* Test C for a set of character classes according to MASK. */ +extern int isctype (int __c, int __mask) __THROW; +#endif + +#if defined __USE_MISC || defined __USE_XOPEN + +/* Return nonzero iff C is in the ASCII set + (i.e., is no more than 7 bits wide). */ +extern int isascii (int __c) __THROW; + +/* Return the part of C that is in the ASCII set + (i.e., the low-order 7 bits of C). */ +extern int toascii (int __c) __THROW; + +/* These are the same as `toupper' and `tolower' except that they do not + check the argument for being in the range of a `char'. */ +__exctype (_toupper); +__exctype (_tolower); +#endif /* Use X/Open or use misc. */ + +/* This code is needed for the optimized mapping functions. */ +#define __tobody(c, f, a, args) \ + (__extension__ \ + ({ int __res; \ + if (sizeof (c) > 1) \ + { \ + if (__builtin_constant_p (c)) \ + { \ + int __c = (c); \ + __res = __c < -128 || __c > 255 ? __c : (a)[__c]; \ + } \ + else \ + __res = f args; \ + } \ + else \ + __res = (a)[(int) (c)]; \ + __res; })) + +#if !defined __NO_CTYPE +# ifdef __isctype_f +__isctype_f (alnum) +__isctype_f (alpha) +__isctype_f (cntrl) +__isctype_f (digit) +__isctype_f (lower) +__isctype_f (graph) +__isctype_f (print) +__isctype_f (punct) +__isctype_f (space) +__isctype_f (upper) +__isctype_f (xdigit) +# ifdef __USE_ISOC99 +__isctype_f (blank) +# endif +# elif defined __isctype +# define isalnum(c) __isctype((c), _ISalnum) +# define isalpha(c) __isctype((c), _ISalpha) +# define iscntrl(c) __isctype((c), _IScntrl) +# define isdigit(c) __isctype((c), _ISdigit) +# define islower(c) __isctype((c), _ISlower) +# define isgraph(c) __isctype((c), _ISgraph) +# define isprint(c) __isctype((c), _ISprint) +# define ispunct(c) __isctype((c), _ISpunct) +# define isspace(c) __isctype((c), _ISspace) +# define isupper(c) __isctype((c), _ISupper) +# define isxdigit(c) __isctype((c), _ISxdigit) +# ifdef __USE_ISOC99 +# define isblank(c) __isctype((c), _ISblank) +# endif +# endif + +# ifdef __USE_EXTERN_INLINES +__extern_inline int +__NTH (tolower (int __c)) +{ + return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c; +} + +__extern_inline int +__NTH (toupper (int __c)) +{ + return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c; +} +# endif + +# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus +# define tolower(c) __tobody (c, tolower, *__ctype_tolower_loc (), (c)) +# define toupper(c) __tobody (c, toupper, *__ctype_toupper_loc (), (c)) +# endif /* Optimizing gcc */ + +# if defined __USE_MISC || defined __USE_XOPEN +# define isascii(c) __isascii (c) +# define toascii(c) __toascii (c) + +# define _tolower(c) ((int) (*__ctype_tolower_loc ())[(int) (c)]) +# define _toupper(c) ((int) (*__ctype_toupper_loc ())[(int) (c)]) +# endif + +#endif /* Not __NO_CTYPE. */ + + +#ifdef __USE_XOPEN2K8 +/* POSIX.1-2008 extended locale interface (see locale.h). */ +# include + +/* These definitions are similar to the ones above but all functions + take as an argument a handle for the locale which shall be used. */ +# define __isctype_l(c, type, locale) \ + ((locale)->__ctype_b[(int) (c)] & (unsigned short int) type) + +# define __exctype_l(name) \ + extern int name (int, locale_t) __THROW + +/* The following names are all functions: + int isCHARACTERISTIC(int c, locale_t *locale); + which return nonzero iff C has CHARACTERISTIC. + For the meaning of the characteristic names, see the `enum' above. */ +__exctype_l (isalnum_l); +__exctype_l (isalpha_l); +__exctype_l (iscntrl_l); +__exctype_l (isdigit_l); +__exctype_l (islower_l); +__exctype_l (isgraph_l); +__exctype_l (isprint_l); +__exctype_l (ispunct_l); +__exctype_l (isspace_l); +__exctype_l (isupper_l); +__exctype_l (isxdigit_l); + +__exctype_l (isblank_l); + + +/* Return the lowercase version of C in locale L. */ +extern int __tolower_l (int __c, locale_t __l) __THROW; +extern int tolower_l (int __c, locale_t __l) __THROW; + +/* Return the uppercase version of C. */ +extern int __toupper_l (int __c, locale_t __l) __THROW; +extern int toupper_l (int __c, locale_t __l) __THROW; + +# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus +# define __tolower_l(c, locale) \ + __tobody (c, __tolower_l, (locale)->__ctype_tolower, (c, locale)) +# define __toupper_l(c, locale) \ + __tobody (c, __toupper_l, (locale)->__ctype_toupper, (c, locale)) +# define tolower_l(c, locale) __tolower_l ((c), (locale)) +# define toupper_l(c, locale) __toupper_l ((c), (locale)) +# endif /* Optimizing gcc */ + + +# ifndef __NO_CTYPE +# define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l)) +# define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l)) +# define __iscntrl_l(c,l) __isctype_l((c), _IScntrl, (l)) +# define __isdigit_l(c,l) __isctype_l((c), _ISdigit, (l)) +# define __islower_l(c,l) __isctype_l((c), _ISlower, (l)) +# define __isgraph_l(c,l) __isctype_l((c), _ISgraph, (l)) +# define __isprint_l(c,l) __isctype_l((c), _ISprint, (l)) +# define __ispunct_l(c,l) __isctype_l((c), _ISpunct, (l)) +# define __isspace_l(c,l) __isctype_l((c), _ISspace, (l)) +# define __isupper_l(c,l) __isctype_l((c), _ISupper, (l)) +# define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l)) + +# define __isblank_l(c,l) __isctype_l((c), _ISblank, (l)) + +# ifdef __USE_MISC +# define __isascii_l(c,l) ((l), __isascii (c)) +# define __toascii_l(c,l) ((l), __toascii (c)) +# endif + +# define isalnum_l(c,l) __isalnum_l ((c), (l)) +# define isalpha_l(c,l) __isalpha_l ((c), (l)) +# define iscntrl_l(c,l) __iscntrl_l ((c), (l)) +# define isdigit_l(c,l) __isdigit_l ((c), (l)) +# define islower_l(c,l) __islower_l ((c), (l)) +# define isgraph_l(c,l) __isgraph_l ((c), (l)) +# define isprint_l(c,l) __isprint_l ((c), (l)) +# define ispunct_l(c,l) __ispunct_l ((c), (l)) +# define isspace_l(c,l) __isspace_l ((c), (l)) +# define isupper_l(c,l) __isupper_l ((c), (l)) +# define isxdigit_l(c,l) __isxdigit_l ((c), (l)) + +# define isblank_l(c,l) __isblank_l ((c), (l)) + +# ifdef __USE_MISC +# define isascii_l(c,l) __isascii_l ((c), (l)) +# define toascii_l(c,l) __toascii_l ((c), (l)) +# endif + +# endif /* Not __NO_CTYPE. */ + +#endif /* Use POSIX 2008. */ + +__END_DECLS + +#endif /* ctype.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@ctype.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@ctype.h.blob new file mode 100644 index 0000000..b1cc86d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@ctype.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@endian.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@endian.h new file mode 100644 index 0000000..5b73254 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@endian.h @@ -0,0 +1,72 @@ +/* Copyright (C) 1992-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _ENDIAN_H +#define _ENDIAN_H 1 + +#include + +/* Get the definitions of __*_ENDIAN, __BYTE_ORDER, and __FLOAT_WORD_ORDER. */ +#include + +#ifdef __USE_MISC +# define LITTLE_ENDIAN __LITTLE_ENDIAN +# define BIG_ENDIAN __BIG_ENDIAN +# define PDP_ENDIAN __PDP_ENDIAN +# define BYTE_ORDER __BYTE_ORDER +#endif + +#if defined __USE_MISC && !defined __ASSEMBLER__ +/* Conversion interfaces. */ +# include +# include + +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define htobe16(x) __bswap_16 (x) +# define htole16(x) __uint16_identity (x) +# define be16toh(x) __bswap_16 (x) +# define le16toh(x) __uint16_identity (x) + +# define htobe32(x) __bswap_32 (x) +# define htole32(x) __uint32_identity (x) +# define be32toh(x) __bswap_32 (x) +# define le32toh(x) __uint32_identity (x) + +# define htobe64(x) __bswap_64 (x) +# define htole64(x) __uint64_identity (x) +# define be64toh(x) __bswap_64 (x) +# define le64toh(x) __uint64_identity (x) + +# else +# define htobe16(x) __uint16_identity (x) +# define htole16(x) __bswap_16 (x) +# define be16toh(x) __uint16_identity (x) +# define le16toh(x) __bswap_16 (x) + +# define htobe32(x) __uint32_identity (x) +# define htole32(x) __bswap_32 (x) +# define be32toh(x) __uint32_identity (x) +# define le32toh(x) __bswap_32 (x) + +# define htobe64(x) __uint64_identity (x) +# define htole64(x) __bswap_64 (x) +# define be64toh(x) __uint64_identity (x) +# define le64toh(x) __bswap_64 (x) +# endif +#endif + +#endif /* endian.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@endian.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@endian.h.blob new file mode 100644 index 0000000..d22811a Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@endian.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@errno.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@errno.h new file mode 100644 index 0000000..f7828f0 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@errno.h @@ -0,0 +1,55 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard: 7.5 Errors + */ + +#ifndef _ERRNO_H +#define _ERRNO_H 1 + +#include + +/* The system-specific definitions of the E* constants, as macros. */ +#include + +/* When included from assembly language, this header only provides the + E* constants. */ +#ifndef __ASSEMBLER__ + +__BEGIN_DECLS + +/* The error code set by various library functions. */ +extern int *__errno_location (void) __THROW __attribute_const__; +# define errno (*__errno_location ()) + +# ifdef __USE_GNU + +/* The full and simple forms of the name with which the program was + invoked. These variables are set up automatically at startup based on + the value of argv[0]. */ +extern char *program_invocation_name; +extern char *program_invocation_short_name; + +#include + +# endif /* __USE_GNU */ + +__END_DECLS + +#endif /* !__ASSEMBLER__ */ +#endif /* errno.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@errno.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@errno.h.blob new file mode 100644 index 0000000..609c9d0 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@errno.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features-time64.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features-time64.h new file mode 100644 index 0000000..4c1136f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features-time64.h @@ -0,0 +1,42 @@ +/* Features part to handle 64-bit time_t support. + Copyright (C) 2021-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* We need to know the word size in order to check the time size. */ +#include +#include + +#if defined _TIME_BITS +# if _TIME_BITS == 64 +# if ! defined (_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64 +# error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" +# endif +# define __USE_TIME_BITS64 1 +# elif _TIME_BITS == 32 +# if __TIMESIZE > 32 +# error "_TIME_BITS=32 is not compatible with __TIMESIZE > 32" +# endif +# else +# error Invalid _TIME_BITS value (can only be 32 or 64-bit) +# endif +#elif __TIMESIZE == 64 +# define __USE_TIME_BITS64 1 +#endif + +#if defined __USE_TIME_BITS64 && __TIMESIZE == 32 +# define __USE_TIME64_REDIRECTS 1 +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features-time64.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features-time64.h.blob new file mode 100644 index 0000000..6bd94d8 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features-time64.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features.h new file mode 100644 index 0000000..c080ad4 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features.h @@ -0,0 +1,567 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _FEATURES_H +#define _FEATURES_H 1 + +/* These are defined by the user (or the compiler) + to specify the desired environment: + + __STRICT_ANSI__ ISO Standard C. + _ISOC99_SOURCE Extensions to ISO C89 from ISO C99. + _ISOC11_SOURCE Extensions to ISO C99 from ISO C11. + _ISOC23_SOURCE Extensions to ISO C99 from ISO C23. + _ISOC2X_SOURCE Old name for _ISOC23_SOURCE. + _ISOC2Y_SOURCE Extensions to ISO C23 from ISO C2Y. + __STDC_WANT_LIB_EXT2__ + Extensions to ISO C99 from TR 27431-2:2010. + __STDC_WANT_IEC_60559_BFP_EXT__ + Extensions to ISO C11 from TS 18661-1:2014. + __STDC_WANT_IEC_60559_FUNCS_EXT__ + Extensions to ISO C11 from TS 18661-4:2015. + __STDC_WANT_IEC_60559_TYPES_EXT__ + Extensions to ISO C11 from TS 18661-3:2015. + __STDC_WANT_IEC_60559_EXT__ + ISO C23 interfaces defined only in Annex F. + + _POSIX_SOURCE IEEE Std 1003.1. + _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2; + if >=199309L, add IEEE Std 1003.1b-1993; + if >=199506L, add IEEE Std 1003.1c-1995; + if >=200112L, all of IEEE 1003.1-2004 + if >=200809L, all of IEEE 1003.1-2008 + if >=202405L, all of IEEE 1003.1-2024 + _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if + Single Unix conformance is wanted, to 600 for the + sixth revision, to 700 for the seventh revision, + to 800 for the eighth revision. + _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions. + _LARGEFILE_SOURCE Some more functions for correct standard I/O. + _LARGEFILE64_SOURCE Additional functionality from LFS for large files. + _FILE_OFFSET_BITS=N Select default filesystem interface. + _ATFILE_SOURCE Additional *at interfaces. + _DYNAMIC_STACK_SIZE_SOURCE Select correct (but non compile-time constant) + MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN. + _GNU_SOURCE All of the above, plus GNU extensions. + _DEFAULT_SOURCE The default set of features (taking precedence over + __STRICT_ANSI__). + + _FORTIFY_SOURCE Add security hardening to many library functions. + Set to 1, 2 or 3; 3 performs stricter checks than 2, which + performs stricter checks than 1. + + _REENTRANT, _THREAD_SAFE + Obsolete; equivalent to _POSIX_C_SOURCE=199506L. + + The `-ansi' switch to the GNU C compiler, and standards conformance + options such as `-std=c99', define __STRICT_ANSI__. If none of + these are defined, or if _DEFAULT_SOURCE is defined, the default is + to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to + 202405L, as well as enabling miscellaneous functions from BSD and + SVID. If more than one of these are defined, they accumulate. For + example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together + give you ISO C, 1003.1, and 1003.2, but nothing else. + + These are defined by this file and are used by the + header files to decide what to declare or define: + + __GLIBC_USE (F) Define things from feature set F. This is defined + to 1 or 0; the subsequent macros are either defined + or undefined, and those tests should be moved to + __GLIBC_USE. + __USE_ISOC11 Define ISO C11 things. + __USE_ISOC99 Define ISO C99 things. + __USE_ISOC95 Define ISO C90 AMD1 (C95) things. + __USE_ISOCXX11 Define ISO C++11 things. + __USE_POSIX Define IEEE Std 1003.1 things. + __USE_POSIX2 Define IEEE Std 1003.2 things. + __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things. + __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things. + __USE_XOPEN Define XPG things. + __USE_XOPEN_EXTENDED Define X/Open Unix things. + __USE_UNIX98 Define Single Unix V2 things. + __USE_XOPEN2K Define XPG6 things. + __USE_XOPEN2KXSI Define XPG6 XSI things. + __USE_XOPEN2K8 Define XPG7 things. + __USE_XOPEN2K8XSI Define XPG7 XSI things. + __USE_XOPEN2K24 Define XPG8 things. + __USE_XOPEN2K24XSI Define XPG8 XSI things. + __USE_LARGEFILE Define correct standard I/O things. + __USE_LARGEFILE64 Define LFS things with separate names. + __USE_FILE_OFFSET64 Define 64bit interface as default. + __USE_MISC Define things from 4.3BSD or System V Unix. + __USE_ATFILE Define *at interfaces and AT_* constants for them. + __USE_DYNAMIC_STACK_SIZE Define correct (but non compile-time constant) + MINSIGSTKSZ, SIGSTKSZ and PTHREAD_STACK_MIN. + __USE_GNU Define GNU extensions. + __USE_FORTIFY_LEVEL Additional security measures used, according to level. + + The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are + defined by this file unconditionally. `__GNU_LIBRARY__' is provided + only for compatibility. All new code should use the other symbols + to test for features. + + All macros listed above as possibly being defined by this file are + explicitly undefined if they are not explicitly defined. + Feature-test macros that are not defined by the user or compiler + but are implied by the other feature-test macros defined (or by the + lack of any definitions) are defined by the file. + + ISO C feature test macros depend on the definition of the macro + when an affected header is included, not when the first system + header is included, and so they are handled in + , which does not have a multiple include + guard. Feature test macros that can be handled from the first + system header included are handled here. */ + + +/* Undefine everything, so we get a clean slate. */ +#undef __USE_ISOC11 +#undef __USE_ISOC99 +#undef __USE_ISOC95 +#undef __USE_ISOCXX11 +#undef __USE_POSIX +#undef __USE_POSIX2 +#undef __USE_POSIX199309 +#undef __USE_POSIX199506 +#undef __USE_XOPEN +#undef __USE_XOPEN_EXTENDED +#undef __USE_UNIX98 +#undef __USE_XOPEN2K +#undef __USE_XOPEN2KXSI +#undef __USE_XOPEN2K8 +#undef __USE_XOPEN2K8XSI +#undef __USE_XOPEN2K24 +#undef __USE_XOPEN2K24XSI +#undef __USE_LARGEFILE +#undef __USE_LARGEFILE64 +#undef __USE_FILE_OFFSET64 +#undef __USE_MISC +#undef __USE_ATFILE +#undef __USE_DYNAMIC_STACK_SIZE +#undef __USE_GNU +#undef __USE_FORTIFY_LEVEL +#undef __KERNEL_STRICT_NAMES +#undef __GLIBC_USE_ISOC23 +#undef __GLIBC_USE_ISOC2Y +#undef __GLIBC_USE_DEPRECATED_GETS +#undef __GLIBC_USE_DEPRECATED_SCANF +#undef __GLIBC_USE_C23_STRTOL + +/* Suppress kernel-name space pollution unless user explicitly asks + for it. */ +#ifndef _LOOSE_KERNEL_NAMES +# define __KERNEL_STRICT_NAMES +#endif + +/* Convenience macro to test the version of gcc. + Use like this: + #if __GNUC_PREREQ (2,8) + ... code requiring gcc 2.8 or later ... + #endif + Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was + added in 2.0. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +# define __GNUC_PREREQ(maj, min) 0 +#endif + +/* Similarly for clang. Features added to GCC after version 4.2 may + or may not also be available in clang, and clang's definitions of + __GNUC(_MINOR)__ are fixed at 4 and 2 respectively. Not all such + features can be queried via __has_extension/__has_feature. */ +#if defined __clang_major__ && defined __clang_minor__ +# define __glibc_clang_prereq(maj, min) \ + ((__clang_major__ << 16) + __clang_minor__ >= ((maj) << 16) + (min)) +#else +# define __glibc_clang_prereq(maj, min) 0 +#endif + +/* Whether to use feature set F. */ +#define __GLIBC_USE(F) __GLIBC_USE_ ## F + +/* _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for + _DEFAULT_SOURCE. If _DEFAULT_SOURCE is present we do not + issue a warning; the expectation is that the source is being + transitioned to use the new macro. */ +#if (defined _BSD_SOURCE || defined _SVID_SOURCE) \ + && !defined _DEFAULT_SOURCE +# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" +# undef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE 1 +#endif + +/* Remap the old name _ISOC2X_SOURCE to _ISOC23_SOURCE. */ +#ifdef _ISOC2X_SOURCE +# undef _ISOC2X_SOURCE +# undef _ISOC23_SOURCE +# define _ISOC23_SOURCE 1 +#endif + +/* If _GNU_SOURCE was defined by the user, turn on all the other features. */ +#ifdef _GNU_SOURCE +# undef _ISOC95_SOURCE +# define _ISOC95_SOURCE 1 +# undef _ISOC99_SOURCE +# define _ISOC99_SOURCE 1 +# undef _ISOC11_SOURCE +# define _ISOC11_SOURCE 1 +# undef _ISOC23_SOURCE +# define _ISOC23_SOURCE 1 +# undef _ISOC2Y_SOURCE +# define _ISOC2Y_SOURCE 1 +# undef _POSIX_SOURCE +# define _POSIX_SOURCE 1 +# undef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 202405L +# undef _XOPEN_SOURCE +# define _XOPEN_SOURCE 800 +# undef _XOPEN_SOURCE_EXTENDED +# define _XOPEN_SOURCE_EXTENDED 1 +# undef _LARGEFILE64_SOURCE +# define _LARGEFILE64_SOURCE 1 +# undef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE 1 +# undef _ATFILE_SOURCE +# define _ATFILE_SOURCE 1 +# undef _DYNAMIC_STACK_SIZE_SOURCE +# define _DYNAMIC_STACK_SIZE_SOURCE 1 +#endif + +/* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, + define _DEFAULT_SOURCE. */ +#if (defined _DEFAULT_SOURCE \ + || (!defined __STRICT_ANSI__ \ + && !defined _ISOC99_SOURCE && !defined _ISOC11_SOURCE \ + && !defined _ISOC23_SOURCE && !defined _ISOC2Y_SOURCE \ + && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE \ + && !defined _XOPEN_SOURCE)) +# undef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE 1 +#endif + +/* This is to enable the ISO C2Y extension. */ +#if (defined _ISOC2Y_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ > 202311L)) +# define __GLIBC_USE_ISOC2Y 1 +#else +# define __GLIBC_USE_ISOC2Y 0 +#endif + +/* This is to enable the ISO C23 extension. */ +#if (defined _ISOC23_SOURCE || defined _ISOC2Y_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L)) +# define __GLIBC_USE_ISOC23 1 +#else +# define __GLIBC_USE_ISOC23 0 +#endif + +/* This is to enable the ISO C11 extension. */ +#if (defined _ISOC11_SOURCE || defined _ISOC23_SOURCE \ + || defined _ISOC2Y_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)) +# define __USE_ISOC11 1 +#endif + +/* This is to enable the ISO C99 extension. */ +#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ + || defined _ISOC23_SOURCE || defined _ISOC2Y_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) +# define __USE_ISOC99 1 +#endif + +/* This is to enable the ISO C90 Amendment 1:1995 extension. */ +#if (defined _ISOC99_SOURCE || defined _ISOC11_SOURCE \ + || defined _ISOC23_SOURCE || defined _ISOC2Y_SOURCE \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L)) +# define __USE_ISOC95 1 +#endif + +#ifdef __cplusplus +/* This is to enable compatibility for ISO C++17. */ +# if __cplusplus >= 201703L +# define __USE_ISOC11 1 +# endif +/* This is to enable compatibility for ISO C++11. + Check the temporary macro for now, too. */ +# if __cplusplus >= 201103L || defined __GXX_EXPERIMENTAL_CXX0X__ +# define __USE_ISOCXX11 1 +# define __USE_ISOC99 1 +# endif +#endif + +/* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE + is defined, use POSIX.1-2024 (or another version depending on + _XOPEN_SOURCE). */ +#ifdef _DEFAULT_SOURCE +# if !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE +# define __USE_POSIX_IMPLICITLY 1 +# endif +# undef _POSIX_SOURCE +# define _POSIX_SOURCE 1 +# undef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 202405L +#endif + +#if ((!defined __STRICT_ANSI__ \ + || (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500)) \ + && !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE) +# define _POSIX_SOURCE 1 +# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500 +# define _POSIX_C_SOURCE 2 +# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600 +# define _POSIX_C_SOURCE 199506L +# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700 +# define _POSIX_C_SOURCE 200112L +# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 800 +# define _POSIX_C_SOURCE 200809L +# else +# define _POSIX_C_SOURCE 202405L +# endif +# define __USE_POSIX_IMPLICITLY 1 +#endif + +/* Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be + defined in all multithreaded code. GNU libc has not required this + for many years. We now treat them as compatibility synonyms for + _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with + comprehensive support for multithreaded code. Using them never + lowers the selected level of POSIX conformance, only raises it. */ +#if ((!defined _POSIX_C_SOURCE || (_POSIX_C_SOURCE - 0) < 199506L) \ + && (defined _REENTRANT || defined _THREAD_SAFE)) +# define _POSIX_SOURCE 1 +# undef _POSIX_C_SOURCE +# define _POSIX_C_SOURCE 199506L +#endif + +#if (defined _POSIX_SOURCE \ + || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1) \ + || defined _XOPEN_SOURCE) +# define __USE_POSIX 1 +#endif + +#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE +# define __USE_POSIX2 1 +#endif + +#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L +# define __USE_POSIX199309 1 +#endif + +#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L +# define __USE_POSIX199506 1 +#endif + +#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L +# define __USE_XOPEN2K 1 +# undef __USE_ISOC95 +# define __USE_ISOC95 1 +# undef __USE_ISOC99 +# define __USE_ISOC99 1 +#endif + +#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200809L +# define __USE_XOPEN2K8 1 +# undef _ATFILE_SOURCE +# define _ATFILE_SOURCE 1 +#endif + +#if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 202405L +# define __USE_XOPEN2K24 1 +#endif + +#ifdef _XOPEN_SOURCE +# define __USE_XOPEN 1 +# if (_XOPEN_SOURCE - 0) >= 500 +# define __USE_XOPEN_EXTENDED 1 +# define __USE_UNIX98 1 +# undef _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 +# if (_XOPEN_SOURCE - 0) >= 600 +# if (_XOPEN_SOURCE - 0) >= 700 +# define __USE_XOPEN2K8 1 +# define __USE_XOPEN2K8XSI 1 +# if (_XOPEN_SOURCE - 0) >= 800 +# define __USE_XOPEN2K24 1 +# define __USE_XOPEN2K24XSI 1 +# endif +# endif +# define __USE_XOPEN2K 1 +# define __USE_XOPEN2KXSI 1 +# undef __USE_ISOC95 +# define __USE_ISOC95 1 +# undef __USE_ISOC99 +# define __USE_ISOC99 1 +# endif +# else +# ifdef _XOPEN_SOURCE_EXTENDED +# define __USE_XOPEN_EXTENDED 1 +# endif +# endif +#endif + +#ifdef _LARGEFILE_SOURCE +# define __USE_LARGEFILE 1 +#endif + +#ifdef _LARGEFILE64_SOURCE +# define __USE_LARGEFILE64 1 +#endif + +#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 +# define __USE_FILE_OFFSET64 1 +#endif + +#include + +#if defined _DEFAULT_SOURCE +# define __USE_MISC 1 +#endif + +#ifdef _ATFILE_SOURCE +# define __USE_ATFILE 1 +#endif + +#ifdef _DYNAMIC_STACK_SIZE_SOURCE +# define __USE_DYNAMIC_STACK_SIZE 1 +#endif + +#ifdef _GNU_SOURCE +# define __USE_GNU 1 +#endif + +#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 +# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0 +# warning _FORTIFY_SOURCE requires compiling with optimization (-O) +# elif !__GNUC_PREREQ (4, 1) +# warning _FORTIFY_SOURCE requires GCC 4.1 or later +# elif _FORTIFY_SOURCE > 2 && (__glibc_clang_prereq (9, 0) \ + || __GNUC_PREREQ (12, 0)) + +# if _FORTIFY_SOURCE > 3 +# warning _FORTIFY_SOURCE > 3 is treated like 3 on this platform +# endif +# define __USE_FORTIFY_LEVEL 3 +# elif _FORTIFY_SOURCE > 1 +# if _FORTIFY_SOURCE > 2 +# warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform +# endif +# define __USE_FORTIFY_LEVEL 2 +# else +# define __USE_FORTIFY_LEVEL 1 +# endif +#endif +#ifndef __USE_FORTIFY_LEVEL +# define __USE_FORTIFY_LEVEL 0 +#endif + +/* The function 'gets' existed in C89, but is impossible to use + safely. It has been removed from ISO C11 and ISO C++14. Note: for + compatibility with various implementations of , this test + must consider only the value of __cplusplus when compiling C++. */ +#if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11 +# define __GLIBC_USE_DEPRECATED_GETS 0 +#else +# define __GLIBC_USE_DEPRECATED_GETS 1 +#endif + +/* GNU formerly extended the scanf functions with modified format + specifiers %as, %aS, and %a[...] that allocate a buffer for the + input using malloc. This extension conflicts with ISO C99, which + defines %a as a standalone format specifier that reads a floating- + point number; moreover, POSIX.1-2008 provides the same feature + using the modifier letter 'm' instead (%ms, %mS, %m[...]). + + We now follow C99 unless GNU extensions are active and the compiler + is specifically in C89 or C++98 mode (strict or not). For + instance, with GCC, -std=gnu11 will have C99-compliant scanf with + or without -D_GNU_SOURCE, but -std=c89 -D_GNU_SOURCE will have the + old extension. */ +#if (defined __USE_GNU \ + && (defined __cplusplus \ + ? (__cplusplus < 201103L && !defined __GXX_EXPERIMENTAL_CXX0X__) \ + : (!defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L))) +# define __GLIBC_USE_DEPRECATED_SCANF 1 +#else +# define __GLIBC_USE_DEPRECATED_SCANF 0 +#endif + +/* ISO C23 added support for a 0b or 0B prefix on binary constants as + inputs to strtol-family functions (base 0 or 2). This macro is + used to condition redirection in headers to allow that redirection + to be disabled when building those functions, despite _GNU_SOURCE + being defined. */ +#if __GLIBC_USE (ISOC23) +# define __GLIBC_USE_C23_STRTOL 1 +#else +# define __GLIBC_USE_C23_STRTOL 0 +#endif + +/* Get definitions of __STDC_* predefined macros, if the compiler has + not preincluded this header automatically. */ +#include + +/* This macro indicates that the installed library is the GNU C Library. + For historic reasons the value now is 6 and this will stay from now + on. The use of this variable is deprecated. Use __GLIBC__ and + __GLIBC_MINOR__ now (see below) when you want to test for a specific + GNU C library version and use the values in to get + the sonames of the shared libraries. */ +#undef __GNU_LIBRARY__ +#define __GNU_LIBRARY__ 6 + +/* Major and minor version number of the GNU C library package. Use + these macros to test for features in specific releases. */ +#define __GLIBC__ 2 +#define __GLIBC_MINOR__ 43 + +#define __GLIBC_PREREQ(maj, min) \ + ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) + +/* This is here only because every header file already includes this one. */ +#ifndef __ASSEMBLER__ +# ifndef _SYS_CDEFS_H +# include +# endif + +/* If we don't have __REDIRECT, prototypes will be missing if + __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */ +# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT +# define __USE_LARGEFILE 1 +# define __USE_LARGEFILE64 1 +# endif + +#endif /* !ASSEMBLER */ + +/* Decide whether we can define 'extern inline' functions in headers. */ +#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ + && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \ + && defined __extern_inline && !(defined __clang__ && defined _LIBC) +# define __USE_EXTERN_INLINES 1 +#endif + + +/* This is here only because every header file already includes this one. + Get the definitions of all the appropriate `__stub_FUNCTION' symbols. + contains `#define __stub_FUNCTION' when FUNCTION is a stub + that will always return failure (and set errno to ENOSYS). */ +#include + + +#endif /* features.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features.h.blob new file mode 100644 index 0000000..988f5ac Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@features.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs-64.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs-64.h new file mode 100644 index 0000000..b745721 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs-64.h @@ -0,0 +1,17 @@ +/* This file is automatically generated. + It defines a symbol `__stub_FUNCTION' for each function + in the C library which is a stub, meaning it will fail + every time called, usually setting errno to ENOSYS. */ + +#ifdef _LIBC + #error Applications may not define the macro _LIBC +#endif + +#define __stub___compat_bdflush +#define __stub_chflags +#define __stub_fchflags +#define __stub_gtty +#define __stub_revoke +#define __stub_setlogin +#define __stub_sigreturn +#define __stub_stty diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs-64.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs-64.h.blob new file mode 100644 index 0000000..12e3670 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs-64.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs.h new file mode 100644 index 0000000..70a1ba0 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs.h @@ -0,0 +1,14 @@ +/* This file is automatically generated. + This file selects the right generated file of `__stub_FUNCTION' macros + based on the architecture being compiled for. */ + + +#if !defined __x86_64__ +# include +#endif +#if defined __x86_64__ && defined __LP64__ +# include +#endif +#if defined __x86_64__ && defined __ILP32__ +# include +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs.h.blob new file mode 100644 index 0000000..0384b13 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@gnu@stubs.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@libintl.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@libintl.h new file mode 100644 index 0000000..bd6ff4f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@libintl.h @@ -0,0 +1,123 @@ +/* Message catalogs for internationalization. + Copyright (C) 1995-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + This file is derived from the file libgettext.h in the GNU gettext package. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _LIBINTL_H +#define _LIBINTL_H 1 + +#include + +/* We define an additional symbol to signal that we use the GNU + implementation of gettext. */ +#define __USE_GNU_GETTEXT 1 + +/* Provide information about the supported file formats. Returns the + maximum minor revision number supported for a given major revision. */ +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \ + ((major) == 0 ? 1 : -1) + +__BEGIN_DECLS + +/* Look up MSGID in the current default message catalog for the current + LC_MESSAGES locale. If not found, returns MSGID itself (the default + text). */ +extern char *gettext (const char *__msgid) + __THROW __attribute_format_arg__ (1); + +/* Look up MSGID in the DOMAINNAME message catalog for the current + LC_MESSAGES locale. */ +extern char *dgettext (const char *__domainname, const char *__msgid) + __THROW __attribute_format_arg__ (2); +extern char *__dgettext (const char *__domainname, const char *__msgid) + __THROW __attribute_format_arg__ (2); + +/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY + locale. */ +extern char *dcgettext (const char *__domainname, + const char *__msgid, int __category) + __THROW __attribute_format_arg__ (2); +extern char *__dcgettext (const char *__domainname, + const char *__msgid, int __category) + __THROW __attribute_format_arg__ (2); + + +/* Similar to `gettext' but select the plural form corresponding to the + number N. */ +extern char *ngettext (const char *__msgid1, const char *__msgid2, + unsigned long int __n) + __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2); + +/* Similar to `dgettext' but select the plural form corresponding to the + number N. */ +extern char *dngettext (const char *__domainname, const char *__msgid1, + const char *__msgid2, unsigned long int __n) + __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); + +/* Similar to `dcgettext' but select the plural form corresponding to the + number N. */ +extern char *dcngettext (const char *__domainname, const char *__msgid1, + const char *__msgid2, unsigned long int __n, + int __category) + __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3); + + +/* Set the current default message catalog to DOMAINNAME. + If DOMAINNAME is null, return the current default. + If DOMAINNAME is "", reset to the default of "messages". */ +extern char *textdomain (const char *__domainname) __THROW; + +/* Specify that the DOMAINNAME message catalog will be found + in DIRNAME rather than in the system locale data base. */ +extern char *bindtextdomain (const char *__domainname, + const char *__dirname) __THROW; + +/* Specify the character encoding in which the messages from the + DOMAINNAME message catalog will be returned. */ +extern char *bind_textdomain_codeset (const char *__domainname, + const char *__codeset) __THROW; + + +/* Optimized version of the function above. */ +#if defined __OPTIMIZE__ && !defined __cplusplus + +/* We need NULL for `gettext'. */ +# define __need_NULL +# include + +/* We need LC_MESSAGES for `dgettext'. */ +# include + +/* These must be macros. Inlined functions are useless because the + `__builtin_constant_p' predicate in dcgettext would always return + false. */ + +# define gettext(msgid) dgettext (NULL, msgid) + +# define dgettext(domainname, msgid) \ + dcgettext (domainname, msgid, LC_MESSAGES) + +# define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n) + +# define dngettext(domainname, msgid1, msgid2, n) \ + dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES) + +#endif /* Optimizing. */ + +__END_DECLS + +#endif /* libintl.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@libintl.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@libintl.h.blob new file mode 100644 index 0000000..580f0a2 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@libintl.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@errno.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@errno.h new file mode 100644 index 0000000..70f2bd3 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@errno.h @@ -0,0 +1 @@ +#include diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@errno.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@errno.h.blob new file mode 100644 index 0000000..94c76fc Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@errno.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@posix_types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@posix_types.h new file mode 100644 index 0000000..9a7a740 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@posix_types.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_POSIX_TYPES_H +#define _LINUX_POSIX_TYPES_H + +#include + +/* + * This allows for 1024 file descriptors: if NR_OPEN is ever grown + * beyond that you'll have to change this too. But 1024 fd's seem to be + * enough even for such "real" unices like OSF/1, so hopefully this is + * one limit that doesn't have to be changed [again]. + * + * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in + * (and thus ) - but this is a more logical + * place for them. Solved by having dummy defines in . + */ + +/* + * This macro may have been defined in . But we always + * use the one here. + */ +#undef __FD_SETSIZE +#define __FD_SETSIZE 1024 + +typedef struct { + unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))]; +} __kernel_fd_set; + +/* Type of a signal handler. */ +typedef void (*__kernel_sighandler_t)(int); + +/* Type of a SYSV IPC key. */ +typedef int __kernel_key_t; +typedef int __kernel_mqd_t; + +#include + +#endif /* _LINUX_POSIX_TYPES_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@posix_types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@posix_types.h.blob new file mode 100644 index 0000000..54f4f09 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@posix_types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@sched@types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@sched@types.h new file mode 100644 index 0000000..90606bc --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@sched@types.h @@ -0,0 +1,121 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_SCHED_TYPES_H +#define _LINUX_SCHED_TYPES_H + +#include + +#define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */ +#define SCHED_ATTR_SIZE_VER1 56 /* add: util_{min,max} */ + +/* + * Extended scheduling parameters data structure. + * + * This is needed because the original struct sched_param can not be + * altered without introducing ABI issues with legacy applications + * (e.g., in sched_getparam()). + * + * However, the possibility of specifying more than just a priority for + * the tasks may be useful for a wide variety of application fields, e.g., + * multimedia, streaming, automation and control, and many others. + * + * This variant (sched_attr) allows to define additional attributes to + * improve the scheduler knowledge about task requirements. + * + * Scheduling Class Attributes + * =========================== + * + * A subset of sched_attr attributes specifies the + * scheduling policy and relative POSIX attributes: + * + * @size size of the structure, for fwd/bwd compat. + * + * @sched_policy task's scheduling policy + * @sched_nice task's nice value (SCHED_NORMAL/BATCH) + * @sched_priority task's static priority (SCHED_FIFO/RR) + * + * Certain more advanced scheduling features can be controlled by a + * predefined set of flags via the attribute: + * + * @sched_flags for customizing the scheduler behaviour + * + * Sporadic Time-Constrained Task Attributes + * ========================================= + * + * A subset of sched_attr attributes allows to describe a so-called + * sporadic time-constrained task. + * + * In such a model a task is specified by: + * - the activation period or minimum instance inter-arrival time; + * - the maximum (or average, depending on the actual scheduling + * discipline) computation time of all instances, a.k.a. runtime; + * - the deadline (relative to the actual activation time) of each + * instance. + * Very briefly, a periodic (sporadic) task asks for the execution of + * some specific computation --which is typically called an instance-- + * (at most) every period. Moreover, each instance typically lasts no more + * than the runtime and must be completed by time instant t equal to + * the instance activation time + the deadline. + * + * This is reflected by the following fields of the sched_attr structure: + * + * @sched_deadline representative of the task's deadline in nanoseconds + * @sched_runtime representative of the task's runtime in nanoseconds + * @sched_period representative of the task's period in nanoseconds + * + * Given this task model, there are a multiplicity of scheduling algorithms + * and policies, that can be used to ensure all the tasks will make their + * timing constraints. + * + * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the + * only user of this new interface. More information about the algorithm + * available in the scheduling class file or in Documentation/. + * + * Task Utilization Attributes + * =========================== + * + * A subset of sched_attr attributes allows to specify the utilization + * expected for a task. These attributes allow to inform the scheduler about + * the utilization boundaries within which it should schedule the task. These + * boundaries are valuable hints to support scheduler decisions on both task + * placement and frequency selection. + * + * @sched_util_min represents the minimum utilization + * @sched_util_max represents the maximum utilization + * + * Utilization is a value in the range [0..SCHED_CAPACITY_SCALE]. It + * represents the percentage of CPU time used by a task when running at the + * maximum frequency on the highest capacity CPU of the system. For example, a + * 20% utilization task is a task running for 2ms every 10ms at maximum + * frequency. + * + * A task with a min utilization value bigger than 0 is more likely scheduled + * on a CPU with a capacity big enough to fit the specified value. + * A task with a max utilization value smaller than 1024 is more likely + * scheduled on a CPU with no more capacity than the specified value. + * + * A task utilization boundary can be reset by setting the attribute to -1. + */ +struct sched_attr { + __u32 size; + + __u32 sched_policy; + __u64 sched_flags; + + /* SCHED_NORMAL, SCHED_BATCH */ + __s32 sched_nice; + + /* SCHED_FIFO, SCHED_RR */ + __u32 sched_priority; + + /* SCHED_DEADLINE */ + __u64 sched_runtime; + __u64 sched_deadline; + __u64 sched_period; + + /* Utilization hints */ + __u32 sched_util_min; + __u32 sched_util_max; + +}; + +#endif /* _LINUX_SCHED_TYPES_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@sched@types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@sched@types.h.blob new file mode 100644 index 0000000..efe4a3c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@sched@types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@stddef.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@stddef.h new file mode 100644 index 0000000..48ee443 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@stddef.h @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_STDDEF_H +#define _LINUX_STDDEF_H + + +#ifndef __always_inline +#define __always_inline __inline__ +#endif + +/* Not all C++ standards support type declarations inside an anonymous union */ +#ifndef __cplusplus +#define __struct_group_tag(TAG) TAG +#else +#define __struct_group_tag(TAG) +#endif + +/** + * __struct_group() - Create a mirrored named and anonyomous struct + * + * @TAG: The tag name for the named sub-struct (usually empty) + * @NAME: The identifier name of the mirrored sub-struct + * @ATTRS: Any struct attributes (usually empty) + * @MEMBERS: The member declarations for the mirrored structs + * + * Used to create an anonymous union of two structs with identical layout + * and size: one anonymous and one named. The former's members can be used + * normally without sub-struct naming, and the latter can be used to + * reason about the start, end, and size of the group of struct members. + * The named struct can also be explicitly tagged for layer reuse (C only), + * as well as both having struct attributes appended. + */ +#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \ + union { \ + struct { MEMBERS } ATTRS; \ + struct __struct_group_tag(TAG) { MEMBERS } ATTRS NAME; \ + } ATTRS + +#ifdef __cplusplus +/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */ +#define __DECLARE_FLEX_ARRAY(T, member) \ + T member[0] +#else +/** + * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union + * + * @TYPE: The type of each flexible array element + * @NAME: The name of the flexible array member + * + * In order to have a flexible array member in a union or alone in a + * struct, it needs to be wrapped in an anonymous struct with at least 1 + * named member, but that member can be empty. + */ +#define __DECLARE_FLEX_ARRAY(TYPE, NAME) \ + struct { \ + struct { } __empty_ ## NAME; \ + TYPE NAME[]; \ + } +#endif + +#ifndef __counted_by +#define __counted_by(m) +#endif + +#ifndef __counted_by_le +#define __counted_by_le(m) +#endif + +#ifndef __counted_by_be +#define __counted_by_be(m) +#endif + +#define __kernel_nonstring + +#endif /* _LINUX_STDDEF_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@stddef.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@stddef.h.blob new file mode 100644 index 0000000..a0a2013 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@stddef.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@types.h new file mode 100644 index 0000000..2518741 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@types.h @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_TYPES_H +#define _LINUX_TYPES_H + +#include + +#ifndef __ASSEMBLY__ + +#include + +#ifdef __SIZEOF_INT128__ +typedef __signed__ __int128 __s128 __attribute__((aligned(16))); +typedef unsigned __int128 __u128 __attribute__((aligned(16))); +#endif + +/* + * Below are truly Linux-specific types that should never collide with + * any application/library that wants linux/types.h. + */ + +/* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */ +#ifdef __CHECKER__ +#define __bitwise __attribute__((bitwise)) +#else +#define __bitwise +#endif + +/* The kernel doesn't use this legacy form, but user space does */ +#define __bitwise__ __bitwise + +typedef __u16 __bitwise __le16; +typedef __u16 __bitwise __be16; +typedef __u32 __bitwise __le32; +typedef __u32 __bitwise __be32; +typedef __u64 __bitwise __le64; +typedef __u64 __bitwise __be64; + +typedef __u16 __bitwise __sum16; +typedef __u32 __bitwise __wsum; + +/* + * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid + * common 32/64-bit compat problems. + * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other + * architectures) and to 8-byte boundaries on 64-bit architectures. The new + * aligned_64 type enforces 8-byte alignment so that structs containing + * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. + * No conversions are necessary between 32-bit user-space and a 64-bit kernel. + */ +#define __aligned_u64 __u64 __attribute__((aligned(8))) +#define __aligned_s64 __s64 __attribute__((aligned(8))) +#define __aligned_be64 __be64 __attribute__((aligned(8))) +#define __aligned_le64 __le64 __attribute__((aligned(8))) + +typedef unsigned __bitwise __poll_t; + +#endif /* __ASSEMBLY__ */ +#endif /* _LINUX_TYPES_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@types.h.blob new file mode 100644 index 0000000..774196c Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@linux@types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@locale.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@locale.h new file mode 100644 index 0000000..51950ec --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@locale.h @@ -0,0 +1,197 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard: 7.11 Localization + */ + +#ifndef _LOCALE_H +#define _LOCALE_H 1 + +#include + +#define __need_NULL +#include +#include + +__BEGIN_DECLS + +/* These are the possibilities for the first argument to setlocale. + The code assumes that the lowest LC_* symbol has the value zero. */ +#define LC_CTYPE __LC_CTYPE +#define LC_NUMERIC __LC_NUMERIC +#define LC_TIME __LC_TIME +#define LC_COLLATE __LC_COLLATE +#define LC_MONETARY __LC_MONETARY +#define LC_MESSAGES __LC_MESSAGES +#define LC_ALL __LC_ALL +#define LC_PAPER __LC_PAPER +#define LC_NAME __LC_NAME +#define LC_ADDRESS __LC_ADDRESS +#define LC_TELEPHONE __LC_TELEPHONE +#define LC_MEASUREMENT __LC_MEASUREMENT +#define LC_IDENTIFICATION __LC_IDENTIFICATION + + +/* Structure giving information about numeric and monetary notation. */ +struct lconv +{ + /* Numeric (non-monetary) information. */ + + char *decimal_point; /* Decimal point character. */ + char *thousands_sep; /* Thousands separator. */ + /* Each element is the number of digits in each group; + elements with higher indices are farther left. + An element with value CHAR_MAX means that no further grouping is done. + An element with value 0 means that the previous element is used + for all groups farther left. */ + char *grouping; + + /* Monetary information. */ + + /* First three chars are a currency symbol from ISO 4217. + Fourth char is the separator. Fifth char is '\0'. */ + char *int_curr_symbol; + char *currency_symbol; /* Local currency symbol. */ + char *mon_decimal_point; /* Decimal point character. */ + char *mon_thousands_sep; /* Thousands separator. */ + char *mon_grouping; /* Like `grouping' element (above). */ + char *positive_sign; /* Sign for positive values. */ + char *negative_sign; /* Sign for negative values. */ + char int_frac_digits; /* Int'l fractional digits. */ + char frac_digits; /* Local fractional digits. */ + /* 1 if currency_symbol precedes a positive value, 0 if succeeds. */ + char p_cs_precedes; + /* 1 iff a space separates currency_symbol from a positive value. */ + char p_sep_by_space; + /* 1 if currency_symbol precedes a negative value, 0 if succeeds. */ + char n_cs_precedes; + /* 1 iff a space separates currency_symbol from a negative value. */ + char n_sep_by_space; + /* Positive and negative sign positions: + 0 Parentheses surround the quantity and currency_symbol. + 1 The sign string precedes the quantity and currency_symbol. + 2 The sign string follows the quantity and currency_symbol. + 3 The sign string immediately precedes the currency_symbol. + 4 The sign string immediately follows the currency_symbol. */ + char p_sign_posn; + char n_sign_posn; +#ifdef __USE_ISOC99 + /* 1 if int_curr_symbol precedes a positive value, 0 if succeeds. */ + char int_p_cs_precedes; + /* 1 iff a space separates int_curr_symbol from a positive value. */ + char int_p_sep_by_space; + /* 1 if int_curr_symbol precedes a negative value, 0 if succeeds. */ + char int_n_cs_precedes; + /* 1 iff a space separates int_curr_symbol from a negative value. */ + char int_n_sep_by_space; + /* Positive and negative sign positions: + 0 Parentheses surround the quantity and int_curr_symbol. + 1 The sign string precedes the quantity and int_curr_symbol. + 2 The sign string follows the quantity and int_curr_symbol. + 3 The sign string immediately precedes the int_curr_symbol. + 4 The sign string immediately follows the int_curr_symbol. */ + char int_p_sign_posn; + char int_n_sign_posn; +#else + char __int_p_cs_precedes; + char __int_p_sep_by_space; + char __int_n_cs_precedes; + char __int_n_sep_by_space; + char __int_p_sign_posn; + char __int_n_sign_posn; +#endif +}; + + +/* Set and/or return the current locale. */ +extern char *setlocale (int __category, const char *__locale) __THROW; + +/* Return the numeric/monetary information for the current locale. */ +extern struct lconv *localeconv (void) __THROW; + + +#ifdef __USE_XOPEN2K8 +/* POSIX.1-2008 extends the locale interface with functions for + explicit creation and manipulation of 'locale_t' objects + representing locale contexts, and a set of parallel + locale-sensitive text processing functions that take a locale_t + argument. This enables applications to work with data from + multiple locales simultaneously and thread-safely. */ +# include + +/* Return a reference to a data structure representing a set of locale + datasets. Unlike for the CATEGORY parameter for `setlocale' the + CATEGORY_MASK parameter here uses a single bit for each category, + made by OR'ing together LC_*_MASK bits above. */ +extern locale_t newlocale (int __category_mask, const char *__locale, + locale_t __base) __THROW; + +/* These are the bits that can be set in the CATEGORY_MASK argument to + `newlocale'. In the GNU implementation, LC_FOO_MASK has the value + of (1 << LC_FOO), but this is not a part of the interface that + callers can assume will be true. */ +# define LC_CTYPE_MASK (1 << __LC_CTYPE) +# define LC_NUMERIC_MASK (1 << __LC_NUMERIC) +# define LC_TIME_MASK (1 << __LC_TIME) +# define LC_COLLATE_MASK (1 << __LC_COLLATE) +# define LC_MONETARY_MASK (1 << __LC_MONETARY) +# define LC_MESSAGES_MASK (1 << __LC_MESSAGES) +# define LC_PAPER_MASK (1 << __LC_PAPER) +# define LC_NAME_MASK (1 << __LC_NAME) +# define LC_ADDRESS_MASK (1 << __LC_ADDRESS) +# define LC_TELEPHONE_MASK (1 << __LC_TELEPHONE) +# define LC_MEASUREMENT_MASK (1 << __LC_MEASUREMENT) +# define LC_IDENTIFICATION_MASK (1 << __LC_IDENTIFICATION) +# define LC_ALL_MASK (LC_CTYPE_MASK \ + | LC_NUMERIC_MASK \ + | LC_TIME_MASK \ + | LC_COLLATE_MASK \ + | LC_MONETARY_MASK \ + | LC_MESSAGES_MASK \ + | LC_PAPER_MASK \ + | LC_NAME_MASK \ + | LC_ADDRESS_MASK \ + | LC_TELEPHONE_MASK \ + | LC_MEASUREMENT_MASK \ + | LC_IDENTIFICATION_MASK \ + ) + +/* Return a duplicate of the set of locale in DATASET. All usage + counters are increased if necessary. */ +extern locale_t duplocale (locale_t __dataset) __THROW; + +/* Free the data associated with a locale dataset previously returned + by a call to `setlocale_r'. */ +extern void freelocale (locale_t __dataset) __THROW; + +/* Switch the current thread's locale to DATASET. + If DATASET is null, instead just return the current setting. + The special value LC_GLOBAL_LOCALE is the initial setting + for all threads and can also be installed any time, meaning + the thread uses the global settings controlled by `setlocale'. */ +extern locale_t uselocale (locale_t __dataset) __THROW; + +/* This value can be passed to `uselocale' and may be returned by it. + Passing this value to any other function has undefined behavior. */ +# define LC_GLOBAL_LOCALE ((locale_t) -1L) + +#endif + +__END_DECLS + +#endif /* locale.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@locale.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@locale.h.blob new file mode 100644 index 0000000..3eda26d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@locale.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@pthread.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@pthread.h new file mode 100644 index 0000000..95c0eb7 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@pthread.h @@ -0,0 +1,1353 @@ +/* Copyright (C) 2002-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _PTHREAD_H +#define _PTHREAD_H 1 + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#ifdef __USE_MISC +# include +#endif + +/* Detach state. */ +enum +{ + PTHREAD_CREATE_JOINABLE, +#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_JOINABLE + PTHREAD_CREATE_DETACHED +#define PTHREAD_CREATE_DETACHED PTHREAD_CREATE_DETACHED +}; + + +/* Mutex types. */ +enum +{ + PTHREAD_MUTEX_TIMED_NP, + PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_ADAPTIVE_NP +#if defined __USE_UNIX98 || defined __USE_XOPEN2K8 + , + PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP, + PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, + PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, + PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL +#endif +#ifdef __USE_GNU + /* For compatibility. */ + , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP +#endif +}; + + +#ifdef __USE_XOPEN2K +/* Robust mutex or not flags. */ +enum +{ + PTHREAD_MUTEX_STALLED, + PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED, + PTHREAD_MUTEX_ROBUST, + PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST +}; +#endif + + +#if defined __USE_POSIX199506 || defined __USE_UNIX98 +/* Mutex protocols. */ +enum +{ + PTHREAD_PRIO_NONE, + PTHREAD_PRIO_INHERIT, + PTHREAD_PRIO_PROTECT +}; +#endif + + +#define PTHREAD_MUTEX_INITIALIZER \ + { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_TIMED_NP) } } +#ifdef __USE_GNU +# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ + { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_RECURSIVE_NP) } } +# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \ + { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ERRORCHECK_NP) } } +# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \ + { { __PTHREAD_MUTEX_INITIALIZER (PTHREAD_MUTEX_ADAPTIVE_NP) } } +#endif + + +/* Read-write lock types. */ +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +enum +{ + PTHREAD_RWLOCK_PREFER_READER_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, + PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP +}; + + +/* Read-write lock initializers. */ +# define PTHREAD_RWLOCK_INITIALIZER \ + { { __PTHREAD_RWLOCK_INITIALIZER (PTHREAD_RWLOCK_DEFAULT_NP) } } +# ifdef __USE_GNU +# define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \ + { { __PTHREAD_RWLOCK_INITIALIZER (PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) } } +# endif +#endif /* Unix98 or XOpen2K */ + + +/* Scheduler inheritance. */ +enum +{ + PTHREAD_INHERIT_SCHED, +#define PTHREAD_INHERIT_SCHED PTHREAD_INHERIT_SCHED + PTHREAD_EXPLICIT_SCHED +#define PTHREAD_EXPLICIT_SCHED PTHREAD_EXPLICIT_SCHED +}; + + +/* Scope handling. */ +enum +{ + PTHREAD_SCOPE_SYSTEM, +#define PTHREAD_SCOPE_SYSTEM PTHREAD_SCOPE_SYSTEM + PTHREAD_SCOPE_PROCESS +#define PTHREAD_SCOPE_PROCESS PTHREAD_SCOPE_PROCESS +}; + + +/* Process shared or private flag. */ +enum +{ + PTHREAD_PROCESS_PRIVATE, +#define PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_PRIVATE + PTHREAD_PROCESS_SHARED +#define PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_SHARED +}; + + + +/* Conditional variable handling. */ +#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, 0, 0, {0, 0}, 0, 0 } } + + +/* Cleanup buffers */ +struct _pthread_cleanup_buffer +{ + void (*__routine) (void *); /* Function to call. */ + void *__arg; /* Its argument. */ + int __canceltype; /* Saved cancellation type. */ + struct _pthread_cleanup_buffer *__prev; /* Chaining of cleanup functions. */ +}; + +/* Cancellation */ +enum +{ + PTHREAD_CANCEL_ENABLE, +#define PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_ENABLE + PTHREAD_CANCEL_DISABLE +#define PTHREAD_CANCEL_DISABLE PTHREAD_CANCEL_DISABLE +}; +enum +{ + PTHREAD_CANCEL_DEFERRED, +#define PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DEFERRED + PTHREAD_CANCEL_ASYNCHRONOUS +#define PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS +}; +#define PTHREAD_CANCELED ((void *) -1) + + +/* Single execution handling. */ +#define PTHREAD_ONCE_INIT 0 + + +#ifdef __USE_XOPEN2K +/* Value returned by 'pthread_barrier_wait' for one of the threads after + the required number of threads have called this function. + -1 is distinct from 0 and all errno constants */ +# define PTHREAD_BARRIER_SERIAL_THREAD -1 +#endif + + +__BEGIN_DECLS + +/* Create a new thread, starting with execution of START-ROUTINE + getting passed ARG. Creation attributed come from ATTR. The new + handle is stored in *NEWTHREAD. */ +extern int pthread_create (pthread_t *__restrict __newthread, + const pthread_attr_t *__restrict __attr, + void *(*__start_routine) (void *), + void *__restrict __arg) __THROWNL __nonnull ((1, 3)); + +/* Terminate calling thread. + + The registered cleanup handlers are called via exception handling + so we cannot mark this function with __THROW.*/ +extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__)); + +/* Make calling thread wait for termination of the thread TH. The + exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN + is not NULL. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pthread_join (pthread_t __th, void **__thread_return); + +#ifdef __USE_GNU +/* Check whether thread TH has terminated. If yes return the status of + the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ +extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; + +# ifndef __USE_TIME64_REDIRECTS +/* Make calling thread wait for termination of the thread TH, but only + until TIMEOUT. The exit status of the thread is stored in + *THREAD_RETURN, if THREAD_RETURN is not NULL. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pthread_timedjoin_np (pthread_t __th, void **__thread_return, + const struct timespec *__abstime); + +/* Make calling thread wait for termination of the thread TH, but only + until TIMEOUT measured against the clock specified by CLOCKID. The + exit status of the thread is stored in *THREAD_RETURN, if + THREAD_RETURN is not NULL. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pthread_clockjoin_np (pthread_t __th, void **__thread_return, + clockid_t __clockid, + const struct timespec *__abstime); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pthread_timedjoin_np, + (pthread_t __th, void **__thread_return, + const struct timespec *__abstime), + __pthread_timedjoin_np64); + +extern int __REDIRECT (pthread_clockjoin_np, + (pthread_t __th, void **__thread_return, + clockid_t __clockid, + const struct timespec *__abstime), + __pthread_clockjoin_np64); +# else +# define pthread_timedjoin_np __pthread_timedjoin_np64 +# define pthread_clockjoin_np __pthread_clockjoin_np64 +# endif +# endif +#endif + +/* Indicate that the thread TH is never to be joined with PTHREAD_JOIN. + The resources of TH will therefore be freed immediately when it + terminates, instead of waiting for another thread to perform PTHREAD_JOIN + on it. */ +extern int pthread_detach (pthread_t __th) __THROW; + + +/* Obtain the identifier of the current thread. */ +extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__)); + +/* Compare two thread identifiers. */ +extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) + __THROW __attribute__ ((__const__)); + + +/* Thread attribute handling. */ + +/* Initialize thread attribute *ATTR with default attributes + (detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER, + no user-provided stack). */ +extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1)); + +/* Destroy thread attribute *ATTR. */ +extern int pthread_attr_destroy (pthread_attr_t *__attr) + __THROW __nonnull ((1)); + +/* Get detach state attribute. */ +extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr, + int *__detachstate) + __THROW __nonnull ((1, 2)); + +/* Set detach state attribute. */ +extern int pthread_attr_setdetachstate (pthread_attr_t *__attr, + int __detachstate) + __THROW __nonnull ((1)); + + +/* Get the size of the guard area created for stack overflow protection. */ +extern int pthread_attr_getguardsize (const pthread_attr_t *__attr, + size_t *__guardsize) + __THROW __nonnull ((1, 2)); + +/* Set the size of the guard area created for stack overflow protection. */ +extern int pthread_attr_setguardsize (pthread_attr_t *__attr, + size_t __guardsize) + __THROW __nonnull ((1)); + + +/* Return in *PARAM the scheduling parameters of *ATTR. */ +extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr, + struct sched_param *__restrict __param) + __THROW __nonnull ((1, 2)); + +/* Set scheduling parameters (priority, etc) in *ATTR according to PARAM. */ +extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, + const struct sched_param *__restrict + __param) __THROW __nonnull ((1, 2)); + +/* Return in *POLICY the scheduling policy of *ATTR. */ +extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict + __attr, int *__restrict __policy) + __THROW __nonnull ((1, 2)); + +/* Set scheduling policy in *ATTR according to POLICY. */ +extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) + __THROW __nonnull ((1)); + +/* Return in *INHERIT the scheduling inheritance mode of *ATTR. */ +extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict + __attr, int *__restrict __inherit) + __THROW __nonnull ((1, 2)); + +/* Set scheduling inheritance mode in *ATTR according to INHERIT. */ +extern int pthread_attr_setinheritsched (pthread_attr_t *__attr, + int __inherit) + __THROW __nonnull ((1)); + + +/* Return in *SCOPE the scheduling contention scope of *ATTR. */ +extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr, + int *__restrict __scope) + __THROW __nonnull ((1, 2)); + +/* Set scheduling contention scope in *ATTR according to SCOPE. */ +extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) + __THROW __nonnull ((1)); + +/* Return the previously set address for the stack. */ +extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict + __attr, void **__restrict __stackaddr) + __THROW __nonnull ((1, 2)) __attribute_deprecated__; + +/* Set the starting address of the stack of the thread to be created. + Depending on whether the stack grows up or down the value must either + be higher or lower than all the address in the memory block. The + minimal size of the block must be PTHREAD_STACK_MIN. */ +extern int pthread_attr_setstackaddr (pthread_attr_t *__attr, + void *__stackaddr) + __THROW __nonnull ((1)) __attribute_deprecated__; + +/* Return the currently used minimal stack size. */ +extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict + __attr, size_t *__restrict __stacksize) + __THROW __nonnull ((1, 2)); + +/* Add information about the minimum stack size needed for the thread + to be started. This size must never be less than PTHREAD_STACK_MIN + and must also not exceed the system limits. */ +extern int pthread_attr_setstacksize (pthread_attr_t *__attr, + size_t __stacksize) + __THROW __nonnull ((1)); + +#ifdef __USE_XOPEN2K +/* Return the previously set address for the stack. */ +extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr, + void **__restrict __stackaddr, + size_t *__restrict __stacksize) + __THROW __nonnull ((1, 2, 3)); + +/* The following two interfaces are intended to replace the last two. They + require setting the address as well as the size since only setting the + address will make the implementation on some architectures impossible. */ +extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, + size_t __stacksize) __THROW __nonnull ((1)); +#endif + +#ifdef __USE_GNU +/* Thread created with attribute ATTR will be limited to run only on + the processors represented in CPUSET. */ +extern int pthread_attr_setaffinity_np (pthread_attr_t *__attr, + size_t __cpusetsize, + const cpu_set_t *__cpuset) + __THROW __nonnull ((1, 3)); + +/* Get bit set in CPUSET representing the processors threads created with + ATTR can run on. */ +extern int pthread_attr_getaffinity_np (const pthread_attr_t *__attr, + size_t __cpusetsize, + cpu_set_t *__cpuset) + __THROW __nonnull ((1, 3)); + +/* Get the default attributes used by pthread_create in this process. */ +extern int pthread_getattr_default_np (pthread_attr_t *__attr) + __THROW __nonnull ((1)); + +/* Store *SIGMASK as the signal mask for the new thread in *ATTR. */ +extern int pthread_attr_setsigmask_np (pthread_attr_t *__attr, + const __sigset_t *sigmask); + +/* Store the signal mask of *ATTR in *SIGMASK. If there is no signal + mask stored, return PTHREAD_ATTR_NOSIGMASK_NP. Return zero on + success. */ +extern int pthread_attr_getsigmask_np (const pthread_attr_t *__attr, + __sigset_t *sigmask); + +/* Special return value from pthread_attr_getsigmask_np if the signal + mask has not been set. */ +#define PTHREAD_ATTR_NO_SIGMASK_NP (-1) + +/* Set the default attributes to be used by pthread_create in this + process. */ +extern int pthread_setattr_default_np (const pthread_attr_t *__attr) + __THROW __nonnull ((1)); + +/* Initialize thread attribute *ATTR with attributes corresponding to the + already running thread TH. It shall be called on uninitialized ATTR + and destroyed with pthread_attr_destroy when no longer needed. */ +extern int pthread_getattr_np (pthread_t __th, pthread_attr_t *__attr) + __THROW __nonnull ((2)); +#endif + + +/* Functions for scheduling control. */ + +/* Set the scheduling parameters for TARGET_THREAD according to POLICY + and *PARAM. */ +extern int pthread_setschedparam (pthread_t __target_thread, int __policy, + const struct sched_param *__param) + __THROW __nonnull ((3)); + +/* Return in *POLICY and *PARAM the scheduling parameters for TARGET_THREAD. */ +extern int pthread_getschedparam (pthread_t __target_thread, + int *__restrict __policy, + struct sched_param *__restrict __param) + __THROW __nonnull ((2, 3)); + +/* Set the scheduling priority for TARGET_THREAD. */ +extern int pthread_setschedprio (pthread_t __target_thread, int __prio) + __THROW; + + +#ifdef __USE_GNU +/* Get thread name visible in the kernel and its interfaces. */ +extern int pthread_getname_np (pthread_t __target_thread, char *__buf, + size_t __buflen) + __THROW __nonnull ((2)); + +/* Set thread name visible in the kernel and its interfaces. */ +extern int pthread_setname_np (pthread_t __target_thread, const char *__name) + __THROW __nonnull ((2)); +#endif + + +#ifdef __USE_UNIX98 +/* Determine level of concurrency. */ +extern int pthread_getconcurrency (void) __THROW; + +/* Set new concurrency level to LEVEL. */ +extern int pthread_setconcurrency (int __level) __THROW; +#endif + +#ifdef __USE_GNU +extern int pthread_yield (void) __THROW; +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield) + __attribute_deprecated_msg__ ("\ +pthread_yield is deprecated, use sched_yield instead"); +# else +# define pthread_yield sched_yield +# endif + + +/* Limit specified thread TH to run only on the processors represented + in CPUSET. */ +extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize, + const cpu_set_t *__cpuset) + __THROW __nonnull ((3)); + +/* Get bit set in CPUSET representing the processors TH can run on. */ +extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize, + cpu_set_t *__cpuset) + __THROW __nonnull ((3)); +#endif + + +/* Functions for handling initialization. */ + +/* Guarantee that the initialization function INIT_ROUTINE will be called + only once, even if pthread_once is executed several times with the + same ONCE_CONTROL argument. ONCE_CONTROL must point to a static or + extern variable initialized to PTHREAD_ONCE_INIT. + + The initialization functions might throw exception which is why + this function is not marked with __THROW. */ +extern int pthread_once (pthread_once_t *__once_control, + void (*__init_routine) (void)) __nonnull ((1, 2)); + + +/* Functions for handling cancellation. + + Note that these functions are explicitly not marked to not throw an + exception in C++ code. If cancellation is implemented by unwinding + this is necessary to have the compiler generate the unwind information. */ + +/* Set cancellability state of current thread to STATE, returning old + state in *OLDSTATE if OLDSTATE is not NULL. */ +extern int pthread_setcancelstate (int __state, int *__oldstate); + +/* Set cancellation state of current thread to TYPE, returning the old + type in *OLDTYPE if OLDTYPE is not NULL. */ +extern int pthread_setcanceltype (int __type, int *__oldtype); + +/* Cancel THREAD immediately or at the next possibility. */ +extern int pthread_cancel (pthread_t __th); + +/* Test for pending cancellation for the current thread and terminate + the thread as per pthread_exit(PTHREAD_CANCELED) if it has been + cancelled. */ +extern void pthread_testcancel (void); + + +/* Cancellation handling with integration into exception handling. */ + +struct __cancel_jmp_buf_tag +{ + __jmp_buf __cancel_jmp_buf; + int __mask_was_saved; +}; + +typedef struct +{ + struct __cancel_jmp_buf_tag __cancel_jmp_buf[1]; + void *__pad[4]; +} __pthread_unwind_buf_t __attribute__ ((__aligned__)); + +/* No special attributes by default. */ +#ifndef __cleanup_fct_attribute +# define __cleanup_fct_attribute +#endif + + +/* Structure to hold the cleanup handler information. */ +struct __pthread_cleanup_frame +{ + void (*__cancel_routine) (void *); + void *__cancel_arg; + int __do_it; + int __cancel_type; +}; + +#if defined __GNUC__ && defined __EXCEPTIONS +# ifdef __cplusplus +/* Class to handle cancellation handler invocation. */ +class __pthread_cleanup_class +{ + void (*__cancel_routine) (void *); + void *__cancel_arg; + int __do_it; + int __cancel_type; + + public: + __pthread_cleanup_class (void (*__fct) (void *), void *__arg) + : __cancel_routine (__fct), __cancel_arg (__arg), __do_it (1) { } + ~__pthread_cleanup_class () { if (__do_it) __cancel_routine (__cancel_arg); } + void __setdoit (int __newval) { __do_it = __newval; } + void __defer () { pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, + &__cancel_type); } + void __restore () const { pthread_setcanceltype (__cancel_type, 0); } +}; + +/* Install a cleanup handler: ROUTINE will be called with arguments ARG + when the thread is canceled or calls pthread_exit. ROUTINE will also + be called with arguments ARG when the matching pthread_cleanup_pop + is executed with non-zero EXECUTE argument. + + pthread_cleanup_push and pthread_cleanup_pop are macros and must always + be used in matching pairs at the same nesting level of braces. */ +# define pthread_cleanup_push(routine, arg) \ + do { \ + __pthread_cleanup_class __clframe (routine, arg) + +/* Remove a cleanup handler installed by the matching pthread_cleanup_push. + If EXECUTE is non-zero, the handler function is called. */ +# define pthread_cleanup_pop(execute) \ + __clframe.__setdoit (execute); \ + } while (0) + +# ifdef __USE_GNU +/* Install a cleanup handler as pthread_cleanup_push does, but also + saves the current cancellation type and sets it to deferred + cancellation. */ +# define pthread_cleanup_push_defer_np(routine, arg) \ + do { \ + __pthread_cleanup_class __clframe (routine, arg); \ + __clframe.__defer () + +/* Remove a cleanup handler as pthread_cleanup_pop does, but also + restores the cancellation type that was in effect when the matching + pthread_cleanup_push_defer was called. */ +# define pthread_cleanup_pop_restore_np(execute) \ + __clframe.__restore (); \ + __clframe.__setdoit (execute); \ + } while (0) +# endif +# else +/* Function called to call the cleanup handler. As an extern inline + function the compiler is free to decide inlining the change when + needed or fall back on the copy which must exist somewhere + else. */ +__extern_inline void +__pthread_cleanup_routine (struct __pthread_cleanup_frame *__frame) +{ + if (__frame->__do_it) + __frame->__cancel_routine (__frame->__cancel_arg); +} + +/* Install a cleanup handler: ROUTINE will be called with arguments ARG + when the thread is canceled or calls pthread_exit. ROUTINE will also + be called with arguments ARG when the matching pthread_cleanup_pop + is executed with non-zero EXECUTE argument. + + pthread_cleanup_push and pthread_cleanup_pop are macros and must always + be used in matching pairs at the same nesting level of braces. */ +# define pthread_cleanup_push(routine, arg) \ + do { \ + struct __pthread_cleanup_frame __clframe \ + __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \ + = { .__cancel_routine = (routine), .__cancel_arg = (arg), \ + .__do_it = 1 }; + +/* Remove a cleanup handler installed by the matching pthread_cleanup_push. + If EXECUTE is non-zero, the handler function is called. */ +# define pthread_cleanup_pop(execute) \ + __clframe.__do_it = (execute); \ + } while (0) + +# ifdef __USE_GNU +/* Install a cleanup handler as pthread_cleanup_push does, but also + saves the current cancellation type and sets it to deferred + cancellation. */ +# define pthread_cleanup_push_defer_np(routine, arg) \ + do { \ + struct __pthread_cleanup_frame __clframe \ + __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \ + = { .__cancel_routine = (routine), .__cancel_arg = (arg), \ + .__do_it = 1 }; \ + (void) pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, \ + &__clframe.__cancel_type) + +/* Remove a cleanup handler as pthread_cleanup_pop does, but also + restores the cancellation type that was in effect when the matching + pthread_cleanup_push_defer was called. */ +# define pthread_cleanup_pop_restore_np(execute) \ + (void) pthread_setcanceltype (__clframe.__cancel_type, NULL); \ + __clframe.__do_it = (execute); \ + } while (0) +# endif +# endif +#else +/* Install a cleanup handler: ROUTINE will be called with arguments ARG + when the thread is canceled or calls pthread_exit. ROUTINE will also + be called with arguments ARG when the matching pthread_cleanup_pop + is executed with non-zero EXECUTE argument. + + pthread_cleanup_push and pthread_cleanup_pop are macros and must always + be used in matching pairs at the same nesting level of braces. */ +# define pthread_cleanup_push(routine, arg) \ + do { \ + __pthread_unwind_buf_t __cancel_buf; \ + void (*__cancel_routine) (void *) = (routine); \ + void *__cancel_arg = (arg); \ + int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \ + 0); \ + if (__glibc_unlikely (__not_first_call)) \ + { \ + __cancel_routine (__cancel_arg); \ + __pthread_unwind_next (&__cancel_buf); \ + /* NOTREACHED */ \ + } \ + \ + __pthread_register_cancel (&__cancel_buf); \ + do { +extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf) + __cleanup_fct_attribute; + +/* Remove a cleanup handler installed by the matching pthread_cleanup_push. + If EXECUTE is non-zero, the handler function is called. */ +# define pthread_cleanup_pop(execute) \ + do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ + } while (0); \ + __pthread_unregister_cancel (&__cancel_buf); \ + if (execute) \ + __cancel_routine (__cancel_arg); \ + } while (0) +extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) + __cleanup_fct_attribute; + +# ifdef __USE_GNU +/* Install a cleanup handler as pthread_cleanup_push does, but also + saves the current cancellation type and sets it to deferred + cancellation. */ +# define pthread_cleanup_push_defer_np(routine, arg) \ + do { \ + __pthread_unwind_buf_t __cancel_buf; \ + void (*__cancel_routine) (void *) = (routine); \ + void *__cancel_arg = (arg); \ + int __not_first_call = __sigsetjmp_cancel (__cancel_buf.__cancel_jmp_buf, \ + 0); \ + if (__glibc_unlikely (__not_first_call)) \ + { \ + __cancel_routine (__cancel_arg); \ + __pthread_unwind_next (&__cancel_buf); \ + /* NOTREACHED */ \ + } \ + \ + __pthread_register_cancel_defer (&__cancel_buf); \ + do { +extern void __pthread_register_cancel_defer (__pthread_unwind_buf_t *__buf) + __cleanup_fct_attribute; + +/* Remove a cleanup handler as pthread_cleanup_pop does, but also + restores the cancellation type that was in effect when the matching + pthread_cleanup_push_defer was called. */ +# define pthread_cleanup_pop_restore_np(execute) \ + do { } while (0);/* Empty to allow label before pthread_cleanup_pop. */\ + } while (0); \ + __pthread_unregister_cancel_restore (&__cancel_buf); \ + if (execute) \ + __cancel_routine (__cancel_arg); \ + } while (0) +extern void __pthread_unregister_cancel_restore (__pthread_unwind_buf_t *__buf) + __cleanup_fct_attribute; +# endif + +/* Internal interface to initiate cleanup. */ +extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) + __cleanup_fct_attribute __attribute__ ((__noreturn__)) +# ifndef SHARED + __attribute__ ((__weak__)) +# endif + ; +#endif + +/* Function used in the macros. Calling __sigsetjmp, with its first + argument declared as an array, results in a -Wstringop-overflow + warning from GCC 11 because struct pthread_unwind_buf is smaller + than jmp_buf. The calls from the macros have __SAVEMASK set to 0, + so nothing beyond the common prefix is used and this warning is a + false positive. Use an alias with its first argument declared to + use the type in the macros if possible to avoid this warning. */ +#if __GNUC_PREREQ (11, 0) +extern int __REDIRECT_NTHNL (__sigsetjmp_cancel, + (struct __cancel_jmp_buf_tag __env[1], + int __savemask), + __sigsetjmp) __attribute_returns_twice__; +#else +# define __sigsetjmp_cancel(env, savemask) \ + __sigsetjmp ((struct __jmp_buf_tag *) (void *) (env), (savemask)) +extern int __sigsetjmp (struct __jmp_buf_tag __env[1], + int __savemask) __THROWNL; +#endif + + +/* Mutex handling. */ + +/* Initialize a mutex. */ +extern int pthread_mutex_init (pthread_mutex_t *__mutex, + const pthread_mutexattr_t *__mutexattr) + __THROW __nonnull ((1)); + +/* Destroy a mutex. */ +extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) + __THROW __nonnull ((1)); + +/* Try locking a mutex. */ +extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) + __THROWNL __nonnull ((1)); + +/* Lock a mutex. */ +extern int pthread_mutex_lock (pthread_mutex_t *__mutex) + __THROWNL __nonnull ((1)); + +#ifdef __USE_XOPEN2K +/* Wait until lock becomes available, or specified time passes. */ +# ifndef __USE_TIME64_REDIRECTS +extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_mutex_timedlock, + (pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime), + __pthread_mutex_timedlock64) __nonnull ((1, 2)); +# else +# define pthread_mutex_timedlock __pthread_mutex_timedlock64 +# endif +# endif +#endif + +#ifdef __USE_GNU +# ifndef __USE_TIME64_REDIRECTS +extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, + clockid_t __clockid, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 3)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_mutex_clocklock, + (pthread_mutex_t *__restrict __mutex, + clockid_t __clockid, + const struct timespec *__restrict __abstime), + __pthread_mutex_clocklock64) __nonnull ((1, 3)); +# else +# define pthread_mutex_clocklock __pthread_mutex_clocklock64 +# endif +# endif +#endif + +/* Unlock a mutex. */ +extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) + __THROWNL __nonnull ((1)); + + +/* Get the priority ceiling of MUTEX. */ +extern int pthread_mutex_getprioceiling (const pthread_mutex_t * + __restrict __mutex, + int *__restrict __prioceiling) + __THROW __nonnull ((1, 2)); + +/* Set the priority ceiling of MUTEX to PRIOCEILING, return old + priority ceiling value in *OLD_CEILING. */ +extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex, + int __prioceiling, + int *__restrict __old_ceiling) + __THROW __nonnull ((1, 3)); + + +#ifdef __USE_XOPEN2K8 +/* Declare the state protected by MUTEX as consistent. */ +extern int pthread_mutex_consistent (pthread_mutex_t *__mutex) + __THROW __nonnull ((1)); +# ifdef __USE_GNU +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_mutex_consistent_np, (pthread_mutex_t *), + pthread_mutex_consistent) __nonnull ((1)) + __attribute_deprecated_msg__ ("\ +pthread_mutex_consistent_np is deprecated, use pthread_mutex_consistent"); +# else +# define pthread_mutex_consistent_np pthread_mutex_consistent +# endif +# endif +#endif + + +/* Functions for handling mutex attributes. */ + +/* Initialize mutex attribute object ATTR with default attributes + (kind is PTHREAD_MUTEX_TIMED_NP). */ +extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) + __THROW __nonnull ((1)); + +/* Destroy mutex attribute object ATTR. */ +extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) + __THROW __nonnull ((1)); + +/* Get the process-shared flag of the mutex attribute ATTR. */ +extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t * + __restrict __attr, + int *__restrict __pshared) + __THROW __nonnull ((1, 2)); + +/* Set the process-shared flag of the mutex attribute ATTR. */ +extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, + int __pshared) + __THROW __nonnull ((1)); + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K8 +/* Return in *KIND the mutex kind attribute in *ATTR. */ +extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict + __attr, int *__restrict __kind) + __THROW __nonnull ((1, 2)); + +/* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL, + PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or + PTHREAD_MUTEX_DEFAULT). */ +extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) + __THROW __nonnull ((1)); +#endif + +/* Return in *PROTOCOL the mutex protocol attribute in *ATTR. */ +extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t * + __restrict __attr, + int *__restrict __protocol) + __THROW __nonnull ((1, 2)); + +/* Set the mutex protocol attribute in *ATTR to PROTOCOL (either + PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, or PTHREAD_PRIO_PROTECT). */ +extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr, + int __protocol) + __THROW __nonnull ((1)); + +/* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */ +extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t * + __restrict __attr, + int *__restrict __prioceiling) + __THROW __nonnull ((1, 2)); + +/* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */ +extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr, + int __prioceiling) + __THROW __nonnull ((1)); + +#ifdef __USE_XOPEN2K +/* Get the robustness flag of the mutex attribute ATTR. */ +extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr, + int *__robustness) + __THROW __nonnull ((1, 2)); +# ifdef __USE_GNU +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np, + (pthread_mutexattr_t *, int *), + pthread_mutexattr_getrobust) __nonnull ((1)) + __attribute_deprecated_msg__ ("\ +pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust"); +# else +# define pthread_mutexattr_getrobust_np pthread_mutexattr_getrobust +# endif +# endif + +/* Set the robustness flag of the mutex attribute ATTR. */ +extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr, + int __robustness) + __THROW __nonnull ((1)); +# ifdef __USE_GNU +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np, + (pthread_mutexattr_t *, int), + pthread_mutexattr_setrobust) __nonnull ((1)) + __attribute_deprecated_msg__ ("\ +pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust"); +# else +# define pthread_mutexattr_setrobust_np pthread_mutexattr_setrobust +# endif +# endif +#endif + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +/* Functions for handling read-write locks. */ + +/* Initialize read-write lock RWLOCK using attributes ATTR, or use + the default values if later is NULL. */ +extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, + const pthread_rwlockattr_t *__restrict + __attr) __THROW __nonnull ((1)); + +/* Destroy read-write lock RWLOCK. */ +extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) + __THROW __nonnull ((1)); + +/* Acquire read lock for RWLOCK. */ +extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) + __THROWNL __nonnull ((1)); + +/* Try to acquire read lock for RWLOCK. */ +extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) + __THROWNL __nonnull ((1)); + +# ifdef __USE_XOPEN2K +/* Try to acquire read lock for RWLOCK or return after specified time. */ +# ifndef __USE_TIME64_REDIRECTS +extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock, + (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict __abstime), + __pthread_rwlock_timedrdlock64) + __nonnull ((1, 2)); +# else +# define pthread_rwlock_timedrdlock __pthread_rwlock_timedrdlock64 +# endif +# endif +# endif + +# ifdef __USE_GNU +# ifndef __USE_TIME64_REDIRECTS +extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 3)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_clockrdlock, + (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict __abstime), + __pthread_rwlock_clockrdlock64) + __nonnull ((1, 3)); +# else +# define pthread_rwlock_clockrdlock __pthread_rwlock_clockrdlock64 +# endif +# endif +# endif + +/* Acquire write lock for RWLOCK. */ +extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) + __THROWNL __nonnull ((1)); + +/* Try to acquire write lock for RWLOCK. */ +extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) + __THROWNL __nonnull ((1)); + +# ifdef __USE_XOPEN2K +/* Try to acquire write lock for RWLOCK or return after specified time. */ +# ifndef __USE_TIME64_REDIRECTS +extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 2)); +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock, + (pthread_rwlock_t *__restrict __rwlock, + const struct timespec *__restrict __abstime), + __pthread_rwlock_timedwrlock64) + __nonnull ((1, 2)); +# else +# define pthread_rwlock_timedwrlock __pthread_rwlock_timedwrlock64 +# endif +# endif +# endif + +# ifdef __USE_GNU +# ifndef __USE_TIME64_REDIRECTS +extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict + __abstime) __THROWNL __nonnull ((1, 3)); + +# else +# ifdef __REDIRECT_NTHNL +extern int __REDIRECT_NTHNL (pthread_rwlock_clockwrlock, + (pthread_rwlock_t *__restrict __rwlock, + clockid_t __clockid, + const struct timespec *__restrict __abstime), + __pthread_rwlock_clockwrlock64) + __nonnull ((1, 3)); +# else +# define pthread_rwlock_clockwrlock __pthread_rwlock_clockwrlock64 +# endif +# endif +# endif + +/* Unlock RWLOCK. */ +extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) + __THROWNL __nonnull ((1)); + + +/* Functions for handling read-write lock attributes. */ + +/* Initialize attribute object ATTR with default values. */ +extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) + __THROW __nonnull ((1)); + +/* Destroy attribute object ATTR. */ +extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) + __THROW __nonnull ((1)); + +/* Return current setting of process-shared attribute of ATTR in PSHARED. */ +extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * + __restrict __attr, + int *__restrict __pshared) + __THROW __nonnull ((1, 2)); + +/* Set process-shared attribute of ATTR to PSHARED. */ +extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, + int __pshared) + __THROW __nonnull ((1)); + +/* Return current setting of reader/writer preference. */ +extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t * + __restrict __attr, + int *__restrict __pref) + __THROW __nonnull ((1, 2)); + +/* Set reader/write preference. */ +extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr, + int __pref) __THROW __nonnull ((1)); +#endif + + +/* Functions for handling conditional variables. */ + +/* Initialize condition variable COND using attributes ATTR, or use + the default values if later is NULL. */ +extern int pthread_cond_init (pthread_cond_t *__restrict __cond, + const pthread_condattr_t *__restrict __cond_attr) + __THROW __nonnull ((1)); + +/* Destroy condition variable COND. */ +extern int pthread_cond_destroy (pthread_cond_t *__cond) + __THROW __nonnull ((1)); + +/* Wake up one thread waiting for condition variable COND. */ +extern int pthread_cond_signal (pthread_cond_t *__cond) + __THROWNL __nonnull ((1)); + +/* Wake up all threads waiting for condition variables COND. */ +extern int pthread_cond_broadcast (pthread_cond_t *__cond) + __THROWNL __nonnull ((1)); + +/* Wait for condition variable COND to be signaled or broadcast. + MUTEX is assumed to be locked before. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex) + __nonnull ((1, 2)); + +/* Wait for condition variable COND to be signaled or broadcast until + ABSTIME. MUTEX is assumed to be locked before. ABSTIME is an + absolute time specification; zero is the beginning of the epoch + (00:00:00 GMT, January 1, 1970). + + This function is a cancellation point and therefore not marked with + __THROW. */ +# ifndef __USE_TIME64_REDIRECTS +extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime) + __nonnull ((1, 2, 3)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pthread_cond_timedwait, + (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + const struct timespec *__restrict __abstime), + __pthread_cond_timedwait64) + __nonnull ((1, 2, 3)); +# else +# define pthread_cond_timedwait __pthread_cond_timedwait64 +# endif +# endif + +# ifdef __USE_GNU +/* Wait for condition variable COND to be signaled or broadcast until + ABSTIME measured by the specified clock. MUTEX is assumed to be + locked before. CLOCK is the clock to use. ABSTIME is an absolute + time specification against CLOCK's epoch. + + This function is a cancellation point and therefore not marked with + __THROW. */ +# ifndef __USE_TIME64_REDIRECTS +extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + __clockid_t __clock_id, + const struct timespec *__restrict __abstime) + __nonnull ((1, 2, 4)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pthread_cond_clockwait, + (pthread_cond_t *__restrict __cond, + pthread_mutex_t *__restrict __mutex, + __clockid_t __clock_id, + const struct timespec *__restrict __abstime), + __pthread_cond_clockwait64) + __nonnull ((1, 2, 4)); +# else +# define pthread_cond_clockwait __pthread_cond_clockwait64 +# endif +# endif +# endif + +/* Functions for handling condition variable attributes. */ + +/* Initialize condition variable attribute ATTR. */ +extern int pthread_condattr_init (pthread_condattr_t *__attr) + __THROW __nonnull ((1)); + +/* Destroy condition variable attribute ATTR. */ +extern int pthread_condattr_destroy (pthread_condattr_t *__attr) + __THROW __nonnull ((1)); + +/* Get the process-shared flag of the condition variable attribute ATTR. */ +extern int pthread_condattr_getpshared (const pthread_condattr_t * + __restrict __attr, + int *__restrict __pshared) + __THROW __nonnull ((1, 2)); + +/* Set the process-shared flag of the condition variable attribute ATTR. */ +extern int pthread_condattr_setpshared (pthread_condattr_t *__attr, + int __pshared) __THROW __nonnull ((1)); + +#ifdef __USE_XOPEN2K +/* Get the clock selected for the condition variable attribute ATTR. */ +extern int pthread_condattr_getclock (const pthread_condattr_t * + __restrict __attr, + __clockid_t *__restrict __clock_id) + __THROW __nonnull ((1, 2)); + +/* Set the clock selected for the condition variable attribute ATTR. */ +extern int pthread_condattr_setclock (pthread_condattr_t *__attr, + __clockid_t __clock_id) + __THROW __nonnull ((1)); +#endif + + +#ifdef __USE_XOPEN2K +/* Functions to handle spinlocks. */ + +/* Initialize the spinlock LOCK. If PSHARED is nonzero the spinlock can + be shared between different processes. */ +extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) + __THROW __nonnull ((1)); + +/* Destroy the spinlock LOCK. */ +extern int pthread_spin_destroy (pthread_spinlock_t *__lock) + __THROW __nonnull ((1)); + +/* Wait until spinlock LOCK is retrieved. */ +extern int pthread_spin_lock (pthread_spinlock_t *__lock) + __THROWNL __nonnull ((1)); + +/* Try to lock spinlock LOCK. */ +extern int pthread_spin_trylock (pthread_spinlock_t *__lock) + __THROWNL __nonnull ((1)); + +/* Release spinlock LOCK. */ +extern int pthread_spin_unlock (pthread_spinlock_t *__lock) + __THROWNL __nonnull ((1)); + + +/* Functions to handle barriers. */ + +/* Initialize BARRIER with the attributes in ATTR. The barrier is + opened when COUNT waiters arrived. */ +extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier, + const pthread_barrierattr_t *__restrict + __attr, unsigned int __count) + __THROW __nonnull ((1)); + +/* Destroy a previously dynamically initialized barrier BARRIER. */ +extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) + __THROW __nonnull ((1)); + +/* Wait on barrier BARRIER. */ +extern int pthread_barrier_wait (pthread_barrier_t *__barrier) + __THROWNL __nonnull ((1)); + + +/* Initialize barrier attribute ATTR. */ +extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) + __THROW __nonnull ((1)); + +/* Destroy previously dynamically initialized barrier attribute ATTR. */ +extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) + __THROW __nonnull ((1)); + +/* Get the process-shared flag of the barrier attribute ATTR. */ +extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t * + __restrict __attr, + int *__restrict __pshared) + __THROW __nonnull ((1, 2)); + +/* Set the process-shared flag of the barrier attribute ATTR. */ +extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, + int __pshared) + __THROW __nonnull ((1)); +#endif + + +/* Functions for handling thread-specific data. */ + +/* Create a key value identifying a location in the thread-specific + data area. Each thread maintains a distinct thread-specific data + area. DESTR_FUNCTION, if non-NULL, is called with the value + associated to that key when the key is destroyed. + DESTR_FUNCTION is not called if the value associated is NULL when + the key is destroyed. */ +extern int pthread_key_create (pthread_key_t *__key, + void (*__destr_function) (void *)) + __THROW __nonnull ((1)); + +/* Destroy KEY. */ +extern int pthread_key_delete (pthread_key_t __key) __THROW; + +/* Return current value of the thread-specific data slot identified by KEY. */ +extern void *pthread_getspecific (pthread_key_t __key) __THROW; + +/* Store POINTER in the thread-specific data slot identified by KEY. */ +extern int pthread_setspecific (pthread_key_t __key, + const void *__pointer) + __THROW __attr_access_none (2); + + +#ifdef __USE_XOPEN2K +/* Get ID of CPU-time clock for thread THREAD_ID. */ +extern int pthread_getcpuclockid (pthread_t __thread_id, + __clockid_t *__clock_id) + __THROW __nonnull ((2)); +#endif + +#ifdef __USE_GNU +/* Return the Linux TID for THREAD_ID. Returns -1 on failure. */ +extern pid_t pthread_gettid_np (pthread_t __thread_id); +#endif + + +/* Install handlers to be called when a new process is created with FORK. + The PREPARE handler is called in the parent process just before performing + FORK. The PARENT handler is called in the parent process just after FORK. + The CHILD handler is called in the child process. Each of the three + handlers can be NULL, meaning that no handler needs to be called at that + point. + PTHREAD_ATFORK can be called several times, in which case the PREPARE + handlers are called in LIFO order (last added with PTHREAD_ATFORK, + first called before FORK), and the PARENT and CHILD handlers are called + in FIFO (first added, first called). */ + +extern int pthread_atfork (void (*__prepare) (void), + void (*__parent) (void), + void (*__child) (void)) __THROW; + + +#ifdef __USE_EXTERN_INLINES +/* Optimizations. */ +__extern_inline int +__NTH (pthread_equal (pthread_t __thread1, pthread_t __thread2)) +{ + return __thread1 == __thread2; +} +#endif + +__END_DECLS + +#endif /* pthread.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@pthread.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@pthread.h.blob new file mode 100644 index 0000000..19b6549 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@pthread.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sched.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sched.h new file mode 100644 index 0000000..8f7d9db --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sched.h @@ -0,0 +1,140 @@ +/* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface. + Copyright (C) 1996-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SCHED_H +#define _SCHED_H 1 + +#include + +/* Get type definitions. */ +#include + +#define __need_size_t +#define __need_NULL +#include + +#include +#include +#ifndef __USE_XOPEN2K +# include +#endif + +#ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +#endif + +/* Get system specific constant and data structure definitions. */ +#include +#include + +/* Backward compatibility. */ +#define sched_priority sched_priority +#define __sched_priority sched_priority + + +__BEGIN_DECLS + +/* Set scheduling parameters for a process. */ +extern int sched_setparam (__pid_t __pid, const struct sched_param *__param) + __THROW; + +/* Retrieve scheduling parameters for a particular process. */ +extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __THROW; + +/* Set scheduling algorithm and/or parameters for a process. */ +extern int sched_setscheduler (__pid_t __pid, int __policy, + const struct sched_param *__param) __THROW; + +/* Retrieve scheduling algorithm for a particular purpose. */ +extern int sched_getscheduler (__pid_t __pid) __THROW; + +/* Yield the processor. */ +extern int sched_yield (void) __THROW; + +/* Get maximum priority value for a scheduler. */ +extern int sched_get_priority_max (int __algorithm) __THROW; + +/* Get minimum priority value for a scheduler. */ +extern int sched_get_priority_min (int __algorithm) __THROW; + +/* Get the SCHED_RR interval for the named process. */ +#ifndef __USE_TIME64_REDIRECTS +extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; +#else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (sched_rr_get_interval, + (__pid_t __pid, struct timespec *__t), + __sched_rr_get_interval64); +# else +# define sched_rr_get_interval __sched_rr_get_interval64 +# endif +#endif + +#ifdef __USE_GNU +/* Access macros for `cpu_set'. */ +# define CPU_SETSIZE __CPU_SETSIZE +# define CPU_SET(cpu, cpusetp) __CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp) +# define CPU_CLR(cpu, cpusetp) __CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp) +# define CPU_ISSET(cpu, cpusetp) __CPU_ISSET_S (cpu, sizeof (cpu_set_t), \ + cpusetp) +# define CPU_ZERO(cpusetp) __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp) +# define CPU_COUNT(cpusetp) __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp) + +# define CPU_SET_S(cpu, setsize, cpusetp) __CPU_SET_S (cpu, setsize, cpusetp) +# define CPU_CLR_S(cpu, setsize, cpusetp) __CPU_CLR_S (cpu, setsize, cpusetp) +# define CPU_ISSET_S(cpu, setsize, cpusetp) __CPU_ISSET_S (cpu, setsize, \ + cpusetp) +# define CPU_ZERO_S(setsize, cpusetp) __CPU_ZERO_S (setsize, cpusetp) +# define CPU_COUNT_S(setsize, cpusetp) __CPU_COUNT_S (setsize, cpusetp) + +# define CPU_EQUAL(cpusetp1, cpusetp2) \ + __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2) +# define CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \ + __CPU_EQUAL_S (setsize, cpusetp1, cpusetp2) + +# define CPU_AND(destset, srcset1, srcset2) \ + __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, &) +# define CPU_OR(destset, srcset1, srcset2) \ + __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |) +# define CPU_XOR(destset, srcset1, srcset2) \ + __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, ^) +# define CPU_AND_S(setsize, destset, srcset1, srcset2) \ + __CPU_OP_S (setsize, destset, srcset1, srcset2, &) +# define CPU_OR_S(setsize, destset, srcset1, srcset2) \ + __CPU_OP_S (setsize, destset, srcset1, srcset2, |) +# define CPU_XOR_S(setsize, destset, srcset1, srcset2) \ + __CPU_OP_S (setsize, destset, srcset1, srcset2, ^) + +# define CPU_ALLOC_SIZE(count) __CPU_ALLOC_SIZE (count) +# define CPU_ALLOC(count) __CPU_ALLOC (count) +# define CPU_FREE(cpuset) __CPU_FREE (cpuset) + + +/* Set the CPU affinity for a task */ +extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize, + const cpu_set_t *__cpuset) __THROW; + +/* Get the CPU affinity for a task */ +extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize, + cpu_set_t *__cpuset) __THROW; +#endif + +__END_DECLS + +#endif /* sched.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sched.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sched.h.blob new file mode 100644 index 0000000..bdfc873 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sched.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sndfile.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sndfile.h new file mode 100644 index 0000000..ed99208 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sndfile.h @@ -0,0 +1,885 @@ +/* +** Copyright (C) 1999-2016 Erik de Castro Lopo +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU Lesser General Public License as published by +** the Free Software Foundation; either version 2.1 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU Lesser General Public License for more details. +** +** You should have received a copy of the GNU Lesser General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +/* +** sndfile.h -- system-wide definitions +** +** API documentation is in the doc/ directory of the source code tarball +** and at http://libsndfile.github.io/libsndfile/api.html. +*/ + +#ifndef SNDFILE_H +#define SNDFILE_H + +/* This is the version 1.0.X header file. */ +#define SNDFILE_1 + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* The following file types can be read and written. +** A file type would consist of a major type (ie SF_FORMAT_WAV) bitwise +** ORed with a minor type (ie SF_FORMAT_PCM). SF_FORMAT_TYPEMASK and +** SF_FORMAT_SUBMASK can be used to separate the major and minor file +** types. +*/ + +enum +{ /* Major formats. */ + SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian default). */ + SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */ + SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */ + SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */ + SF_FORMAT_PAF = 0x050000, /* Ensoniq PARIS file format. */ + SF_FORMAT_SVX = 0x060000, /* Amiga IFF / SVX8 / SV16 format. */ + SF_FORMAT_NIST = 0x070000, /* Sphere NIST format. */ + SF_FORMAT_VOC = 0x080000, /* VOC files. */ + SF_FORMAT_IRCAM = 0x0A0000, /* Berkeley/IRCAM/CARL */ + SF_FORMAT_W64 = 0x0B0000, /* Sonic Foundry's 64 bit RIFF/WAV */ + SF_FORMAT_MAT4 = 0x0C0000, /* Matlab (tm) V4.2 / GNU Octave 2.0 */ + SF_FORMAT_MAT5 = 0x0D0000, /* Matlab (tm) V5.0 / GNU Octave 2.1 */ + SF_FORMAT_PVF = 0x0E0000, /* Portable Voice Format */ + SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */ + SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */ + SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */ + SF_FORMAT_AVR = 0x120000, /* Audio Visual Research */ + SF_FORMAT_WAVEX = 0x130000, /* MS WAVE with WAVEFORMATEX */ + SF_FORMAT_SD2 = 0x160000, /* Sound Designer 2 */ + SF_FORMAT_FLAC = 0x170000, /* FLAC lossless file format */ + SF_FORMAT_CAF = 0x180000, /* Core Audio File format */ + SF_FORMAT_WVE = 0x190000, /* Psion WVE format */ + SF_FORMAT_OGG = 0x200000, /* Xiph OGG container */ + SF_FORMAT_MPC2K = 0x210000, /* Akai MPC 2000 sampler */ + SF_FORMAT_RF64 = 0x220000, /* RF64 WAV file */ + SF_FORMAT_MPEG = 0x230000, /* MPEG-1/2 audio stream */ + + /* Subtypes from here on. */ + + SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */ + SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */ + SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */ + SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */ + + SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */ + + SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */ + SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */ + + SF_FORMAT_ULAW = 0x0010, /* U-Law encoded. */ + SF_FORMAT_ALAW = 0x0011, /* A-Law encoded. */ + SF_FORMAT_IMA_ADPCM = 0x0012, /* IMA ADPCM. */ + SF_FORMAT_MS_ADPCM = 0x0013, /* Microsoft ADPCM. */ + + SF_FORMAT_GSM610 = 0x0020, /* GSM 6.10 encoding. */ + SF_FORMAT_VOX_ADPCM = 0x0021, /* OKI / Dialogix ADPCM */ + + SF_FORMAT_NMS_ADPCM_16 = 0x0022, /* 16kbs NMS G721-variant encoding. */ + SF_FORMAT_NMS_ADPCM_24 = 0x0023, /* 24kbs NMS G721-variant encoding. */ + SF_FORMAT_NMS_ADPCM_32 = 0x0024, /* 32kbs NMS G721-variant encoding. */ + + SF_FORMAT_G721_32 = 0x0030, /* 32kbs G721 ADPCM encoding. */ + SF_FORMAT_G723_24 = 0x0031, /* 24kbs G723 ADPCM encoding. */ + SF_FORMAT_G723_40 = 0x0032, /* 40kbs G723 ADPCM encoding. */ + + SF_FORMAT_DWVW_12 = 0x0040, /* 12 bit Delta Width Variable Word encoding. */ + SF_FORMAT_DWVW_16 = 0x0041, /* 16 bit Delta Width Variable Word encoding. */ + SF_FORMAT_DWVW_24 = 0x0042, /* 24 bit Delta Width Variable Word encoding. */ + SF_FORMAT_DWVW_N = 0x0043, /* N bit Delta Width Variable Word encoding. */ + + SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */ + SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */ + + SF_FORMAT_VORBIS = 0x0060, /* Xiph Vorbis encoding. */ + SF_FORMAT_OPUS = 0x0064, /* Xiph/Skype Opus encoding. */ + + SF_FORMAT_ALAC_16 = 0x0070, /* Apple Lossless Audio Codec (16 bit). */ + SF_FORMAT_ALAC_20 = 0x0071, /* Apple Lossless Audio Codec (20 bit). */ + SF_FORMAT_ALAC_24 = 0x0072, /* Apple Lossless Audio Codec (24 bit). */ + SF_FORMAT_ALAC_32 = 0x0073, /* Apple Lossless Audio Codec (32 bit). */ + + SF_FORMAT_MPEG_LAYER_I = 0x0080, /* MPEG-1 Audio Layer I */ + SF_FORMAT_MPEG_LAYER_II = 0x0081, /* MPEG-1 Audio Layer II */ + SF_FORMAT_MPEG_LAYER_III = 0x0082, /* MPEG-2 Audio Layer III */ + + /* Endian-ness options. */ + + SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */ + SF_ENDIAN_LITTLE = 0x10000000, /* Force little endian-ness. */ + SF_ENDIAN_BIG = 0x20000000, /* Force big endian-ness. */ + SF_ENDIAN_CPU = 0x30000000, /* Force CPU endian-ness. */ + + SF_FORMAT_SUBMASK = 0x0000FFFF, + SF_FORMAT_TYPEMASK = 0x0FFF0000, + SF_FORMAT_ENDMASK = 0x30000000 +} ; + +/* +** The following are the valid command numbers for the sf_command() +** interface. The use of these commands is documented in the file +** command.html in the doc directory of the source code distribution. +*/ + +enum +{ SFC_GET_LIB_VERSION = 0x1000, + SFC_GET_LOG_INFO = 0x1001, + SFC_GET_CURRENT_SF_INFO = 0x1002, + + + SFC_GET_NORM_DOUBLE = 0x1010, + SFC_GET_NORM_FLOAT = 0x1011, + SFC_SET_NORM_DOUBLE = 0x1012, + SFC_SET_NORM_FLOAT = 0x1013, + SFC_SET_SCALE_FLOAT_INT_READ = 0x1014, + SFC_SET_SCALE_INT_FLOAT_WRITE = 0x1015, + + SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020, + SFC_GET_SIMPLE_FORMAT = 0x1021, + + SFC_GET_FORMAT_INFO = 0x1028, + + SFC_GET_FORMAT_MAJOR_COUNT = 0x1030, + SFC_GET_FORMAT_MAJOR = 0x1031, + SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032, + SFC_GET_FORMAT_SUBTYPE = 0x1033, + + SFC_CALC_SIGNAL_MAX = 0x1040, + SFC_CALC_NORM_SIGNAL_MAX = 0x1041, + SFC_CALC_MAX_ALL_CHANNELS = 0x1042, + SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043, + SFC_GET_SIGNAL_MAX = 0x1044, + SFC_GET_MAX_ALL_CHANNELS = 0x1045, + + SFC_SET_ADD_PEAK_CHUNK = 0x1050, + + SFC_UPDATE_HEADER_NOW = 0x1060, + SFC_SET_UPDATE_HEADER_AUTO = 0x1061, + + SFC_FILE_TRUNCATE = 0x1080, + + SFC_SET_RAW_START_OFFSET = 0x1090, + + /* Commands reserved for dithering, which is not implemented. */ + SFC_SET_DITHER_ON_WRITE = 0x10A0, + SFC_SET_DITHER_ON_READ = 0x10A1, + + SFC_GET_DITHER_INFO_COUNT = 0x10A2, + SFC_GET_DITHER_INFO = 0x10A3, + + SFC_GET_EMBED_FILE_INFO = 0x10B0, + + SFC_SET_CLIPPING = 0x10C0, + SFC_GET_CLIPPING = 0x10C1, + + SFC_GET_CUE_COUNT = 0x10CD, + SFC_GET_CUE = 0x10CE, + SFC_SET_CUE = 0x10CF, + + SFC_GET_INSTRUMENT = 0x10D0, + SFC_SET_INSTRUMENT = 0x10D1, + + SFC_GET_LOOP_INFO = 0x10E0, + + SFC_GET_BROADCAST_INFO = 0x10F0, + SFC_SET_BROADCAST_INFO = 0x10F1, + + SFC_GET_CHANNEL_MAP_INFO = 0x1100, + SFC_SET_CHANNEL_MAP_INFO = 0x1101, + + SFC_RAW_DATA_NEEDS_ENDSWAP = 0x1110, + + /* Support for Wavex Ambisonics Format */ + SFC_WAVEX_SET_AMBISONIC = 0x1200, + SFC_WAVEX_GET_AMBISONIC = 0x1201, + + /* + ** RF64 files can be set so that on-close, writable files that have less + ** than 4GB of data in them are converted to RIFF/WAV, as per EBU + ** recommendations. + */ + SFC_RF64_AUTO_DOWNGRADE = 0x1210, + + SFC_SET_VBR_ENCODING_QUALITY = 0x1300, + SFC_SET_COMPRESSION_LEVEL = 0x1301, + + /* Ogg format commands */ + SFC_SET_OGG_PAGE_LATENCY_MS = 0x1302, + SFC_SET_OGG_PAGE_LATENCY = 0x1303, + SFC_GET_OGG_STREAM_SERIALNO = 0x1306, + + SFC_GET_BITRATE_MODE = 0x1304, + SFC_SET_BITRATE_MODE = 0x1305, + + /* Cart Chunk support */ + SFC_SET_CART_INFO = 0x1400, + SFC_GET_CART_INFO = 0x1401, + + /* Opus files original samplerate metadata */ + SFC_SET_ORIGINAL_SAMPLERATE = 0x1500, + SFC_GET_ORIGINAL_SAMPLERATE = 0x1501, + + /* Following commands for testing only. */ + SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001, + + /* + ** These SFC_SET_ADD_* values are deprecated and will disappear at some + ** time in the future. They are guaranteed to be here up to and + ** including version 1.0.8 to avoid breakage of existing software. + ** They currently do nothing and will continue to do nothing. + */ + SFC_SET_ADD_HEADER_PAD_CHUNK = 0x1051, + + SFC_SET_ADD_DITHER_ON_WRITE = 0x1070, + SFC_SET_ADD_DITHER_ON_READ = 0x1071 +} ; + + +/* +** String types that can be set and read from files. Not all file types +** support this and even the file types which support one, may not support +** all string types. +*/ + +enum +{ SF_STR_TITLE = 0x01, + SF_STR_COPYRIGHT = 0x02, + SF_STR_SOFTWARE = 0x03, + SF_STR_ARTIST = 0x04, + SF_STR_COMMENT = 0x05, + SF_STR_DATE = 0x06, + SF_STR_ALBUM = 0x07, + SF_STR_LICENSE = 0x08, + SF_STR_TRACKNUMBER = 0x09, + SF_STR_GENRE = 0x10 +} ; + +/* +** Use the following as the start and end index when doing metadata +** transcoding. +*/ + +#define SF_STR_FIRST SF_STR_TITLE +#define SF_STR_LAST SF_STR_GENRE + +enum +{ /* True and false */ + SF_FALSE = 0, + SF_TRUE = 1, + + /* Modes for opening files. */ + SFM_READ = 0x10, + SFM_WRITE = 0x20, + SFM_RDWR = 0x30, + + SF_AMBISONIC_NONE = 0x40, + SF_AMBISONIC_B_FORMAT = 0x41 +} ; + +/* Public error values. These are guaranteed to remain unchanged for the duration +** of the library major version number. +** There are also a large number of private error numbers which are internal to +** the library which can change at any time. +*/ + +enum +{ SF_ERR_NO_ERROR = 0, + SF_ERR_UNRECOGNISED_FORMAT = 1, + SF_ERR_SYSTEM = 2, + SF_ERR_MALFORMED_FILE = 3, + SF_ERR_UNSUPPORTED_ENCODING = 4 +} ; + + +/* Channel map values (used with SFC_SET/GET_CHANNEL_MAP). +*/ + +enum +{ SF_CHANNEL_MAP_INVALID = 0, + SF_CHANNEL_MAP_MONO = 1, + SF_CHANNEL_MAP_LEFT, /* Apple calls this 'Left' */ + SF_CHANNEL_MAP_RIGHT, /* Apple calls this 'Right' */ + SF_CHANNEL_MAP_CENTER, /* Apple calls this 'Center' */ + SF_CHANNEL_MAP_FRONT_LEFT, + SF_CHANNEL_MAP_FRONT_RIGHT, + SF_CHANNEL_MAP_FRONT_CENTER, + SF_CHANNEL_MAP_REAR_CENTER, /* Apple calls this 'Center Surround', Msft calls this 'Back Center' */ + SF_CHANNEL_MAP_REAR_LEFT, /* Apple calls this 'Left Surround', Msft calls this 'Back Left' */ + SF_CHANNEL_MAP_REAR_RIGHT, /* Apple calls this 'Right Surround', Msft calls this 'Back Right' */ + SF_CHANNEL_MAP_LFE, /* Apple calls this 'LFEScreen', Msft calls this 'Low Frequency' */ + SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER, /* Apple calls this 'Left Center' */ + SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER, /* Apple calls this 'Right Center */ + SF_CHANNEL_MAP_SIDE_LEFT, /* Apple calls this 'Left Surround Direct' */ + SF_CHANNEL_MAP_SIDE_RIGHT, /* Apple calls this 'Right Surround Direct' */ + SF_CHANNEL_MAP_TOP_CENTER, /* Apple calls this 'Top Center Surround' */ + SF_CHANNEL_MAP_TOP_FRONT_LEFT, /* Apple calls this 'Vertical Height Left' */ + SF_CHANNEL_MAP_TOP_FRONT_RIGHT, /* Apple calls this 'Vertical Height Right' */ + SF_CHANNEL_MAP_TOP_FRONT_CENTER, /* Apple calls this 'Vertical Height Center' */ + SF_CHANNEL_MAP_TOP_REAR_LEFT, /* Apple and MS call this 'Top Back Left' */ + SF_CHANNEL_MAP_TOP_REAR_RIGHT, /* Apple and MS call this 'Top Back Right' */ + SF_CHANNEL_MAP_TOP_REAR_CENTER, /* Apple and MS call this 'Top Back Center' */ + + SF_CHANNEL_MAP_AMBISONIC_B_W, + SF_CHANNEL_MAP_AMBISONIC_B_X, + SF_CHANNEL_MAP_AMBISONIC_B_Y, + SF_CHANNEL_MAP_AMBISONIC_B_Z, + + SF_CHANNEL_MAP_MAX +} ; + +/* Bitrate mode values (for use with SFC_GET/SET_BITRATE_MODE) +*/ +enum +{ SF_BITRATE_MODE_CONSTANT = 0, + SF_BITRATE_MODE_AVERAGE, + SF_BITRATE_MODE_VARIABLE +} ; + + +/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */ + +typedef struct sf_private_tag SNDFILE ; + +/* The following typedef is system specific and is defined when libsndfile is +** compiled. sf_count_t will be a 64 bit value when the underlying OS allows +** 64 bit file offsets. +** On windows, we need to allow the same header file to be compiler by both GCC +** and the Microsoft compiler. +*/ + +typedef int64_t sf_count_t ; +#ifndef SF_COUNT_MAX +#define SF_COUNT_MAX INT64_MAX +#endif + + +/* A pointer to a SF_INFO structure is passed to sf_open () and filled in. +** On write, the SF_INFO structure is filled in by the user and passed into +** sf_open (). +*/ + +struct SF_INFO +{ sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */ + int samplerate ; + int channels ; + int format ; + int sections ; + int seekable ; +} ; + +typedef struct SF_INFO SF_INFO ; + +/* The SF_FORMAT_INFO struct is used to retrieve information about the sound +** file formats libsndfile supports using the sf_command () interface. +** +** Using this interface will allow applications to support new file formats +** and encoding types when libsndfile is upgraded, without requiring +** re-compilation of the application. +** +** Please consult the libsndfile documentation (particularly the information +** on the sf_command () interface) for examples of its use. +*/ + +typedef struct +{ int format ; + const char *name ; + const char *extension ; +} SF_FORMAT_INFO ; + +/* +** Enums and typedefs for adding dither on read and write. +** Reserved for future implementation. +*/ + +enum +{ SFD_DEFAULT_LEVEL = 0, + SFD_CUSTOM_LEVEL = 0x40000000, + + SFD_NO_DITHER = 500, + SFD_WHITE = 501, + SFD_TRIANGULAR_PDF = 502 +} ; + +typedef struct +{ int type ; + double level ; + const char *name ; +} SF_DITHER_INFO ; + +/* Struct used to retrieve information about a file embedded within a +** larger file. See SFC_GET_EMBED_FILE_INFO. +*/ + +typedef struct +{ sf_count_t offset ; + sf_count_t length ; +} SF_EMBED_FILE_INFO ; + +/* +** Struct used to retrieve cue marker information from a file +*/ + +typedef struct +{ int32_t indx ; + uint32_t position ; + int32_t fcc_chunk ; + int32_t chunk_start ; + int32_t block_start ; + uint32_t sample_offset ; + char name [256] ; +} SF_CUE_POINT ; + +#define SF_CUES_VAR(count) \ + struct \ + { uint32_t cue_count ; \ + SF_CUE_POINT cue_points [count] ; \ + } + +typedef SF_CUES_VAR (100) SF_CUES ; + +/* +** Structs used to retrieve music sample information from a file. +*/ + +enum +{ /* + ** The loop mode field in SF_INSTRUMENT will be one of the following. + */ + SF_LOOP_NONE = 800, + SF_LOOP_FORWARD, + SF_LOOP_BACKWARD, + SF_LOOP_ALTERNATING +} ; + +typedef struct +{ int gain ; + char basenote, detune ; + char velocity_lo, velocity_hi ; + char key_lo, key_hi ; + int loop_count ; + + struct + { int mode ; + uint32_t start ; + uint32_t end ; + uint32_t count ; + } loops [16] ; /* make variable in a sensible way */ +} SF_INSTRUMENT ; + + + +/* Struct used to retrieve loop information from a file.*/ +typedef struct +{ + short time_sig_num ; /* any positive integer > 0 */ + short time_sig_den ; /* any positive power of 2 > 0 */ + int loop_mode ; /* see SF_LOOP enum */ + + int num_beats ; /* this is NOT the amount of quarter notes !!!*/ + /* a full bar of 4/4 is 4 beats */ + /* a full bar of 7/8 is 7 beats */ + + float bpm ; /* suggestion, as it can be calculated using other fields:*/ + /* file's length, file's sampleRate and our time_sig_den*/ + /* -> bpms are always the amount of _quarter notes_ per minute */ + + int root_key ; /* MIDI note, or -1 for None */ + int future [6] ; +} SF_LOOP_INFO ; + + +/* Struct used to retrieve broadcast (EBU) information from a file. +** Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE. +*/ +#define SF_BROADCAST_INFO_VAR(coding_hist_size) \ + struct \ + { char description [256] ; \ + char originator [32] ; \ + char originator_reference [32] ; \ + char origination_date [10] ; \ + char origination_time [8] ; \ + uint32_t time_reference_low ; \ + uint32_t time_reference_high ; \ + short version ; \ + char umid [64] ; \ + int16_t loudness_value ; \ + int16_t loudness_range ; \ + int16_t max_true_peak_level ; \ + int16_t max_momentary_loudness ; \ + int16_t max_shortterm_loudness ; \ + char reserved [180] ; \ + uint32_t coding_history_size ; \ + char coding_history [coding_hist_size] ; \ + } + +/* SF_BROADCAST_INFO is the above struct with coding_history field of 256 bytes. */ +typedef SF_BROADCAST_INFO_VAR (256) SF_BROADCAST_INFO ; + +struct SF_CART_TIMER +{ char usage [4] ; + int32_t value ; +} ; + +typedef struct SF_CART_TIMER SF_CART_TIMER ; + +#define SF_CART_INFO_VAR(p_tag_text_size) \ + struct \ + { char version [4] ; \ + char title [64] ; \ + char artist [64] ; \ + char cut_id [64] ; \ + char client_id [64] ; \ + char category [64] ; \ + char classification [64] ; \ + char out_cue [64] ; \ + char start_date [10] ; \ + char start_time [8] ; \ + char end_date [10] ; \ + char end_time [8] ; \ + char producer_app_id [64] ; \ + char producer_app_version [64] ; \ + char user_def [64] ; \ + int32_t level_reference ; \ + SF_CART_TIMER post_timers [8] ; \ + char reserved [276] ; \ + char url [1024] ; \ + uint32_t tag_text_size ; \ + char tag_text [p_tag_text_size] ; \ + } + +typedef SF_CART_INFO_VAR (256) SF_CART_INFO ; + +/* Virtual I/O functionality. */ + +typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ; +typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ; +typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ; +typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ; +typedef sf_count_t (*sf_vio_tell) (void *user_data) ; + +struct SF_VIRTUAL_IO +{ sf_vio_get_filelen get_filelen ; + sf_vio_seek seek ; + sf_vio_read read ; + sf_vio_write write ; + sf_vio_tell tell ; +} ; + +typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ; + + +/* Open the specified file for read, write or both. On error, this will +** return a NULL pointer. To find the error number, pass a NULL SNDFILE +** to sf_strerror (). +** All calls to sf_open() should be matched with a call to sf_close(). +*/ + +SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ; + + +/* Use the existing file descriptor to create a SNDFILE object. If close_desc +** is TRUE, the file descriptor will be closed when sf_close() is called. If +** it is FALSE, the descriptor will not be closed. +** When passed a descriptor like this, the library will assume that the start +** of file header is at the current file offset. This allows sound files within +** larger container files to be read and/or written. +** On error, this will return a NULL pointer. To find the error number, pass a +** NULL SNDFILE to sf_strerror (). +** All calls to sf_open_fd() should be matched with a call to sf_close(). + +*/ + +SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ; + +SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ; + + +/* sf_error () returns a error number which can be translated to a text +** string using sf_error_number(). +*/ + +int sf_error (SNDFILE *sndfile) ; + + +/* sf_strerror () returns to the caller a pointer to the current error message for +** the given SNDFILE. +*/ + +const char* sf_strerror (SNDFILE *sndfile) ; + + +/* sf_error_number () allows the retrieval of the error string for each internal +** error number. +** +*/ + +const char* sf_error_number (int errnum) ; + + +/* The following two error functions are deprecated but they will remain in the +** library for the foreseeable future. The function sf_strerror() should be used +** in their place. +*/ + +int sf_perror (SNDFILE *sndfile) ; +int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ; + + +/* Allow the caller to retrieve information from or change aspects of the +** library behaviour. +*/ + +int sf_command (SNDFILE *sndfile, int command, void *data, int datasize) ; + + +/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */ + +int sf_format_check (const SF_INFO *info) ; + + +/* Seek within the waveform data chunk of the SNDFILE. sf_seek () uses +** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as +** stdio.h function fseek (). +** An offset of zero with whence set to SEEK_SET will position the +** read / write pointer to the first data sample. +** On success sf_seek returns the current position in (multi-channel) +** samples from the start of the file. +** Please see the libsndfile documentation for moving the read pointer +** separately from the write pointer on files open in mode SFM_RDWR. +** On error all of these functions return -1. +*/ + +enum +{ SF_SEEK_SET = SEEK_SET, + SF_SEEK_CUR = SEEK_CUR, + SF_SEEK_END = SEEK_END +} ; + +sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ; + + +/* Functions for retrieving and setting string data within sound files. +** Not all file types support this features; AIFF and WAV do. For both +** functions, the str_type parameter must be one of the SF_STR_* values +** defined above. +** On error, sf_set_string() returns non-zero while sf_get_string() +** returns NULL. +*/ + +int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ; + +const char* sf_get_string (SNDFILE *sndfile, int str_type) ; + + +/* Return the library version string. */ + +const char * sf_version_string (void) ; + +/* Return the current byterate at this point in the file. The byte rate in this +** case is the number of bytes per second of audio data. For instance, for a +** stereo, 18 bit PCM encoded file with an 16kHz sample rate, the byte rate +** would be 2 (stereo) * 2 (two bytes per sample) * 16000 => 64000 bytes/sec. +** For some file formats the returned value will be accurate and exact, for some +** it will be a close approximation, for some it will be the average bitrate for +** the whole file and for some it will be a time varying value that was accurate +** when the file was most recently read or written. +** To get the bitrate, multiple this value by 8. +** Returns -1 for unknown. +*/ +int sf_current_byterate (SNDFILE *sndfile) ; + +/* Functions for reading/writing the waveform data of a sound file. +*/ + +sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ; +sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ; + + +/* Functions for reading and writing the data chunk in terms of frames. +** The number of items actually read/written = frames * number of channels. +** sf_xxxx_raw read/writes the raw data bytes from/to the file +** sf_xxxx_short passes data in the native short format +** sf_xxxx_int passes data in the native int format +** sf_xxxx_float passes data in the native float format +** sf_xxxx_double passes data in the native double format +** All of these read/write function return number of frames read/written. +*/ + +sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ; +sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ; + +sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ; +sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ; + +sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ; +sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ; + +sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ; +sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ; + + +/* Functions for reading and writing the data chunk in terms of items. +** Otherwise similar to above. +** All of these read/write function return number of items read/written. +*/ + +sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ; +sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ; + +sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ; +sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ; + +sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ; +sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ; + +sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ; +sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ; + + +/* Close the SNDFILE and clean up all memory allocations associated with this +** file. +** Returns 0 on success, or an error number. +*/ + +int sf_close (SNDFILE *sndfile) ; + + +/* If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file +** to force the writing of data to disk. If the file is opened SFM_READ +** no action is taken. +*/ + +void sf_write_sync (SNDFILE *sndfile) ; + + + +/* The function sf_wchar_open() is Windows Only! +** Open a file passing in a Windows Unicode filename. Otherwise, this is +** the same as sf_open(). +*/ + +#ifdef _WIN32 +SNDFILE* sf_wchar_open (const wchar_t *wpath, int mode, SF_INFO *sfinfo) ; +#endif + + + + +/* Getting and setting of chunks from within a sound file. +** +** These functions allow the getting and setting of chunks within a sound file +** (for those formats which allow it). +** +** These functions fail safely. Specifically, they will not allow you to overwrite +** existing chunks or add extra versions of format specific reserved chunks but +** should allow you to retrieve any and all chunks (may not be implemented for +** all chunks or all file formats). +*/ + +struct SF_CHUNK_INFO +{ char id [64] ; /* The chunk identifier. */ + unsigned id_size ; /* The size of the chunk identifier. */ + unsigned datalen ; /* The size of that data. */ + void *data ; /* Pointer to the data. */ +} ; + +typedef struct SF_CHUNK_INFO SF_CHUNK_INFO ; + +/* Set the specified chunk info (must be done before any audio data is written +** to the file). This will fail for format specific reserved chunks. +** The chunk_info->data pointer must be valid until the file is closed. +** Returns SF_ERR_NO_ERROR on success or non-zero on failure. +*/ +int sf_set_chunk (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info) ; + +/* +** An opaque structure to an iterator over the all chunks of a given id +*/ +typedef struct SF_CHUNK_ITERATOR SF_CHUNK_ITERATOR ; + +/* Get an iterator for all chunks matching chunk_info. +** The iterator will point to the first chunk matching chunk_info. +** Chunks are matching, if (chunk_info->id) matches the first +** (chunk_info->id_size) bytes of a chunk found in the SNDFILE* handle. +** If chunk_info is NULL, an iterator to all chunks in the SNDFILE* handle +** is returned. +** The values of chunk_info->datalen and chunk_info->data are ignored. +** If no matching chunks are found in the sndfile, NULL is returned. +** The returned iterator will stay valid until one of the following occurs: +** a) The sndfile is closed. +** b) A new chunk is added using sf_set_chunk(). +** c) Another chunk iterator function is called on the same SNDFILE* handle +** that causes the iterator to be modified. +** The memory for the iterator belongs to the SNDFILE* handle and is freed when +** sf_close() is called. +*/ +SF_CHUNK_ITERATOR * +sf_get_chunk_iterator (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info) ; + +/* Iterate through chunks by incrementing the iterator. +** Increments the iterator and returns a handle to the new one. +** After this call, iterator will no longer be valid, and you must use the +** newly returned handle from now on. +** The returned handle can be used to access the next chunk matching +** the criteria as defined in sf_get_chunk_iterator(). +** If iterator points to the last chunk, this will free all resources +** associated with iterator and return NULL. +** The returned iterator will stay valid until sf_get_chunk_iterator_next +** is called again, the sndfile is closed or a new chunk us added. +*/ +SF_CHUNK_ITERATOR * +sf_next_chunk_iterator (SF_CHUNK_ITERATOR * iterator) ; + + +/* Get the size of the specified chunk. +** If the specified chunk exists, the size will be returned in the +** datalen field of the SF_CHUNK_INFO struct. +** Additionally, the id of the chunk will be copied to the id +** field of the SF_CHUNK_INFO struct and it's id_size field will +** be updated accordingly. +** If the chunk doesn't exist chunk_info->datalen will be zero, and the +** id and id_size fields will be undefined. +** The function will return SF_ERR_NO_ERROR on success or non-zero on +** failure. +*/ +int +sf_get_chunk_size (const SF_CHUNK_ITERATOR * it, SF_CHUNK_INFO * chunk_info) ; + +/* Get the specified chunk data. +** If the specified chunk exists, up to chunk_info->datalen bytes of +** the chunk data will be copied into the chunk_info->data buffer +** (allocated by the caller) and the chunk_info->datalen field +** updated to reflect the size of the data. The id and id_size +** field will be updated according to the retrieved chunk +** If the chunk doesn't exist chunk_info->datalen will be zero, and the +** id and id_size fields will be undefined. +** The function will return SF_ERR_NO_ERROR on success or non-zero on +** failure. +*/ +int +sf_get_chunk_data (const SF_CHUNK_ITERATOR * it, SF_CHUNK_INFO * chunk_info) ; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* SNDFILE_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sndfile.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sndfile.h.blob new file mode 100644 index 0000000..f5fff24 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sndfile.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdc-predef.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdc-predef.h new file mode 100644 index 0000000..fcf528c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdc-predef.h @@ -0,0 +1,64 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _STDC_PREDEF_H +#define _STDC_PREDEF_H 1 + +/* This header is separate from features.h so that the compiler can + include it implicitly at the start of every compilation. It must + not itself include or any other header that includes + because the implicit include comes before any feature + test macros that may be defined in a source file before it first + explicitly includes a system header. GCC knows the name of this + header in order to preinclude it. */ + +/* glibc's intent is to support the IEC 559 math functionality, real + and complex. If the GCC (4.9 and later) predefined macros + specifying compiler intent are available, use them to determine + whether the overall intent is to support these features; otherwise, + presume an older compiler has intent to support these features and + define these macros by default. */ + +#ifdef __GCC_IEC_559 +# if __GCC_IEC_559 > 0 +# define __STDC_IEC_559__ 1 +# define __STDC_IEC_60559_BFP__ 201404L +# endif +#else +# define __STDC_IEC_559__ 1 +# define __STDC_IEC_60559_BFP__ 201404L +#endif + +#ifdef __GCC_IEC_559_COMPLEX +# if __GCC_IEC_559_COMPLEX > 0 +# define __STDC_IEC_559_COMPLEX__ 1 +# define __STDC_IEC_60559_COMPLEX__ 201404L +# endif +#else +# define __STDC_IEC_559_COMPLEX__ 1 +# define __STDC_IEC_60559_COMPLEX__ 201404L +#endif + +/* wchar_t uses Unicode 10.0.0. Version 10.0 of the Unicode Standard is + synchronized with ISO/IEC 10646:2017, fifth edition, plus + the following additions from Amendment 1 to the fifth edition: + - 56 emoji characters + - 285 hentaigana + - 3 additional Zanabazar Square characters */ +#define __STDC_ISO_10646__ 201706L + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdc-predef.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdc-predef.h.blob new file mode 100644 index 0000000..81a7586 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdc-predef.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdint.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdint.h new file mode 100644 index 0000000..ed0ca63 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdint.h @@ -0,0 +1,314 @@ +/* Copyright (C) 1997-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99: 7.18 Integer types + */ + +#ifndef _STDINT_H +#define _STDINT_H 1 + +#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION +#include +#include +#include +#include + +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_STDINT_H__ 202311L +#endif + +/* Exact integral types. */ + +/* Signed. */ +#include + +/* Unsigned. */ +#include + + +/* Small types. */ +#include + + +/* Fast types. */ + +/* Signed. */ +typedef signed char int_fast8_t; +#if __WORDSIZE == 64 +typedef long int int_fast16_t; +typedef long int int_fast32_t; +typedef long int int_fast64_t; +#else +typedef int int_fast16_t; +typedef int int_fast32_t; +__extension__ +typedef long long int int_fast64_t; +#endif + +/* Unsigned. */ +typedef unsigned char uint_fast8_t; +#if __WORDSIZE == 64 +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; +typedef unsigned long int uint_fast64_t; +#else +typedef unsigned int uint_fast16_t; +typedef unsigned int uint_fast32_t; +__extension__ +typedef unsigned long long int uint_fast64_t; +#endif + + +/* Types for `void *' pointers. */ +#if __WORDSIZE == 64 +# ifndef __intptr_t_defined +typedef long int intptr_t; +# define __intptr_t_defined +# endif +typedef unsigned long int uintptr_t; +#else +# ifndef __intptr_t_defined +typedef int intptr_t; +# define __intptr_t_defined +# endif +typedef unsigned int uintptr_t; +#endif + + +/* Largest integral types. */ +typedef __intmax_t intmax_t; +typedef __uintmax_t uintmax_t; + + +# undef __INT64_C +# undef __UINT64_C +# if __WORDSIZE == 64 +# define __INT64_C(c) c ## L +# define __UINT64_C(c) c ## UL +# else +# define __INT64_C(c) c ## LL +# define __UINT64_C(c) c ## ULL +# endif + +/* Limits of integral types. */ + +/* Minimum of signed integral types. */ +# define INT8_MIN (-128) +# define INT16_MIN (-32767-1) +# define INT32_MIN (-2147483647-1) +# define INT64_MIN (-__INT64_C(9223372036854775807)-1) +/* Maximum of signed integral types. */ +# define INT8_MAX (127) +# define INT16_MAX (32767) +# define INT32_MAX (2147483647) +# define INT64_MAX (__INT64_C(9223372036854775807)) + +/* Maximum of unsigned integral types. */ +# define UINT8_MAX (255) +# define UINT16_MAX (65535) +# define UINT32_MAX (4294967295U) +# define UINT64_MAX (__UINT64_C(18446744073709551615)) + + +/* Minimum of signed integral types having a minimum size. */ +# define INT_LEAST8_MIN (-128) +# define INT_LEAST16_MIN (-32767-1) +# define INT_LEAST32_MIN (-2147483647-1) +# define INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1) +/* Maximum of signed integral types having a minimum size. */ +# define INT_LEAST8_MAX (127) +# define INT_LEAST16_MAX (32767) +# define INT_LEAST32_MAX (2147483647) +# define INT_LEAST64_MAX (__INT64_C(9223372036854775807)) + +/* Maximum of unsigned integral types having a minimum size. */ +# define UINT_LEAST8_MAX (255) +# define UINT_LEAST16_MAX (65535) +# define UINT_LEAST32_MAX (4294967295U) +# define UINT_LEAST64_MAX (__UINT64_C(18446744073709551615)) + + +/* Minimum of fast signed integral types having a minimum size. */ +# define INT_FAST8_MIN (-128) +# if __WORDSIZE == 64 +# define INT_FAST16_MIN (-9223372036854775807L-1) +# define INT_FAST32_MIN (-9223372036854775807L-1) +# else +# define INT_FAST16_MIN (-2147483647-1) +# define INT_FAST32_MIN (-2147483647-1) +# endif +# define INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1) +/* Maximum of fast signed integral types having a minimum size. */ +# define INT_FAST8_MAX (127) +# if __WORDSIZE == 64 +# define INT_FAST16_MAX (9223372036854775807L) +# define INT_FAST32_MAX (9223372036854775807L) +# else +# define INT_FAST16_MAX (2147483647) +# define INT_FAST32_MAX (2147483647) +# endif +# define INT_FAST64_MAX (__INT64_C(9223372036854775807)) + +/* Maximum of fast unsigned integral types having a minimum size. */ +# define UINT_FAST8_MAX (255) +# if __WORDSIZE == 64 +# define UINT_FAST16_MAX (18446744073709551615UL) +# define UINT_FAST32_MAX (18446744073709551615UL) +# else +# define UINT_FAST16_MAX (4294967295U) +# define UINT_FAST32_MAX (4294967295U) +# endif +# define UINT_FAST64_MAX (__UINT64_C(18446744073709551615)) + + +/* Values to test for integral types holding `void *' pointer. */ +# if __WORDSIZE == 64 +# define INTPTR_MIN (-9223372036854775807L-1) +# define INTPTR_MAX (9223372036854775807L) +# define UINTPTR_MAX (18446744073709551615UL) +# else +# define INTPTR_MIN (-2147483647-1) +# define INTPTR_MAX (2147483647) +# define UINTPTR_MAX (4294967295U) +# endif + + +/* Minimum for largest signed integral type. */ +# define INTMAX_MIN (-__INT64_C(9223372036854775807)-1) +/* Maximum for largest signed integral type. */ +# define INTMAX_MAX (__INT64_C(9223372036854775807)) + +/* Maximum for largest unsigned integral type. */ +# define UINTMAX_MAX (__UINT64_C(18446744073709551615)) + + +/* Limits of other integer types. */ + +/* Limits of `ptrdiff_t' type. */ +# if __WORDSIZE == 64 +# define PTRDIFF_MIN (-9223372036854775807L-1) +# define PTRDIFF_MAX (9223372036854775807L) +# else +# if __WORDSIZE32_PTRDIFF_LONG +# define PTRDIFF_MIN (-2147483647L-1) +# define PTRDIFF_MAX (2147483647L) +# else +# define PTRDIFF_MIN (-2147483647-1) +# define PTRDIFF_MAX (2147483647) +# endif +# endif + +/* Limits of `sig_atomic_t'. */ +# define SIG_ATOMIC_MIN (-2147483647-1) +# define SIG_ATOMIC_MAX (2147483647) + +/* Limit of `size_t' type. */ +# if __WORDSIZE == 64 +# define SIZE_MAX (18446744073709551615UL) +# else +# if __WORDSIZE32_SIZE_ULONG +# define SIZE_MAX (4294967295UL) +# else +# define SIZE_MAX (4294967295U) +# endif +# endif + +/* Limits of `wchar_t'. */ +# ifndef WCHAR_MIN +/* These constants might also be defined in . */ +# define WCHAR_MIN __WCHAR_MIN +# define WCHAR_MAX __WCHAR_MAX +# endif + +/* Limits of `wint_t'. */ +# define WINT_MIN (0u) +# define WINT_MAX (4294967295u) + +/* Signed. */ +# define INT8_C(c) c +# define INT16_C(c) c +# define INT32_C(c) c +# if __WORDSIZE == 64 +# define INT64_C(c) c ## L +# else +# define INT64_C(c) c ## LL +# endif + +/* Unsigned. */ +# define UINT8_C(c) c +# define UINT16_C(c) c +# define UINT32_C(c) c ## U +# if __WORDSIZE == 64 +# define UINT64_C(c) c ## UL +# else +# define UINT64_C(c) c ## ULL +# endif + +/* Maximal type. */ +# if __WORDSIZE == 64 +# define INTMAX_C(c) c ## L +# define UINTMAX_C(c) c ## UL +# else +# define INTMAX_C(c) c ## LL +# define UINTMAX_C(c) c ## ULL +# endif + +#if __GLIBC_USE (IEC_60559_BFP_EXT_C23) + +# define INT8_WIDTH 8 +# define UINT8_WIDTH 8 +# define INT16_WIDTH 16 +# define UINT16_WIDTH 16 +# define INT32_WIDTH 32 +# define UINT32_WIDTH 32 +# define INT64_WIDTH 64 +# define UINT64_WIDTH 64 + +# define INT_LEAST8_WIDTH 8 +# define UINT_LEAST8_WIDTH 8 +# define INT_LEAST16_WIDTH 16 +# define UINT_LEAST16_WIDTH 16 +# define INT_LEAST32_WIDTH 32 +# define UINT_LEAST32_WIDTH 32 +# define INT_LEAST64_WIDTH 64 +# define UINT_LEAST64_WIDTH 64 + +# define INT_FAST8_WIDTH 8 +# define UINT_FAST8_WIDTH 8 +# define INT_FAST16_WIDTH __WORDSIZE +# define UINT_FAST16_WIDTH __WORDSIZE +# define INT_FAST32_WIDTH __WORDSIZE +# define UINT_FAST32_WIDTH __WORDSIZE +# define INT_FAST64_WIDTH 64 +# define UINT_FAST64_WIDTH 64 + +# define INTPTR_WIDTH __WORDSIZE +# define UINTPTR_WIDTH __WORDSIZE + +# define INTMAX_WIDTH 64 +# define UINTMAX_WIDTH 64 + +# define PTRDIFF_WIDTH __WORDSIZE +# define SIG_ATOMIC_WIDTH 32 +# define SIZE_WIDTH __WORDSIZE +# define WCHAR_WIDTH 32 +# define WINT_WIDTH 32 + +#endif + +#endif /* stdint.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdint.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdint.h.blob new file mode 100644 index 0000000..c1f51ec Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdint.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdio.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdio.h new file mode 100644 index 0000000..3bf6a1f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdio.h @@ -0,0 +1,979 @@ +/* Define ISO C stdio on top of C++ iostreams. + Copyright (C) 1991-2026 Free Software Foundation, Inc. + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard: 7.19 Input/output + */ + +#ifndef _STDIO_H +#define _STDIO_H 1 + +#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION +#include + +__BEGIN_DECLS + +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_STDIO_H__ 202311L +#endif + +#define __need_size_t +#define __need_NULL +#include + +#define __need___va_list +#include + +#include +#include +#include +#include +#include +#include + +#ifdef __USE_MISC +# include +#endif + +#if defined __USE_XOPEN || defined __USE_XOPEN2K8 +# ifdef __GNUC__ +# ifndef _VA_LIST_DEFINED +typedef __gnuc_va_list va_list; +# define _VA_LIST_DEFINED +# endif +# else +# include +# endif +#endif + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +# ifndef __off_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __off_t off_t; +# else +typedef __off64_t off_t; +# endif +# define __off_t_defined +# endif +# if defined __USE_LARGEFILE64 && !defined __off64_t_defined +typedef __off64_t off64_t; +# define __off64_t_defined +# endif +#endif + +#ifdef __USE_XOPEN2K8 +# ifndef __ssize_t_defined +typedef __ssize_t ssize_t; +# define __ssize_t_defined +# endif +#endif + +/* The type of the second argument to `fgetpos' and `fsetpos'. */ +#ifndef __USE_FILE_OFFSET64 +typedef __fpos_t fpos_t; +#else +typedef __fpos64_t fpos_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __fpos64_t fpos64_t; +#endif + +/* The possibilities for the third argument to `setvbuf'. */ +#define _IOFBF 0 /* Fully buffered. */ +#define _IOLBF 1 /* Line buffered. */ +#define _IONBF 2 /* No buffering. */ + + +/* Default buffer size. */ +#define BUFSIZ 8192 + + +/* The value returned by fgetc and similar functions to indicate the + end of the file. */ +#define EOF (-1) + + +/* The possibilities for the third argument to `fseek'. + These values should not be changed. */ +#define SEEK_SET 0 /* Seek from beginning of file. */ +#define SEEK_CUR 1 /* Seek from current position. */ +#define SEEK_END 2 /* Seek from end of file. */ +#ifdef __USE_GNU +# define SEEK_DATA 3 /* Seek to next data. */ +# define SEEK_HOLE 4 /* Seek to next hole. */ +#endif + + +#if defined __USE_MISC || defined __USE_XOPEN +/* Default path prefix for `tempnam' and `tmpnam'. */ +# define P_tmpdir "/tmp" +#endif + +#define L_tmpnam 20 +#define TMP_MAX 238328 + +/* Get the values: + FILENAME_MAX Maximum length of a filename. */ +#include + +#ifdef __USE_POSIX +# define L_ctermid 9 +# if !defined __USE_XOPEN2K || defined __USE_GNU +# define L_cuserid 9 +# endif +#endif + +#undef FOPEN_MAX +#define FOPEN_MAX 16 + + +#if __GLIBC_USE (ISOC23) +/* Maximum length of printf output for a NaN. */ +# define _PRINTF_NAN_LEN_MAX 4 +#endif + + +/* Standard streams. */ +extern FILE *stdin; /* Standard input stream. */ +extern FILE *stdout; /* Standard output stream. */ +extern FILE *stderr; /* Standard error output stream. */ +/* C89/C99 say they're macros. Make them happy. */ +#define stdin stdin +#define stdout stdout +#define stderr stderr + +/* Remove file FILENAME. */ +extern int remove (const char *__filename) __THROW; +/* Rename file OLD to NEW. */ +extern int rename (const char *__old, const char *__new) __THROW; + +#ifdef __USE_ATFILE +/* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */ +extern int renameat (int __oldfd, const char *__old, int __newfd, + const char *__new) __THROW; +#endif + +#ifdef __USE_GNU +/* Flags for renameat2. */ +# define RENAME_NOREPLACE (1 << 0) +# define AT_RENAME_NOREPLACE 0x0001 +# define RENAME_EXCHANGE (1 << 1) +# define AT_RENAME_EXCHANGE 0x0002 +# define RENAME_WHITEOUT (1 << 2) +# define AT_RENAME_WHITEOUT 0x0004 + +/* Rename file OLD relative to OLDFD to NEW relative to NEWFD, with + additional flags. */ +extern int renameat2 (int __oldfd, const char *__old, int __newfd, + const char *__new, unsigned int __flags) __THROW; +#endif + +/* Close STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fclose (FILE *__stream) __nonnull ((1)); + +#undef __attr_dealloc_fclose +#define __attr_dealloc_fclose __attr_dealloc (fclose, 1) + +/* Create a temporary file and open it read/write. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +#ifndef __USE_FILE_OFFSET64 +extern FILE *tmpfile (void) + __attribute_malloc__ __attr_dealloc_fclose __wur; +#else +# ifdef __REDIRECT +extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) + __attribute_malloc__ __attr_dealloc_fclose __wur; +# else +# define tmpfile tmpfile64 +# endif +#endif + +#ifdef __USE_LARGEFILE64 +extern FILE *tmpfile64 (void) + __attribute_malloc__ __attr_dealloc_fclose __wur; +#endif + +/* Generate a temporary filename. */ +extern char *tmpnam (char[L_tmpnam]) __THROW __wur; + +#ifdef __USE_MISC +/* This is the reentrant variant of `tmpnam'. The only difference is + that it does not allow S to be NULL. */ +extern char *tmpnam_r (char __s[L_tmpnam]) __THROW __wur; +#endif + + +#if defined __USE_MISC || defined __USE_XOPEN +/* Generate a unique temporary filename using up to five characters of PFX + if it is not NULL. The directory to put this file in is searched for + as follows: First the environment variable "TMPDIR" is checked. + If it contains the name of a writable directory, that directory is used. + If not and if DIR is not NULL, that value is checked. If that fails, + P_tmpdir is tried and finally "/tmp". The storage for the filename + is allocated by `malloc'. */ +extern char *tempnam (const char *__dir, const char *__pfx) + __THROW __attribute_malloc__ __wur __attr_dealloc_free; +#endif + +/* Flush STREAM, or all streams if STREAM is NULL. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fflush (FILE *__stream); + +#ifdef __USE_MISC +/* Faster versions when locking is not required. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fflush_unlocked (FILE *__stream); +#endif + +#ifdef __USE_GNU +/* Close all streams. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fcloseall (void); +#endif + + +#ifndef __USE_FILE_OFFSET64 +/* Open a file and create a new stream for it. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern FILE *fopen (const char *__restrict __filename, + const char *__restrict __modes) + __attribute_malloc__ __attr_dealloc_fclose __wur; +/* Open a file, replacing an existing stream with it. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern FILE *freopen (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) __wur __nonnull ((3)); +#else +# ifdef __REDIRECT +extern FILE *__REDIRECT (fopen, (const char *__restrict __filename, + const char *__restrict __modes), fopen64) + __attribute_malloc__ __attr_dealloc_fclose __wur; +extern FILE *__REDIRECT (freopen, (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream), freopen64) + __wur __nonnull ((3)); +# else +# define fopen fopen64 +# define freopen freopen64 +# endif +#endif +#ifdef __USE_LARGEFILE64 +extern FILE *fopen64 (const char *__restrict __filename, + const char *__restrict __modes) + __attribute_malloc__ __attr_dealloc_fclose __wur; +extern FILE *freopen64 (const char *__restrict __filename, + const char *__restrict __modes, + FILE *__restrict __stream) __wur __nonnull ((3)); +#endif + +#ifdef __USE_POSIX +/* Create a new stream that refers to an existing system file descriptor. */ +extern FILE *fdopen (int __fd, const char *__modes) __THROW + __attribute_malloc__ __attr_dealloc_fclose __wur; +#endif + +#ifdef __USE_MISC +/* Create a new stream that refers to the given magic cookie, + and uses the given functions for input and output. */ +extern FILE *fopencookie (void *__restrict __magic_cookie, + const char *__restrict __modes, + cookie_io_functions_t __io_funcs) __THROW + __attribute_malloc__ __attr_dealloc_fclose __wur; +#endif + +#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) +/* Create a new stream that refers to a memory buffer. */ +extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) + __THROW __attribute_malloc__ __attr_dealloc_fclose __wur; + +/* Open a stream that writes into a malloc'd buffer that is expanded as + necessary. *BUFLOC and *SIZELOC are updated with the buffer's location + and the number of characters written on fflush or fclose. */ +extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW + __attribute_malloc__ __attr_dealloc_fclose __wur; + +#ifdef _WCHAR_H +/* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces + a wide character string. Declared here only to add attribute malloc + and only if has been previously #included. */ +extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW + __attribute_malloc__ __attr_dealloc_fclose; +# endif +#endif + +/* If BUF is NULL, make STREAM unbuffered. + Else make it use buffer BUF, of size BUFSIZ. */ +extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW + __nonnull ((1)); +/* Make STREAM use buffering mode MODE. + If BUF is not NULL, use N bytes of it for buffering; + else allocate an internal buffer N bytes long. */ +extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf, + int __modes, size_t __n) __THROW __nonnull ((1)); + +#ifdef __USE_MISC +/* If BUF is NULL, make STREAM unbuffered. + Else make it use SIZE bytes of BUF for buffering. */ +extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf, + size_t __size) __THROW __nonnull ((1)); + +/* Make STREAM line-buffered. */ +extern void setlinebuf (FILE *__stream) __THROW __nonnull ((1)); +#endif + + +/* Write formatted output to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fprintf (FILE *__restrict __stream, + const char *__restrict __format, ...) __nonnull ((1)); +/* Write formatted output to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int printf (const char *__restrict __format, ...); +/* Write formatted output to S. */ +extern int sprintf (char *__restrict __s, + const char *__restrict __format, ...) __THROWNL; + +/* Write formatted output to S from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __nonnull ((1)); +/* Write formatted output to stdout from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); +/* Write formatted output to S from argument list ARG. */ +extern int vsprintf (char *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) __THROWNL; + +#if defined __USE_ISOC99 || defined __USE_UNIX98 +/* Maximum chars of output to write in MAXLEN. */ +extern int snprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, ...) + __THROWNL __attribute__ ((__format__ (__printf__, 3, 4))); + +extern int vsnprintf (char *__restrict __s, size_t __maxlen, + const char *__restrict __format, __gnuc_va_list __arg) + __THROWNL __attribute__ ((__format__ (__printf__, 3, 0))); +#endif + +#if defined (__USE_MISC) || __GLIBC_USE (LIB_EXT2) +/* Write formatted output to a string dynamically allocated with `malloc'. + Store the address of the string in *PTR. */ +extern int vasprintf (char **__restrict __ptr, const char *__restrict __f, + __gnuc_va_list __arg) + __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur; +extern int __asprintf (char **__restrict __ptr, + const char *__restrict __fmt, ...) + __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur; +extern int asprintf (char **__restrict __ptr, + const char *__restrict __fmt, ...) + __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur; +#endif + +#ifdef __USE_XOPEN2K8 +/* Write formatted output to a file descriptor. */ +extern int vdprintf (int __fd, const char *__restrict __fmt, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__printf__, 2, 0))); +extern int dprintf (int __fd, const char *__restrict __fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +#endif + + +/* Read formatted input from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) __wur __nonnull ((1)); +/* Read formatted input from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int scanf (const char *__restrict __format, ...) __wur; +/* Read formatted input from S. */ +extern int sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __THROW; + +/* For historical reasons, the C99-compliant versions of the scanf + functions are at alternative names. When __LDBL_COMPAT or + __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in + bits/stdio-ldbl.h. */ +#include +#if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \ + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 +# if __GLIBC_USE (C23_STRTOL) +# ifdef __REDIRECT +extern int __REDIRECT (fscanf, (FILE *__restrict __stream, + const char *__restrict __format, ...), + __isoc23_fscanf) __wur __nonnull ((1)); +extern int __REDIRECT (scanf, (const char *__restrict __format, ...), + __isoc23_scanf) __wur; +extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s, + const char *__restrict __format, ...), + __isoc23_sscanf); +# else +extern int __isoc23_fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) __wur + __nonnull ((1)); +extern int __isoc23_scanf (const char *__restrict __format, ...) __wur; +extern int __isoc23_sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __THROW; +# define fscanf __isoc23_fscanf +# define scanf __isoc23_scanf +# define sscanf __isoc23_sscanf +# endif +# else +# ifdef __REDIRECT +extern int __REDIRECT (fscanf, (FILE *__restrict __stream, + const char *__restrict __format, ...), + __isoc99_fscanf) __wur __nonnull ((1)); +extern int __REDIRECT (scanf, (const char *__restrict __format, ...), + __isoc99_scanf) __wur; +extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s, + const char *__restrict __format, ...), + __isoc99_sscanf); +# else +extern int __isoc99_fscanf (FILE *__restrict __stream, + const char *__restrict __format, ...) __wur + __nonnull ((1)); +extern int __isoc99_scanf (const char *__restrict __format, ...) __wur; +extern int __isoc99_sscanf (const char *__restrict __s, + const char *__restrict __format, ...) __THROW; +# define fscanf __isoc99_fscanf +# define scanf __isoc99_scanf +# define sscanf __isoc99_sscanf +# endif +# endif +#endif + +#ifdef __USE_ISOC99 +/* Read formatted input from S into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, + __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 2, 0))) __wur __nonnull ((1)); + +/* Read formatted input from stdin into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) + __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; + +/* Read formatted input from S into argument list ARG. */ +extern int vsscanf (const char *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg) + __THROW __attribute__ ((__format__ (__scanf__, 2, 0))); + +/* Same redirection as above for the v*scanf family. */ +# if !__GLIBC_USE (DEPRECATED_SCANF) +# if __GLIBC_USE (C23_STRTOL) +# if defined __REDIRECT && !defined __LDBL_COMPAT \ + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 +extern int __REDIRECT (vfscanf, + (FILE *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg), + __isoc23_vfscanf) + __attribute__ ((__format__ (__scanf__, 2, 0))) __wur __nonnull ((1)); +extern int __REDIRECT (vscanf, (const char *__restrict __format, + __gnuc_va_list __arg), __isoc23_vscanf) + __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; +extern int __REDIRECT_NTH (vsscanf, + (const char *__restrict __s, + const char *__restrict __format, + __gnuc_va_list __arg), __isoc23_vsscanf) + __attribute__ ((__format__ (__scanf__, 2, 0))); +# elif !defined __REDIRECT +extern int __isoc23_vfscanf (FILE *__restrict __s, + const char *__restrict __format, + __gnuc_va_list __arg) __wur __nonnull ((1)); +extern int __isoc23_vscanf (const char *__restrict __format, + __gnuc_va_list __arg) __wur; +extern int __isoc23_vsscanf (const char *__restrict __s, + const char *__restrict __format, + __gnuc_va_list __arg) __THROW; +# define vfscanf __isoc23_vfscanf +# define vscanf __isoc23_vscanf +# define vsscanf __isoc23_vsscanf +# endif +# else +# if defined __REDIRECT && !defined __LDBL_COMPAT \ + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 +extern int __REDIRECT (vfscanf, + (FILE *__restrict __s, + const char *__restrict __format, __gnuc_va_list __arg), + __isoc99_vfscanf) + __attribute__ ((__format__ (__scanf__, 2, 0))) __wur __nonnull ((1)); +extern int __REDIRECT (vscanf, (const char *__restrict __format, + __gnuc_va_list __arg), __isoc99_vscanf) + __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; +extern int __REDIRECT_NTH (vsscanf, + (const char *__restrict __s, + const char *__restrict __format, + __gnuc_va_list __arg), __isoc99_vsscanf) + __attribute__ ((__format__ (__scanf__, 2, 0))); +# elif !defined __REDIRECT +extern int __isoc99_vfscanf (FILE *__restrict __s, + const char *__restrict __format, + __gnuc_va_list __arg) __wur __nonnull ((1)); +extern int __isoc99_vscanf (const char *__restrict __format, + __gnuc_va_list __arg) __wur; +extern int __isoc99_vsscanf (const char *__restrict __s, + const char *__restrict __format, + __gnuc_va_list __arg) __THROW; +# define vfscanf __isoc99_vfscanf +# define vscanf __isoc99_vscanf +# define vsscanf __isoc99_vsscanf +# endif +# endif +# endif +#endif /* Use ISO C9x. */ + + +/* Read a character from STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int fgetc (FILE *__stream) __nonnull ((1)); +extern int getc (FILE *__stream) __nonnull ((1)); + +/* Read a character from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int getchar (void); + +#ifdef __USE_POSIX199506 +/* These are defined in POSIX.1:1996. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int getc_unlocked (FILE *__stream) __nonnull ((1)); +extern int getchar_unlocked (void); +#endif /* Use POSIX. */ + +#ifdef __USE_MISC +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fgetc_unlocked (FILE *__stream) __nonnull ((1)); +#endif /* Use MISC. */ + + +/* Write a character to STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int fputc (int __c, FILE *__stream) __nonnull ((2)); +extern int putc (int __c, FILE *__stream) __nonnull ((2)); + +/* Write a character to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int putchar (int __c); + +#ifdef __USE_MISC +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fputc_unlocked (int __c, FILE *__stream) __nonnull ((2)); +#endif /* Use MISC. */ + +#ifdef __USE_POSIX199506 +/* These are defined in POSIX.1:1996. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern int putc_unlocked (int __c, FILE *__stream) __nonnull ((2)); +extern int putchar_unlocked (int __c); +#endif /* Use POSIX. */ + + +#if defined __USE_MISC \ + || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +/* Get a word (int) from STREAM. */ +extern int getw (FILE *__stream) __nonnull ((1)); + +/* Write a word (int) to STREAM. */ +extern int putw (int __w, FILE *__stream) __nonnull ((2)); +#endif + + +/* Get a newline-terminated string of finite length from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) + __wur __fortified_attr_access (__write_only__, 1, 2) __nonnull ((3)); + +#if __GLIBC_USE (DEPRECATED_GETS) +/* Get a newline-terminated string from stdin, removing the newline. + + This function is impossible to use safely. It has been officially + removed from ISO C11 and ISO C++14, and we have also removed it + from the _GNU_SOURCE feature list. It remains available when + explicitly using an old ISO C, Unix, or POSIX standard. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern char *gets (char *__s) __wur __attribute_deprecated__; +#endif + +#ifdef __USE_GNU +/* This function does the same as `fgets' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern char *fgets_unlocked (char *__restrict __s, int __n, + FILE *__restrict __stream) __wur + __fortified_attr_access (__write_only__, 1, 2) __nonnull ((3)); +#endif + + +#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) +/* Read up to (and including) a DELIMITER from STREAM into *LINEPTR + (and null-terminate it). *LINEPTR is a pointer returned from malloc (or + NULL), pointing to *N characters of space. It is realloc'd as + necessary. Returns the number of characters read (not including the + null terminator), or -1 on error or EOF. */ +extern __ssize_t __getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) __wur __nonnull ((4)); +extern __ssize_t getdelim (char **__restrict __lineptr, + size_t *__restrict __n, int __delimiter, + FILE *__restrict __stream) __wur __nonnull ((4)); + +/* Like `getdelim', but reads up to a newline. */ +extern __ssize_t getline (char **__restrict __lineptr, + size_t *__restrict __n, + FILE *__restrict __stream) __wur __nonnull ((3)); +#endif + + +/* Write a string to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fputs (const char *__restrict __s, FILE *__restrict __stream) + __nonnull ((2)); + +/* Write a string, followed by a newline, to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int puts (const char *__s); + + +/* Push a character back onto the input buffer of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int ungetc (int __c, FILE *__stream) __nonnull ((2)); + + +/* Read chunks of generic data from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern size_t fread (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) __wur + __nonnull((4)); +/* Write chunks of generic data to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern size_t fwrite (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __s) __nonnull((4)); + +#ifdef __USE_GNU +/* This function does the same as `fputs' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fputs_unlocked (const char *__restrict __s, + FILE *__restrict __stream) __nonnull ((2)); +#endif + +#ifdef __USE_MISC +/* Faster versions when locking is not necessary. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern size_t fread_unlocked (void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) __wur + __nonnull ((4)); +extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size, + size_t __n, FILE *__restrict __stream) + __nonnull ((4)); +#endif + + +/* Seek to a certain position on STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fseek (FILE *__stream, long int __off, int __whence) + __nonnull ((1)); +/* Return the current position of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern long int ftell (FILE *__stream) __wur __nonnull ((1)); +/* Rewind to the beginning of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void rewind (FILE *__stream) __nonnull ((1)); + +/* The Single Unix Specification, Version 2, specifies an alternative, + more adequate interface for the two functions above which deal with + file offset. `long int' is not the right type. These definitions + are originally defined in the Large File Support API. */ + +#if defined __USE_LARGEFILE || defined __USE_XOPEN2K +# ifndef __USE_FILE_OFFSET64 +/* Seek to a certain position on STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fseeko (FILE *__stream, __off_t __off, int __whence) + __nonnull ((1)); +/* Return the current position of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern __off_t ftello (FILE *__stream) __wur __nonnull ((1)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (fseeko, + (FILE *__stream, __off64_t __off, int __whence), + fseeko64) __nonnull ((1)); +extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64) + __nonnull ((1)); +# else +# define fseeko fseeko64 +# define ftello ftello64 +# endif +# endif +#endif + +#ifndef __USE_FILE_OFFSET64 +/* Get STREAM's position. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos) + __nonnull ((1)); +/* Set STREAM's position. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fsetpos (FILE *__stream, const fpos_t *__pos) __nonnull ((1)); +#else +# ifdef __REDIRECT +extern int __REDIRECT (fgetpos, (FILE *__restrict __stream, + fpos_t *__restrict __pos), fgetpos64) + __nonnull ((1)); +extern int __REDIRECT (fsetpos, + (FILE *__stream, const fpos_t *__pos), fsetpos64) + __nonnull ((1)); +# else +# define fgetpos fgetpos64 +# define fsetpos fsetpos64 +# endif +#endif + +#ifdef __USE_LARGEFILE64 +extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) + __nonnull ((1)); +extern __off64_t ftello64 (FILE *__stream) __wur __nonnull ((1)); +extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos) + __nonnull ((1)); +extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos) __nonnull ((1)); +#endif + +/* Clear the error and EOF indicators for STREAM. */ +extern void clearerr (FILE *__stream) __THROW __nonnull ((1)); +/* Return the EOF indicator for STREAM. */ +extern int feof (FILE *__stream) __THROW __wur __nonnull ((1)); +/* Return the error indicator for STREAM. */ +extern int ferror (FILE *__stream) __THROW __wur __nonnull ((1)); + +#ifdef __USE_MISC +/* Faster versions when locking is not required. */ +extern void clearerr_unlocked (FILE *__stream) __THROW __nonnull ((1)); +extern int feof_unlocked (FILE *__stream) __THROW __wur __nonnull ((1)); +extern int ferror_unlocked (FILE *__stream) __THROW __wur __nonnull ((1)); +#endif + + +/* Print a message describing the meaning of the value of errno. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern void perror (const char *__s) __COLD; + + +#ifdef __USE_POSIX +/* Return the system file descriptor for STREAM. */ +extern int fileno (FILE *__stream) __THROW __wur __nonnull ((1)); +#endif /* Use POSIX. */ + +#ifdef __USE_MISC +/* Faster version when locking is not required. */ +extern int fileno_unlocked (FILE *__stream) __THROW __wur __nonnull ((1)); +#endif + + +#ifdef __USE_POSIX2 +/* Close a stream opened by popen and return the status of its child. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int pclose (FILE *__stream) __nonnull ((1)); + +/* Create a new stream connected to a pipe running the given command. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern FILE *popen (const char *__command, const char *__modes) + __attribute_malloc__ __attr_dealloc (pclose, 1) __wur; + +#endif + + +#ifdef __USE_POSIX +/* Return the name of the controlling terminal. */ +extern char *ctermid (char *__s) __THROW + __attr_access ((__write_only__, 1)); +#endif /* Use POSIX. */ + + +#if (defined __USE_XOPEN && !defined __USE_XOPEN2K) || defined __USE_GNU +/* Return the name of the current user. */ +extern char *cuserid (char *__s) + __attr_access ((__write_only__, 1)); +#endif /* Use X/Open, but not issue 6. */ + + +#ifdef __USE_GNU +struct obstack; /* See . */ + +/* Write formatted output to an obstack. */ +extern int obstack_printf (struct obstack *__restrict __obstack, + const char *__restrict __format, ...) + __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))); +extern int obstack_vprintf (struct obstack *__restrict __obstack, + const char *__restrict __format, + __gnuc_va_list __args) + __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))); +#endif /* Use GNU. */ + + +#ifdef __USE_POSIX199506 +/* These are defined in POSIX.1:1996. */ + +/* Acquire ownership of STREAM. */ +extern void flockfile (FILE *__stream) __THROW __nonnull ((1)); + +/* Try to acquire ownership of STREAM but do not block if it is not + possible. */ +extern int ftrylockfile (FILE *__stream) __THROW __wur __nonnull ((1)); + +/* Relinquish the ownership granted for STREAM. */ +extern void funlockfile (FILE *__stream) __THROW __nonnull ((1)); +#endif /* POSIX */ + +#if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU +/* X/Open Issues 1-5 required getopt to be declared in this + header. It was removed in Issue 6. GNU follows Issue 6. */ +# include +#endif + +/* Slow-path routines used by the optimized inline functions in + bits/stdio.h. */ +extern int __uflow (FILE *); +extern int __overflow (FILE *, int); + +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function +/* Declare all functions from bits/stdio2-decl.h first. */ +# include +#endif + +/* The following headers provide asm redirections. These redirections must + appear before the first usage of these functions, e.g. in bits/stdio.h. */ +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# include +#endif + +/* If we are compiling with optimizing read this file. It contains + several optimizing inline functions and macros. */ +#ifdef __USE_EXTERN_INLINES +# include +#endif +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function +/* Now include the function definitions and redirects too. */ +# include +#endif + +__END_DECLS + +#endif /* included. */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdio.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdio.h.blob new file mode 100644 index 0000000..87f2581 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdio.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdlib.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdlib.h new file mode 100644 index 0000000..1c67d8e --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdlib.h @@ -0,0 +1,1216 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard: 7.20 General utilities + */ + +#ifndef _STDLIB_H + +#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION +#include + +/* Get size_t, wchar_t and NULL from . */ +#define __need_size_t +#define __need_wchar_t +#define __need_NULL +#include + +__BEGIN_DECLS + +#define _STDLIB_H 1 + +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_STDLIB_H__ 202311L +#endif + +#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H +/* XPG requires a few symbols from being defined. */ +# include +# include + +/* Define the macros also would define this way. */ +# define WEXITSTATUS(status) __WEXITSTATUS (status) +# define WTERMSIG(status) __WTERMSIG (status) +# define WSTOPSIG(status) __WSTOPSIG (status) +# define WIFEXITED(status) __WIFEXITED (status) +# define WIFSIGNALED(status) __WIFSIGNALED (status) +# define WIFSTOPPED(status) __WIFSTOPPED (status) +# ifdef __WIFCONTINUED +# define WIFCONTINUED(status) __WIFCONTINUED (status) +# endif +#endif /* X/Open or XPG7 and not included. */ + +/* _FloatN API tests for enablement. */ +#include + +/* Returned by `div'. */ +typedef struct + { + int quot; /* Quotient. */ + int rem; /* Remainder. */ + } div_t; + +/* Returned by `ldiv'. */ +#ifndef __ldiv_t_defined +typedef struct + { + long int quot; /* Quotient. */ + long int rem; /* Remainder. */ + } ldiv_t; +# define __ldiv_t_defined 1 +#endif + +#if defined __USE_ISOC99 && !defined __lldiv_t_defined +/* Returned by `lldiv'. */ +__extension__ typedef struct + { + long long int quot; /* Quotient. */ + long long int rem; /* Remainder. */ + } lldiv_t; +# define __lldiv_t_defined 1 +#endif + + +/* The largest number rand will return (same as INT_MAX). */ +#define RAND_MAX 2147483647 + + +/* We define these the same for all machines. + Changes from this to the outside world should be done in `_exit'. */ +#define EXIT_FAILURE 1 /* Failing exit status. */ +#define EXIT_SUCCESS 0 /* Successful exit status. */ + + +/* Maximum length of a multibyte character in the current locale. */ +#define MB_CUR_MAX (__ctype_get_mb_cur_max ()) +extern size_t __ctype_get_mb_cur_max (void) __THROW __wur; + + +/* Convert a string to a floating-point number. */ +extern double atof (const char *__nptr) + __THROW __attribute_pure__ __nonnull ((1)) __wur; +/* Convert a string to an integer. */ +extern int atoi (const char *__nptr) + __THROW __attribute_pure__ __nonnull ((1)) __wur; +/* Convert a string to a long integer. */ +extern long int atol (const char *__nptr) + __THROW __attribute_pure__ __nonnull ((1)) __wur; + +#ifdef __USE_ISOC99 +/* Convert a string to a long long integer. */ +__extension__ extern long long int atoll (const char *__nptr) + __THROW __attribute_pure__ __nonnull ((1)) __wur; +#endif + +/* Convert a string to a floating-point number. */ +extern double strtod (const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)); + +#ifdef __USE_ISOC99 +/* Likewise for `float' and `long double' sizes of floating-point numbers. */ +extern float strtof (const char *__restrict __nptr, + char **__restrict __endptr) __THROW __nonnull ((1)); + +extern long double strtold (const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)); +#endif + +/* Likewise for '_FloatN' and '_FloatNx'. */ + +#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern _Float16 strtof16 (const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)); +#endif + +#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern _Float32 strtof32 (const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)); +#endif + +#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern _Float64 strtof64 (const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)); +#endif + +#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern _Float128 strtof128 (const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)); +#endif + +#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern _Float32x strtof32x (const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)); +#endif + +#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern _Float64x strtof64x (const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)); +#endif + +#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern _Float128x strtof128x (const char *__restrict __nptr, + char **__restrict __endptr) + __THROW __nonnull ((1)); +#endif + +/* Convert a string to a long integer. */ +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)); +/* Convert a string to an unsigned long integer. */ +extern unsigned long int strtoul (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)); + +#ifdef __USE_MISC +/* Convert a string to a quadword integer. */ +__extension__ +extern long long int strtoq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)); +/* Convert a string to an unsigned quadword integer. */ +__extension__ +extern unsigned long long int strtouq (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)); +#endif /* Use misc. */ + +#ifdef __USE_ISOC99 +/* Convert a string to a quadword integer. */ +__extension__ +extern long long int strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)); +/* Convert a string to an unsigned quadword integer. */ +__extension__ +extern unsigned long long int strtoull (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)); +#endif /* ISO C99 or use MISC. */ + +/* Versions of the above functions that handle '0b' and '0B' prefixes + in base 0 or 2. */ +#if __GLIBC_USE (C23_STRTOL) +# ifdef __REDIRECT +extern long int __REDIRECT_NTH (strtol, (const char *__restrict __nptr, + char **__restrict __endptr, + int __base), __isoc23_strtol) + __nonnull ((1)); +extern unsigned long int __REDIRECT_NTH (strtoul, + (const char *__restrict __nptr, + char **__restrict __endptr, + int __base), __isoc23_strtoul) + __nonnull ((1)); +# ifdef __USE_MISC +__extension__ +extern long long int __REDIRECT_NTH (strtoq, (const char *__restrict __nptr, + char **__restrict __endptr, + int __base), __isoc23_strtoll) + __nonnull ((1)); +__extension__ +extern unsigned long long int __REDIRECT_NTH (strtouq, + (const char *__restrict __nptr, + char **__restrict __endptr, + int __base), __isoc23_strtoull) + __nonnull ((1)); +# endif +__extension__ +extern long long int __REDIRECT_NTH (strtoll, (const char *__restrict __nptr, + char **__restrict __endptr, + int __base), __isoc23_strtoll) + __nonnull ((1)); +__extension__ +extern unsigned long long int __REDIRECT_NTH (strtoull, + (const char *__restrict __nptr, + char **__restrict __endptr, + int __base), __isoc23_strtoull) + __nonnull ((1)); +# else +extern long int __isoc23_strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)); +extern unsigned long int __isoc23_strtoul (const char *__restrict __nptr, + char **__restrict __endptr, + int __base) + __THROW __nonnull ((1)); +__extension__ +extern long long int __isoc23_strtoll (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __THROW __nonnull ((1)); +__extension__ +extern unsigned long long int __isoc23_strtoull (const char *__restrict __nptr, + char **__restrict __endptr, + int __base) + __THROW __nonnull ((1)); +# define strtol __isoc23_strtol +# define strtoul __isoc23_strtoul +# ifdef __USE_MISC +# define strtoq __isoc23_strtoll +# define strtouq __isoc23_strtoull +# endif +# define strtoll __isoc23_strtoll +# define strtoull __isoc23_strtoull +# endif +#endif + +/* Convert a floating-point number to a string. */ +#if __GLIBC_USE (IEC_60559_BFP_EXT_C23) +extern int strfromd (char *__dest, size_t __size, const char *__format, + double __f) + __THROW __nonnull ((3)); + +extern int strfromf (char *__dest, size_t __size, const char *__format, + float __f) + __THROW __nonnull ((3)); + +extern int strfroml (char *__dest, size_t __size, const char *__format, + long double __f) + __THROW __nonnull ((3)); +#endif + +#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern int strfromf16 (char *__dest, size_t __size, const char * __format, + _Float16 __f) + __THROW __nonnull ((3)); +#endif + +#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern int strfromf32 (char *__dest, size_t __size, const char * __format, + _Float32 __f) + __THROW __nonnull ((3)); +#endif + +#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern int strfromf64 (char *__dest, size_t __size, const char * __format, + _Float64 __f) + __THROW __nonnull ((3)); +#endif + +#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern int strfromf128 (char *__dest, size_t __size, const char * __format, + _Float128 __f) + __THROW __nonnull ((3)); +#endif + +#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern int strfromf32x (char *__dest, size_t __size, const char * __format, + _Float32x __f) + __THROW __nonnull ((3)); +#endif + +#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern int strfromf64x (char *__dest, size_t __size, const char * __format, + _Float64x __f) + __THROW __nonnull ((3)); +#endif + +#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT) +extern int strfromf128x (char *__dest, size_t __size, const char * __format, + _Float128x __f) + __THROW __nonnull ((3)); +#endif + + +#ifdef __USE_GNU +/* Parallel versions of the functions above which take the locale to + use as an additional parameter. These are GNU extensions inspired + by the POSIX.1-2008 extended locale API. */ +# include + +extern long int strtol_l (const char *__restrict __nptr, + char **__restrict __endptr, int __base, + locale_t __loc) __THROW __nonnull ((1, 4)); + +extern unsigned long int strtoul_l (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, locale_t __loc) + __THROW __nonnull ((1, 4)); + +__extension__ +extern long long int strtoll_l (const char *__restrict __nptr, + char **__restrict __endptr, int __base, + locale_t __loc) + __THROW __nonnull ((1, 4)); + +__extension__ +extern unsigned long long int strtoull_l (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, locale_t __loc) + __THROW __nonnull ((1, 4)); + +/* Versions of the above functions that handle '0b' and '0B' prefixes + in base 0 or 2. */ +# if __GLIBC_USE (C23_STRTOL) +# ifdef __REDIRECT +extern long int __REDIRECT_NTH (strtol_l, (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, locale_t __loc), + __isoc23_strtol_l) + __nonnull ((1, 4)); +extern unsigned long int __REDIRECT_NTH (strtoul_l, + (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, locale_t __loc), + __isoc23_strtoul_l) + __nonnull ((1, 4)); +__extension__ +extern long long int __REDIRECT_NTH (strtoll_l, (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, + locale_t __loc), + __isoc23_strtoll_l) + __nonnull ((1, 4)); +__extension__ +extern unsigned long long int __REDIRECT_NTH (strtoull_l, + (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, locale_t __loc), + __isoc23_strtoull_l) + __nonnull ((1, 4)); +# else +extern long int __isoc23_strtol_l (const char *__restrict __nptr, + char **__restrict __endptr, int __base, + locale_t __loc) __THROW __nonnull ((1, 4)); +extern unsigned long int __isoc23_strtoul_l (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, locale_t __loc) + __THROW __nonnull ((1, 4)); +__extension__ +extern long long int __isoc23_strtoll_l (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, locale_t __loc) + __THROW __nonnull ((1, 4)); +__extension__ +extern unsigned long long int __isoc23_strtoull_l (const char *__restrict __nptr, + char **__restrict __endptr, + int __base, locale_t __loc) + __THROW __nonnull ((1, 4)); +# define strtol_l __isoc23_strtol_l +# define strtoul_l __isoc23_strtoul_l +# define strtoll_l __isoc23_strtoll_l +# define strtoull_l __isoc23_strtoull_l +# endif +# endif + +extern double strtod_l (const char *__restrict __nptr, + char **__restrict __endptr, locale_t __loc) + __THROW __nonnull ((1, 3)); + +extern float strtof_l (const char *__restrict __nptr, + char **__restrict __endptr, locale_t __loc) + __THROW __nonnull ((1, 3)); + +extern long double strtold_l (const char *__restrict __nptr, + char **__restrict __endptr, + locale_t __loc) + __THROW __nonnull ((1, 3)); + +# if __HAVE_FLOAT16 +extern _Float16 strtof16_l (const char *__restrict __nptr, + char **__restrict __endptr, + locale_t __loc) + __THROW __nonnull ((1, 3)); +# endif + +# if __HAVE_FLOAT32 +extern _Float32 strtof32_l (const char *__restrict __nptr, + char **__restrict __endptr, + locale_t __loc) + __THROW __nonnull ((1, 3)); +# endif + +# if __HAVE_FLOAT64 +extern _Float64 strtof64_l (const char *__restrict __nptr, + char **__restrict __endptr, + locale_t __loc) + __THROW __nonnull ((1, 3)); +# endif + +# if __HAVE_FLOAT128 +extern _Float128 strtof128_l (const char *__restrict __nptr, + char **__restrict __endptr, + locale_t __loc) + __THROW __nonnull ((1, 3)); +# endif + +# if __HAVE_FLOAT32X +extern _Float32x strtof32x_l (const char *__restrict __nptr, + char **__restrict __endptr, + locale_t __loc) + __THROW __nonnull ((1, 3)); +# endif + +# if __HAVE_FLOAT64X +extern _Float64x strtof64x_l (const char *__restrict __nptr, + char **__restrict __endptr, + locale_t __loc) + __THROW __nonnull ((1, 3)); +# endif + +# if __HAVE_FLOAT128X +extern _Float128x strtof128x_l (const char *__restrict __nptr, + char **__restrict __endptr, + locale_t __loc) + __THROW __nonnull ((1, 3)); +# endif +#endif /* GNU */ + + +#ifdef __USE_EXTERN_INLINES +__extern_inline int +__NTH (atoi (const char *__nptr)) +{ + return (int) strtol (__nptr, (char **) NULL, 10); +} +__extern_inline long int +__NTH (atol (const char *__nptr)) +{ + return strtol (__nptr, (char **) NULL, 10); +} + +# ifdef __USE_ISOC99 +__extension__ __extern_inline long long int +__NTH (atoll (const char *__nptr)) +{ + return strtoll (__nptr, (char **) NULL, 10); +} +# endif +#endif /* Optimizing and Inlining. */ + + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +/* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant + digit first. Returns a pointer to static storage overwritten by the + next call. */ +extern char *l64a (long int __n) __THROW __wur; + +/* Read a number from a string S in base 64 as above. */ +extern long int a64l (const char *__s) + __THROW __attribute_pure__ __nonnull ((1)) __wur; + +#endif /* Use misc || extended X/Open. */ + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +# include /* we need int32_t... */ + +/* These are the functions that actually do things. The `random', `srandom', + `initstate' and `setstate' functions are those from BSD Unices. + The `rand' and `srand' functions are required by the ANSI standard. + We provide both interfaces to the same random number generator. */ +/* Return a random long integer between 0 and 2^31-1 inclusive. */ +extern long int random (void) __THROW; + +/* Seed the random number generator with the given number. */ +extern void srandom (unsigned int __seed) __THROW; + +/* Initialize the random number generator to use state buffer STATEBUF, + of length STATELEN, and seed it with SEED. Optimal lengths are 8, 16, + 32, 64, 128 and 256, the bigger the better; values less than 8 will + cause an error and values greater than 256 will be rounded down. */ +extern char *initstate (unsigned int __seed, char *__statebuf, + size_t __statelen) __THROW __nonnull ((2)); + +/* Switch the random number generator to state buffer STATEBUF, + which should have been previously initialized by `initstate'. */ +extern char *setstate (char *__statebuf) __THROW __nonnull ((1)); + + +# ifdef __USE_MISC +/* Reentrant versions of the `random' family of functions. + These functions all use the following data structure to contain + state, rather than global state variables. */ + +struct random_data + { + int32_t *fptr; /* Front pointer. */ + int32_t *rptr; /* Rear pointer. */ + int32_t *state; /* Array of state values. */ + int rand_type; /* Type of random number generator. */ + int rand_deg; /* Degree of random number generator. */ + int rand_sep; /* Distance between front and rear. */ + int32_t *end_ptr; /* Pointer behind state table. */ + }; + +extern int random_r (struct random_data *__restrict __buf, + int32_t *__restrict __result) __THROW __nonnull ((1, 2)); + +extern int srandom_r (unsigned int __seed, struct random_data *__buf) + __THROW __nonnull ((2)); + +extern int initstate_r (unsigned int __seed, char *__restrict __statebuf, + size_t __statelen, + struct random_data *__restrict __buf) + __THROW __nonnull ((2, 4)); + +extern int setstate_r (char *__restrict __statebuf, + struct random_data *__restrict __buf) + __THROW __nonnull ((1, 2)); +# endif /* Use misc. */ +#endif /* Use extended X/Open || misc. */ + + +/* Return a random integer between 0 and RAND_MAX inclusive. */ +extern int rand (void) __THROW; +/* Seed the random number generator with the given number. */ +extern void srand (unsigned int __seed) __THROW; + +#ifdef __USE_POSIX199506 +/* Reentrant interface according to POSIX.1. */ +extern int rand_r (unsigned int *__seed) __THROW; +#endif + + +#if defined __USE_MISC || defined __USE_XOPEN +/* System V style 48-bit random number generator functions. */ + +/* Return non-negative, double-precision floating-point value in [0.0,1.0). */ +extern double drand48 (void) __THROW; +extern double erand48 (unsigned short int __xsubi[3]) __THROW __nonnull ((1)); + +/* Return non-negative, long integer in [0,2^31). */ +extern long int lrand48 (void) __THROW; +extern long int nrand48 (unsigned short int __xsubi[3]) + __THROW __nonnull ((1)); + +/* Return signed, long integers in [-2^31,2^31). */ +extern long int mrand48 (void) __THROW; +extern long int jrand48 (unsigned short int __xsubi[3]) + __THROW __nonnull ((1)); + +/* Seed random number generator. */ +extern void srand48 (long int __seedval) __THROW; +extern unsigned short int *seed48 (unsigned short int __seed16v[3]) + __THROW __nonnull ((1)); +extern void lcong48 (unsigned short int __param[7]) __THROW __nonnull ((1)); + +# ifdef __USE_MISC +/* Data structure for communication with thread safe versions. This + type is to be regarded as opaque. It's only exported because users + have to allocate objects of this type. */ +struct drand48_data + { + unsigned short int __x[3]; /* Current state. */ + unsigned short int __old_x[3]; /* Old state. */ + unsigned short int __c; /* Additive const. in congruential formula. */ + unsigned short int __init; /* Flag for initializing. */ + __extension__ unsigned long long int __a; /* Factor in congruential + formula. */ + }; + +/* Return non-negative, double-precision floating-point value in [0.0,1.0). */ +extern int drand48_r (struct drand48_data *__restrict __buffer, + double *__restrict __result) __THROW __nonnull ((1, 2)); +extern int erand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + double *__restrict __result) __THROW __nonnull ((1, 2)); + +/* Return non-negative, long integer in [0,2^31). */ +extern int lrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __THROW __nonnull ((1, 2)); +extern int nrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __THROW __nonnull ((1, 2)); + +/* Return signed, long integers in [-2^31,2^31). */ +extern int mrand48_r (struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __THROW __nonnull ((1, 2)); +extern int jrand48_r (unsigned short int __xsubi[3], + struct drand48_data *__restrict __buffer, + long int *__restrict __result) + __THROW __nonnull ((1, 2)); + +/* Seed random number generator. */ +extern int srand48_r (long int __seedval, struct drand48_data *__buffer) + __THROW __nonnull ((2)); + +extern int seed48_r (unsigned short int __seed16v[3], + struct drand48_data *__buffer) __THROW __nonnull ((1, 2)); + +extern int lcong48_r (unsigned short int __param[7], + struct drand48_data *__buffer) + __THROW __nonnull ((1, 2)); + +/* Return a random integer between zero and 2**32-1 (inclusive). */ +extern __uint32_t arc4random (void) + __THROW __wur; + +/* Fill the buffer with random data. */ +extern void arc4random_buf (void *__buf, size_t __size) + __THROW __nonnull ((1)); + +/* Return a random number between zero (inclusive) and the specified + limit (exclusive). */ +extern __uint32_t arc4random_uniform (__uint32_t __upper_bound) + __THROW __wur; +# endif /* Use misc. */ +#endif /* Use misc or X/Open. */ + +/* Allocate SIZE bytes of memory. */ +extern void *malloc (size_t __size) __THROW __attribute_malloc__ + __attribute_alloc_size__ ((1)) __wur; +/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */ +extern void *calloc (size_t __nmemb, size_t __size) + __THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur; + +/* Re-allocate the previously allocated block + in PTR, making the new block SIZE bytes long. */ +/* __attribute_malloc__ is not used, because if realloc returns + the same pointer that was passed to it, aliasing needs to be allowed + between objects pointed by the old and new pointers. */ +extern void *realloc (void *__ptr, size_t __size) + __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2)); + +/* Free a block allocated by `malloc', `realloc' or `calloc'. */ +extern void free (void *__ptr) __THROW; + +#if __GLIBC_USE(ISOC23) +/* Free a block allocated by `malloc', `realloc' or `calloc' but not + `aligned_alloc', `memalign', `posix_memalign', `valloc' or + `pvalloc'. SIZE must be equal to the original requested size + provided to `malloc', `realloc' or `calloc'. For `calloc' SIZE is + NMEMB elements * SIZE bytes. It is forbidden to call `free_sized' + for allocations which the caller did not directly allocate but + must still deallocate, such as `strdup' or `strndup'. Instead + continue using `free` for these cases. */ +extern void free_sized (void *__ptr, size_t __size) __THROW; + +/* Free a block allocated by `aligned_alloc', `memalign' or + `posix_memalign'. ALIGNMENT and SIZE must be the same as the values + provided to `aligned_alloc', `memalign' or `posix_memalign'. */ +extern void free_aligned_sized (void *__ptr, size_t __alignment, size_t __size) + __THROW; +#endif + +#ifdef __USE_MISC +/* Re-allocate the previously allocated block in PTR, making the new + block large enough for NMEMB elements of SIZE bytes each. */ +/* __attribute_malloc__ is not used, because if reallocarray returns + the same pointer that was passed to it, aliasing needs to be allowed + between objects pointed by the old and new pointers. */ +extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) + __THROW __attribute_warn_unused_result__ + __attribute_alloc_size__ ((2, 3)) + __attr_dealloc_free; + +/* Add reallocarray as its own deallocator. */ +extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size) + __THROW __attr_dealloc (reallocarray, 1); +#endif + +#ifdef __USE_MISC +# include +#endif /* Use misc. */ + +#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \ + || defined __USE_MISC +/* Allocate SIZE bytes on a page boundary. The storage cannot be freed. */ +extern void *valloc (size_t __size) __THROW __attribute_malloc__ + __attribute_alloc_size__ ((1)) __wur; +#endif + +#ifdef __USE_XOPEN2K +/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT. */ +extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size) + __THROW __nonnull ((1)) __wur; +#endif + +#ifdef __USE_ISOC11 +/* ISO C variant of aligned allocation. */ +extern void *aligned_alloc (size_t __alignment, size_t __size) + __THROW __attribute_malloc__ __attribute_alloc_align__ ((1)) + __attribute_alloc_size__ ((2)) __wur; +#endif + +/* Abort execution and generate a core-dump. */ +extern void abort (void) __THROW __attribute__ ((__noreturn__)) __COLD; + + +/* Register a function to be called when `exit' is called. */ +extern int atexit (void (*__func) (void)) __THROW __nonnull ((1)); + +#if defined __USE_ISOC11 || defined __USE_ISOCXX11 +/* Register a function to be called when `quick_exit' is called. */ +# ifdef __cplusplus +extern "C++" int at_quick_exit (void (*__func) (void)) + __THROW __asm ("at_quick_exit") __nonnull ((1)); +# else +extern int at_quick_exit (void (*__func) (void)) __THROW __nonnull ((1)); +# endif +#endif + +#ifdef __USE_MISC +/* Register a function to be called with the status + given to `exit' and the given argument. */ +extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg) + __THROW __nonnull ((1)); +#endif + +/* Call all functions registered with `atexit' and `on_exit', + in the reverse of the order in which they were registered, + perform stdio cleanup, and terminate program execution with STATUS. */ +extern void exit (int __status) __THROW __attribute__ ((__noreturn__)); + +#if defined __USE_ISOC11 || defined __USE_ISOCXX11 +/* Call all functions registered with `at_quick_exit' in the reverse + of the order in which they were registered and terminate program + execution with STATUS. */ +extern void quick_exit (int __status) __THROW __attribute__ ((__noreturn__)); +#endif + +#ifdef __USE_ISOC99 +/* Terminate the program with STATUS without calling any of the + functions registered with `atexit' or `on_exit'. */ +extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__)); +#endif + + +/* Return the value of envariable NAME, or NULL if it doesn't exist. */ +extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur; + +#ifdef __USE_GNU +/* This function is similar to the above but returns NULL if the + programs is running with SUID or SGID enabled. */ +extern char *secure_getenv (const char *__name) + __THROW __nonnull ((1)) __wur; +#endif + +#if defined __USE_MISC || defined __USE_XOPEN +/* The SVID says this is in , but this seems a better place. */ +/* Put STRING, which is of the form "NAME=VALUE", in the environment. + If there is no `=', remove NAME from the environment. */ +extern int putenv (char *__string) __THROW __nonnull ((1)); +#endif + +#ifdef __USE_XOPEN2K +/* Set NAME to VALUE in the environment. + If REPLACE is nonzero, overwrite an existing value. */ +extern int setenv (const char *__name, const char *__value, int __replace) + __THROW __nonnull ((2)); + +/* Remove the variable NAME from the environment. */ +extern int unsetenv (const char *__name) __THROW __nonnull ((1)); +#endif + +#ifdef __USE_MISC +/* The `clearenv' was planned to be added to POSIX.1 but probably + never made it. Nevertheless the POSIX.9 standard (POSIX bindings + for Fortran 77) requires this function. */ +extern int clearenv (void) __THROW; +#endif + + +#if defined __USE_MISC \ + || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) +/* Generate a unique temporary file name from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the file name unique. + Always returns TEMPLATE, it's either a temporary file name or a null + string if it cannot get a unique file name. */ +extern char *mktemp (char *__template) __THROW __nonnull ((1)); +#endif + +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +/* Generate a unique temporary file name from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the filename unique. + Returns a file descriptor open on the file for reading and writing, + or -1 if it cannot create a uniquely-named file. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int mkstemp (char *__template) __nonnull ((1)) __wur; +# else +# ifdef __REDIRECT +extern int __REDIRECT (mkstemp, (char *__template), mkstemp64) + __nonnull ((1)) __wur; +# else +# define mkstemp mkstemp64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int mkstemp64 (char *__template) __nonnull ((1)) __wur; +# endif +#endif + +#ifdef __USE_MISC +/* Similar to mkstemp, but the template can have a suffix after the + XXXXXX. The length of the suffix is specified in the second + parameter. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int mkstemps (char *__template, int __suffixlen) __nonnull ((1)) __wur; +# else +# ifdef __REDIRECT +extern int __REDIRECT (mkstemps, (char *__template, int __suffixlen), + mkstemps64) __nonnull ((1)) __wur; +# else +# define mkstemps mkstemps64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int mkstemps64 (char *__template, int __suffixlen) + __nonnull ((1)) __wur; +# endif +#endif + +#ifdef __USE_XOPEN2K8 +/* Create a unique temporary directory from TEMPLATE. + The last six characters of TEMPLATE must be "XXXXXX"; + they are replaced with a string that makes the directory name unique. + Returns TEMPLATE, or a null pointer if it cannot get a unique name. + The directory is created mode 700. */ +extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur; +#endif + +#ifdef __USE_GNU +/* Generate a unique temporary file name from TEMPLATE similar to + mkstemp. But allow the caller to pass additional flags which are + used in the open call to create the file.. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur; +# else +# ifdef __REDIRECT +extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64) + __nonnull ((1)) __wur; +# else +# define mkostemp mkostemp64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur; +# endif + +/* Similar to mkostemp, but the template can have a suffix after the + XXXXXX. The length of the suffix is specified in the second + parameter. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +# ifndef __USE_FILE_OFFSET64 +extern int mkostemps (char *__template, int __suffixlen, int __flags) + __nonnull ((1)) __wur; +# else +# ifdef __REDIRECT +extern int __REDIRECT (mkostemps, (char *__template, int __suffixlen, + int __flags), mkostemps64) + __nonnull ((1)) __wur; +# else +# define mkostemps mkostemps64 +# endif +# endif +# ifdef __USE_LARGEFILE64 +extern int mkostemps64 (char *__template, int __suffixlen, int __flags) + __nonnull ((1)) __wur; +# endif +#endif + + +/* Execute the given line as a shell command. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int system (const char *__command) __wur; + + +#ifdef __USE_GNU +/* Return a malloc'd string containing the canonical absolute name of the + existing named file. */ +extern char *canonicalize_file_name (const char *__name) + __THROW __nonnull ((1)) __attribute_malloc__ + __attr_dealloc_free __wur; +#endif + +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED +/* Return the canonical absolute name of file NAME. If RESOLVED is + null, the result is malloc'd; otherwise, if the canonical name is + PATH_MAX chars or more, returns null with `errno' set to + ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, + returns the name in RESOLVED. */ +extern char *realpath (const char *__restrict __name, + char *__restrict __resolved) __THROW __wur; +#endif + + +/* Shorthand for type of comparison functions. */ +#ifndef __COMPAR_FN_T +# define __COMPAR_FN_T +typedef int (*__compar_fn_t) (const void *, const void *); + +# ifdef __USE_GNU +typedef __compar_fn_t comparison_fn_t; +# endif +#endif +#ifdef __USE_GNU +typedef int (*__compar_d_fn_t) (const void *, const void *, void *); +#endif + +/* Do a binary search for KEY in BASE, which consists of NMEMB elements + of SIZE bytes each, using COMPAR to perform the comparisons. */ +extern void *bsearch (const void *__key, const void *__base, + size_t __nmemb, size_t __size, __compar_fn_t __compar) + __nonnull ((1, 2, 5)) __wur; + +#ifdef __USE_EXTERN_INLINES +# include +#endif + +#if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC +# define bsearch(KEY, BASE, NMEMB, SIZE, COMPAR) \ + __glibc_const_generic (BASE, const void *, \ + bsearch (KEY, BASE, NMEMB, SIZE, COMPAR)) +#endif + +/* Sort NMEMB elements of BASE, of SIZE bytes each, + using COMPAR to perform the comparisons. */ +extern void qsort (void *__base, size_t __nmemb, size_t __size, + __compar_fn_t __compar) __nonnull ((1, 4)); +#ifdef __USE_GNU +extern void qsort_r (void *__base, size_t __nmemb, size_t __size, + __compar_d_fn_t __compar, void *__arg) + __nonnull ((1, 4)); +#endif + + +/* Return the absolute value of X. */ +extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; +extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur; + +#ifdef __USE_ISOC99 +__extension__ extern long long int llabs (long long int __x) + __THROW __attribute__ ((__const__)) __wur; +#endif + +#if __GLIBC_USE (ISOC2Y) +extern unsigned int uabs (int __x) __THROW __attribute__ ((__const__)) __wur; +extern unsigned long int ulabs (long int __x) __THROW __attribute__ ((__const__)) __wur; +__extension__ extern unsigned long long int ullabs (long long int __x) + __THROW __attribute__ ((__const__)) __wur; +#endif + +/* Return the `div_t', `ldiv_t' or `lldiv_t' representation + of the value of NUMER over DENOM. */ +/* GCC may have built-ins for these someday. */ +extern div_t div (int __numer, int __denom) + __THROW __attribute__ ((__const__)) __wur; +extern ldiv_t ldiv (long int __numer, long int __denom) + __THROW __attribute__ ((__const__)) __wur; + +#ifdef __USE_ISOC99 +__extension__ extern lldiv_t lldiv (long long int __numer, + long long int __denom) + __THROW __attribute__ ((__const__)) __wur; +#endif + + +#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ + || defined __USE_MISC +/* Convert floating point numbers to strings. The returned values are + valid only until another call to the same function. */ + +/* Convert VALUE to a string with NDIGIT digits and return a pointer to + this. Set *DECPT with the position of the decimal character and *SIGN + with the sign of the number. */ +extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; + +/* Convert VALUE to a string rounded to NDIGIT decimal digits. Set *DECPT + with the position of the decimal character and *SIGN with the sign of + the number. */ +extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur; + +/* If possible convert VALUE to a string with NDIGIT significant digits. + Otherwise use exponential representation. The resulting string will + be written to BUF. */ +extern char *gcvt (double __value, int __ndigit, char *__buf) + __THROW __nonnull ((3)) __wur; +#endif + +#ifdef __USE_MISC +/* Long double versions of above functions. */ +extern char *qecvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __THROW __nonnull ((3, 4)) __wur; +extern char *qfcvt (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign) + __THROW __nonnull ((3, 4)) __wur; +extern char *qgcvt (long double __value, int __ndigit, char *__buf) + __THROW __nonnull ((3)) __wur; + + +/* Reentrant version of the functions above which provide their own + buffers. */ +extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __THROW __nonnull ((3, 4, 5)); +extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt, + int *__restrict __sign, char *__restrict __buf, + size_t __len) __THROW __nonnull ((3, 4, 5)); + +extern int qecvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __THROW __nonnull ((3, 4, 5)); +extern int qfcvt_r (long double __value, int __ndigit, + int *__restrict __decpt, int *__restrict __sign, + char *__restrict __buf, size_t __len) + __THROW __nonnull ((3, 4, 5)); +#endif /* misc */ + + +/* Return the length of the multibyte character + in S, which is no longer than N. */ +extern int mblen (const char *__s, size_t __n) __THROW; +/* Return the length of the given multibyte character, + putting its `wchar_t' representation in *PWC. */ +extern int mbtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n) __THROW; +/* Put the multibyte character represented + by WCHAR in S, returning its length. */ +extern int wctomb (char *__s, wchar_t __wchar) __THROW; + + +/* Convert a multibyte string to a wide char string. */ +extern size_t mbstowcs (wchar_t *__restrict __pwcs, + const char *__restrict __s, size_t __n) __THROW + __attr_access ((__read_only__, 2)); +/* Convert a wide char string to multibyte string. */ +extern size_t wcstombs (char *__restrict __s, + const wchar_t *__restrict __pwcs, size_t __n) + __THROW + __fortified_attr_access (__write_only__, 1, 3) + __attr_access ((__read_only__, 2)); + +#ifdef __USE_MISC +/* Determine whether the string value of RESPONSE matches the affirmation + or negative response expression as specified by the LC_MESSAGES category + in the program's current locale. Returns 1 if affirmative, 0 if + negative, and -1 if not matching. */ +extern int rpmatch (const char *__response) __THROW __nonnull ((1)) __wur; +#endif + + +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +/* Parse comma separated suboption from *OPTIONP and match against + strings in TOKENS. If found return index and set *VALUEP to + optional value introduced by an equal sign. If the suboption is + not part of TOKENS return in *VALUEP beginning of unknown + suboption. On exit *OPTIONP is set to the beginning of the next + token or at the terminating NUL character. */ +extern int getsubopt (char **__restrict __optionp, + char *const *__restrict __tokens, + char **__restrict __valuep) + __THROW __nonnull ((1, 2, 3)) __wur; +#endif + + +/* X/Open pseudo terminal handling. */ + +#ifdef __USE_XOPEN2KXSI +/* Return a master pseudo-terminal handle. */ +extern int posix_openpt (int __oflag) __wur; +#endif + +#ifdef __USE_XOPEN_EXTENDED +/* The next four functions all take a master pseudo-tty fd and + perform an operation on the associated slave: */ + +/* Chown the slave to the calling user. */ +extern int grantpt (int __fd) __THROW; + +/* Release an internal lock so the slave can be opened. + Call after grantpt(). */ +extern int unlockpt (int __fd) __THROW; + +/* Return the pathname of the pseudo terminal slave associated with + the master FD is open on, or NULL on errors. + The returned storage is good until the next call to this function. */ +extern char *ptsname (int __fd) __THROW __wur; +#endif + +#ifdef __USE_GNU +/* Store at most BUFLEN characters of the pathname of the slave pseudo + terminal associated with the master FD is open on in BUF. + Return 0 on success, otherwise an error number. */ +extern int ptsname_r (int __fd, char *__buf, size_t __buflen) + __THROW __nonnull ((2)) __fortified_attr_access (__write_only__, 2, 3); + +/* Open a master pseudo terminal and return its file descriptor. */ +extern int getpt (void); +#endif + +#ifdef __USE_MISC +/* Put the 1 minute, 5 minute and 15 minute load averages into the first + NELEM elements of LOADAVG. Return the number written (never more than + three, but may be less than NELEM), or -1 if an error occurred. */ +extern int getloadavg (double __loadavg[], int __nelem) + __THROW __nonnull ((1)); +#endif + +#if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K +/* Return the index into the active-logins file (utmp) for + the controlling terminal. */ +extern int ttyslot (void) __THROW; +#endif + +#if __GLIBC_USE (ISOC23) +# ifndef __cplusplus +# include + +/* Call function __FUNC exactly once, even if invoked from several threads. + All calls must be made with the same __FLAGS object. */ +extern void call_once (once_flag *__flag, void (*__func)(void)); +# endif /* !__cplusplus */ + +/* Return the alignment of P. */ +extern size_t memalignment (const void *__p); +#endif + +#include + +/* Define some macros helping to catch buffer overflows. */ +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function +# include +#endif + +#include +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# include +#endif + +__END_DECLS + +#endif /* stdlib.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdlib.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdlib.h.blob new file mode 100644 index 0000000..1fad3c9 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@stdlib.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@cdefs.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@cdefs.h new file mode 100644 index 0000000..8d27f26 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@cdefs.h @@ -0,0 +1,898 @@ +/* Copyright (C) 1992-2026 Free Software Foundation, Inc. + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_CDEFS_H +#define _SYS_CDEFS_H 1 + +/* We are almost always included from features.h. */ +#ifndef _FEATURES_H +# include +#endif + +/* The GNU libc does not support any K&R compilers or the traditional mode + of ISO C compilers anymore. Check for some of the combinations not + supported anymore. */ +#if defined __GNUC__ && !defined __STDC__ && !defined __cplusplus +# error "You need a ISO C or C++ conforming compiler to use the glibc headers" +#endif + +/* Some user header file might have defined this before. */ +#undef __P +#undef __PMT + +/* Compilers that lack __has_attribute may object to + #if defined __has_attribute && __has_attribute (...) + even though they do not need to evaluate the right-hand side of the &&. + Similarly for __has_builtin, etc. */ +#if (defined __has_attribute \ + && (!defined __clang_minor__ \ + || 3 < __clang_major__ + (5 <= __clang_minor__))) +# define __glibc_has_attribute(attr) __has_attribute (attr) +#else +# define __glibc_has_attribute(attr) 0 +#endif +#ifdef __has_builtin +# define __glibc_has_builtin(name) __has_builtin (name) +#else +# define __glibc_has_builtin(name) 0 +#endif +#ifdef __has_extension +# define __glibc_has_extension(ext) __has_extension (ext) +#else +# define __glibc_has_extension(ext) 0 +#endif + +#if defined __GNUC__ || defined __clang__ + +/* All functions, except those with callbacks or those that + synchronize memory, are leaf functions. */ +# if __GNUC_PREREQ (4, 6) && !defined _LIBC +# define __LEAF , __leaf__ +# define __LEAF_ATTR __attribute__ ((__leaf__)) +# else +# define __LEAF +# define __LEAF_ATTR +# endif + +/* GCC can always grok prototypes. For C++ programs we add throw() + to help it optimize the function calls. But this only works with + gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions + as non-throwing using a function attribute since programs can use + the -fexceptions options for C code as well. */ +# if !defined __cplusplus \ + && (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__)) +# define __THROW __attribute__ ((__nothrow__ __LEAF)) +# define __THROWNL __attribute__ ((__nothrow__)) +# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct +# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct +# else +# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4) +# if __cplusplus >= 201103L +# define __THROW noexcept (true) +# else +# define __THROW throw () +# endif +# define __THROWNL __THROW +# define __NTH(fct) __LEAF_ATTR fct __THROW +# define __NTHNL(fct) fct __THROW +# else +# define __THROW +# define __THROWNL +# define __NTH(fct) fct +# define __NTHNL(fct) fct +# endif +# endif + +# if __GNUC_PREREQ (4, 3) || __glibc_has_attribute (__cold__) +# define __COLD __attribute__ ((__cold__)) +# else +# define __COLD +# endif + +#else /* Not GCC or clang. */ + +# if (defined __cplusplus \ + || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)) +# define __inline inline +# else +# define __inline /* No inline functions. */ +# endif + +# define __THROW +# define __THROWNL +# define __NTH(fct) fct +# define __COLD + +#endif /* GCC || clang. */ + +/* These two macros are not used in glibc anymore. They are kept here + only because some other projects expect the macros to be defined. */ +#define __P(args) args +#define __PMT(args) args + +/* For these things, GCC behaves the ANSI way normally, + and the non-ANSI way under -traditional. */ + +#define __CONCAT(x,y) x ## y +#define __STRING(x) #x + +/* This is not a typedef so `const __ptr_t' does the right thing. */ +#define __ptr_t void * + + +/* C++ needs to know that types and declarations are C, not C++. */ +#ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# define __END_DECLS } +#else +# define __BEGIN_DECLS +# define __END_DECLS +#endif + + +/* The overloadable attribute was added on clang 2.6. */ +#if defined __clang_major__ \ + && (__clang_major__ + (__clang_minor__ >= 6) > 2) +# define __attribute_overloadable__ __attribute__((__overloadable__)) +#else +# define __attribute_overloadable__ +#endif + +/* Fortify support. */ +#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) +#define __bos0(ptr) __builtin_object_size (ptr, 0) + +/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ +#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ + || __GNUC_PREREQ (12, 0)) +# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) +# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) +#else +# define __glibc_objsize0(__o) __bos0 (__o) +# define __glibc_objsize(__o) __bos (__o) +#endif + +#if __USE_FORTIFY_LEVEL > 0 +/* Compile time conditions to choose between the regular, _chk and _chk_warn + variants. These conditions should get evaluated to constant and optimized + away. */ + +#define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) +#define __glibc_unsigned_or_positive(__l) \ + ((__typeof (__l)) 0 < (__typeof (__l)) -1 \ + || (__builtin_constant_p (__l) && (__l) > 0)) + +/* Length is known to be safe at compile time if the __L * __S <= __OBJSZ + condition can be folded to a constant and if it is true, or unknown (-1) */ +#define __glibc_safe_or_unknown_len(__l, __s, __osz) \ + ((__builtin_constant_p (__osz) && (__osz) == (__SIZE_TYPE__) -1) \ + || (__glibc_unsigned_or_positive (__l) \ + && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ + (__s), (__osz))) \ + && __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), (__s), (__osz)))) + +/* Conversely, we know at compile time that the length is unsafe if the + __L * __S <= __OBJSZ condition can be folded to a constant and if it is + false. */ +#define __glibc_unsafe_len(__l, __s, __osz) \ + (__glibc_unsigned_or_positive (__l) \ + && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ + __s, __osz)) \ + && !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz)) + +/* To correctly instrument the fortify wrapper clang requires the + pass_object_size attribute, and the attribute has the restriction that the + argument needs to be 'const'. Furthermore, to make it usable with C + interfaces, clang provides the overload attribute, which provides a C++ + like function overload support. The overloaded fortify wrapper with the + pass_object_size attribute has precedence over the default symbol. + + Also, clang does not support __va_arg_pack, so variadic functions are + expanded to issue va_arg implementations. The error function must not have + bodies (address takes are expanded to nonfortified calls), and with + __fortify_function compiler might still create a body with the C++ + mangling name (due to the overload attribute). In this case, the function + is defined with __fortify_function_error_function macro instead. + + The argument size check is also done with a clang-only attribute, + __attribute__ ((__diagnose_if__ (...))), different than gcc which calls + symbol_chk_warn alias with uses __warnattr attribute. + + The pass_object_size was added on clang 4.0, __diagnose_if__ on 5.0, + and pass_dynamic_object_size on 9.0. */ +#if defined __clang_major__ && __clang_major__ >= 5 +# define __fortify_use_clang 1 + +# define __fortify_function_error_function static __attribute__((__unused__)) + +# define __fortify_clang_pass_object_size_n(n) \ + __attribute__ ((__pass_object_size__ (n))) +# define __fortify_clang_pass_object_size0 \ + __fortify_clang_pass_object_size_n (0) +# define __fortify_clang_pass_object_size \ + __fortify_clang_pass_object_size_n (__USE_FORTIFY_LEVEL > 1) + +# if __clang_major__ >= 9 +# define __fortify_clang_pass_dynamic_object_size_n(n) \ + __attribute__ ((__pass_dynamic_object_size__ (n))) +# define __fortify_clang_pass_dynamic_object_size0 \ + __fortify_clang_pass_dynamic_object_size_n (0) +# define __fortify_clang_pass_dynamic_object_size \ + __fortify_clang_pass_dynamic_object_size_n (1) +# else +# define __fortify_clang_pass_dynamic_object_size_n(n) +# define __fortify_clang_pass_dynamic_object_size0 +# define __fortify_clang_pass_dynamic_object_size +# endif + +# define __fortify_clang_bos_static_lt_impl(bos_val, n, s) \ + ((bos_val) != -1ULL && (n) > (bos_val) / (s)) +# define __fortify_clang_bos_static_lt2(__n, __e, __s) \ + __fortify_clang_bos_static_lt_impl (__bos (__e), __n, __s) +# define __fortify_clang_bos_static_lt(__n, __e) \ + __fortify_clang_bos_static_lt2 (__n, __e, 1) +# define __fortify_clang_bos0_static_lt2(__n, __e, __s) \ + __fortify_clang_bos_static_lt_impl (__bos0 (__e), __n, __s) +# define __fortify_clang_bos0_static_lt(__n, __e) \ + __fortify_clang_bos0_static_lt2 (__n, __e, 1) + +# define __fortify_clang_bosn_args(bos_fn, n, buf, div, complaint) \ + (__fortify_clang_bos_static_lt_impl (bos_fn (buf), n, div)), (complaint), \ + "warning" + +# define __fortify_clang_warning(__c, __msg) \ + __attribute__ ((__diagnose_if__ ((__c), (__msg), "warning"))) +# define __fortify_clang_error(__c, __msg) \ + __attribute__ ((__diagnose_if__ ((__c), (__msg), "error"))) +# define __fortify_clang_warning_only_if_bos0_lt(n, buf, complaint) \ + __attribute__ ((__diagnose_if__ \ + (__fortify_clang_bosn_args (__bos0, n, buf, 1, complaint)))) +# define __fortify_clang_warning_only_if_bos0_lt2(n, buf, div, complaint) \ + __attribute__ ((__diagnose_if__ \ + (__fortify_clang_bosn_args (__bos0, n, buf, div, complaint)))) +# define __fortify_clang_warning_only_if_bos_lt(n, buf, complaint) \ + __attribute__ ((__diagnose_if__ \ + (__fortify_clang_bosn_args (__bos, n, buf, 1, complaint)))) +# define __fortify_clang_warning_only_if_bos_lt2(n, buf, div, complaint) \ + __attribute__ ((__diagnose_if__ \ + (__fortify_clang_bosn_args (__bos, n, buf, div, complaint)))) + +# define __fortify_clang_prefer_this_overload \ + __attribute__ ((enable_if (1, ""))) +# define __fortify_clang_unavailable(__msg) \ + __attribute__ ((unavailable(__msg))) + +# if __USE_FORTIFY_LEVEL == 3 +# define __fortify_clang_overload_arg(__type, __attr, __name) \ + __type __attr const __fortify_clang_pass_dynamic_object_size __name +# define __fortify_clang_overload_arg0(__type, __attr, __name) \ + __type __attr const __fortify_clang_pass_dynamic_object_size0 __name +# else +# define __fortify_clang_overload_arg(__type, __attr, __name) \ + __type __attr const __fortify_clang_pass_object_size __name +# define __fortify_clang_overload_arg0(__type, __attr, __name) \ + __type __attr const __fortify_clang_pass_object_size0 __name +# endif + +# define __fortify_clang_mul_may_overflow(size, n) \ + ((size | n) >= (((size_t)1) << (8 * sizeof (size_t) / 2))) + +# define __fortify_clang_size_too_small(__bos, __dest, __len) \ + (__bos (__dest) != (size_t) -1 && __bos (__dest) < __len) +# define __fortify_clang_warn_if_src_too_large(__dest, __src) \ + __fortify_clang_warning (__fortify_clang_size_too_small (__glibc_objsize, \ + __dest, \ + __builtin_strlen (__src) + 1), \ + "destination buffer will always be overflown by source") +# define __fortify_clang_warn_if_dest_too_small(__dest, __len) \ + __fortify_clang_warning (__fortify_clang_size_too_small (__glibc_objsize, \ + __dest, \ + __len), \ + "function called with bigger length than the destination buffer") +# define __fortify_clang_warn_if_dest_too_small0(__dest, __len) \ + __fortify_clang_warning (__fortify_clang_size_too_small (__glibc_objsize0, \ + __dest, \ + __len), \ + "function called with bigger length than the destination buffer") +#else +# define __fortify_use_clang 0 +# define __fortify_clang_warning(__c, __msg) +# define __fortify_clang_warning_only_if_bos0_lt(__n, __buf, __complaint) +# define __fortify_clang_warning_only_if_bos0_lt2(__n, __buf, __div, complaint) +# define __fortify_clang_warning_only_if_bos_lt(__n, __buf, __complaint) +# define __fortify_clang_warning_only_if_bos_lt2(__n, __buf, div, __complaint) +# define __fortify_clang_overload_arg(__type, __attr, __name) \ + __type __attr __name +# define __fortify_clang_overload_arg0(__type, __attr, __name) \ + __fortify_clang_overload_arg (__type, __attr, __name) +# define __fortify_clang_warn_if_src_too_large(__dest, __src) +# define __fortify_clang_warn_if_dest_too_small(__dest, __len) +# define __fortify_clang_warn_if_dest_too_small0(__dest, __len) +#endif + + +/* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be + declared. */ + +#if !__fortify_use_clang +# define __glibc_fortify(f, __l, __s, __osz, ...) \ + (__glibc_safe_or_unknown_len (__l, __s, __osz) \ + ? __ ## f ## _alias (__VA_ARGS__) \ + : (__glibc_unsafe_len (__l, __s, __osz) \ + ? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \ + : __ ## f ## _chk (__VA_ARGS__, __osz))) +#else +# define __glibc_fortify(f, __l, __s, __osz, ...) \ + (__osz == (__SIZE_TYPE__) -1) \ + ? __ ## f ## _alias (__VA_ARGS__) \ + : __ ## f ## _chk (__VA_ARGS__, __osz) +#endif + +/* Fortify function f, where object size argument passed to f is the number of + elements and not total size. */ + +#if !__fortify_use_clang +# define __glibc_fortify_n(f, __l, __s, __osz, ...) \ + (__glibc_safe_or_unknown_len (__l, __s, __osz) \ + ? __ ## f ## _alias (__VA_ARGS__) \ + : (__glibc_unsafe_len (__l, __s, __osz) \ + ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ + : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) +# else +# define __glibc_fortify_n(f, __l, __s, __osz, ...) \ + (__osz == (__SIZE_TYPE__) -1) \ + ? __ ## f ## _alias (__VA_ARGS__) \ + : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)) +#endif + +#endif /* __USE_FORTIFY_LEVEL > 0 */ + +#if __GNUC_PREREQ (4,3) +# define __warnattr(msg) __attribute__((__warning__ (msg))) +# define __errordecl(name, msg) \ + extern void name (void) __attribute__((__error__ (msg))) +#else +# define __warnattr(msg) +# define __errordecl(name, msg) extern void name (void) +#endif + +/* Support for flexible arrays. + Headers that should use flexible arrays only if they're "real" + (e.g. only if they won't affect sizeof()) should test + #if __glibc_c99_flexarr_available. */ +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc +# define __flexarr [] +# define __glibc_c99_flexarr_available 1 +#elif __GNUC_PREREQ (2,97) || defined __clang__ +/* GCC 2.97 and clang support C99 flexible array members as an extension, + even when in C89 mode or compiling C++ (any version). */ +# define __flexarr [] +# define __glibc_c99_flexarr_available 1 +#elif defined __GNUC__ +/* Pre-2.97 GCC did not support C99 flexible arrays but did have + an equivalent extension with slightly different notation. */ +# define __flexarr [0] +# define __glibc_c99_flexarr_available 1 +#else +/* Some other non-C99 compiler. Approximate with [1]. */ +# define __flexarr [1] +# define __glibc_c99_flexarr_available 0 +#endif + + +/* __asm__ ("xyz") is used throughout the headers to rename functions + at the assembly language level. This is wrapped by the __REDIRECT + macro, in order to support compilers that can do this some other + way. When compilers don't support asm-names at all, we have to do + preprocessor tricks instead (which don't have exactly the right + semantics, but it's the best we can do). + + Example: + int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */ + +#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4) + +# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias)) +# ifdef __cplusplus +# define __REDIRECT_NTH(name, proto, alias) \ + name proto __THROW __asm__ (__ASMNAME (#alias)) +# define __REDIRECT_NTHNL(name, proto, alias) \ + name proto __THROWNL __asm__ (__ASMNAME (#alias)) +# else +# define __REDIRECT_NTH(name, proto, alias) \ + name proto __asm__ (__ASMNAME (#alias)) __THROW +# define __REDIRECT_NTHNL(name, proto, alias) \ + name proto __asm__ (__ASMNAME (#alias)) __THROWNL +# endif +# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname) +# define __ASMNAME2(prefix, cname) __STRING (prefix) cname + +#ifndef __REDIRECT_FORTIFY +#define __REDIRECT_FORTIFY __REDIRECT +#endif + +#ifndef __REDIRECT_FORTIFY_NTH +#define __REDIRECT_FORTIFY_NTH __REDIRECT_NTH +#endif + +/* +#elif __SOME_OTHER_COMPILER__ + +# define __REDIRECT(name, proto, alias) name proto; \ + _Pragma("let " #name " = " #alias) +*/ +#endif + +/* GCC, clang, and compatible compilers have various useful declarations + that can be made with the '__attribute__' syntax. All of the ways we use + this do fine if they are omitted for compilers that don't understand it. */ +#if !(defined __GNUC__ || defined __clang__ || defined __TINYC__) +# define __attribute__(xyz) /* Ignore */ +#endif + +/* At some point during the gcc 2.96 development the `malloc' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__) +# define __attribute_malloc__ __attribute__ ((__malloc__)) +#else +# define __attribute_malloc__ /* Ignore */ +#endif + +/* Tell the compiler which arguments to an allocation function + indicate the size of the allocation. */ +#if __GNUC_PREREQ (4, 3) +# define __attribute_alloc_size__(params) \ + __attribute__ ((__alloc_size__ params)) +#else +# define __attribute_alloc_size__(params) /* Ignore. */ +#endif + +/* Tell the compiler which argument to an allocation function + indicates the alignment of the allocation. */ +#if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__alloc_align__) +# define __attribute_alloc_align__(param) \ + __attribute__ ((__alloc_align__ param)) +#else +# define __attribute_alloc_align__(param) /* Ignore. */ +#endif + +/* At some point during the gcc 2.96 development the `pure' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__) +# define __attribute_pure__ __attribute__ ((__pure__)) +#else +# define __attribute_pure__ /* Ignore */ +#endif + +/* This declaration tells the compiler that the value is constant. */ +#if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__) +# define __attribute_const__ __attribute__ ((__const__)) +#else +# define __attribute_const__ /* Ignore */ +#endif + +#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) +# define __attribute_maybe_unused__ __attribute__ ((__unused__)) +#else +# define __attribute_maybe_unused__ /* Ignore */ +#endif + +/* At some point during the gcc 3.1 development the `used' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +#if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__) +# define __attribute_used__ __attribute__ ((__used__)) +# define __attribute_noinline__ __attribute__ ((__noinline__)) +#else +# define __attribute_used__ __attribute__ ((__unused__)) +# define __attribute_noinline__ /* Ignore */ +#endif + +/* Since version 3.2, gcc allows marking deprecated functions. */ +#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__) +# define __attribute_deprecated__ __attribute__ ((__deprecated__)) +#else +# define __attribute_deprecated__ /* Ignore */ +#endif + +/* Since version 4.5, gcc also allows one to specify the message printed + when a deprecated function is used. clang claims to be gcc 4.2, but + may also support this feature. */ +#if __GNUC_PREREQ (4,5) \ + || __glibc_has_extension (__attribute_deprecated_with_message__) +# define __attribute_deprecated_msg__(msg) \ + __attribute__ ((__deprecated__ (msg))) +#else +# define __attribute_deprecated_msg__(msg) __attribute_deprecated__ +#endif + +/* At some point during the gcc 2.8 development the `format_arg' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. + If several `format_arg' attributes are given for the same function, in + gcc-3.0 and older, all but the last one are ignored. In newer gccs, + all designated arguments are considered. */ +#if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__) +# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) +#else +# define __attribute_format_arg__(x) /* Ignore */ +#endif + +/* At some point during the gcc 2.97 development the `strfmon' format + attribute for functions was introduced. We don't want to use it + unconditionally (although this would be possible) since it + generates warnings. */ +#if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__) +# define __attribute_format_strfmon__(a,b) \ + __attribute__ ((__format__ (__strfmon__, a, b))) +#else +# define __attribute_format_strfmon__(a,b) /* Ignore */ +#endif + +/* The nonnull function attribute marks pointer parameters that + must not be NULL. This has the name __nonnull in glibc, + and __attribute_nonnull__ in files shared with Gnulib to avoid + collision with a different __nonnull in DragonFlyBSD 5.9. */ +#ifndef __attribute_nonnull__ +# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) +# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params)) +# else +# define __attribute_nonnull__(params) +# endif +#endif +#ifndef __nonnull +# define __nonnull(params) __attribute_nonnull__ (params) +#endif + +/* The returns_nonnull function attribute marks the return type of the function + as always being non-null. */ +#ifndef __returns_nonnull +# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__) +# define __returns_nonnull __attribute__ ((__returns_nonnull__)) +# else +# define __returns_nonnull +# endif +#endif + +/* If fortification mode, we warn about unused results of certain + function calls which can lead to problems. */ +#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__) +# define __attribute_warn_unused_result__ \ + __attribute__ ((__warn_unused_result__)) +# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0 +# define __wur __attribute_warn_unused_result__ +# endif +#else +# define __attribute_warn_unused_result__ /* empty */ +#endif +#ifndef __wur +# define __wur /* Ignore */ +#endif + +/* Forces a function to be always inlined. */ +#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__) +/* The Linux kernel defines __always_inline in stddef.h (283d7573), and + it conflicts with this definition. Therefore undefine it first to + allow either header to be included first. */ +# undef __always_inline +# define __always_inline __inline __attribute__ ((__always_inline__)) +#else +# undef __always_inline +# define __always_inline __inline +#endif + +/* Associate error messages with the source location of the call site rather + than with the source location inside the function. */ +#if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__) +# define __attribute_artificial__ __attribute__ ((__artificial__)) +#else +# define __attribute_artificial__ /* Ignore */ +#endif + +/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 inline + semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__ or + __GNUC_GNU_INLINE__ is not a good enough check for gcc because gcc versions + older than 4.3 may define these macros and still not guarantee GNU inlining + semantics. + + clang++ identifies itself as gcc-4.2, but has support for GNU inlining + semantics, that can be checked for by using the __GNUC_STDC_INLINE__ and + __GNUC_GNU_INLINE__ macro definitions. */ +#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \ + || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \ + || defined __GNUC_GNU_INLINE__))) +# if defined __GNUC_STDC_INLINE__ || defined __cplusplus +# define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) +# define __extern_always_inline \ + extern __always_inline __attribute__ ((__gnu_inline__)) +# else +# define __extern_inline extern __inline +# define __extern_always_inline extern __always_inline +# endif +#endif + +#ifdef __extern_always_inline +# define __fortify_function __extern_always_inline __attribute_artificial__ +#endif + +/* GCC 4.3 and above allow passing all anonymous arguments of an + __extern_always_inline function to some other vararg function. */ +#if __GNUC_PREREQ (4,3) +# define __va_arg_pack() __builtin_va_arg_pack () +# define __va_arg_pack_len() __builtin_va_arg_pack_len () +#endif + +/* It is possible to compile containing GCC extensions even if GCC is + run in pedantic mode if the uses are carefully marked using the + `__extension__' keyword. But this is not generally available before + version 2.8. */ +#if !(__GNUC_PREREQ (2,8) || defined __clang__) +# define __extension__ /* Ignore */ +#endif + +/* __restrict is known in EGCS 1.2 and above, and in clang. + It works also in C++ mode (outside of arrays), but only when spelled + as '__restrict', not 'restrict'. */ +#if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3) +# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# define __restrict restrict +# else +# define __restrict /* Ignore */ +# endif +#endif + +/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is + array_name[restrict] + GCC 3.1 and clang support this. + This syntax is not usable in C++ mode. */ +#if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus +# define __restrict_arr __restrict +#else +# ifdef __GNUC__ +# define __restrict_arr /* Not supported in old GCC. */ +# else +# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +# define __restrict_arr restrict +# else +/* Some other non-C99 compiler. */ +# define __restrict_arr /* Not supported. */ +# endif +# endif +#endif + +#if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect) +# define __glibc_unlikely(cond) __builtin_expect ((cond), 0) +# define __glibc_likely(cond) __builtin_expect ((cond), 1) +#else +# define __glibc_unlikely(cond) (cond) +# define __glibc_likely(cond) (cond) +#endif + +#if (!defined _Noreturn \ + && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ + && !(__GNUC_PREREQ (4,7) \ + || (3 < __clang_major__ + (5 <= __clang_minor__)))) +# if __GNUC_PREREQ (2,8) +# define _Noreturn __attribute__ ((__noreturn__)) +# else +# define _Noreturn +# endif +#endif + +#if __GNUC_PREREQ (8, 0) +/* Describes a char array whose address can safely be passed as the first + argument to strncpy and strncat, as the char array is not necessarily + a NUL-terminated string. */ +# define __attribute_nonstring__ __attribute__ ((__nonstring__)) +#else +# define __attribute_nonstring__ +#endif + +/* Undefine (also defined in libc-symbols.h). */ +#undef __attribute_copy__ +#if __GNUC_PREREQ (9, 0) +/* Copies attributes from the declaration or type referenced by + the argument. */ +# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg))) +#else +# define __attribute_copy__(arg) +#endif + +#if (!defined _Static_assert && !defined __cplusplus \ + && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ + && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \ + || defined __STRICT_ANSI__)) +# define _Static_assert(expr, diagnostic) \ + extern int (*__Static_assert_function (void)) \ + [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] +#endif + +/* Gnulib avoids including these, as they don't work on non-glibc or + older glibc platforms. */ +#ifndef __GNULIB_CDEFS +# include +# include +#endif + +#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# ifdef __REDIRECT + +/* Alias name defined automatically. */ +# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir +# define __LDBL_REDIR_DECL(name) \ + extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); +# define __REDIRECT_LDBL(name, proto, alias) \ + name proto __asm (__ASMNAME ("__" #alias "ieee128")) + +/* Alias name defined automatically, with leading underscores. */ +# define __LDBL_REDIR2_DECL(name) \ + extern __typeof (__##name) __##name \ + __asm (__ASMNAME ("__" #name "ieee128")); + +/* Alias name defined manually. */ +# define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1 +# define __LDBL_REDIR1_DECL(name, alias) \ + extern __typeof (name) name __asm (__ASMNAME (#alias)); + +# define __LDBL_REDIR1_NTH(name, proto, alias) \ + __REDIRECT_NTH (name, proto, alias) +# define __REDIRECT_NTH_LDBL(name, proto, alias) \ + __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128) + +/* Unused. */ +# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth + +# else +_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform"); +# endif +#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH +# define __LDBL_COMPAT 1 +# ifdef __REDIRECT +# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) +# define __LDBL_REDIR(name, proto) \ + __LDBL_REDIR1 (name, proto, __nldbl_##name) +# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) +# define __LDBL_REDIR_NTH(name, proto) \ + __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) +# define __LDBL_REDIR2_DECL(name) \ + extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name)); +# define __LDBL_REDIR1_DECL(name, alias) \ + extern __typeof (name) name __asm (__ASMNAME (#alias)); +# define __LDBL_REDIR_DECL(name) \ + extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name)); +# define __REDIRECT_LDBL(name, proto, alias) \ + __LDBL_REDIR1 (name, proto, __nldbl_##alias) +# define __REDIRECT_NTH_LDBL(name, proto, alias) \ + __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) +# endif +#endif +#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \ + || !defined __REDIRECT +# define __LDBL_REDIR1(name, proto, alias) name proto +# define __LDBL_REDIR(name, proto) name proto +# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW +# define __LDBL_REDIR_NTH(name, proto) name proto __THROW +# define __LDBL_REDIR2_DECL(name) +# define __LDBL_REDIR_DECL(name) +# ifdef __REDIRECT +# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) +# define __REDIRECT_NTH_LDBL(name, proto, alias) \ + __REDIRECT_NTH (name, proto, alias) +# endif +#endif + +/* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is + intended for use in preprocessor macros. + + Note: MESSAGE must be a _single_ string; concatenation of string + literals is not supported. */ +#if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5) +# define __glibc_macro_warning1(message) _Pragma (#message) +# define __glibc_macro_warning(message) \ + __glibc_macro_warning1 (GCC warning message) +#else +# define __glibc_macro_warning(msg) +#endif + +/* Generic selection (ISO C11) is a C-only feature, available in GCC + since version 4.9. Previous versions do not provide generic + selection, even though they might set __STDC_VERSION__ to 201112L, + when in -std=c11 mode. Thus, we must check for !defined __GNUC__ + when testing __STDC_VERSION__ for generic selection support. + On the other hand, Clang also defines __GNUC__, so a clang-specific + check is required to enable the use of generic selection. */ +#if !defined __cplusplus \ + && (__GNUC_PREREQ (4, 9) \ + || __glibc_has_extension (c_generic_selections) \ + || (!defined __GNUC__ && defined __STDC_VERSION__ \ + && __STDC_VERSION__ >= 201112L)) +# define __HAVE_GENERIC_SELECTION 1 +#else +# define __HAVE_GENERIC_SELECTION 0 +#endif + +#if __HAVE_GENERIC_SELECTION +/* If PTR is a pointer to const, return CALL cast to type CTYPE, + otherwise return CALL. Pointers to types with non-const qualifiers + are not valid. This should not be defined for C++, as macros are + not an appropriate way of implementing such qualifier-generic + operations for C++. */ +# define __glibc_const_generic(PTR, CTYPE, CALL) \ + _Generic (0 ? (PTR) : (void *) 1, \ + const void *: (CTYPE) (CALL), \ + default: CALL) +#endif + +#if __GNUC_PREREQ (10, 0) +/* Designates a 1-based positional argument ref-index of pointer type + that can be used to access size-index elements of the pointed-to + array according to access mode, or at least one element when + size-index is not provided: + access (access-mode, [, ]) */ +# define __attr_access(x) __attribute__ ((__access__ x)) +/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may + use the access attribute to get object sizes from function definition + arguments, so we can't use them on functions we fortify. Drop the access + attribute for such functions. */ +# if __USE_FORTIFY_LEVEL == 3 +# define __fortified_attr_access(a, o, s) +# else +# define __fortified_attr_access(a, o, s) __attr_access ((a, o, s)) +# endif +# if __GNUC_PREREQ (11, 0) +# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno))) +# else +# define __attr_access_none(argno) +# endif +#else +# define __fortified_attr_access(a, o, s) +# define __attr_access(x) +# define __attr_access_none(argno) +#endif + +#if __GNUC_PREREQ (11, 0) +/* Designates dealloc as a function to call to deallocate objects + allocated by the declared function. */ +# define __attr_dealloc(dealloc, argno) \ + __attribute__ ((__malloc__ (dealloc, argno))) +# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1) +#else +# define __attr_dealloc(dealloc, argno) +# define __attr_dealloc_free +#endif + +/* Specify that a function such as setjmp or vfork may return + twice. */ +#if __GNUC_PREREQ (4, 1) +# define __attribute_returns_twice__ __attribute__ ((__returns_twice__)) +#else +# define __attribute_returns_twice__ /* Ignore. */ +#endif + +/* Mark struct types as aliasable. Restricted to compilers that + support forward declarations of structs in the presence of the + attribute. */ +#if __GNUC_PREREQ (7, 1) || defined __clang__ +# define __attribute_struct_may_alias__ __attribute__ ((__may_alias__)) +#else +# define __attribute_struct_may_alias__ +#endif + +#endif /* sys/cdefs.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@cdefs.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@cdefs.h.blob new file mode 100644 index 0000000..ece8008 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@cdefs.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@select.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@select.h new file mode 100644 index 0000000..fdc3c89 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@select.h @@ -0,0 +1,155 @@ +/* `fd_set' type and related macros, and `select'/`pselect' declarations. + Copyright (C) 1996-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* POSIX 1003.1g: 6.2 Select from File Descriptor Sets */ + +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H 1 + +#include + +/* Get definition of needed basic types. */ +#include + +/* Get __FD_* definitions. */ +#include + +/* Get sigset_t. */ +#include + +/* Get definition of timer specification structures. */ +#include +#include +#ifdef __USE_XOPEN2K +# include +#endif + +#ifndef __suseconds_t_defined +typedef __suseconds_t suseconds_t; +# define __suseconds_t_defined +#endif + + +/* The fd_set member is required to be an array of longs. */ +typedef long int __fd_mask; + +/* Some versions of define this macros. */ +#undef __NFDBITS +/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ +#define __NFDBITS (8 * (int) sizeof (__fd_mask)) +#define __FD_ELT(d) ((d) / __NFDBITS) +#define __FD_MASK(d) ((__fd_mask) (1UL << ((d) % __NFDBITS))) + +/* fd_set for select and pselect. */ +typedef struct + { + /* XPG4.2 requires this member name. Otherwise avoid the name + from the global namespace. */ +#ifdef __USE_XOPEN + __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS]; +# define __FDS_BITS(set) ((set)->fds_bits) +#else + __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS]; +# define __FDS_BITS(set) ((set)->__fds_bits) +#endif + } fd_set; + +/* Maximum number of file descriptors in `fd_set'. */ +#define FD_SETSIZE __FD_SETSIZE + +#ifdef __USE_MISC +/* Sometimes the fd_set member is assumed to have this type. */ +typedef __fd_mask fd_mask; + +/* Number of bits per word of `fd_set' (some code assumes this is 32). */ +# define NFDBITS __NFDBITS +#endif + + +/* Access macros for `fd_set'. */ +#define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp) +#define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp) +#define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp) +#define FD_ZERO(fdsetp) __FD_ZERO (fdsetp) + + +__BEGIN_DECLS + +/* Check the first NFDS descriptors each in READFDS (if not NULL) for read + readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS + (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out + after waiting the interval specified therein. Returns the number of ready + descriptors, or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +#ifndef __USE_TIME64_REDIRECTS +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +#else +# ifdef __REDIRECT +extern int __REDIRECT (select, + (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout), + __select64); +# else +# define select __select64 +# endif +#endif + +#ifdef __USE_XOPEN2K +/* Same as above only that the TIMEOUT value is given with higher + resolution and a sigmask which is been set temporarily. This version + should be used. + + This function is a cancellation point and therefore not marked with + __THROW. */ +# ifndef __USE_TIME64_REDIRECTS +extern int pselect (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask); +# else +# ifdef __REDIRECT +extern int __REDIRECT (pselect, + (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + const struct timespec *__restrict __timeout, + const __sigset_t *__restrict __sigmask), + __pselect64); +# else +# define pselect __pselect64 +# endif +# endif +#endif + + +/* Define some inlines helping to catch common problems. */ +#if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__ +# include +#endif + +__END_DECLS + +#endif /* sys/select.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@select.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@select.h.blob new file mode 100644 index 0000000..c1d79c4 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@select.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@single_threaded.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@single_threaded.h new file mode 100644 index 0000000..ddbdd25 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@single_threaded.h @@ -0,0 +1,33 @@ +/* Support for single-thread optimizations. + Copyright (C) 2020-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_SINGLE_THREADED_H +#define _SYS_SINGLE_THREADED_H + +#include + +__BEGIN_DECLS + +/* If this variable is non-zero, then the current thread is the only + thread in the process image. If it is zero, the process might be + multi-threaded. */ +extern char __libc_single_threaded; + +__END_DECLS + +#endif /* _SYS_SINGLE_THREADED_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@single_threaded.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@single_threaded.h.blob new file mode 100644 index 0000000..a0d978f Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@single_threaded.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@types.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@types.h new file mode 100644 index 0000000..2b52476 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@types.h @@ -0,0 +1,232 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * POSIX Standard: 2.6 Primitive System Data Types + */ + +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H 1 + +#include + +__BEGIN_DECLS + +#include + +#ifdef __USE_MISC +# ifndef __u_char_defined +typedef __u_char u_char; +typedef __u_short u_short; +typedef __u_int u_int; +typedef __u_long u_long; +typedef __quad_t quad_t; +typedef __u_quad_t u_quad_t; +typedef __fsid_t fsid_t; +# define __u_char_defined +# endif +typedef __loff_t loff_t; +#endif + +#ifndef __ino_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __ino_t ino_t; +# else +typedef __ino64_t ino_t; +# endif +# define __ino_t_defined +#endif +#if defined __USE_LARGEFILE64 && !defined __ino64_t_defined +typedef __ino64_t ino64_t; +# define __ino64_t_defined +#endif + +#ifndef __dev_t_defined +typedef __dev_t dev_t; +# define __dev_t_defined +#endif + +#ifndef __gid_t_defined +typedef __gid_t gid_t; +# define __gid_t_defined +#endif + +#ifndef __mode_t_defined +typedef __mode_t mode_t; +# define __mode_t_defined +#endif + +#ifndef __nlink_t_defined +typedef __nlink_t nlink_t; +# define __nlink_t_defined +#endif + +#ifndef __uid_t_defined +typedef __uid_t uid_t; +# define __uid_t_defined +#endif + +#ifndef __off_t_defined +# ifndef __USE_FILE_OFFSET64 +typedef __off_t off_t; +# else +typedef __off64_t off_t; +# endif +# define __off_t_defined +#endif +#if defined __USE_LARGEFILE64 && !defined __off64_t_defined +typedef __off64_t off64_t; +# define __off64_t_defined +#endif + +#ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +#endif + +#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \ + && !defined __id_t_defined +typedef __id_t id_t; +# define __id_t_defined +#endif + +#ifndef __ssize_t_defined +typedef __ssize_t ssize_t; +# define __ssize_t_defined +#endif + +#ifdef __USE_MISC +# ifndef __daddr_t_defined +typedef __daddr_t daddr_t; +typedef __caddr_t caddr_t; +# define __daddr_t_defined +# endif +#endif + +#if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined +typedef __key_t key_t; +# define __key_t_defined +#endif + +#if defined __USE_XOPEN || defined __USE_XOPEN2K8 +# include +#endif +#include +#include +#include + +#ifdef __USE_XOPEN +# ifndef __useconds_t_defined +typedef __useconds_t useconds_t; +# define __useconds_t_defined +# endif +# ifndef __suseconds_t_defined +typedef __suseconds_t suseconds_t; +# define __suseconds_t_defined +# endif +#endif + +#define __need_size_t +#include + +#ifdef __USE_MISC +/* Old compatibility names for C types. */ +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +#endif + +/* These size-specific names are used by some of the inet code. */ + +#include + +/* These were defined by ISO C without the first `_'. */ +typedef __uint8_t u_int8_t; +typedef __uint16_t u_int16_t; +typedef __uint32_t u_int32_t; +typedef __uint64_t u_int64_t; + +#if __GNUC_PREREQ (2, 7) +typedef int register_t __attribute__ ((__mode__ (__word__))); +#else +typedef int register_t; +#endif + +/* Some code from BIND tests this macro to see if the types above are + defined. */ +#define __BIT_TYPES_DEFINED__ 1 + + +#ifdef __USE_MISC +/* In BSD is expected to define BYTE_ORDER. */ +# include + +/* It also defines `fd_set' and the FD_* macros for `select'. */ +# include +#endif /* Use misc. */ + + +#if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \ + && !defined __blksize_t_defined +typedef __blksize_t blksize_t; +# define __blksize_t_defined +#endif + +/* Types from the Large File Support interface. */ +#ifndef __USE_FILE_OFFSET64 +# ifndef __blkcnt_t_defined +typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */ +# define __blkcnt_t_defined +# endif +# ifndef __fsblkcnt_t_defined +typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */ +# define __fsblkcnt_t_defined +# endif +# ifndef __fsfilcnt_t_defined +typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */ +# define __fsfilcnt_t_defined +# endif +#else +# ifndef __blkcnt_t_defined +typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */ +# define __blkcnt_t_defined +# endif +# ifndef __fsblkcnt_t_defined +typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */ +# define __fsblkcnt_t_defined +# endif +# ifndef __fsfilcnt_t_defined +typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */ +# define __fsfilcnt_t_defined +# endif +#endif + +#ifdef __USE_LARGEFILE64 +typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */ +typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */ +typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */ +#endif + + +/* Now add the thread types. */ +#if defined __USE_POSIX199506 || defined __USE_UNIX98 +# include +#endif + +__END_DECLS + +#endif /* sys/types.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@types.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@types.h.blob new file mode 100644 index 0000000..6dc33c9 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@sys@types.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@time.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@time.h new file mode 100644 index 0000000..ae7becc --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@time.h @@ -0,0 +1,463 @@ +/* Copyright (C) 1991-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard: 7.23 Date and time + */ + +#ifndef _TIME_H +#define _TIME_H 1 + +#include + +#define __need_size_t +#define __need_NULL +#include + +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_TIME_H__ 202311L +#endif + +/* This defines CLOCKS_PER_SEC, which is the number of processor clock + ticks per second, and possibly a number of other constants. */ +#include + +/* Many of the typedefs and structs whose official home is this header + may also need to be defined by other headers. */ +#include +#include +#include + +#if defined __USE_POSIX199309 || defined __USE_ISOC11 +# include +#endif + +#ifdef __USE_POSIX199309 +# include +# include +# include +struct sigevent; +#endif + +#ifdef __USE_XOPEN2K +# ifndef __pid_t_defined +typedef __pid_t pid_t; +# define __pid_t_defined +# endif +#endif + +#ifdef __USE_XOPEN2K8 +# include +#endif + +#ifdef __USE_ISOC11 +/* Time base values for timespec_get. */ +# define TIME_UTC 1 +#endif +#if __GLIBC_USE (ISOC23) +# define TIME_MONOTONIC 2 +# define TIME_ACTIVE 3 +# define TIME_THREAD_ACTIVE 4 +#endif + +__BEGIN_DECLS + +/* Time used by the program so far (user time + system time). + The result / CLOCKS_PER_SEC is program time in seconds. */ +extern clock_t clock (void) __THROW; + +#ifndef __USE_TIME64_REDIRECTS +/* Return the current time and put it in *TIMER if TIMER is not NULL. */ +extern time_t time (time_t *__timer) __THROW; + +/* Return the difference between TIME1 and TIME0. */ +extern double difftime (time_t __time1, time_t __time0); + +/* Return the `time_t' representation of TP and normalize TP. */ +extern time_t mktime (struct tm *__tp) __THROW; +#else +# ifdef __REDIRECT_NTH +extern time_t __REDIRECT_NTH (time, (time_t *__timer), __time64); +extern double __REDIRECT_NTH (difftime, (time_t __time1, time_t __time0), + __difftime64); +extern time_t __REDIRECT_NTH (mktime, (struct tm *__tp), __mktime64); +# else +# define time __time64 +# define difftime __difftime64 +# define mktime __mktime64 +# endif +#endif + +/* Format TP into S according to FORMAT. + Write no more than MAXSIZE characters and return the number + of characters written, or 0 if it would exceed MAXSIZE. */ +extern size_t strftime (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp) + __THROW __nonnull((1, 3, 4)); + +#ifdef __USE_XOPEN +/* Parse S according to FORMAT and store binary time information in TP. + The return value is a pointer to the first unparsed character in S. */ +extern char *strptime (const char *__restrict __s, + const char *__restrict __fmt, struct tm *__tp) + __THROW; +#endif + +#ifdef __USE_XOPEN2K8 +/* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ + +extern size_t strftime_l (char *__restrict __s, size_t __maxsize, + const char *__restrict __format, + const struct tm *__restrict __tp, + locale_t __loc) __THROW; +#endif + +#ifdef __USE_GNU +extern char *strptime_l (const char *__restrict __s, + const char *__restrict __fmt, struct tm *__tp, + locale_t __loc) __THROW; +#endif + + +#ifndef __USE_TIME64_REDIRECTS +/* Return the `struct tm' representation of *TIMER + in Universal Coordinated Time (aka Greenwich Mean Time). */ +extern struct tm *gmtime (const time_t *__timer) __THROW; + +/* Return the `struct tm' representation + of *TIMER in the local timezone. */ +extern struct tm *localtime (const time_t *__timer) __THROW; + +#else +# ifdef __REDIRECT_NTH +extern struct tm*__REDIRECT_NTH (gmtime, (const time_t *__timer), __gmtime64); +extern struct tm *__REDIRECT_NTH (localtime, (const time_t *__timer), + __localtime64); +# else +# define gmtime __gmtime64 +# define localtime __localtime64 +# endif +#endif + + +#if defined __USE_POSIX || __GLIBC_USE (ISOC23) +# ifndef __USE_TIME64_REDIRECTS +/* Return the `struct tm' representation of *TIMER in UTC, + using *TP to store the result. */ +extern struct tm *gmtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __THROW; + +/* Return the `struct tm' representation of *TIMER in local time, + using *TP to store the result. */ +extern struct tm *localtime_r (const time_t *__restrict __timer, + struct tm *__restrict __tp) __THROW; +# else +# ifdef __REDIRECT_NTH +extern struct tm*__REDIRECT_NTH (gmtime_r, (const time_t *__restrict __timer, + struct tm *__restrict __tp), + __gmtime64_r); + +extern struct tm*__REDIRECT_NTH (localtime_r, (const time_t *__restrict __t, + struct tm *__restrict __tp), + __localtime64_r); +# else +# define gmtime_r __gmtime64_r +# define localtime_r __localtime_r +# endif +# endif +#endif /* POSIX || C23 */ + +/* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n" + that is the representation of TP in this format. */ +extern char *asctime (const struct tm *__tp) __THROW; + +/* Equivalent to `asctime (localtime (timer))'. */ +#ifndef __USE_TIME64_REDIRECTS +extern char *ctime (const time_t *__timer) __THROW; +#else +# ifdef __REDIRECT_NTH +extern char *__REDIRECT_NTH (ctime, (const time_t *__timer), __ctime64); +# else +# define ctime __ctime64 +# endif +#endif + +#ifdef __USE_POSIX +/* Reentrant versions of the above functions. */ + +/* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n" + that is the representation of TP in this format. */ +extern char *asctime_r (const struct tm *__restrict __tp, + char *__restrict __buf) __THROW; + +/* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */ +#ifndef __USE_TIME64_REDIRECTS +extern char *ctime_r (const time_t *__restrict __timer, + char *__restrict __buf) __THROW; +#else +# ifdef __REDIRECT_NTH +extern char *__REDIRECT_NTH (ctime_r, (const time_t *__restrict __timer, + char *__restrict __buf), __ctime64_r); +# else +# define ctime_r __ctime64_r +# endif +#endif + +#endif /* POSIX */ + + +/* Defined in localtime.c. */ +extern char *__tzname[2]; /* Current time zone abbreviations. */ +extern int __daylight; /* If daylight-saving time is ever in use. */ +extern long int __timezone; /* Seconds west of UTC. */ + + +#ifdef __USE_POSIX +/* Same as above. */ +extern char *tzname[2]; + +/* Set time conversion information from the TZ environment variable. + If TZ is not defined, a locale-dependent default is used. */ +extern void tzset (void) __THROW; +#endif + +#if defined __USE_MISC || defined __USE_XOPEN +extern int daylight; +extern long int timezone; +#endif + + +/* Nonzero if YEAR is a leap year (every 4 years, + except every 100th isn't, and every 400th is). */ +#define __isleap(year) \ + ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) + + +#if defined __USE_MISC || __GLIBC_USE (ISOC23) +# ifndef __USE_TIME64_REDIRECTS +/* Like `mktime', but for TP represents Universal Time, not local time. */ +extern time_t timegm (struct tm *__tp) __THROW; +# else +# ifdef __REDIRECT_NTH +extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64); +# else +# define timegm __timegm64 +# endif +# endif +#endif + + +#ifdef __USE_MISC +/* Miscellaneous functions many Unices inherited from the public domain + localtime package. These are included only for compatibility. */ + +#ifndef __USE_TIME64_REDIRECTS +/* Another name for `mktime'. */ +extern time_t timelocal (struct tm *__tp) __THROW; +#else +# ifdef __REDIRECT_NTH +extern time_t __REDIRECT_NTH (timelocal, (struct tm *__tp), __mktime64); +# endif +#endif + +/* Return the number of days in YEAR. */ +extern int dysize (int __year) __THROW __attribute__ ((__const__)); +#endif + + +#ifdef __USE_POSIX199309 +# ifndef __USE_TIME64_REDIRECTS +/* Pause execution for a number of nanoseconds. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int nanosleep (const struct timespec *__requested_time, + struct timespec *__remaining); + +/* Get resolution of clock CLOCK_ID. */ +extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __THROW; + +/* Get current value of clock CLOCK_ID and store it in TP. */ +extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) + __THROW __nonnull((2)); + +/* Set clock CLOCK_ID to value TP. */ +extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp) + __THROW __nonnull((2)); +# else +# ifdef __REDIRECT +extern int __REDIRECT (nanosleep, (const struct timespec *__requested_time, + struct timespec *__remaining), + __nanosleep64); +extern int __REDIRECT_NTH (clock_getres, (clockid_t __clock_id, + struct timespec *__res), + __clock_getres64); +extern int __REDIRECT_NTH (clock_gettime, (clockid_t __clock_id, struct + timespec *__tp), __clock_gettime64) + __nonnull((2)); +extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const struct + timespec *__tp), __clock_settime64) + __nonnull((2)); +# else +# define nanosleep __nanosleep64 +# define clock_getres __clock_getres64 +# define clock_gettime __clock_gettime64 +# define clock_settime __clock_settime64 +# endif +# endif + + +# ifdef __USE_XOPEN2K +/* High-resolution sleep with the specified clock. + + This function is a cancellation point and therefore not marked with + __THROW. */ +# ifndef __USE_TIME64_REDIRECTS +extern int clock_nanosleep (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem); +# else +# ifdef __REDIRECT +extern int __REDIRECT (clock_nanosleep, (clockid_t __clock_id, int __flags, + const struct timespec *__req, + struct timespec *__rem), + __clock_nanosleep_time64); +# else +# define clock_nanosleep __clock_nanosleep_time64 +# endif +# endif + +/* Return clock ID for CPU-time clock. */ +extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW; +# endif + + +/* Create new per-process timer using CLOCK_ID. */ +extern int timer_create (clockid_t __clock_id, + struct sigevent *__restrict __evp, + timer_t *__restrict __timerid) __THROW; + +/* Delete timer TIMERID. */ +extern int timer_delete (timer_t __timerid) __THROW; + +/* Set timer TIMERID to VALUE, returning old value in OVALUE. */ +# ifndef __USE_TIME64_REDIRECTS +extern int timer_settime (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue) __THROW; + +/* Get current value of timer TIMERID and store it in VALUE. */ +extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) + __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (timer_settime, (timer_t __timerid, int __flags, + const struct itimerspec *__restrict __value, + struct itimerspec *__restrict __ovalue), + __timer_settime64); + +extern int __REDIRECT_NTH (timer_gettime, (timer_t __timerid, + struct itimerspec *__value), + __timer_gettime64); +# else +# define timer_settime __timer_settime64 +# define timer_gettime __timer_gettime64 +# endif +# endif + +/* Get expiration overrun for timer TIMERID. */ +extern int timer_getoverrun (timer_t __timerid) __THROW; +#endif + + +#ifdef __USE_ISOC11 +# ifndef __USE_TIME64_REDIRECTS +/* Set TS to calendar time based in time base BASE. */ +extern int timespec_get (struct timespec *__ts, int __base) + __THROW __nonnull ((1)); +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (timespec_get, (struct timespec *__ts, int __base), + __timespec_get64) __nonnull ((1)); +# else +# define timespec_get __timespec_get64 +# endif +# endif +#endif + + +#if __GLIBC_USE (ISOC23) +# ifndef __USE_TIME64_REDIRECTS +/* Set TS to resolution of time base BASE. */ +extern int timespec_getres (struct timespec *__ts, int __base) + __THROW; +# else +# ifdef __REDIRECT_NTH +extern int __REDIRECT_NTH (timespec_getres, (struct timespec *__ts, + int __base), + __timespec_getres64); +# else +# define timespec_getres __timespec_getres64 +# endif +# endif +#endif + + +#ifdef __USE_XOPEN_EXTENDED +/* Set to one of the following values to indicate an error. + 1 the DATEMSK environment variable is null or undefined, + 2 the template file cannot be opened for reading, + 3 failed to get file status information, + 4 the template file is not a regular file, + 5 an error is encountered while reading the template file, + 6 memory allication failed (not enough memory available), + 7 there is no line in the template that matches the input, + 8 invalid input specification Example: February 31 or a time is + specified that can not be represented in a time_t (representing + the time in seconds since 00:00:00 UTC, January 1, 1970) */ +extern int getdate_err; + +/* Parse the given string as a date specification and return a value + representing the value. The templates from the file identified by + the environment variable DATEMSK are used. In case of an error + `getdate_err' is set. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern struct tm *getdate (const char *__string); +#endif + +#ifdef __USE_GNU +/* Since `getdate' is not reentrant because of the use of `getdate_err' + and the static buffer to return the result in, we provide a thread-safe + variant. The functionality is the same. The result is returned in + the buffer pointed to by RESBUFP and in case of an error the return + value is != 0 with the same values as given above for `getdate_err'. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int getdate_r (const char *__restrict __string, + struct tm *__restrict __resbufp); +#endif + +__END_DECLS + +#endif /* time.h. */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@time.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@time.h.blob new file mode 100644 index 0000000..4122c0b Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@time.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wchar.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wchar.h new file mode 100644 index 0000000..449f3b4 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wchar.h @@ -0,0 +1,1100 @@ +/* Copyright (C) 1995-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard: 7.24 + * Extended multibyte and wide character utilities + */ + +#ifndef _WCHAR_H +#define _WCHAR_H 1 + +#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION +#include + +/* Gather machine dependent type support. */ +#include + +#define __need_size_t +#define __need_wchar_t +#define __need_NULL +#include + +#define __need___va_list +#include + +#if defined __USE_XOPEN2K || defined __USE_XOPEN2K8 +# ifdef __GNUC__ +# ifndef _VA_LIST_DEFINED +typedef __gnuc_va_list va_list; +# define _VA_LIST_DEFINED +# endif +# else +# include +# endif +#endif + +#include +#include +#include +#include + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K +# include +#endif +#ifdef __USE_XOPEN2K8 +# include +#endif + +#if __GLIBC_USE (ISOC23) +# define __STDC_VERSION_WCHAR_H__ 202311L +#endif + +/* Tell the caller that we provide correct C++ prototypes. */ +#if defined __cplusplus && __GNUC_PREREQ (4, 4) +# define __CORRECT_ISO_CPP_WCHAR_H_PROTO +#endif + +#ifndef WCHAR_MIN +/* These constants might also be defined in . */ +# define WCHAR_MIN __WCHAR_MIN +# define WCHAR_MAX __WCHAR_MAX +#endif + +#ifndef WEOF +# define WEOF (0xffffffffu) +#endif + +/* All versions of XPG prior to the publication of ISO C99 required + the bulk of 's declarations to appear in this header + (because did not exist prior to C99). In POSIX.1-2001 + those declarations were marked as XSI extensions; in -2008 they + were additionally marked as obsolescent. _GNU_SOURCE mode + anticipates the removal of these declarations in the next revision + of POSIX. */ +#if (defined __USE_XOPEN && !defined __USE_GNU \ + && !(defined __USE_XOPEN2K && !defined __USE_XOPEN2KXSI)) +# include +#endif + +__BEGIN_DECLS + +/* This incomplete type is defined in but needed here because + of `wcsftime'. */ +struct tm; + + +/* Copy SRC to DEST. */ +extern wchar_t *wcscpy (wchar_t *__restrict __dest, + const wchar_t *__restrict __src) + __THROW __nonnull ((1, 2)); + +/* Copy no more than N wide-characters of SRC to DEST. */ +extern wchar_t *wcsncpy (wchar_t *__restrict __dest, + const wchar_t *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)); + +#ifdef __USE_MISC +/* Copy at most N - 1 characters from SRC to DEST. */ +extern size_t wcslcpy (wchar_t *__restrict __dest, + const wchar_t *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)) __attr_access ((__write_only__, 1, 3)); + +/* Append SRC to DEST, possibly with truncation to keep the total size + below N. */ +extern size_t wcslcat (wchar_t *__restrict __dest, + const wchar_t *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)) __attr_access ((__read_write__, 1, 3)); +#endif + +/* Append SRC onto DEST. */ +extern wchar_t *wcscat (wchar_t *__restrict __dest, + const wchar_t *__restrict __src) + __THROW __nonnull ((1, 2)); +/* Append no more than N wide-characters of SRC onto DEST. */ +extern wchar_t *wcsncat (wchar_t *__restrict __dest, + const wchar_t *__restrict __src, size_t __n) + __THROW __nonnull ((1, 2)); + +/* Compare S1 and S2. */ +extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2) + __THROW __attribute_pure__ __nonnull ((1, 2)); +/* Compare N wide-characters of S1 and S2. */ +extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) + __THROW __attribute_pure__ __nonnull ((1, 2)); + +#ifdef __USE_XOPEN2K8 +/* Compare S1 and S2, ignoring case. */ +extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW; + +/* Compare no more than N chars of S1 and S2, ignoring case. */ +extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2, + size_t __n) __THROW; + +/* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ +extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2, + locale_t __loc) __THROW; + +extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2, + size_t __n, locale_t __loc) __THROW; +#endif + +/* Compare S1 and S2, both interpreted as appropriate to the + LC_COLLATE category of the current locale. */ +extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW; +/* Transform S2 into array pointed to by S1 such that if wcscmp is + applied to two transformed strings the result is the as applying + `wcscoll' to the original strings. */ +extern size_t wcsxfrm (wchar_t *__restrict __s1, + const wchar_t *__restrict __s2, size_t __n) __THROW; + +#ifdef __USE_XOPEN2K8 +/* Similar to the two functions above but take the information from + the provided locale and not the global locale. */ + +/* Compare S1 and S2, both interpreted as appropriate to the + LC_COLLATE category of the given locale. */ +extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2, + locale_t __loc) __THROW; + +/* Transform S2 into array pointed to by S1 such that if wcscmp is + applied to two transformed strings the result is the as applying + `wcscoll' to the original strings. */ +extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2, + size_t __n, locale_t __loc) __THROW; + +/* Duplicate S, returning an identical malloc'd string. */ +extern wchar_t *wcsdup (const wchar_t *__s) __THROW + __attribute_malloc__ __attr_dealloc_free; +#endif + +/* Find the first occurrence of WC in WCS. */ +#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO +extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc) + __THROW __asm ("wcschr") __attribute_pure__; +extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc) + __THROW __asm ("wcschr") __attribute_pure__; +#else +extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc) + __THROW __attribute_pure__; +# if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC +# define wcschr(WCS, WC) \ + __glibc_const_generic (WCS, const wchar_t *, wcschr (WCS, WC)) +# endif +#endif +/* Find the last occurrence of WC in WCS. */ +#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO +extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc) + __THROW __asm ("wcsrchr") __attribute_pure__; +extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc) + __THROW __asm ("wcsrchr") __attribute_pure__; +#else +extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc) + __THROW __attribute_pure__; +# if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC +# define wcsrchr(WCS, WC) \ + __glibc_const_generic (WCS, const wchar_t *, wcsrchr (WCS, WC)) +# endif +#endif + +#ifdef __USE_GNU +/* This function is similar to `wcschr'. But it returns a pointer to + the closing NUL wide character in case C is not found in S. */ +extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc) + __THROW __attribute_pure__; +#endif + +/* Return the length of the initial segmet of WCS which + consists entirely of wide characters not in REJECT. */ +extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject) + __THROW __attribute_pure__; +/* Return the length of the initial segmet of WCS which + consists entirely of wide characters in ACCEPT. */ +extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept) + __THROW __attribute_pure__; +/* Find the first occurrence in WCS of any character in ACCEPT. */ +#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO +extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept) + __THROW __asm ("wcspbrk") __attribute_pure__; +extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs, + const wchar_t *__accept) + __THROW __asm ("wcspbrk") __attribute_pure__; +#else +extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept) + __THROW __attribute_pure__; +# if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC +# define wcspbrk(WCS, ACCEPT) \ + __glibc_const_generic (WCS, const wchar_t *, wcspbrk (WCS, ACCEPT)) +# endif +#endif +/* Find the first occurrence of NEEDLE in HAYSTACK. */ +#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO +extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle) + __THROW __asm ("wcsstr") __attribute_pure__; +extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack, + const wchar_t *__needle) + __THROW __asm ("wcsstr") __attribute_pure__; +#else +extern wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle) + __THROW __attribute_pure__; +# if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC +# define wcsstr(HAYSTACK, NEEDLE) \ + __glibc_const_generic (HAYSTACK, const wchar_t *, \ + wcsstr (HAYSTACK, NEEDLE)) +# endif +#endif + +/* Divide WCS into tokens separated by characters in DELIM. */ +extern wchar_t *wcstok (wchar_t *__restrict __s, + const wchar_t *__restrict __delim, + wchar_t **__restrict __ptr) __THROW; + +/* Return the number of wide characters in S. */ +extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__; + +#ifdef __USE_XOPEN +/* Another name for `wcsstr' from XPG4. */ +# ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO +extern "C++" wchar_t *wcswcs (wchar_t *__haystack, const wchar_t *__needle) + __THROW __asm ("wcswcs") __attribute_pure__; +extern "C++" const wchar_t *wcswcs (const wchar_t *__haystack, + const wchar_t *__needle) + __THROW __asm ("wcswcs") __attribute_pure__; +# else +extern wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle) + __THROW __attribute_pure__; +# endif +#endif + +#ifdef __USE_XOPEN2K8 +/* Return the number of wide characters in S, but at most MAXLEN. */ +extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen) + __THROW __attribute_pure__; +#endif + + +/* Search N wide characters of S for C. */ +#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO +extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n) + __THROW __asm ("wmemchr") __attribute_pure__; +extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, + size_t __n) + __THROW __asm ("wmemchr") __attribute_pure__; +#else +extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n) + __THROW __attribute_pure__; +# if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC +# define wmemchr(S, C, N) \ + __glibc_const_generic (S, const wchar_t *, wmemchr (S, C, N)) +# endif +#endif + +/* Compare N wide characters of S1 and S2. */ +extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) + __THROW __attribute_pure__; + +/* Copy N wide characters of SRC to DEST. */ +extern wchar_t *wmemcpy (wchar_t *__restrict __s1, + const wchar_t *__restrict __s2, size_t __n) __THROW; + +/* Copy N wide characters of SRC to DEST, guaranteeing + correct behavior for overlapping strings. */ +extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n) + __THROW; + +/* Set N wide characters of S to C. */ +extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW; + +#ifdef __USE_GNU +/* Copy N wide characters of SRC to DEST and return pointer to following + wide character. */ +extern wchar_t *wmempcpy (wchar_t *__restrict __s1, + const wchar_t *__restrict __s2, size_t __n) + __THROW; +#endif + + +/* Determine whether C constitutes a valid (one-byte) multibyte + character. */ +extern wint_t btowc (int __c) __THROW; + +/* Determine whether C corresponds to a member of the extended + character set whose multibyte representation is a single byte. */ +extern int wctob (wint_t __c) __THROW; + +/* Determine whether PS points to an object representing the initial + state. */ +extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__; + +/* Write wide character representation of multibyte character pointed + to by S to PWC. */ +extern size_t mbrtowc (wchar_t *__restrict __pwc, + const char *__restrict __s, size_t __n, + mbstate_t *__restrict __p) __THROW; + +/* Write multibyte representation of wide character WC to S. */ +extern size_t wcrtomb (char *__restrict __s, wchar_t __wc, + mbstate_t *__restrict __ps) __THROW; + +/* Return number of bytes in multibyte character pointed to by S. */ +extern size_t __mbrlen (const char *__restrict __s, size_t __n, + mbstate_t *__restrict __ps) __THROW; +extern size_t mbrlen (const char *__restrict __s, size_t __n, + mbstate_t *__restrict __ps) __THROW; + +#ifdef __USE_EXTERN_INLINES +/* Define inline function as optimization. */ + +/* We can use the BTOWC and WCTOB optimizations since we know that all + locales must use ASCII encoding for the values in the ASCII range + and because the wchar_t encoding is always ISO 10646. */ +extern wint_t __btowc_alias (int __c) __asm ("btowc"); +__extern_inline wint_t +__NTH (btowc (int __c)) +{ return (__builtin_constant_p (__c) && __c >= '\0' && __c <= '\x7f' + ? (wint_t) __c : __btowc_alias (__c)); } + +extern int __wctob_alias (wint_t __c) __asm ("wctob"); +__extern_inline int +__NTH (wctob (wint_t __wc)) +{ return (__builtin_constant_p (__wc) && __wc >= L'\0' && __wc <= L'\x7f' + ? (int) __wc : __wctob_alias (__wc)); } + +__extern_inline size_t +__NTH (mbrlen (const char *__restrict __s, size_t __n, + mbstate_t *__restrict __ps)) +{ return (__ps != NULL + ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); } +#endif + +/* Write wide character representation of multibyte character string + SRC to DST. */ +extern size_t mbsrtowcs (wchar_t *__restrict __dst, + const char **__restrict __src, size_t __len, + mbstate_t *__restrict __ps) __THROW; + +/* Write multibyte character representation of wide character string + SRC to DST. */ +extern size_t wcsrtombs (char *__restrict __dst, + const wchar_t **__restrict __src, size_t __len, + mbstate_t *__restrict __ps) __THROW; + + +#ifdef __USE_XOPEN2K8 +/* Write wide character representation of at most NMC bytes of the + multibyte character string SRC to DST. */ +extern size_t mbsnrtowcs (wchar_t *__restrict __dst, + const char **__restrict __src, size_t __nmc, + size_t __len, mbstate_t *__restrict __ps) __THROW; + +/* Write multibyte character representation of at most NWC characters + from the wide character string SRC to DST. */ +extern size_t wcsnrtombs (char *__restrict __dst, + const wchar_t **__restrict __src, + size_t __nwc, size_t __len, + mbstate_t *__restrict __ps) __THROW; +#endif /* use POSIX 2008 */ + + +/* The following functions are extensions found in X/Open CAE. */ +#ifdef __USE_XOPEN +/* Determine number of column positions required for C. */ +extern int wcwidth (wchar_t __c) __THROW; + +/* Determine number of column positions required for first N wide + characters (or fewer if S ends before this) in S. */ +extern int wcswidth (const wchar_t *__s, size_t __n) __THROW; +#endif /* Use X/Open. */ + + +/* Convert initial portion of the wide string NPTR to `double' + representation. */ +extern double wcstod (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; + +#ifdef __USE_ISOC99 +/* Likewise for `float' and `long double' sizes of floating-point numbers. */ +extern float wcstof (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +extern long double wcstold (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +#endif /* C99 */ + +#if __GLIBC_USE (IEC_60559_TYPES_EXT) && __GLIBC_USE (ISOC23) +/* Likewise for `_FloatN' and `_FloatNx' when support is enabled. */ + +# if __HAVE_FLOAT16 +extern _Float16 wcstof16 (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +# endif + +# if __HAVE_FLOAT32 +extern _Float32 wcstof32 (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +# endif + +# if __HAVE_FLOAT64 +extern _Float64 wcstof64 (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +# endif + +# if __HAVE_FLOAT128 +extern _Float128 wcstof128 (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +# endif + +# if __HAVE_FLOAT32X +extern _Float32x wcstof32x (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +# endif + +# if __HAVE_FLOAT64X +extern _Float64x wcstof64x (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +# endif + +# if __HAVE_FLOAT128X +extern _Float128x wcstof128x (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr) __THROW; +# endif +#endif /* __GLIBC_USE (IEC_60559_TYPES_EXT) && __GLIBC_USE (ISOC23) */ + + +/* Convert initial portion of wide string NPTR to `long int' + representation. */ +extern long int wcstol (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) __THROW; + +/* Convert initial portion of wide string NPTR to `unsigned long int' + representation. */ +extern unsigned long int wcstoul (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) + __THROW; + +#ifdef __USE_ISOC99 +/* Convert initial portion of wide string NPTR to `long long int' + representation. */ +__extension__ +extern long long int wcstoll (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) + __THROW; + +/* Convert initial portion of wide string NPTR to `unsigned long long int' + representation. */ +__extension__ +extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) __THROW; +#endif /* ISO C99. */ + +#ifdef __USE_GNU +/* Convert initial portion of wide string NPTR to `long long int' + representation. */ +__extension__ +extern long long int wcstoq (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) + __THROW; + +/* Convert initial portion of wide string NPTR to `unsigned long long int' + representation. */ +__extension__ +extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) __THROW; +#endif /* Use GNU. */ + +/* Versions of the above functions that handle '0b' and '0B' prefixes + in base 0 or 2. */ +#if __GLIBC_USE (C23_STRTOL) +# ifdef __REDIRECT +extern long int __REDIRECT_NTH (wcstol, (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base), __isoc23_wcstol); +extern unsigned long int __REDIRECT_NTH (wcstoul, + (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base), __isoc23_wcstoul); +__extension__ +extern long long int __REDIRECT_NTH (wcstoll, + (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base), __isoc23_wcstoll); +__extension__ +extern unsigned long long int __REDIRECT_NTH (wcstoull, + (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base), __isoc23_wcstoull); +# ifdef __USE_GNU +__extension__ +extern long long int __REDIRECT_NTH (wcstoq, (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base), __isoc23_wcstoll); +__extension__ +extern unsigned long long int __REDIRECT_NTH (wcstouq, + (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base), __isoc23_wcstoull); +# endif +# else +extern long int __isoc23_wcstol (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base) + __THROW; +extern unsigned long int __isoc23_wcstoul (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) + __THROW; +__extension__ +extern long long int __isoc23_wcstoll (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) + __THROW; +__extension__ +extern unsigned long long int __isoc23_wcstoull (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base) + __THROW; +# define wcstol __isoc23_wcstol +# define wcstoul __isoc23_wcstoul +# define wcstoll __isoc23_wcstoll +# define wcstoull __isoc23_wcstoull +# ifdef __USE_GNU +# define wcstoq __isoc23_wcstoll +# define wcstouq __isoc23_wcstoull +# endif +# endif +#endif + +#ifdef __USE_GNU +/* Parallel versions of the functions above which take the locale to + use as an additional parameter. These are GNU extensions inspired + by the POSIX.1-2008 extended locale API. */ +extern long int wcstol_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base, + locale_t __loc) __THROW; + +extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc) __THROW; + +__extension__ +extern long long int wcstoll_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc) __THROW; + +__extension__ +extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc) + __THROW; + +/* Versions of the above functions that handle '0b' and '0B' prefixes + in base 0 or 2. */ +# if __GLIBC_USE (C23_STRTOL) +# ifdef __REDIRECT +extern long int __REDIRECT_NTH (wcstol_l, (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc), + __isoc23_wcstol_l); +extern unsigned long int __REDIRECT_NTH (wcstoul_l, + (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc), + __isoc23_wcstoul_l); +__extension__ +extern long long int __REDIRECT_NTH (wcstoll_l, + (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc), + __isoc23_wcstoll_l); +__extension__ +extern unsigned long long int __REDIRECT_NTH (wcstoull_l, + (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc), + __isoc23_wcstoull_l); +# else +extern long int __isoc23_wcstol_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, int __base, + locale_t __loc) __THROW; +extern unsigned long int __isoc23_wcstoul_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc) + __THROW; +__extension__ +extern long long int __isoc23_wcstoll_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc) + __THROW; +__extension__ +extern unsigned long long int __isoc23_wcstoull_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + int __base, locale_t __loc) + __THROW; +# define wcstol_l __isoc23_wcstol_l +# define wcstoul_l __isoc23_wcstoul_l +# define wcstoll_l __isoc23_wcstoll_l +# define wcstoull_l __isoc23_wcstoull_l +# endif +# endif + +extern double wcstod_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, locale_t __loc) + __THROW; + +extern float wcstof_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, locale_t __loc) + __THROW; + +extern long double wcstold_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + locale_t __loc) __THROW; + +# if __HAVE_FLOAT16 +extern _Float16 wcstof16_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + locale_t __loc) __THROW; +# endif + +# if __HAVE_FLOAT32 +extern _Float32 wcstof32_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + locale_t __loc) __THROW; +# endif + +# if __HAVE_FLOAT64 +extern _Float64 wcstof64_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + locale_t __loc) __THROW; +# endif + +# if __HAVE_FLOAT128 +extern _Float128 wcstof128_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + locale_t __loc) __THROW; +# endif + +# if __HAVE_FLOAT32X +extern _Float32x wcstof32x_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + locale_t __loc) __THROW; +# endif + +# if __HAVE_FLOAT64X +extern _Float64x wcstof64x_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + locale_t __loc) __THROW; +# endif + +# if __HAVE_FLOAT128X +extern _Float128x wcstof128x_l (const wchar_t *__restrict __nptr, + wchar_t **__restrict __endptr, + locale_t __loc) __THROW; +# endif +#endif /* use GNU */ + + +#ifdef __USE_XOPEN2K8 +/* Copy SRC to DEST, returning the address of the terminating L'\0' in + DEST. */ +extern wchar_t *wcpcpy (wchar_t *__restrict __dest, + const wchar_t *__restrict __src) __THROW; + +/* Copy no more than N characters of SRC to DEST, returning the address of + the last character written into DEST. */ +extern wchar_t *wcpncpy (wchar_t *__restrict __dest, + const wchar_t *__restrict __src, size_t __n) + __THROW; +#endif + + +/* Wide character I/O functions. */ + +#if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) +# ifndef __attr_dealloc_fclose +# if defined __has_builtin +# if __has_builtin (__builtin_fclose) +/* If the attribute macro hasn't been defined yet (by ) and + fclose is a built-in, use it. */ +# define __attr_dealloc_fclose __attr_dealloc (__builtin_fclose, 1) +# endif +# endif +# endif +# ifndef __attr_dealloc_fclose +# define __attr_dealloc_fclose /* empty */ +# endif + +/* Like OPEN_MEMSTREAM, but the stream is wide oriented and produces + a wide character string. */ +extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW + __attribute_malloc__ __attr_dealloc_fclose; +#endif + +#if defined __USE_ISOC95 || defined __USE_UNIX98 + +/* Select orientation for stream. */ +extern int fwide (__FILE *__fp, int __mode) __THROW; + + +/* Write formatted output to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fwprintf (__FILE *__restrict __stream, + const wchar_t *__restrict __format, ...) + /* __attribute__ ((__format__ (__wprintf__, 2, 3))) */; +/* Write formatted output to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int wprintf (const wchar_t *__restrict __format, ...) + /* __attribute__ ((__format__ (__wprintf__, 1, 2))) */; +/* Write formatted output of at most N characters to S. */ +extern int swprintf (wchar_t *__restrict __s, size_t __n, + const wchar_t *__restrict __format, ...) + __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */; + +/* Write formatted output to S from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vfwprintf (__FILE *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg) + /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */; +/* Write formatted output to stdout from argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vwprintf (const wchar_t *__restrict __format, + __gnuc_va_list __arg) + /* __attribute__ ((__format__ (__wprintf__, 1, 0))) */; +/* Write formatted output of at most N character to S from argument + list ARG. */ +extern int vswprintf (wchar_t *__restrict __s, size_t __n, + const wchar_t *__restrict __format, + __gnuc_va_list __arg) + __THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */; + + +/* Read formatted input from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fwscanf (__FILE *__restrict __stream, + const wchar_t *__restrict __format, ...) + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +/* Read formatted input from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int wscanf (const wchar_t *__restrict __format, ...) + /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; +/* Read formatted input from S. */ +extern int swscanf (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, ...) + __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; + +/* For historical reasons, the C99-compliant versions of the scanf + functions are at alternative names. When __LDBL_COMPAT or + __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI are in effect, this is handled in + bits/wchar-ldbl.h. */ +# if !__GLIBC_USE (DEPRECATED_SCANF) && !defined __LDBL_COMPAT \ + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 +# if __GLIBC_USE (C23_STRTOL) +# ifdef __REDIRECT +extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream, + const wchar_t *__restrict __format, ...), + __isoc23_fwscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...), + __isoc23_wscanf) + /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; +extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + ...), __isoc23_swscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +# else +extern int __isoc23_fwscanf (__FILE *__restrict __stream, + const wchar_t *__restrict __format, ...); +extern int __isoc23_wscanf (const wchar_t *__restrict __format, ...); +extern int __isoc23_swscanf (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, ...) + __THROW; +# define fwscanf __isoc23_fwscanf +# define wscanf __isoc23_wscanf +# define swscanf __isoc23_swscanf +# endif +# else +# ifdef __REDIRECT +extern int __REDIRECT (fwscanf, (__FILE *__restrict __stream, + const wchar_t *__restrict __format, ...), + __isoc99_fwscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +extern int __REDIRECT (wscanf, (const wchar_t *__restrict __format, ...), + __isoc99_wscanf) + /* __attribute__ ((__format__ (__wscanf__, 1, 2))) */; +extern int __REDIRECT_NTH (swscanf, (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + ...), __isoc99_swscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */; +# else +extern int __isoc99_fwscanf (__FILE *__restrict __stream, + const wchar_t *__restrict __format, ...); +extern int __isoc99_wscanf (const wchar_t *__restrict __format, ...); +extern int __isoc99_swscanf (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, ...) + __THROW; +# define fwscanf __isoc99_fwscanf +# define wscanf __isoc99_wscanf +# define swscanf __isoc99_swscanf +# endif +# endif +# endif + +#endif /* Use ISO C95, C99 and Unix98. */ + +#ifdef __USE_ISOC99 +/* Read formatted input from S into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vfwscanf (__FILE *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg) + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +/* Read formatted input from stdin into argument list ARG. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int vwscanf (const wchar_t *__restrict __format, + __gnuc_va_list __arg) + /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; +/* Read formatted input from S into argument list ARG. */ +extern int vswscanf (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg) + __THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; + +/* Same redirection as above for the v*wscanf family. */ +# if !__GLIBC_USE (DEPRECATED_SCANF) \ + && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ + && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) \ + && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0 +# if __GLIBC_USE (C23_STRTOL) +# ifdef __REDIRECT +extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg), __isoc23_vfwscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format, + __gnuc_va_list __arg), __isoc23_vwscanf) + /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; +extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg), __isoc23_vswscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +# else +extern int __isoc23_vfwscanf (__FILE *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg); +extern int __isoc23_vwscanf (const wchar_t *__restrict __format, + __gnuc_va_list __arg); +extern int __isoc23_vswscanf (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg) __THROW; +# define vfwscanf __isoc23_vfwscanf +# define vwscanf __isoc23_vwscanf +# define vswscanf __isoc23_vswscanf +# endif +# else +# ifdef __REDIRECT +extern int __REDIRECT (vfwscanf, (__FILE *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg), __isoc99_vfwscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +extern int __REDIRECT (vwscanf, (const wchar_t *__restrict __format, + __gnuc_va_list __arg), __isoc99_vwscanf) + /* __attribute__ ((__format__ (__wscanf__, 1, 0))) */; +extern int __REDIRECT_NTH (vswscanf, (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg), __isoc99_vswscanf) + /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */; +# else +extern int __isoc99_vfwscanf (__FILE *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg); +extern int __isoc99_vwscanf (const wchar_t *__restrict __format, + __gnuc_va_list __arg); +extern int __isoc99_vswscanf (const wchar_t *__restrict __s, + const wchar_t *__restrict __format, + __gnuc_va_list __arg) __THROW; +# define vfwscanf __isoc99_vfwscanf +# define vwscanf __isoc99_vwscanf +# define vswscanf __isoc99_vswscanf +# endif +# endif +# endif + +#endif /* Use ISO C99. */ + + +/* Read a character from STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t fgetwc (__FILE *__stream); +extern wint_t getwc (__FILE *__stream); + +/* Read a character from stdin. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern wint_t getwchar (void); + + +/* Write a character to STREAM. + + These functions are possible cancellation points and therefore not + marked with __THROW. */ +extern wint_t fputwc (wchar_t __wc, __FILE *__stream); +extern wint_t putwc (wchar_t __wc, __FILE *__stream); + +/* Write a character to stdout. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern wint_t putwchar (wchar_t __wc); + + +/* Get a newline-terminated wide character string of finite length + from STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n, + __FILE *__restrict __stream); + +/* Write a string to STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fputws (const wchar_t *__restrict __ws, + __FILE *__restrict __stream); + + +/* Push a character back onto the input buffer of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern wint_t ungetwc (wint_t __wc, __FILE *__stream); + + +#ifdef __USE_GNU +/* These are defined to be equivalent to the `char' functions defined + in POSIX.1:1996. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern wint_t getwc_unlocked (__FILE *__stream); +extern wint_t getwchar_unlocked (void); + +/* This is the wide character version of a GNU extension. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wint_t fgetwc_unlocked (__FILE *__stream); + +/* Faster version when locking is not necessary. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream); + +/* These are defined to be equivalent to the `char' functions defined + in POSIX.1:1996. + + These functions are not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation they are cancellation points and + therefore not marked with __THROW. */ +extern wint_t putwc_unlocked (wchar_t __wc, __FILE *__stream); +extern wint_t putwchar_unlocked (wchar_t __wc); + + +/* This function does the same as `fgetws' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n, + __FILE *__restrict __stream); + +/* This function does the same as `fputws' but does not lock the stream. + + This function is not part of POSIX and therefore no official + cancellation point. But due to similarity with an POSIX interface + or due to the implementation it is a cancellation point and + therefore not marked with __THROW. */ +extern int fputws_unlocked (const wchar_t *__restrict __ws, + __FILE *__restrict __stream); +#endif + + +/* Format TP into S according to FORMAT. + Write no more than MAXSIZE wide characters and return the number + of wide characters written, or 0 if it would exceed MAXSIZE. */ +extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize, + const wchar_t *__restrict __format, + const struct tm *__restrict __tp) __THROW; + +# ifdef __USE_GNU +/* Similar to `wcsftime' but takes the information from + the provided locale and not the global locale. */ +extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize, + const wchar_t *__restrict __format, + const struct tm *__restrict __tp, + locale_t __loc) __THROW; +# endif + +/* Define some macros helping to catch buffer overflows. */ +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function +/* Declare all functions from bits/wchar2-decl.h first. */ +# include +#endif + +/* The following headers provide asm redirections. These redirections must + appear before the first usage of these functions, e.g. in bits/wchar.h. */ +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +# include +#endif + +#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function +/* Now include the function definitions and redirects too. */ +# include +#endif + +__END_DECLS + +#endif /* wchar.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wchar.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wchar.h.blob new file mode 100644 index 0000000..351be68 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wchar.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wctype.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wctype.h new file mode 100644 index 0000000..51c4641 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wctype.h @@ -0,0 +1,148 @@ +/* Copyright (C) 1996-2026 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* + * ISO C99 Standard: 7.25 + * Wide character classification and mapping utilities + */ + +#ifndef _WCTYPE_H +#define _WCTYPE_H 1 + +#include +#include +#include + +/* Constant expression of type `wint_t' whose value does not correspond + to any member of the extended character set. */ +#ifndef WEOF +# define WEOF (0xffffffffu) +#endif + +/* Some definitions from this header also appear in in + Unix98 mode. */ +#include + +/* + * Extensible wide-character mapping functions: 7.15.3.2. + */ + +__BEGIN_DECLS + +/* Scalar type that can hold values which represent locale-specific + character mappings. */ +typedef const __int32_t *wctrans_t; + +/* Construct value that describes a mapping between wide characters + identified by the string argument PROPERTY. */ +extern wctrans_t wctrans (const char *__property) __THROW; + +/* Map the wide character WC using the mapping described by DESC. */ +extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW; + +# ifdef __USE_XOPEN2K8 +/* POSIX.1-2008 extended locale interface (see locale.h). */ +# include + +/* Test for any wide character for which `iswalpha' or `iswdigit' is + true. */ +extern int iswalnum_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any wide character for which `iswupper' or 'iswlower' is + true, or any wide character that is one of a locale-specific set of + wide-characters for which none of `iswcntrl', `iswdigit', + `iswpunct', or `iswspace' is true. */ +extern int iswalpha_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any control wide character. */ +extern int iswcntrl_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a decimal-digit + character. */ +extern int iswdigit_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any wide character for which `iswprint' is true and + `iswspace' is false. */ +extern int iswgraph_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a lowercase letter + or is one of a locale-specific set of wide characters for which + none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +extern int iswlower_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any printing wide character. */ +extern int iswprint_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any printing wide character that is one of a + locale-specific et of wide characters for which neither `iswspace' + nor `iswalnum' is true. */ +extern int iswpunct_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a locale-specific + set of wide characters for which none of `iswalnum', `iswgraph', or + `iswpunct' is true. */ +extern int iswspace_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to an uppercase letter + or is one of a locale-specific set of wide character for which none + of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */ +extern int iswupper_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a hexadecimal-digit + character equivalent to that performed be the functions described + in the previous subclause. */ +extern int iswxdigit_l (wint_t __wc, locale_t __locale) __THROW; + +/* Test for any wide character that corresponds to a standard blank + wide character or a locale-specific set of wide characters for + which `iswalnum' is false. */ +extern int iswblank_l (wint_t __wc, locale_t __locale) __THROW; + +/* Construct value that describes a class of wide characters identified + by the string argument PROPERTY. */ +extern wctype_t wctype_l (const char *__property, locale_t __locale) + __THROW; + +/* Determine whether the wide-character WC has the property described by + DESC. */ +extern int iswctype_l (wint_t __wc, wctype_t __desc, locale_t __locale) + __THROW; + +/* + * Wide-character case-mapping functions. + */ + +/* Converts an uppercase letter to the corresponding lowercase letter. */ +extern wint_t towlower_l (wint_t __wc, locale_t __locale) __THROW; + +/* Converts an lowercase letter to the corresponding uppercase letter. */ +extern wint_t towupper_l (wint_t __wc, locale_t __locale) __THROW; + +/* Construct value that describes a mapping between wide characters + identified by the string argument PROPERTY. */ +extern wctrans_t wctrans_l (const char *__property, locale_t __locale) + __THROW; + +/* Map the wide character WC using the mapping described by DESC. */ +extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc, + locale_t __locale) __THROW; + +# endif /* Use POSIX 2008. */ + +__END_DECLS + +#endif /* wctype.h */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wctype.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wctype.h.blob new file mode 100644 index 0000000..30cc8e3 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@include@wctype.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stdarg___gnuc_va_list.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stdarg___gnuc_va_list.h new file mode 100644 index 0000000..2a0a7e8 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stdarg___gnuc_va_list.h @@ -0,0 +1,13 @@ +/*===---- __stdarg___gnuc_va_list.h - Definition of __gnuc_va_list ---------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef __builtin_va_list __gnuc_va_list; +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stdarg___gnuc_va_list.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stdarg___gnuc_va_list.h.blob new file mode 100644 index 0000000..24b6b4a Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stdarg___gnuc_va_list.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_header_macro.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_header_macro.h new file mode 100644 index 0000000..db5fb3c --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_header_macro.h @@ -0,0 +1,12 @@ +/*===---- __stddef_header_macro.h ------------------------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __STDDEF_H +#define __STDDEF_H +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_header_macro.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_header_macro.h.blob new file mode 100644 index 0000000..5a3c62a Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_header_macro.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_max_align_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_max_align_t.h new file mode 100644 index 0000000..512606a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_max_align_t.h @@ -0,0 +1,27 @@ +/*===---- __stddef_max_align_t.h - Definition of max_align_t ---------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __CLANG_MAX_ALIGN_T_DEFINED +#define __CLANG_MAX_ALIGN_T_DEFINED + +#if defined(_MSC_VER) +typedef double max_align_t; +#elif defined(__APPLE__) +typedef long double max_align_t; +#else +// Define 'max_align_t' to match the GCC definition. +typedef struct { + long long __clang_max_align_nonce1 + __attribute__((__aligned__(__alignof__(long long)))); + long double __clang_max_align_nonce2 + __attribute__((__aligned__(__alignof__(long double)))); +} max_align_t; +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_max_align_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_max_align_t.h.blob new file mode 100644 index 0000000..2f64093 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_max_align_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_null.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_null.h new file mode 100644 index 0000000..c10bd2d --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_null.h @@ -0,0 +1,29 @@ +/*===---- __stddef_null.h - Definition of NULL -----------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#if !defined(NULL) || !__building_module(_Builtin_stddef) + +/* linux/stddef.h will define NULL to 0. glibc (and other) headers then define + * __need_NULL and rely on stddef.h to redefine NULL to the correct value again. + * Modules don't support redefining macros like that, but support that pattern + * in the non-modules case. + */ +#undef NULL + +#ifdef __cplusplus +#if !defined(__MINGW32__) && !defined(_MSC_VER) +#define NULL __null +#else +#define NULL 0 +#endif +#else +#define NULL ((void*)0) +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_null.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_null.h.blob new file mode 100644 index 0000000..dd72dbb Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_null.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_nullptr_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_nullptr_t.h new file mode 100644 index 0000000..7f3fbe6 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_nullptr_t.h @@ -0,0 +1,29 @@ +/*===---- __stddef_nullptr_t.h - Definition of nullptr_t -------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_NULLPTR_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _NULLPTR_T + +#ifdef __cplusplus +#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) +namespace std { +typedef decltype(nullptr) nullptr_t; +} +using ::std::nullptr_t; +#endif +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +typedef typeof(nullptr) nullptr_t; +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_nullptr_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_nullptr_t.h.blob new file mode 100644 index 0000000..b8d6ce5 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_nullptr_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_offsetof.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_offsetof.h new file mode 100644 index 0000000..84172c6 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_offsetof.h @@ -0,0 +1,17 @@ +/*===---- __stddef_offsetof.h - Definition of offsetof ---------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(offsetof) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define offsetof(t, d) __builtin_offsetof(t, d) +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_offsetof.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_offsetof.h.blob new file mode 100644 index 0000000..4c00e1d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_offsetof.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_ptrdiff_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_ptrdiff_t.h new file mode 100644 index 0000000..fd3c893 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_ptrdiff_t.h @@ -0,0 +1,20 @@ +/*===---- __stddef_ptrdiff_t.h - Definition of ptrdiff_t -------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_PTRDIFF_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _PTRDIFF_T + +typedef __PTRDIFF_TYPE__ ptrdiff_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_ptrdiff_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_ptrdiff_t.h.blob new file mode 100644 index 0000000..478c08a Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_ptrdiff_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_size_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_size_t.h new file mode 100644 index 0000000..3dd7b1f --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_size_t.h @@ -0,0 +1,20 @@ +/*===---- __stddef_size_t.h - Definition of size_t -------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_SIZE_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _SIZE_T + +typedef __SIZE_TYPE__ size_t; + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_size_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_size_t.h.blob new file mode 100644 index 0000000..4a5f35d Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_size_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_wchar_t.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_wchar_t.h new file mode 100644 index 0000000..bd69f63 --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_wchar_t.h @@ -0,0 +1,28 @@ +/*===---- __stddef_wchar.h - Definition of wchar_t -------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#if !defined(__cplusplus) || (defined(_MSC_VER) && !_NATIVE_WCHAR_T_DEFINED) + +/* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +#if !defined(_WCHAR_T) || \ + (__has_feature(modules) && !__building_module(_Builtin_stddef)) +#define _WCHAR_T + +#ifdef _MSC_EXTENSIONS +#define _WCHAR_T_DEFINED +#endif + +typedef __WCHAR_TYPE__ wchar_t; + +#endif + +#endif diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_wchar_t.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_wchar_t.h.blob new file mode 100644 index 0000000..356f8f6 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@__stddef_wchar_t.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdarg.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdarg.h new file mode 100644 index 0000000..6203d7a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdarg.h @@ -0,0 +1,75 @@ +/*===---- stdarg.h - Variable argument handling ----------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * This header is designed to be included multiple times. If any of the __need_ + * macros are defined, then only that subset of interfaces are provided. This + * can be useful for POSIX headers that need to not expose all of stdarg.h, but + * need to use some of its interfaces. Otherwise this header provides all of + * the expected interfaces. + * + * When clang modules are enabled, this header is a textual header to support + * the multiple include behavior. As such, it doesn't directly declare anything + * so that it doesn't add duplicate declarations to all of its includers' + * modules. + */ +#if defined(__MVS__) && __has_include_next() +#undef __need___va_list +#undef __need_va_list +#undef __need_va_arg +#undef __need___va_copy +#undef __need_va_copy +#include <__stdarg_header_macro.h> +#include_next + +#else +#if !defined(__need___va_list) && !defined(__need_va_list) && \ + !defined(__need_va_arg) && !defined(__need___va_copy) && \ + !defined(__need_va_copy) +#define __need___va_list +#define __need_va_list +#define __need_va_arg +#define __need___va_copy +/* GCC always defines __va_copy, but does not define va_copy unless in c99 mode + * or -ansi is not specified, since it was not part of C90. + */ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + (defined(__cplusplus) && __cplusplus >= 201103L) || \ + !defined(__STRICT_ANSI__) +#define __need_va_copy +#endif +#include <__stdarg_header_macro.h> +#endif + +#ifdef __need___va_list +#include <__stdarg___gnuc_va_list.h> +#undef __need___va_list +#endif /* defined(__need___va_list) */ + +#ifdef __need_va_list +#include <__stdarg_va_list.h> +#undef __need_va_list +#endif /* defined(__need_va_list) */ + +#ifdef __need_va_arg +#include <__stdarg_va_arg.h> +#undef __need_va_arg +#endif /* defined(__need_va_arg) */ + +#ifdef __need___va_copy +#include <__stdarg___va_copy.h> +#undef __need___va_copy +#endif /* defined(__need___va_copy) */ + +#ifdef __need_va_copy +#include <__stdarg_va_copy.h> +#undef __need_va_copy +#endif /* defined(__need_va_copy) */ + +#endif /* __MVS__ */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdarg.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdarg.h.blob new file mode 100644 index 0000000..5f72d57 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdarg.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stddef.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stddef.h new file mode 100644 index 0000000..99b275a --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stddef.h @@ -0,0 +1,139 @@ +/*===---- stddef.h - Basic type definitions --------------------------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +/* + * This header is designed to be included multiple times. If any of the __need_ + * macros are defined, then only that subset of interfaces are provided. This + * can be useful for POSIX headers that need to not expose all of stddef.h, but + * need to use some of its interfaces. Otherwise this header provides all of + * the expected interfaces. + * + * When clang modules are enabled, this header is a textual header to support + * the multiple include behavior. As such, it doesn't directly declare anything + * so that it doesn't add duplicate declarations to all of its includers' + * modules. + */ +#if defined(__MVS__) && __has_include_next() +#undef __need_ptrdiff_t +#undef __need_size_t +#undef __need_rsize_t +#undef __need_wchar_t +#undef __need_NULL +#undef __need_nullptr_t +#undef __need_unreachable +#undef __need_max_align_t +#undef __need_offsetof +#undef __need_wint_t +#include <__stddef_header_macro.h> +#include_next + +#else + +#if !defined(__need_ptrdiff_t) && !defined(__need_size_t) && \ + !defined(__need_rsize_t) && !defined(__need_wchar_t) && \ + !defined(__need_NULL) && !defined(__need_nullptr_t) && \ + !defined(__need_unreachable) && !defined(__need_max_align_t) && \ + !defined(__need_offsetof) && !defined(__need_wint_t) +#define __need_ptrdiff_t +#define __need_size_t +/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is + * enabled. */ +#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 +#define __need_rsize_t +#endif +#define __need_wchar_t +#if !defined(__STDDEF_H) || __has_feature(modules) +/* + * __stddef_null.h is special when building without modules: if __need_NULL is + * set, then it will unconditionally redefine NULL. To avoid stepping on client + * definitions of NULL, __need_NULL should only be set the first time this + * header is included, that is when __STDDEF_H is not defined. However, when + * building with modules, this header is a textual header and needs to + * unconditionally include __stdef_null.h to support multiple submodules + * exporting _Builtin_stddef.null. Take module SM with submodules A and B, whose + * headers both include stddef.h When SM.A builds, __STDDEF_H will be defined. + * When SM.B builds, the definition from SM.A will leak when building without + * local submodule visibility. stddef.h wouldn't include __stddef_null.h, and + * SM.B wouldn't import _Builtin_stddef.null, and SM.B's `export *` wouldn't + * export NULL as expected. When building with modules, always include + * __stddef_null.h so that everything works as expected. + */ +#define __need_NULL +#endif +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \ + defined(__cplusplus) +#define __need_nullptr_t +#endif +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +#define __need_unreachable +#endif +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ + (defined(__cplusplus) && __cplusplus >= 201103L) +#define __need_max_align_t +#endif +#define __need_offsetof +/* wint_t is provided by and not . It's here + * for compatibility, but must be explicitly requested. Therefore + * __need_wint_t is intentionally not defined here. */ +#include <__stddef_header_macro.h> +#endif + +#if defined(__need_ptrdiff_t) +#include <__stddef_ptrdiff_t.h> +#undef __need_ptrdiff_t +#endif /* defined(__need_ptrdiff_t) */ + +#if defined(__need_size_t) +#include <__stddef_size_t.h> +#undef __need_size_t +#endif /*defined(__need_size_t) */ + +#if defined(__need_rsize_t) +#include <__stddef_rsize_t.h> +#undef __need_rsize_t +#endif /* defined(__need_rsize_t) */ + +#if defined(__need_wchar_t) +#include <__stddef_wchar_t.h> +#undef __need_wchar_t +#endif /* defined(__need_wchar_t) */ + +#if defined(__need_NULL) +#include <__stddef_null.h> +#undef __need_NULL +#endif /* defined(__need_NULL) */ + +#if defined(__need_nullptr_t) +#include <__stddef_nullptr_t.h> +#undef __need_nullptr_t +#endif /* defined(__need_nullptr_t) */ + +#if defined(__need_unreachable) +#include <__stddef_unreachable.h> +#undef __need_unreachable +#endif /* defined(__need_unreachable) */ + +#if defined(__need_max_align_t) +#include <__stddef_max_align_t.h> +#undef __need_max_align_t +#endif /* defined(__need_max_align_t) */ + +#if defined(__need_offsetof) +#include <__stddef_offsetof.h> +#undef __need_offsetof +#endif /* defined(__need_offsetof) */ + +/* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use +__WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */ +#if defined(__need_wint_t) +#include <__stddef_wint_t.h> +#undef __need_wint_t +#endif /* __need_wint_t */ + +#endif /* __MVS__ */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stddef.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stddef.h.blob new file mode 100644 index 0000000..494ca11 Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stddef.h.blob differ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdint.h b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdint.h new file mode 100644 index 0000000..96c2cca --- /dev/null +++ b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdint.h @@ -0,0 +1,844 @@ +/*===---- stdint.h - Standard header for sized integer types --------------===*\ + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * +\*===----------------------------------------------------------------------===*/ + +#ifndef __CLANG_STDINT_H +// AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T +// is defined until an inclusion of it without _STD_TYPES_T occurs, in which +// case the header guard macro is defined. +#if !defined(_AIX) || !defined(_STD_TYPES_T) || !defined(__STDC_HOSTED__) +#define __CLANG_STDINT_H +#endif + +#if defined(__MVS__) && __has_include_next() +#include_next +#else + +/* If we're hosted, fall back to the system's stdint.h, which might have + * additional definitions. + */ +#if __STDC_HOSTED__ && __has_include_next() + +// C99 7.18.3 Limits of other integer types +// +// Footnote 219, 220: C++ implementations should define these macros only when +// __STDC_LIMIT_MACROS is defined before is included. +// +// Footnote 222: C++ implementations should define these macros only when +// __STDC_CONSTANT_MACROS is defined before is included. +// +// C++11 [cstdint.syn]p2: +// +// The macros defined by are provided unconditionally. In particular, +// the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in +// footnotes 219, 220, and 222 in the C standard) play no role in C++. +// +// C11 removed the problematic footnotes. +// +// Work around this inconsistency by always defining those macros in C++ mode, +// so that a C library implementation which follows the C99 standard can be +// used in C++. +# ifdef __cplusplus +# if !defined(__STDC_LIMIT_MACROS) +# define __STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG +# endif +# if !defined(__STDC_CONSTANT_MACROS) +# define __STDC_CONSTANT_MACROS +# define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG +# endif +# endif + +# include_next + +# ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG +# undef __STDC_LIMIT_MACROS +# undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG +# endif +# ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG +# undef __STDC_CONSTANT_MACROS +# undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG +# endif + +#else + +/* C99 7.18.1.1 Exact-width integer types. + * C99 7.18.1.2 Minimum-width integer types. + * C99 7.18.1.3 Fastest minimum-width integer types. + * + * The standard requires that exact-width type be defined for 8-, 16-, 32-, and + * 64-bit types if they are implemented. Other exact width types are optional. + * This implementation defines an exact-width types for every integer width + * that is represented in the standard integer types. + * + * The standard also requires minimum-width types be defined for 8-, 16-, 32-, + * and 64-bit widths regardless of whether there are corresponding exact-width + * types. + * + * To accommodate targets that are missing types that are exactly 8, 16, 32, or + * 64 bits wide, this implementation takes an approach of cascading + * redefinitions, redefining __int_leastN_t to successively smaller exact-width + * types. It is therefore important that the types are defined in order of + * descending widths. + * + * We currently assume that the minimum-width types and the fastest + * minimum-width types are the same. This is allowed by the standard, but is + * suboptimal. + * + * In violation of the standard, some targets do not implement a type that is + * wide enough to represent all of the required widths (8-, 16-, 32-, 64-bit). + * To accommodate these targets, a required minimum-width type is only + * defined if there exists an exact-width type of equal or greater width. + */ + +#ifdef __INT64_TYPE__ +# ifndef __int8_t_defined /* glibc sys/types.h also defines int64_t*/ +typedef __INT64_TYPE__ int64_t; +# endif /* __int8_t_defined */ +typedef __UINT64_TYPE__ uint64_t; +# undef __int_least64_t +# define __int_least64_t int64_t +# undef __uint_least64_t +# define __uint_least64_t uint64_t +# undef __int_least32_t +# define __int_least32_t int64_t +# undef __uint_least32_t +# define __uint_least32_t uint64_t +# undef __int_least16_t +# define __int_least16_t int64_t +# undef __uint_least16_t +# define __uint_least16_t uint64_t +# undef __int_least8_t +# define __int_least8_t int64_t +# undef __uint_least8_t +# define __uint_least8_t uint64_t +#endif /* __INT64_TYPE__ */ + +#ifdef __int_least64_t +typedef __int_least64_t int_least64_t; +typedef __uint_least64_t uint_least64_t; +typedef __int_least64_t int_fast64_t; +typedef __uint_least64_t uint_fast64_t; +#endif /* __int_least64_t */ + +#ifdef __INT56_TYPE__ +typedef __INT56_TYPE__ int56_t; +typedef __UINT56_TYPE__ uint56_t; +typedef int56_t int_least56_t; +typedef uint56_t uint_least56_t; +typedef int56_t int_fast56_t; +typedef uint56_t uint_fast56_t; +# undef __int_least32_t +# define __int_least32_t int56_t +# undef __uint_least32_t +# define __uint_least32_t uint56_t +# undef __int_least16_t +# define __int_least16_t int56_t +# undef __uint_least16_t +# define __uint_least16_t uint56_t +# undef __int_least8_t +# define __int_least8_t int56_t +# undef __uint_least8_t +# define __uint_least8_t uint56_t +#endif /* __INT56_TYPE__ */ + + +#ifdef __INT48_TYPE__ +typedef __INT48_TYPE__ int48_t; +typedef __UINT48_TYPE__ uint48_t; +typedef int48_t int_least48_t; +typedef uint48_t uint_least48_t; +typedef int48_t int_fast48_t; +typedef uint48_t uint_fast48_t; +# undef __int_least32_t +# define __int_least32_t int48_t +# undef __uint_least32_t +# define __uint_least32_t uint48_t +# undef __int_least16_t +# define __int_least16_t int48_t +# undef __uint_least16_t +# define __uint_least16_t uint48_t +# undef __int_least8_t +# define __int_least8_t int48_t +# undef __uint_least8_t +# define __uint_least8_t uint48_t +#endif /* __INT48_TYPE__ */ + + +#ifdef __INT40_TYPE__ +typedef __INT40_TYPE__ int40_t; +typedef __UINT40_TYPE__ uint40_t; +typedef int40_t int_least40_t; +typedef uint40_t uint_least40_t; +typedef int40_t int_fast40_t; +typedef uint40_t uint_fast40_t; +# undef __int_least32_t +# define __int_least32_t int40_t +# undef __uint_least32_t +# define __uint_least32_t uint40_t +# undef __int_least16_t +# define __int_least16_t int40_t +# undef __uint_least16_t +# define __uint_least16_t uint40_t +# undef __int_least8_t +# define __int_least8_t int40_t +# undef __uint_least8_t +# define __uint_least8_t uint40_t +#endif /* __INT40_TYPE__ */ + + +#ifdef __INT32_TYPE__ + +# ifndef __int8_t_defined /* glibc sys/types.h also defines int32_t*/ +typedef __INT32_TYPE__ int32_t; +# endif /* __int8_t_defined */ + +# ifndef __uint32_t_defined /* more glibc compatibility */ +# define __uint32_t_defined +typedef __UINT32_TYPE__ uint32_t; +# endif /* __uint32_t_defined */ + +# undef __int_least32_t +# define __int_least32_t int32_t +# undef __uint_least32_t +# define __uint_least32_t uint32_t +# undef __int_least16_t +# define __int_least16_t int32_t +# undef __uint_least16_t +# define __uint_least16_t uint32_t +# undef __int_least8_t +# define __int_least8_t int32_t +# undef __uint_least8_t +# define __uint_least8_t uint32_t +#endif /* __INT32_TYPE__ */ + +#ifdef __int_least32_t +typedef __int_least32_t int_least32_t; +typedef __uint_least32_t uint_least32_t; +typedef __int_least32_t int_fast32_t; +typedef __uint_least32_t uint_fast32_t; +#endif /* __int_least32_t */ + +#ifdef __INT24_TYPE__ +typedef __INT24_TYPE__ int24_t; +typedef __UINT24_TYPE__ uint24_t; +typedef int24_t int_least24_t; +typedef uint24_t uint_least24_t; +typedef int24_t int_fast24_t; +typedef uint24_t uint_fast24_t; +# undef __int_least16_t +# define __int_least16_t int24_t +# undef __uint_least16_t +# define __uint_least16_t uint24_t +# undef __int_least8_t +# define __int_least8_t int24_t +# undef __uint_least8_t +# define __uint_least8_t uint24_t +#endif /* __INT24_TYPE__ */ + +#ifdef __INT16_TYPE__ +#ifndef __int8_t_defined /* glibc sys/types.h also defines int16_t*/ +typedef __INT16_TYPE__ int16_t; +#endif /* __int8_t_defined */ +typedef __UINT16_TYPE__ uint16_t; +# undef __int_least16_t +# define __int_least16_t int16_t +# undef __uint_least16_t +# define __uint_least16_t uint16_t +# undef __int_least8_t +# define __int_least8_t int16_t +# undef __uint_least8_t +# define __uint_least8_t uint16_t +#endif /* __INT16_TYPE__ */ + +#ifdef __int_least16_t +typedef __int_least16_t int_least16_t; +typedef __uint_least16_t uint_least16_t; +typedef __int_least16_t int_fast16_t; +typedef __uint_least16_t uint_fast16_t; +#endif /* __int_least16_t */ + + +#ifdef __INT8_TYPE__ +#ifndef __int8_t_defined /* glibc sys/types.h also defines int8_t*/ +typedef __INT8_TYPE__ int8_t; +#endif /* __int8_t_defined */ +typedef __UINT8_TYPE__ uint8_t; +# undef __int_least8_t +# define __int_least8_t int8_t +# undef __uint_least8_t +# define __uint_least8_t uint8_t +#endif /* __INT8_TYPE__ */ + +#ifdef __int_least8_t +typedef __int_least8_t int_least8_t; +typedef __uint_least8_t uint_least8_t; +typedef __int_least8_t int_fast8_t; +typedef __uint_least8_t uint_fast8_t; +#endif /* __int_least8_t */ + +/* prevent glibc sys/types.h from defining conflicting types */ +#ifndef __int8_t_defined +# define __int8_t_defined +#endif /* __int8_t_defined */ + +/* C99 7.18.1.4 Integer types capable of holding object pointers. + */ +#define __stdint_join3(a,b,c) a ## b ## c + +#ifndef _INTPTR_T +#ifndef __intptr_t_defined +typedef __INTPTR_TYPE__ intptr_t; +#define __intptr_t_defined +#define _INTPTR_T +#endif +#endif + +#ifndef _UINTPTR_T +typedef __UINTPTR_TYPE__ uintptr_t; +#define _UINTPTR_T +#endif + +/* C99 7.18.1.5 Greatest-width integer types. + */ +typedef __INTMAX_TYPE__ intmax_t; +typedef __UINTMAX_TYPE__ uintmax_t; + +/* C99 7.18.4 Macros for minimum-width integer constants. + * + * The standard requires that integer constant macros be defined for all the + * minimum-width types defined above. As 8-, 16-, 32-, and 64-bit minimum-width + * types are required, the corresponding integer constant macros are defined + * here. This implementation also defines minimum-width types for every other + * integer width that the target implements, so corresponding macros are + * defined below, too. + * + * Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the + * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]). + */ + +#ifdef __int_least64_t +#define INT64_C(v) __INT64_C(v) +#define UINT64_C(v) __UINT64_C(v) +#endif /* __int_least64_t */ + + +#ifdef __INT56_TYPE__ +#define INT56_C(v) __INT56_C(v) +#define UINT56_C(v) __UINT56_C(v) +#endif /* __INT56_TYPE__ */ + + +#ifdef __INT48_TYPE__ +#define INT48_C(v) __INT48_C(v) +#define UINT48_C(v) __UINT48_C(v) +#endif /* __INT48_TYPE__ */ + + +#ifdef __INT40_TYPE__ +#define INT40_C(v) __INT40_C(v) +#define UINT40_C(v) __UINT40_C(v) +#endif /* __INT40_TYPE__ */ + + +#ifdef __int_least32_t +#define INT32_C(v) __INT32_C(v) +#define UINT32_C(v) __UINT32_C(v) +#endif /* __int_least32_t */ + + +#ifdef __INT24_TYPE__ +#define INT24_C(v) __INT24_C(v) +#define UINT24_C(v) __UINT24_C(v) +#endif /* __INT24_TYPE__ */ + + +#ifdef __int_least16_t +#define INT16_C(v) __INT16_C(v) +#define UINT16_C(v) __UINT16_C(v) +#endif /* __int_least16_t */ + + +#ifdef __int_least8_t +#define INT8_C(v) __INT8_C(v) +#define UINT8_C(v) __UINT8_C(v) +#endif /* __int_least8_t */ + + +/* C99 7.18.2.1 Limits of exact-width integer types. + * C99 7.18.2.2 Limits of minimum-width integer types. + * C99 7.18.2.3 Limits of fastest minimum-width integer types. + * + * The presence of limit macros are completely optional in C99. This + * implementation defines limits for all of the types (exact- and + * minimum-width) that it defines above, using the limits of the minimum-width + * type for any types that do not have exact-width representations. + * + * As in the type definitions, this section takes an approach of + * successive-shrinking to determine which limits to use for the standard (8, + * 16, 32, 64) bit widths when they don't have exact representations. It is + * therefore important that the definitions be kept in order of decending + * widths. + * + * Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the + * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]). + */ + +#ifdef __INT64_TYPE__ +# define INT64_MAX INT64_C( 9223372036854775807) +# define INT64_MIN (-INT64_C( 9223372036854775807)-1) +# define UINT64_MAX UINT64_C(18446744073709551615) + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT64_WIDTH 64 +# define INT64_WIDTH UINT64_WIDTH + +# define __UINT_LEAST64_WIDTH UINT64_WIDTH +# undef __UINT_LEAST32_WIDTH +# define __UINT_LEAST32_WIDTH UINT64_WIDTH +# undef __UINT_LEAST16_WIDTH +# define __UINT_LEAST16_WIDTH UINT64_WIDTH +# undef __UINT_LEAST8_MAX +# define __UINT_LEAST8_MAX UINT64_MAX +#endif /* __STDC_VERSION__ */ + +# define __INT_LEAST64_MIN INT64_MIN +# define __INT_LEAST64_MAX INT64_MAX +# define __UINT_LEAST64_MAX UINT64_MAX +# undef __INT_LEAST32_MIN +# define __INT_LEAST32_MIN INT64_MIN +# undef __INT_LEAST32_MAX +# define __INT_LEAST32_MAX INT64_MAX +# undef __UINT_LEAST32_MAX +# define __UINT_LEAST32_MAX UINT64_MAX +# undef __INT_LEAST16_MIN +# define __INT_LEAST16_MIN INT64_MIN +# undef __INT_LEAST16_MAX +# define __INT_LEAST16_MAX INT64_MAX +# undef __UINT_LEAST16_MAX +# define __UINT_LEAST16_MAX UINT64_MAX +# undef __INT_LEAST8_MIN +# define __INT_LEAST8_MIN INT64_MIN +# undef __INT_LEAST8_MAX +# define __INT_LEAST8_MAX INT64_MAX +# undef __UINT_LEAST8_MAX +# define __UINT_LEAST8_MAX UINT64_MAX +#endif /* __INT64_TYPE__ */ + +#ifdef __INT_LEAST64_MIN +# define INT_LEAST64_MIN __INT_LEAST64_MIN +# define INT_LEAST64_MAX __INT_LEAST64_MAX +# define UINT_LEAST64_MAX __UINT_LEAST64_MAX +# define INT_FAST64_MIN __INT_LEAST64_MIN +# define INT_FAST64_MAX __INT_LEAST64_MAX +# define UINT_FAST64_MAX __UINT_LEAST64_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT_LEAST64_WIDTH __UINT_LEAST64_WIDTH +# define INT_LEAST64_WIDTH UINT_LEAST64_WIDTH +# define UINT_FAST64_WIDTH __UINT_LEAST64_WIDTH +# define INT_FAST64_WIDTH UINT_FAST64_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT_LEAST64_MIN */ + + +#ifdef __INT56_TYPE__ +# define INT56_MAX INT56_C(36028797018963967) +# define INT56_MIN (-INT56_C(36028797018963967)-1) +# define UINT56_MAX UINT56_C(72057594037927935) +# define INT_LEAST56_MIN INT56_MIN +# define INT_LEAST56_MAX INT56_MAX +# define UINT_LEAST56_MAX UINT56_MAX +# define INT_FAST56_MIN INT56_MIN +# define INT_FAST56_MAX INT56_MAX +# define UINT_FAST56_MAX UINT56_MAX + +# undef __INT_LEAST32_MIN +# define __INT_LEAST32_MIN INT56_MIN +# undef __INT_LEAST32_MAX +# define __INT_LEAST32_MAX INT56_MAX +# undef __UINT_LEAST32_MAX +# define __UINT_LEAST32_MAX UINT56_MAX +# undef __INT_LEAST16_MIN +# define __INT_LEAST16_MIN INT56_MIN +# undef __INT_LEAST16_MAX +# define __INT_LEAST16_MAX INT56_MAX +# undef __UINT_LEAST16_MAX +# define __UINT_LEAST16_MAX UINT56_MAX +# undef __INT_LEAST8_MIN +# define __INT_LEAST8_MIN INT56_MIN +# undef __INT_LEAST8_MAX +# define __INT_LEAST8_MAX INT56_MAX +# undef __UINT_LEAST8_MAX +# define __UINT_LEAST8_MAX UINT56_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT56_WIDTH 56 +# define INT56_WIDTH UINT56_WIDTH +# define UINT_LEAST56_WIDTH UINT56_WIDTH +# define INT_LEAST56_WIDTH UINT_LEAST56_WIDTH +# define UINT_FAST56_WIDTH UINT56_WIDTH +# define INT_FAST56_WIDTH UINT_FAST56_WIDTH +# undef __UINT_LEAST32_WIDTH +# define __UINT_LEAST32_WIDTH UINT56_WIDTH +# undef __UINT_LEAST16_WIDTH +# define __UINT_LEAST16_WIDTH UINT56_WIDTH +# undef __UINT_LEAST8_WIDTH +# define __UINT_LEAST8_WIDTH UINT56_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT56_TYPE__ */ + + +#ifdef __INT48_TYPE__ +# define INT48_MAX INT48_C(140737488355327) +# define INT48_MIN (-INT48_C(140737488355327)-1) +# define UINT48_MAX UINT48_C(281474976710655) +# define INT_LEAST48_MIN INT48_MIN +# define INT_LEAST48_MAX INT48_MAX +# define UINT_LEAST48_MAX UINT48_MAX +# define INT_FAST48_MIN INT48_MIN +# define INT_FAST48_MAX INT48_MAX +# define UINT_FAST48_MAX UINT48_MAX + +# undef __INT_LEAST32_MIN +# define __INT_LEAST32_MIN INT48_MIN +# undef __INT_LEAST32_MAX +# define __INT_LEAST32_MAX INT48_MAX +# undef __UINT_LEAST32_MAX +# define __UINT_LEAST32_MAX UINT48_MAX +# undef __INT_LEAST16_MIN +# define __INT_LEAST16_MIN INT48_MIN +# undef __INT_LEAST16_MAX +# define __INT_LEAST16_MAX INT48_MAX +# undef __UINT_LEAST16_MAX +# define __UINT_LEAST16_MAX UINT48_MAX +# undef __INT_LEAST8_MIN +# define __INT_LEAST8_MIN INT48_MIN +# undef __INT_LEAST8_MAX +# define __INT_LEAST8_MAX INT48_MAX +# undef __UINT_LEAST8_MAX +# define __UINT_LEAST8_MAX UINT48_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +#define UINT48_WIDTH 48 +#define INT48_WIDTH UINT48_WIDTH +#define UINT_LEAST48_WIDTH UINT48_WIDTH +#define INT_LEAST48_WIDTH UINT_LEAST48_WIDTH +#define UINT_FAST48_WIDTH UINT48_WIDTH +#define INT_FAST48_WIDTH UINT_FAST48_WIDTH +#undef __UINT_LEAST32_WIDTH +#define __UINT_LEAST32_WIDTH UINT48_WIDTH +# undef __UINT_LEAST16_WIDTH +#define __UINT_LEAST16_WIDTH UINT48_WIDTH +# undef __UINT_LEAST8_WIDTH +#define __UINT_LEAST8_WIDTH UINT48_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT48_TYPE__ */ + + +#ifdef __INT40_TYPE__ +# define INT40_MAX INT40_C(549755813887) +# define INT40_MIN (-INT40_C(549755813887)-1) +# define UINT40_MAX UINT40_C(1099511627775) +# define INT_LEAST40_MIN INT40_MIN +# define INT_LEAST40_MAX INT40_MAX +# define UINT_LEAST40_MAX UINT40_MAX +# define INT_FAST40_MIN INT40_MIN +# define INT_FAST40_MAX INT40_MAX +# define UINT_FAST40_MAX UINT40_MAX + +# undef __INT_LEAST32_MIN +# define __INT_LEAST32_MIN INT40_MIN +# undef __INT_LEAST32_MAX +# define __INT_LEAST32_MAX INT40_MAX +# undef __UINT_LEAST32_MAX +# define __UINT_LEAST32_MAX UINT40_MAX +# undef __INT_LEAST16_MIN +# define __INT_LEAST16_MIN INT40_MIN +# undef __INT_LEAST16_MAX +# define __INT_LEAST16_MAX INT40_MAX +# undef __UINT_LEAST16_MAX +# define __UINT_LEAST16_MAX UINT40_MAX +# undef __INT_LEAST8_MIN +# define __INT_LEAST8_MIN INT40_MIN +# undef __INT_LEAST8_MAX +# define __INT_LEAST8_MAX INT40_MAX +# undef __UINT_LEAST8_MAX +# define __UINT_LEAST8_MAX UINT40_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT40_WIDTH 40 +# define INT40_WIDTH UINT40_WIDTH +# define UINT_LEAST40_WIDTH UINT40_WIDTH +# define INT_LEAST40_WIDTH UINT_LEAST40_WIDTH +# define UINT_FAST40_WIDTH UINT40_WIDTH +# define INT_FAST40_WIDTH UINT_FAST40_WIDTH +# undef __UINT_LEAST32_WIDTH +# define __UINT_LEAST32_WIDTH UINT40_WIDTH +# undef __UINT_LEAST16_WIDTH +# define __UINT_LEAST16_WIDTH UINT40_WIDTH +# undef __UINT_LEAST8_WIDTH +# define __UINT_LEAST8_WIDTH UINT40_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT40_TYPE__ */ + + +#ifdef __INT32_TYPE__ +# define INT32_MAX INT32_C(2147483647) +# define INT32_MIN (-INT32_C(2147483647)-1) +# define UINT32_MAX UINT32_C(4294967295) + +# undef __INT_LEAST32_MIN +# define __INT_LEAST32_MIN INT32_MIN +# undef __INT_LEAST32_MAX +# define __INT_LEAST32_MAX INT32_MAX +# undef __UINT_LEAST32_MAX +# define __UINT_LEAST32_MAX UINT32_MAX +# undef __INT_LEAST16_MIN +# define __INT_LEAST16_MIN INT32_MIN +# undef __INT_LEAST16_MAX +# define __INT_LEAST16_MAX INT32_MAX +# undef __UINT_LEAST16_MAX +# define __UINT_LEAST16_MAX UINT32_MAX +# undef __INT_LEAST8_MIN +# define __INT_LEAST8_MIN INT32_MIN +# undef __INT_LEAST8_MAX +# define __INT_LEAST8_MAX INT32_MAX +# undef __UINT_LEAST8_MAX +# define __UINT_LEAST8_MAX UINT32_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT32_WIDTH 32 +# define INT32_WIDTH UINT32_WIDTH +# undef __UINT_LEAST32_WIDTH +# define __UINT_LEAST32_WIDTH UINT32_WIDTH +# undef __UINT_LEAST16_WIDTH +# define __UINT_LEAST16_WIDTH UINT32_WIDTH +# undef __UINT_LEAST8_WIDTH +# define __UINT_LEAST8_WIDTH UINT32_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT32_TYPE__ */ + +#ifdef __INT_LEAST32_MIN +# define INT_LEAST32_MIN __INT_LEAST32_MIN +# define INT_LEAST32_MAX __INT_LEAST32_MAX +# define UINT_LEAST32_MAX __UINT_LEAST32_MAX +# define INT_FAST32_MIN __INT_LEAST32_MIN +# define INT_FAST32_MAX __INT_LEAST32_MAX +# define UINT_FAST32_MAX __UINT_LEAST32_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT_LEAST32_WIDTH __UINT_LEAST32_WIDTH +# define INT_LEAST32_WIDTH UINT_LEAST32_WIDTH +# define UINT_FAST32_WIDTH __UINT_LEAST32_WIDTH +# define INT_FAST32_WIDTH UINT_FAST32_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT_LEAST32_MIN */ + + +#ifdef __INT24_TYPE__ +# define INT24_MAX INT24_C(8388607) +# define INT24_MIN (-INT24_C(8388607)-1) +# define UINT24_MAX UINT24_C(16777215) +# define INT_LEAST24_MIN INT24_MIN +# define INT_LEAST24_MAX INT24_MAX +# define UINT_LEAST24_MAX UINT24_MAX +# define INT_FAST24_MIN INT24_MIN +# define INT_FAST24_MAX INT24_MAX +# define UINT_FAST24_MAX UINT24_MAX + +# undef __INT_LEAST16_MIN +# define __INT_LEAST16_MIN INT24_MIN +# undef __INT_LEAST16_MAX +# define __INT_LEAST16_MAX INT24_MAX +# undef __UINT_LEAST16_MAX +# define __UINT_LEAST16_MAX UINT24_MAX +# undef __INT_LEAST8_MIN +# define __INT_LEAST8_MIN INT24_MIN +# undef __INT_LEAST8_MAX +# define __INT_LEAST8_MAX INT24_MAX +# undef __UINT_LEAST8_MAX +# define __UINT_LEAST8_MAX UINT24_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT24_WIDTH 24 +# define INT24_WIDTH UINT24_WIDTH +# define UINT_LEAST24_WIDTH UINT24_WIDTH +# define INT_LEAST24_WIDTH UINT_LEAST24_WIDTH +# define UINT_FAST24_WIDTH UINT24_WIDTH +# define INT_FAST24_WIDTH UINT_FAST24_WIDTH +# undef __UINT_LEAST16_WIDTH +# define __UINT_LEAST16_WIDTH UINT24_WIDTH +# undef __UINT_LEAST8_WIDTH +# define __UINT_LEAST8_WIDTH UINT24_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT24_TYPE__ */ + + +#ifdef __INT16_TYPE__ +#define INT16_MAX INT16_C(32767) +#define INT16_MIN (-INT16_C(32767)-1) +#define UINT16_MAX UINT16_C(65535) + +# undef __INT_LEAST16_MIN +# define __INT_LEAST16_MIN INT16_MIN +# undef __INT_LEAST16_MAX +# define __INT_LEAST16_MAX INT16_MAX +# undef __UINT_LEAST16_MAX +# define __UINT_LEAST16_MAX UINT16_MAX +# undef __INT_LEAST8_MIN +# define __INT_LEAST8_MIN INT16_MIN +# undef __INT_LEAST8_MAX +# define __INT_LEAST8_MAX INT16_MAX +# undef __UINT_LEAST8_MAX +# define __UINT_LEAST8_MAX UINT16_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT16_WIDTH 16 +# define INT16_WIDTH UINT16_WIDTH +# undef __UINT_LEAST16_WIDTH +# define __UINT_LEAST16_WIDTH UINT16_WIDTH +# undef __UINT_LEAST8_WIDTH +# define __UINT_LEAST8_WIDTH UINT16_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT16_TYPE__ */ + +#ifdef __INT_LEAST16_MIN +# define INT_LEAST16_MIN __INT_LEAST16_MIN +# define INT_LEAST16_MAX __INT_LEAST16_MAX +# define UINT_LEAST16_MAX __UINT_LEAST16_MAX +# define INT_FAST16_MIN __INT_LEAST16_MIN +# define INT_FAST16_MAX __INT_LEAST16_MAX +# define UINT_FAST16_MAX __UINT_LEAST16_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT_LEAST16_WIDTH __UINT_LEAST16_WIDTH +# define INT_LEAST16_WIDTH UINT_LEAST16_WIDTH +# define UINT_FAST16_WIDTH __UINT_LEAST16_WIDTH +# define INT_FAST16_WIDTH UINT_FAST16_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT_LEAST16_MIN */ + + +#ifdef __INT8_TYPE__ +# define INT8_MAX INT8_C(127) +# define INT8_MIN (-INT8_C(127)-1) +# define UINT8_MAX UINT8_C(255) + +# undef __INT_LEAST8_MIN +# define __INT_LEAST8_MIN INT8_MIN +# undef __INT_LEAST8_MAX +# define __INT_LEAST8_MAX INT8_MAX +# undef __UINT_LEAST8_MAX +# define __UINT_LEAST8_MAX UINT8_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT8_WIDTH 8 +# define INT8_WIDTH UINT8_WIDTH +# undef __UINT_LEAST8_WIDTH +# define __UINT_LEAST8_WIDTH UINT8_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT8_TYPE__ */ + +#ifdef __INT_LEAST8_MIN +# define INT_LEAST8_MIN __INT_LEAST8_MIN +# define INT_LEAST8_MAX __INT_LEAST8_MAX +# define UINT_LEAST8_MAX __UINT_LEAST8_MAX +# define INT_FAST8_MIN __INT_LEAST8_MIN +# define INT_FAST8_MAX __INT_LEAST8_MAX +# define UINT_FAST8_MAX __UINT_LEAST8_MAX + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +# define UINT_LEAST8_WIDTH __UINT_LEAST8_WIDTH +# define INT_LEAST8_WIDTH UINT_LEAST8_WIDTH +# define UINT_FAST8_WIDTH __UINT_LEAST8_WIDTH +# define INT_FAST8_WIDTH UINT_FAST8_WIDTH +#endif /* __STDC_VERSION__ */ +#endif /* __INT_LEAST8_MIN */ + +/* Some utility macros */ +#define __INTN_MIN(n) __stdint_join3( INT, n, _MIN) +#define __INTN_MAX(n) __stdint_join3( INT, n, _MAX) +#define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX) +#define __INTN_C(n, v) __stdint_join3( INT, n, _C(v)) +#define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v)) + +/* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */ +/* C99 7.18.3 Limits of other integer types. */ + +#define INTPTR_MIN (-__INTPTR_MAX__-1) +#define INTPTR_MAX __INTPTR_MAX__ +#define UINTPTR_MAX __UINTPTR_MAX__ +#define PTRDIFF_MIN (-__PTRDIFF_MAX__-1) +#define PTRDIFF_MAX __PTRDIFF_MAX__ +#define SIZE_MAX __SIZE_MAX__ + +/* C23 7.22.2.4 Width of integer types capable of holding object pointers. */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +/* NB: The C standard requires that these be the same value, but the compiler + exposes separate internal width macros. */ +#define INTPTR_WIDTH __INTPTR_WIDTH__ +#define UINTPTR_WIDTH __UINTPTR_WIDTH__ +#endif + +/* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__ + * is enabled. */ +#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 +#define RSIZE_MAX (SIZE_MAX >> 1) +#endif + +/* C99 7.18.2.5 Limits of greatest-width integer types. */ +#define INTMAX_MIN (-__INTMAX_MAX__-1) +#define INTMAX_MAX __INTMAX_MAX__ +#define UINTMAX_MAX __UINTMAX_MAX__ + +/* C23 7.22.2.5 Width of greatest-width integer types. */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +/* NB: The C standard requires that these be the same value, but the compiler + exposes separate internal width macros. */ +#define INTMAX_WIDTH __INTMAX_WIDTH__ +#define UINTMAX_WIDTH __UINTMAX_WIDTH__ +#endif + +/* C99 7.18.3 Limits of other integer types. */ +#define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__) +#define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__) +#ifdef __WINT_UNSIGNED__ +# define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0) +# define WINT_MAX __UINTN_MAX(__WINT_WIDTH__) +#else +# define WINT_MIN __INTN_MIN(__WINT_WIDTH__) +# define WINT_MAX __INTN_MAX(__WINT_WIDTH__) +#endif + +#ifndef WCHAR_MAX +# define WCHAR_MAX __WCHAR_MAX__ +#endif +#ifndef WCHAR_MIN +# if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__) +# define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__) +# else +# define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0) +# endif +#endif + +/* 7.18.4.2 Macros for greatest-width integer constants. */ +#define INTMAX_C(v) __INTMAX_C(v) +#define UINTMAX_C(v) __UINTMAX_C(v) + +/* C23 7.22.3.x Width of other integer types. */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +#define PTRDIFF_WIDTH __PTRDIFF_WIDTH__ +#define SIG_ATOMIC_WIDTH __SIG_ATOMIC_WIDTH__ +#define SIZE_WIDTH __SIZE_WIDTH__ +#define WCHAR_WIDTH __WCHAR_WIDTH__ +#define WINT_WIDTH __WINT_WIDTH__ +#endif + +#endif /* __STDC_HOSTED__ */ +#endif /* __MVS__ */ +#endif /* __CLANG_STDINT_H */ diff --git a/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdint.h.blob b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdint.h.blob new file mode 100644 index 0000000..e8e101e Binary files /dev/null and b/.ccls-cache/@@mnt@raid@projects@dsp@harmonica@harmonica/@usr@lib@clang@21@include@stdint.h.blob differ diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/bin@main.cpp b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/bin@main.cpp new file mode 100644 index 0000000..6b55657 --- /dev/null +++ b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/bin@main.cpp @@ -0,0 +1,23 @@ +#include +#include "harmonica.hpp" + +auto main() -> int +{ + // setup создается для каждого файла свой + // т.к. при чтении данных из файла уже должен быть определен размер блока + // данных для чтения m_block_size; см. установки по умолчанию. + // Передается по ссылке и заполняется необходимыми данными + hr::setup setup; + setup.m_domain = hr::DOMAIN_PLUGIN::FREQUENSY; + setup.m_file = hr::TEST_SOUND; + + auto r = hr::run(setup); + hack::log()("size:", r.m_data.size()); + + if (!r.empty()) + { + std::vector s; + for (auto p : r.m_data) s.push_back(p.m_value[0]); + hack::log()(s); + } +} diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/bin@main.cpp.blob b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/bin@main.cpp.blob new file mode 100644 index 0000000..6c2e8c3 Binary files /dev/null and b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/bin@main.cpp.blob differ diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@adapter@adapter.hpp b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@adapter@adapter.hpp new file mode 100644 index 0000000..a113be6 --- /dev/null +++ b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@adapter@adapter.hpp @@ -0,0 +1,75 @@ +#pragma once + +#include "utils/workers/result.hpp" +#include "utils/workers/setup.hpp" +#include "utils/fft/fft.hpp" +#include "utils/fvec/fvec.hpp" +#include "utils/windows/hann/hann.hpp" + +namespace hr +{ + template + class adapter + { + public: + adapter(Plugin& p) : m_plugin { p } + { + m_end = m_plugin.m_setup.m_block_size - m_plugin.m_setup.m_step_size; + m_data.resize(m_plugin.m_setup.m_block_size, 0.0); + m_data_old.resize(m_end, 0.0); + m_fft.init(m_plugin.m_setup.m_block_size); + m_hann.creaate(m_plugin.m_setup.m_block_size); + } + + virtual ~adapter() { } + + protected: + Plugin& m_plugin; + real_time m_timestamp; + fft m_fft; + math::hann m_hann; + fvec_t m_data; + fvec_t m_data_old; + size_t m_end; + + public: + void process(fvec_t& in, real_time timestamp) + { + m_timestamp = timestamp; + + switch(m_plugin.m_setup.m_domain) + { + case DOMAIN_PLUGIN::TIME: + { + m_plugin.process(in, m_timestamp); + break; + } + case DOMAIN_PLUGIN::FREQUENSY: + { + frequensy(in); + break; + } + } + } + + result get_result() { return m_plugin.get_result(); } + + private: + void swap_buffer(fvec_t& in) + { + size_t i = 0; + for (i = 0; i < m_end; ++i) m_data[i] = m_data_old[i]; + for (i = 0; i < m_plugin.m_setup.m_step_size; ++i) m_data[m_end + i] = in[i]; + for (i = 0; i < m_end; ++i) m_data_old[i] = m_data[i + m_plugin.m_setup.m_step_size]; + } + + void frequensy(fvec_t& in) + { + swap_buffer(in); + m_hann.apply(m_data); + m_data.shift(); + auto r = m_fft.process(m_data); + m_plugin.process(r, in, m_timestamp); + } + }; +} diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@adapter@adapter.hpp.blob b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@adapter@adapter.hpp.blob new file mode 100644 index 0000000..e7d077c Binary files /dev/null and b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@adapter@adapter.hpp.blob differ diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@harmonica.hpp b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@harmonica.hpp new file mode 100644 index 0000000..7bb7af0 --- /dev/null +++ b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@harmonica.hpp @@ -0,0 +1,108 @@ +#pragma once + +#include +#include + +#include "utils/var.hpp" // IWYU pragma: keep +#include "utils/using.hpp" +#include "utils/workers/setup.hpp" +#include "utils/workers/result.hpp" +#include "adapter/adapter.hpp" + +#include "plugins/magnitude/magnitude.hpp" // IWYU pragma: keep +#include "plugins/signal_generator/signal_generator.hpp" // IWYU pragma: keep + +namespace hr +{ + /** + * @brief Запуск на чтение аудиофайла и обработка его через плагин + * @tparam Plugin Тип плагина для обработки аудиоданных + * @param setup Настройки обработки (путь к файлу, параметры и т.д.) + * @return Результат обработки аудио + */ + template + inline result run(setup& setup) + { + if (setup.m_signal_type.m_type != hr::signal_type::type::FILE) + { + Plugin pl { setup }; + adapter ad { pl }; + // просто заглушки для process + fvec_t v; + real_time t; + ad.process(v, t); + return ad.get_result(); + } + else + { + // Инициализация структуры для libsndfile и открытие файла + SF_INFO sf_info; + SNDFIoLE* file = sf_open(setup.m_file.c_str(), SFM_READ, &sf_info); + if (!file) + { + // Обработка ошибки открытия файла + hack::exception ex; + hack::log().on_file(); + hack::log().on_func(); + hack::log().on_row(); + ex.title("Error of open file"); + ex.description(sf_strerror(file)); + ex.set("file", setup.m_file); + hack::error()(ex); + throw ex; + } + + // Сохранение информации о файле в настройки + setup.m_sample_rate = sf_info.samplerate; + setup.m_frames = sf_info.frames; + setup.m_channels = sf_info.channels; + + if (setup.m_channels == 0) throw std::runtime_error("Нет каналов в аудио файле"); + + // Инициализация переменных для чтения + std::size_t read = 0; // Количество обработанных кадров + fvec_t read_data(setup.m_channels * setup.m_step_size, .0); // Буфер для чтения (интерливированные данные) + fvec_t in(setup.m_step_size, .0); // Буфер для моно-данных + + // Создание плагина и адаптера для обработки + Plugin pl { setup }; + adapter ad { pl }; + + do + { + // Определение длины читаемого блока (защита от выхода за границы) + auto length = hack::math::min(setup.m_step_size, in.size()); + auto read_samples = sf_read_float(file, read_data.data(), read_data.size()); + + uint_t read_length = read_samples / setup.m_channels; // Перевод в кадры + read_length = hack::math::min(length, read_length); // Ограничение длиной буфера + + // Де-интерливирование и down-mixing (преобразование многоканального в моно) + for (std::size_t i = 0; i < read_length; ++i) + { + in[i] = 0.0; + // Суммирование всех каналов + for (int c = 0; c < setup.m_channels; ++c) + in[i] += read_data[setup.m_channels * i + c]; + // Усреднение для получения моно-сигнала + in[i] /= static_cast(setup.m_channels); + } + + // Подготовка к следующей итерации + read = hack::math::min(length, static_cast(floorf(read_length + .5))); + + // Дополнение буфера нулями если считано неполный блок (конец файла) + if (in.size() > read) std::fill(in.begin() + read, in.end(), 0.0); + + // Вычисление временной метки и обработка данных через адаптер + real_time timestamp = real_time::frame2rt(read, sf_info.samplerate); + ad.process(in, timestamp); + } + while (read == setup.m_step_size); // Продолжать пока читаются полные блоки + + // Закрытие файла и возврат результата + sf_close(file); + return ad.get_result(); + } + } +} diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@harmonica.hpp.blob b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@harmonica.hpp.blob new file mode 100644 index 0000000..263b2c7 Binary files /dev/null and b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@harmonica.hpp.blob differ diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@magnitude@magnitude.hpp b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@magnitude@magnitude.hpp new file mode 100644 index 0000000..19daa7b --- /dev/null +++ b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@magnitude@magnitude.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "utils/workers/plugin.hpp" + +namespace hr::plugins +{ + class magnitude : public plugin + { + public: + magnitude(const setup& st); + virtual ~magnitude() = default; + + private: + result m_result; + + public: + void process(fvec_t& base, real_time timestamp) override; + void process(cvec_t& fft, fvec_t& base, real_time timestamp) override; + result get_result() override; + }; +} diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@magnitude@magnitude.hpp.blob b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@magnitude@magnitude.hpp.blob new file mode 100644 index 0000000..f5f677a Binary files /dev/null and b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@magnitude@magnitude.hpp.blob differ diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@signal_generator@signal_generator.hpp b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@signal_generator@signal_generator.hpp new file mode 100644 index 0000000..38e329b --- /dev/null +++ b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@signal_generator@signal_generator.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include "utils/workers/plugin.hpp" +#include "utils/workers/result.hpp" + +// Генерирует простую синусоиду и др. полезности см. workers/signal_type.hpp +namespace hr::plugins +{ + // Формула синусоиды + // f(t) = A_m sin(2 PI t 1/T + a) + // где + // a - начальная фаза + // t - время замера + // 1/T - частота + // T - время полного цикла одного периуда колебаний + class signal_generator : public plugin + { + public: + signal_generator(const setup& st); + virtual ~signal_generator() = default; + + public: + void process(fvec_t& base, real_time timestamp) override; + void process(cvec_t& fft, fvec_t& base, real_time timestamp) override; + result get_result() override; + + private: + result m_result; + + private: + std::vector sin(); + std::vector square(); + std::vector triangle(); + std::vector saw(); + std::vector noise_only(); + std::vector speech_like(); + std::vector three_sines(); + + private: + }; +} diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@signal_generator@signal_generator.hpp.blob b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@signal_generator@signal_generator.hpp.blob new file mode 100644 index 0000000..c6254e3 Binary files /dev/null and b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@plugins@signal_generator@signal_generator.hpp.blob differ diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@using.hpp b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@using.hpp new file mode 100644 index 0000000..9dc7a62 --- /dev/null +++ b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@using.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace hr +{ + using base_t = float; + using uint_t = unsigned int; + + // HERE + // убрать это чтоб не было желяния превраить это по аналогии с fvec_t + using ivec_t = std::vector; +} + diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@using.hpp.blob b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@using.hpp.blob new file mode 100644 index 0000000..45a7f79 Binary files /dev/null and b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@using.hpp.blob differ diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@var.hpp b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@var.hpp new file mode 100644 index 0000000..34348ab --- /dev/null +++ b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@var.hpp @@ -0,0 +1,4 @@ +#pragma once + +#include "noincl.hpp" // IWYU pragma: keep +namespace hr { } diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@var.hpp.blob b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@var.hpp.blob new file mode 100644 index 0000000..695d525 Binary files /dev/null and b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@var.hpp.blob differ diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@result.hpp b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@result.hpp new file mode 100644 index 0000000..c7679be --- /dev/null +++ b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@result.hpp @@ -0,0 +1,39 @@ +#pragma once + +#include +#include "utils/real_time/real_time.hpp" +#include "utils/fvec/fvec.hpp" +#include + +namespace hr +{ + struct result + { + struct bit + { + real_time m_duration; + fvec_t m_value; + }; + + void set_bit(bit& b) + { + m_data.push_back(b); + } + + bool empty() const + { + bool res = true; + try + { + if (!m_data.empty()) res = m_data.at(0).m_value.empty(); + } + catch(std::exception& e) + { + hack::error()(e.what()); + } + return res; + } + + std::vector m_data; + }; +} diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@result.hpp.blob b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@result.hpp.blob new file mode 100644 index 0000000..e9669d7 Binary files /dev/null and b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@result.hpp.blob differ diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@setup.hpp b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@setup.hpp new file mode 100644 index 0000000..f13829b --- /dev/null +++ b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@setup.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include "utils/workers/signals/signal_type.hpp" +#include + +namespace hr +{ + enum class DOMAIN_PLUGIN + { + TIME, + FREQUENSY + }; + + struct setup + { + // Эти данные заполняются из прочитанного файла (sndfile) + int m_sample_rate; + int m_frames; + int m_channels; + + std::filesystem::path m_file; + std::size_t m_block_size = 1'024; + std::size_t m_step_size = 512; + + signal_type m_signal_type; + DOMAIN_PLUGIN m_domain = DOMAIN_PLUGIN::FREQUENSY; + }; +} diff --git a/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@setup.hpp.blob b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@setup.hpp.blob new file mode 100644 index 0000000..70ac810 Binary files /dev/null and b/.ccls-cache/@mnt@raid@projects@dsp@harmonica@harmonica/src@utils@workers@setup.hpp.blob differ diff --git a/bin/main.signal_generator.cpp b/bin/main.signal_generator.cpp deleted file mode 100644 index 3f8c2e7..0000000 --- a/bin/main.signal_generator.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include "harmonica.hpp" // IWYU pragma: keep - -auto main() -> int -{ - hr::signal_generator generator; - hr::signal_type st; - st.m_type = hr::signal_type::type::SIN; - - auto s = generator.generate(st); - hack::log()(st.get_name()); - - std::vector ss; - for (auto p : s.m_data) ss.push_back(p.m_value[0]); - hack::log()(ss); -} diff --git a/bin/meson.build b/bin/meson.build index 8fb4b76..f6ed8ee 100644 --- a/bin/meson.build +++ b/bin/meson.build @@ -1,6 +1,6 @@ executable( meson.project_name(), - 'main.signal_generator.cpp', + 'main.cpp', dependencies : deps, cpp_args: args, include_directories : inc diff --git a/src/harmonica.hpp b/src/harmonica.hpp index d78cfba..55d9189 100644 --- a/src/harmonica.hpp +++ b/src/harmonica.hpp @@ -3,14 +3,13 @@ #include #include -#include "utils/var.hpp" // IWYU pragma: keep -#include "utils/signal_generator/signal_generator.hpp" // IWYU pragma: keep +#include "utils/var.hpp" // IWYU pragma: keep #include "utils/using.hpp" #include "utils/workers/setup.hpp" #include "utils/workers/result.hpp" #include "adapter/adapter.hpp" -#include "plugins/magnitude/magnitude.hpp" // IWYU pragma: keep +#include "plugins/magnitude/magnitude.hpp" // IWYU pragma: keep namespace hr { @@ -88,9 +87,10 @@ namespace hr } while (read == setup.m_step_size); // Продолжать пока читаются полные блоки + hack::log()("adf"); + // Закрытие файла и возврат результата sf_close(file); - return ad.get_result(); } } diff --git a/src/meson.build b/src/meson.build index 0e03417..80bcacb 100644 --- a/src/meson.build +++ b/src/meson.build @@ -12,7 +12,6 @@ headers = [ 'utils/workers/result.hpp', 'utils/workers/setup.hpp', 'utils/windows/hann/hann.hpp', - 'utils/signal_generator/signal_generator.hpp', # plugins 'plugins/magnitude/magnitude.hpp', @@ -26,7 +25,6 @@ sources = [ 'utils/fvec/fvec.cpp', 'utils/windows/hann/hann.cpp', - 'utils/signal_generator/signal_generator.cpp', # plugins 'plugins/magnitude/magnitude.cpp', diff --git a/src/plugins/magnitude/magnitude.cpp b/src/plugins/magnitude/magnitude.cpp index 5e86ea8..1ff2f06 100644 --- a/src/plugins/magnitude/magnitude.cpp +++ b/src/plugins/magnitude/magnitude.cpp @@ -6,10 +6,13 @@ namespace hr::plugins { } + void magnitude::process(fvec_t& base, real_time timestamp) + { + } + void magnitude::process(cvec_t& fft, fvec_t& base, real_time timestamp) { std::size_t frames = fft.size(); - base_t m = 0.f; for (std::size_t i = 0; i < frames; ++i) m += fft.m_norm[i]; m /= frames; diff --git a/src/plugins/magnitude/magnitude.hpp b/src/plugins/magnitude/magnitude.hpp index 56ba2f6..19daa7b 100644 --- a/src/plugins/magnitude/magnitude.hpp +++ b/src/plugins/magnitude/magnitude.hpp @@ -14,7 +14,7 @@ namespace hr::plugins result m_result; public: - void process(fvec_t& base, real_time timestamp) override {}; + void process(fvec_t& base, real_time timestamp) override; void process(cvec_t& fft, fvec_t& base, real_time timestamp) override; result get_result() override; }; diff --git a/src/utils/signal_generator/signal_generator.cpp b/src/utils/signal_generator/signal_generator.cpp deleted file mode 100644 index f7045b8..0000000 --- a/src/utils/signal_generator/signal_generator.cpp +++ /dev/null @@ -1,227 +0,0 @@ -#include "signal_generator.hpp" - -#include - -namespace hr -{ - result signal_generator::generate(signal_type st, NOISE noise) - { - std::vector tmp; - switch (st.m_type) - { - case signal_type::type::SIN: - tmp = sin(noise); - break; - case signal_type::type::SQUARE: - tmp = square(noise); - break; - case signal_type::type::TRIANGLE: - tmp = triangle(noise); - break; - case signal_type::type::SAW: - tmp = saw(noise); - break; - case signal_type::type::SPEECH_LIKE: - tmp = speech_like(noise); - break; - case signal_type::type::NOISE_ONLY: - tmp = noise_only(); - break; - case signal_type::type::THREE_SINES: - tmp = three_sines(noise); - break; - } - - result res; - for (auto t : tmp) - { - result::bit b; - b.m_value.push_back(t); - res.set_bit(b); - } - - return res; - } - - std::vector signal_generator::sin(NOISE noise) - { - std::vector signal(m_params.m_samples); - for (std::size_t i = 0; i < m_params.m_samples; ++i) - { - float t = i * 0.02f; - signal[i] = m_params.m_amplitude * std::sin(m_params.m_frequency * t * 2 * M_PI); - } - - if (noise == NOISE::YES) - { - // создаем распределение случайных величин - std::uniform_real_distribution<> dist(-m_params.m_noise_level, m_params.m_noise_level); - for (auto& s : signal) s += dist(m_gen); - } - - return signal; - } - - std::vector signal_generator::square(NOISE noise) - { - std::vector signal(m_params.m_samples); - for (std::size_t i = 0; i < m_params.m_samples; ++i) - { - float t = i * 0.02f; - float phase = m_params.m_frequency * t * 2 * M_PI; - // Прямоугольный сигнал: +1 когда sin > 0, -1 когда sin < 0 - signal[i] = m_params.m_amplitude * (std::sin(phase) > 0 ? 1.0f : -1.0f); - } - - if (noise == NOISE::YES) - { - std::uniform_real_distribution<> dist(-m_params.m_noise_level, m_params.m_noise_level); - for (auto& s : signal) s += dist(m_gen); - } - - return signal; - } - - std::vector signal_generator::triangle(NOISE noise) - { - std::vector signal(m_params.m_samples); - for (std::size_t i = 0; i < m_params.m_samples; ++i) - { - float t = i * 0.02f; - float phase = fmod(m_params.m_frequency * t, 1.0f); // 0..1 - - // Треугольный сигнал: линейный рост от -1 до 1, потом падение - if (phase < 0.25f) signal[i] = m_params.m_amplitude * (4.0f * phase); // 0..1 - else if (phase < 0.75f) signal[i] = m_params.m_amplitude * (2.0f - 4.0f * phase); // 1..-1 - else signal[i] = m_params.m_amplitude * (4.0f * phase - 4.0f); // -1..0 - } - - if (noise == NOISE::YES) - { - std::uniform_real_distribution<> dist(-m_params.m_noise_level, m_params.m_noise_level); - for (auto& s : signal) s += dist(m_gen); - } - - return signal; - } - - std::vector signal_generator::saw(NOISE noise) - { - std::vector signal(m_params.m_samples); - for (std::size_t i = 0; i < m_params.m_samples; ++i) - { - float t = i * 0.02f; - float phase = fmod(m_params.m_frequency * t, 1.0f); // 0..1 - - // Пилообразный сигнал: линейный рост от -1 до 1, потом резкий сброс - signal[i] = m_params.m_amplitude * (2.0f * phase - 1.0f); // -1..1 - } - - if (noise == NOISE::YES) - { - std::uniform_real_distribution<> dist(-m_params.m_noise_level, m_params.m_noise_level); - for (auto& s : signal) s += dist(m_gen); - } - - return signal; - } - - std::vector signal_generator::noise_only() - { - std::vector signal(m_params.m_samples); - std::uniform_real_distribution<> dist(-m_params.m_amplitude, m_params.m_amplitude); - - for (std::size_t i = 0; i < m_params.m_samples; ++i) - signal[i] = dist(m_gen); - - return signal; - } - - std::vector signal_generator::speech_like(NOISE noise) - { - std::vector signal(m_params.m_samples); - - // Базовая частота (основной тон речи) - float base_freq = m_params.m_frequency; - - // Добавляем гармоники, как в реальной речи - float harmonics[] = { 2.0f, 3.0f, 4.0f, 5.0f }; // гармоники - float harmonics_amp[] = { 0.7f, 0.5f, 0.3f, 0.2f }; // их амплитуды - - // Форманты (резонансные частоты речи) - float formants[] = {500.0f, 1500.0f, 2500.0f, 3500.0f}; - float formants_amp[] = {0.4f, 0.6f, 0.3f, 0.2f}; - - // Модуляция амплитуды (как при произношении слогов) - float envelope_freq = 2.0f; // частота слогов - - for (std::size_t i = 0; i < m_params.m_samples; ++i) - { - float t = i * 0.02f; - float value = 0.0f; - - // Основной тон + гармоники - for (int h = 0; h < 4; h++) - value += harmonics_amp[h] * std::sin(2 * M_PI * base_freq * harmonics[h] * t); - - // Форманты (резонансы) - for (int f = 0; f < 4; f++) - value += formants_amp[f] * std::sin(2 * M_PI * formants[f] * t * 0.001f); // kHz to Hz - - // Огибающая (модуляция амплитуды) - float envelope = 0.5f + 0.5f * std::sin(2 * M_PI * envelope_freq * t); - - // Добавляем немного шума (дыхание) - std::uniform_real_distribution<> breath_noise(-0.1f, 0.1f); - float breath = breath_noise(m_gen); - - // И немного низкочастотной модуляции (вибрато) - float vibrato = 0.1f * std::sin(2 * M_PI * 5.0f * t); // 5 Hz vibrato - - signal[i] = m_params.m_amplitude * envelope * (value + breath + vibrato); - } - - // Нормализуем - float max_val = *std::max_element(signal.begin(), signal.end(), - [](float a, float b) { return std::abs(a) < std::abs(b); }); - if (max_val > 0) - for (auto& s : signal) s /= max_val; - - // Добавляем дополнительный шум если нужно - if (noise == NOISE::YES) - { - std::uniform_real_distribution<> dist(-m_params.m_noise_level, m_params.m_noise_level); - for (auto& s : signal) s += dist(m_gen); - } - - return signal; - } - - std::vector signal_generator::three_sines(NOISE noise) - { - std::vector signal(m_params.m_samples); - - // три разные частоты - float f1 = m_params.m_frequency; - float f2 = m_params.m_frequency * 2.f; - - // амплитуды - float a1 = m_params.m_amplitude; - float a2 = m_params.m_amplitude * 0.5f; - - for (std::size_t i = 0; i < m_params.m_samples; ++i) - { - float t = i * 0.02f; - signal[i] = a1 * std::sin(2 * M_PI * f1 * t) + - a2 * std::sin(2 * M_PI * f2 * t + 3.f/4.f* M_PI); - } - - if (noise == NOISE::YES) - { - std::uniform_real_distribution<> dist(-m_params.m_noise_level, m_params.m_noise_level); - for (auto& s : signal) s += dist(m_gen); - } - - return signal; - } -} diff --git a/src/utils/signal_generator/signal_generator.hpp b/src/utils/signal_generator/signal_generator.hpp deleted file mode 100644 index d9a8036..0000000 --- a/src/utils/signal_generator/signal_generator.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include -#include "utils/workers/signal_type.hpp" -#include "utils/workers/result.hpp" - -// Генерирует простую синусоиду и др. полезности см. workers/signal_type.hpp -namespace hr -{ - enum class NOISE - { - NO, - YES - }; - - // Формула синусоиды - // f(t) = A_m sin(2 PI t 1/T + a) - // где - // a - начальная фаза - // t - время замера - // 1/T - частота - // T - время полного цикла одного периуда колебаний - class signal_generator - { - public: - signal_generator() : m_gen(12345) {} - - public: - result generate(signal_type st, NOISE noise = NOISE::NO); - - public: - struct signal_params - { - float m_amplitude = 1.0f; // A - float m_frequency = 1.0f; // 1/T - float m_noise_level = 0.7f; - std::size_t m_samples = 1200; - } m_params; - - private: - std::vector sin(NOISE noise); - std::vector square(NOISE noise); - std::vector triangle(NOISE noise); - std::vector saw(NOISE noise); - std::vector noise_only(); - std::vector speech_like(NOISE noise); - std::vector three_sines(NOISE noise); - - private: - std::mt19937 m_gen; - }; -} diff --git a/src/utils/workers/setup.hpp b/src/utils/workers/setup.hpp index efe7371..3f195dc 100644 --- a/src/utils/workers/setup.hpp +++ b/src/utils/workers/setup.hpp @@ -1,6 +1,5 @@ #pragma once -#include "utils/workers/signal_type.hpp" #include namespace hr @@ -22,7 +21,6 @@ namespace hr std::size_t m_block_size = 1'024; std::size_t m_step_size = 512; - signal_type m_signal_type; DOMAIN_PLUGIN m_domain = DOMAIN_PLUGIN::FREQUENSY; }; } diff --git a/src/utils/workers/signal_type.hpp b/src/utils/workers/signal_type.hpp deleted file mode 100644 index a3eee40..0000000 --- a/src/utils/workers/signal_type.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include - -namespace hr -{ - // Некая структура описывающая базоввые типы сигналов - struct signal_type - { - enum class type - { - FILE, // Из файла - SIN, // Синусоида - SQUARE, // Прямоугольный - TRIANGLE, // Треугольный - SAW, // Пилообразный - NOISE_ONLY, // Только шум - SPEECH_LIKE, // Типа речь - THREE_SINES // Три частоты - } m_type = type::FILE; - - signal_type() = default; - explicit signal_type(type t) : m_type(t) {} - - // Получить имя типа - std::string get_name() const - { - switch (m_type) - { - case type::FILE: return "FILE"; - case type::SIN: return "SIN"; - case type::SQUARE: return "SQUARE"; - case type::TRIANGLE: return "TRIANGLE"; - case type::SAW: return "SAW"; - case type::NOISE_ONLY: return "NOISE_ONLY"; - case type::SPEECH_LIKE: return "SPEECH_LIKE"; - case type::THREE_SINES: return "THREE_SINES"; - default: return "UNKNOWN"; - } - } - - bool operator<(const signal_type& other) const - { - return m_type < other.m_type; - } - - bool operator==(const signal_type& other) const - { - return m_type == other.m_type; - } - }; - - // просто для итерации в графическом интерфейсе - inline const std::vector& all_types() - { - static const std::vector signals = { - signal_type(signal_type::type::FILE), - signal_type(signal_type::type::SIN), - signal_type(signal_type::type::SQUARE), - signal_type(signal_type::type::TRIANGLE), - signal_type(signal_type::type::SAW), - signal_type(signal_type::type::NOISE_ONLY), - signal_type(signal_type::type::SPEECH_LIKE), - signal_type(signal_type::type::THREE_SINES) - }; - return signals; - } -}