From a7c06db68760e57d106cd2e6dcb7174bd911eff5 Mon Sep 17 00:00:00 2001 From: ykiko Date: Thu, 29 Aug 2024 18:19:56 +0800 Subject: [PATCH] some update. --- .gitignore | 3 +- .txt | 7440 ++++++++++++++++++++++++++++++++ .vscode/launch.json | 20 + CMakeLists.txt | 3 +- docs/clangd2.md | 64 + docs/clice.md | 146 +- docs/examples/ASTVisitor.cpp | 147 +- docs/examples/Module.cpp | 197 +- docs/examples/Preprocessor.cpp | 1 - include/Clang/Module.h | 0 include/Clang/Preamble.h | 2 +- test.cpp | 16 +- 12 files changed, 7775 insertions(+), 264 deletions(-) create mode 100644 .txt create mode 100644 docs/clangd2.md create mode 100644 include/Clang/Module.h diff --git a/.gitignore b/.gitignore index 8aa919a9..86d16ab5 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,8 @@ *.app .cache/ -build/ +build* +temp* external/ logs/ diff --git a/.txt b/.txt new file mode 100644 index 00000000..c946f7e8 --- /dev/null +++ b/.txt @@ -0,0 +1,7440 @@ +running ASTVisitor... +Comment: // -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @file include/vector + * This is a Standard C++ Library header. + */ +Comment: // container +Comment: // Copyright The GNU Toolchain Authors. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // Predefined symbols and macros -*- C++ -*- +Comment: // Copyright (C) 1997-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // The major release number for the GCC release the C++ library belongs to. +Comment: // The datestamp of the C++ library in compressed ISO date format. +Comment: // Macros for various attributes. +Comment: // _GLIBCXX_PURE +Comment: // _GLIBCXX_CONST +Comment: // _GLIBCXX_NORETURN +Comment: // _GLIBCXX_NOTHROW +Comment: // _GLIBCXX_VISIBILITY +Comment: // See below for C++ +Comment: // Macros for visibility attributes. +Comment: // _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY +Comment: // _GLIBCXX_VISIBILITY +Comment: // Macros for deprecated attributes. +Comment: // _GLIBCXX_USE_DEPRECATED +Comment: // _GLIBCXX_DEPRECATED +Comment: // _GLIBCXX_DEPRECATED_SUGGEST( string-literal ) +Comment: // _GLIBCXX11_DEPRECATED +Comment: // _GLIBCXX11_DEPRECATED_SUGGEST( string-literal ) +Comment: // _GLIBCXX14_DEPRECATED +Comment: // _GLIBCXX14_DEPRECATED_SUGGEST( string-literal ) +Comment: // _GLIBCXX17_DEPRECATED +Comment: // _GLIBCXX17_DEPRECATED_SUGGEST( string-literal ) +Comment: // _GLIBCXX20_DEPRECATED +Comment: // _GLIBCXX20_DEPRECATED_SUGGEST( string-literal ) +Comment: // _GLIBCXX23_DEPRECATED +Comment: // _GLIBCXX23_DEPRECATED_SUGGEST( string-literal ) +Comment: // Macros for ABI tag attributes. +Comment: // Macro to warn about unused results. +Comment: // Macro for constexpr, to support in mixed 03/0x mode. +Comment: // Macro for noexcept, to support in mixed 03/0x mode. +Comment: // Macro for extern template, ie controlling template linkage via use +Comment: // of extern keyword on template declaration. As documented in the g++ +Comment: // manual, it inhibits all implicit instantiations and is used +Comment: // throughout the library to avoid multiple weak definitions for +Comment: // required types that are already explicitly instantiated in the +Comment: // library binary. This substantially reduces the binary size of +Comment: // resulting executables. +Comment: // Special case: _GLIBCXX_EXTERN_TEMPLATE == -1 disallows extern +Comment: // templates only in basic_string, thus activating its debug-mode +Comment: // checks even at -O0. +Comment: /* + 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 +*/ +Comment: // This allows the library to terminate without including all of +Comment: // and without making the declaration of std::terminate visible to users. +Comment: // Non-zero if inline namespaces are used for versioning the entire library. +Comment: // Unused. +Comment: // Used to version individual components, e.g. std::_V2::error_category. +Comment: // inline namespace X +Comment: // In the case that we don't have a hosted environment, we can't provide the +Comment: // debugging mode. Instead, we do our best and downgrade to assertions. +Comment: // Inline namespaces for special modes: debug, parallel. +Comment: // Macros for namespace scope. Either namespace std:: or the name +Comment: // of some nested namespace within it corresponding to the active mode. +Comment: // _GLIBCXX_STD_A +Comment: // _GLIBCXX_STD_C +Comment: // +Comment: // Macros for opening/closing conditional namespaces. +Comment: // _GLIBCXX_BEGIN_NAMESPACE_ALGO +Comment: // _GLIBCXX_END_NAMESPACE_ALGO +Comment: // _GLIBCXX_BEGIN_NAMESPACE_CONTAINER +Comment: // _GLIBCXX_END_NAMESPACE_CONTAINER +Comment: // GLIBCXX_ABI Deprecated +Comment: // Define if compatibility should be provided for -mlong-double-64. +Comment: // Define if compatibility should be provided for alternative 128-bit long +Comment: // double formats. Not possible for Clang until __ibm128 is supported. +Comment: // Inline namespaces for long double 128 modes. +Comment: // _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && IEEE128 +Comment: // _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT && IEEE128 +Comment: // Internal version of std::is_constant_evaluated(). +Comment: // This can be used without checking if the compiler supports the feature. +Comment: // The macro _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED can be used to check if +Comment: // the compiler support is present to make this function work as expected. +Comment: // Debug Mode implies checking assertions. +Comment: // Disable std::string explicit instantiation declarations in order to assert. +Comment: /* precondition violation detected! */ +Comment: // Assert. +Comment: // Macro indicating that TSAN is in use. +Comment: // Macros for race detectors. +Comment: // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) and +Comment: // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A) should be used to explain +Comment: // atomic (lock-free) synchronization to race detectors: +Comment: // the race detector will infer a happens-before arc from the former to the +Comment: // latter when they share the same argument pointer. +Comment: // +Comment: // The most frequent use case for these macros (and the only case in the +Comment: // current implementation of the library) is atomic reference counting: +Comment: // void _M_remove_reference() +Comment: // { +Comment: // _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); +Comment: // if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) +Comment: // { +Comment: // _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); +Comment: // _M_destroy(__a); +Comment: // } +Comment: // } +Comment: // The annotations in this example tell the race detector that all memory +Comment: // accesses occurred when the refcount was positive do not race with +Comment: // memory accesses which occurred after the refcount became zero. +Comment: // Macros for C linkage: define extern "C" linkage only when using C++. +Comment: // !__cplusplus +Comment: // First includes. +Comment: // Pick up any OS-specific definitions. +Comment: // Specific definitions for GNU/Linux -*- C++ -*- +Comment: // Copyright (C) 2000-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // System-specific #define, typedefs, corrections, etc, go here. This +Comment: // file will come before all others. +Comment: // This keeps isalnum, et al from being propagated as macros. +Comment: /* Copyright (C) 1991-2024 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 + . */ +Comment: /* 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. + _ISOC2X_SOURCE Extensions to ISO C99 from ISO C2X. + __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 C2X 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 + _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. + _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 + 200809L, 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_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. */ +Comment: /* Undefine everything, so we get a clean slate. */ +Comment: /* Suppress kernel-name space pollution unless user expressedly asks + for it. */ +Comment: /* 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. */ +Comment: /* 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. */ +Comment: /* Whether to use feature set F. */ +Comment: /* _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. */ +Comment: /* If _GNU_SOURCE was defined by the user, turn on all the other features. */ +Comment: /* If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined, + define _DEFAULT_SOURCE. */ +Comment: /* This is to enable the ISO C2X extension. */ +Comment: /* This is to enable the ISO C11 extension. */ +Comment: /* This is to enable the ISO C99 extension. */ +Comment: /* This is to enable the ISO C90 Amendment 1:1995 extension. */ +Comment: /* This is to enable compatibility for ISO C++17. */ +Comment: /* This is to enable compatibility for ISO C++11. + Check the temporary macro for now, too. */ +Comment: /* If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE + is defined, use POSIX.1-2008 (or another version depending on + _XOPEN_SOURCE). */ +Comment: /* 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. */ +Comment: /* Features part to handle 64-bit time_t support. + Copyright (C) 2021-2024 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 + . */ +Comment: /* We need to know the word size in order to check the time size. */ +Comment: /* Determine the wordsize from the preprocessor defines. */ +Comment: /* Both x86-64 and x32 use the 64-bit system call interface. */ +Comment: /* Bit size of the time_t type at glibc build time, x86-64 and x32 case. + Copyright (C) 2018-2024 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 + . */ +Comment: /* Determine the wordsize from the preprocessor defines. */ +Comment: /* Both x86-64 and x32 use the 64-bit system call interface. */ +Comment: /* For others, time size is word size. */ +Comment: /* 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++. */ +Comment: /* 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. */ +Comment: /* ISO C2X 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. */ +Comment: /* Get definitions of __STDC_* predefined macros, if the compiler has + not preincluded this header automatically. */ +Comment: /* Copyright (C) 1991-2024 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 + . */ +Comment: /* 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. */ +Comment: /* 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. */ +Comment: /* 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 */ +Comment: /* 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. */ +Comment: /* Major and minor version number of the GNU C library package. Use + these macros to test for features in specific releases. */ +Comment: /* This is here only because every header file already includes this one. */ +Comment: /* Copyright (C) 1992-2024 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 + . */ +Comment: /* We are almost always included from features.h. */ +Comment: /* 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. */ +Comment: /* Some user header file might have defined this before. */ +Comment: /* 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. */ +Comment: /* All functions, except those with callbacks or those that + synchronize memory, are leaf functions. */ +Comment: /* 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. */ +Comment: /* Not GCC or clang. */ +Comment: /* GCC || clang. */ +Comment: /* These two macros are not used in glibc anymore. They are kept here + only because some other projects expect the macros to be defined. */ +Comment: /* For these things, GCC behaves the ANSI way normally, + and the non-ANSI way under -traditional. */ +Comment: /* This is not a typedef so `const __ptr_t' does the right thing. */ +Comment: /* C++ needs to know that types and declarations are C, not C++. */ +Comment: /* Fortify support. */ +Comment: /* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ +Comment: /* 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. */ +Comment: /* GCC 2.97 and clang support C99 flexible array members as an extension, + even when in C89 mode or compiling C++ (any version). */ +Comment: /* __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); */ +Comment: /* +#elif __SOME_OTHER_COMPILER__ + +# define __REDIRECT(name, proto, alias) name proto; \ + _Pragma("let " #name " = " #alias) +*/ +Comment: /* GCC and clang 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. */ +Comment: /* 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. */ +Comment: /* Tell the compiler which arguments to an allocation function + indicate the size of the allocation. */ +Comment: /* Ignore. */ +Comment: /* Tell the compiler which argument to an allocation function + indicates the alignment of the allocation. */ +Comment: /* 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. */ +Comment: /* This declaration tells the compiler that the value is constant. */ +Comment: /* 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. */ +Comment: /* Since version 3.2, gcc allows marking deprecated functions. */ +Comment: /* 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. */ +Comment: /* 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. */ +Comment: /* 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. */ +Comment: /* 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. */ +Comment: /* The returns_nonnull function attribute marks the return type of the function + as always being non-null. */ +Comment: /* If fortification mode, we warn about unused results of certain + function calls which can lead to problems. */ +Comment: /* Ignore */ +Comment: /* Forces a function to be always inlined. */ +Comment: /* 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. */ +Comment: /* Associate error messages with the source location of the call site rather + than with the source location inside the function. */ +Comment: /* 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. */ +Comment: /* GCC 4.3 and above allow passing all anonymous arguments of an + __extern_always_inline function to some other vararg function. */ +Comment: /* 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. */ +Comment: /* __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'. */ +Comment: /* 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. */ +Comment: /* Not supported in old GCC. */ +Comment: /* Undefine (also defined in libc-symbols.h). */ +Comment: /* Gnulib avoids including these, as they don't work on non-glibc or + older glibc platforms. */ +Comment: /* Determine the wordsize from the preprocessor defines. */ +Comment: /* Both x86-64 and x32 use the 64-bit system call interface. */ +Comment: /* Properties of long double type. ldbl-96 version. + Copyright (C) 2016-2024 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 + . */ +Comment: /* long double is distinct from double, so there is nothing to + define here. */ +Comment: /* __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. */ +Comment: /* 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. */ +Comment: /* Specify that a function such as setjmp or vfork may return + twice. */ +Comment: /* sys/cdefs.h */ +Comment: /* If we don't have __REDIRECT, prototypes will be missing if + __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */ +Comment: /* !ASSEMBLER */ +Comment: /* Decide whether we can define 'extern inline' functions in headers. */ +Comment: /* 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). */ +Comment: /* This file is automatically generated. + This file selects the right generated file of `__stub_FUNCTION' macros + based on the architecture being compiled for. */ +Comment: /* 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. */ +Comment: /* features.h */ +Comment: // Provide a declaration for the possibly deprecated gets function, as +Comment: // glibc 2.15 and later does not declare gets for ISO C11 when +Comment: // __GNU_SOURCE is defined. +Comment: // Glibc 2.23 removed the obsolete isinf and isnan declarations. Check the +Comment: // version dynamically in case it has changed since libstdc++ was configured. +Comment: // Glibc 2.26 on i?86/x86-64/ia64/ppc64le added *f128 support. +Comment: // Glibc 2.27 added it also on many other arches but those have IEEE quad +Comment: // long double. +Comment: // The following libpthread properties only apply to Linux, not GNU/Hurd. +Comment: // Since glibc 2.27 pthread_self() is usable without linking to libpthread. +Comment: // Since glibc 2.34 all pthreads functions are usable without linking to +Comment: // libpthread. +Comment: // __linux__ +Comment: // Pick up any CPU-specific definitions. +Comment: // Specific definitions for generic platforms -*- C++ -*- +Comment: // Copyright (C) 2005-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // If platform uses neither visibility nor psuedo-visibility, +Comment: // specify empty default for namespace annotation macros. +Comment: // Certain function definitions that are meant to be overridable from +Comment: // user code are decorated with this macro. For some targets, this +Comment: // macro causes these definitions to be weak. +Comment: // By default, we assume that __GXX_WEAK__ also means that there is support +Comment: // for declaring functions as weak while not defining such functions. This +Comment: // allows for referring to functions provided by other libraries (e.g., +Comment: // libitm) without depending on them if the respective features are not used. +Comment: // Conditionally enable annotations for the Transactional Memory TS on C++11. +Comment: // Most of the following conditions are due to limitations in the current +Comment: // implementation. +Comment: // In C++17 mathematical special functions are in namespace std. +Comment: // The remainder of the prewritten config is automatic; all the +Comment: // user hooks are listed above. +Comment: // Create a boolean flag to be used to determine if --fast-math is set. +Comment: // This marks string literals in header files to be extracted for eventual +Comment: // translation. It is primarily used for messages in thrown exceptions; see +Comment: // src/functexcept.cc. We use __N because the more traditional _N is used +Comment: // for something else under certain OSes (see BADNAMES). +Comment: // For example, is known to #define min and max as macros... +Comment: // N.B. these _GLIBCXX_USE_C99_XXX macros are defined unconditionally +Comment: // so they should be tested with #if not with #ifdef. +Comment: // Unless explicitly specified, enable char8_t extensions only if the core +Comment: // language char8_t feature macro is defined. +Comment: /* Define if __float128 is supported on this host. */ +Comment: /* For powerpc64 don't use __float128 when it's the same type as long double. */ +Comment: // Define if float has the IEEE binary32 format. +Comment: // Define if double has the IEEE binary64 format. +Comment: // Define if long double has the IEEE binary128 format. +Comment: // Intel and older Clang require !__is_identifier for some built-ins: +Comment: // Mark code that should be ignored by the compiler, but seen by Doxygen. +Comment: // PSTL configuration +Comment: // This header is not installed for freestanding: +Comment: // Preserved here so we have some idea which version of upstream we've pulled in +Comment: // #define PSTL_VERSION 9000 +Comment: // For now this defaults to being based on the presence of Thread Building Blocks +Comment: // This section will need some rework when a new (default) backend type is added +Comment: // -*- C++ -*- +Comment: //===-- pstl_config.h -----------------------------------------------------===// +Comment: // +Comment: // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +Comment: // See https://llvm.org/LICENSE.txt for license information. +Comment: // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +Comment: // +Comment: //===----------------------------------------------------------------------===// +Comment: // The version is XYYZ, where X is major, YY is minor, and Z is patch (i.e. X.YY.Z) +Comment: // Check the user-defined macro for warnings +Comment: // Portability "#pragma" definition +Comment: /* nothing */ +Comment: /* nothing */ +Comment: // note that when ICC or Clang is in use, _PSTL_GCC_VERSION might not fully match +Comment: // the actual GCC version on the system. +Comment: // according to clang documentation, version can be vendor specific +Comment: // Enable SIMD for compilers that support OpenMP 4.0 +Comment: //#pragma simd +Comment: //Enable SIMD +Comment: // Should be defined to 1 for environments with a vendor implementation of C++17 execution policies +Comment: // Declaration of reduction functor, where +Comment: // NAME - the name of the functor +Comment: // OP - type of the callable object with the reduction operation +Comment: // omp_in - refers to the local partial result +Comment: // omp_out - refers to the final value of the combiner operator +Comment: // omp_priv - refers to the private copy of the initial value +Comment: // omp_orig - refers to the original variable to be reduced +Comment: // Check the user-defined macro to use non-temporal stores +Comment: //the preprocessors don't type a message location +Comment: // broken macros +Comment: /* _PSTL_CONFIG_H */ +Comment: // __has_include +Comment: // C++17 +Comment: // End of prewritten config; the settings discovered at configure time follow. +Comment: /* config.h. Generated from config.h.in by configure. */ +Comment: /* config.h.in. Generated from configure.ac by autoheader. */ +Comment: /* Define to 1 if you have the `acosf' function. */ +Comment: /* Define to 1 if you have the `acosl' function. */ +Comment: /* Define to 1 if you have the `aligned_alloc' function. */ +Comment: /* Define if arc4random is available in . */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `asinf' function. */ +Comment: /* Define to 1 if you have the `asinl' function. */ +Comment: /* Define to 1 if the target assembler supports .symver directive. */ +Comment: /* Define to 1 if you have the `atan2f' function. */ +Comment: /* Define to 1 if you have the `atan2l' function. */ +Comment: /* Define to 1 if you have the `atanf' function. */ +Comment: /* Define to 1 if you have the `atanl' function. */ +Comment: /* Defined if shared_ptr reference counting should use atomic operations. */ +Comment: /* Define to 1 if you have the `at_quick_exit' function. */ +Comment: /* Define to 1 if the target assembler supports thread-local storage. */ +Comment: /* #undef _GLIBCXX_HAVE_CC_TLS */ +Comment: /* Define to 1 if you have the `ceilf' function. */ +Comment: /* Define to 1 if you have the `ceill' function. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `cosf' function. */ +Comment: /* Define to 1 if you have the `coshf' function. */ +Comment: /* Define to 1 if you have the `coshl' function. */ +Comment: /* Define to 1 if you have the `cosl' function. */ +Comment: /* Define to 1 if you have the declaration of `strnlen', and to 0 if you + don't. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define if dirfd is available in . */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if GCC 4.6 supported std::exception_ptr for the target */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `expf' function. */ +Comment: /* Define to 1 if you have the `expl' function. */ +Comment: /* Define to 1 if you have the `fabsf' function. */ +Comment: /* Define to 1 if you have the `fabsl' function. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define if fdopendir is available in . */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `finite' function. */ +Comment: /* Define to 1 if you have the `finitef' function. */ +Comment: /* Define to 1 if you have the `finitel' function. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `floorf' function. */ +Comment: /* Define to 1 if you have the `floorl' function. */ +Comment: /* Define to 1 if you have the `fmodf' function. */ +Comment: /* Define to 1 if you have the `fmodl' function. */ +Comment: /* Define to 1 if you have the `fpclass' function. */ +Comment: /* #undef _GLIBCXX_HAVE_FPCLASS */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_FP_H */ +Comment: /* Define to 1 if you have the `frexpf' function. */ +Comment: /* Define to 1 if you have the `frexpl' function. */ +Comment: /* Define if getentropy is available in . */ +Comment: /* Define if _Unwind_GetIPInfo is available. */ +Comment: /* Define if gets is available in before C++14. */ +Comment: /* Define to 1 if you have the `hypot' function. */ +Comment: /* Define to 1 if you have the `hypotf' function. */ +Comment: /* Define to 1 if you have the `hypotl' function. */ +Comment: /* Define if you have the iconv() function. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_IEEEFP_H */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `isinf' function. */ +Comment: /* #undef _GLIBCXX_HAVE_ISINF */ +Comment: /* Define to 1 if you have the `isinff' function. */ +Comment: /* Define to 1 if you have the `isinfl' function. */ +Comment: /* Define to 1 if you have the `isnan' function. */ +Comment: /* #undef _GLIBCXX_HAVE_ISNAN */ +Comment: /* Define to 1 if you have the `isnanf' function. */ +Comment: /* Define to 1 if you have the `isnanl' function. */ +Comment: /* Defined if iswblank exists. */ +Comment: /* Define if LC_MESSAGES is available in . */ +Comment: /* Define to 1 if you have the `ldexpf' function. */ +Comment: /* Define to 1 if you have the `ldexpl' function. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Only used in build directory testsuite_hooks.h. */ +Comment: /* Only used in build directory testsuite_hooks.h. */ +Comment: /* Only used in build directory testsuite_hooks.h. */ +Comment: /* Only used in build directory testsuite_hooks.h. */ +Comment: /* Only used in build directory testsuite_hooks.h. */ +Comment: /* Define if link is available in . */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define if futex syscall is available. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `log10f' function. */ +Comment: /* Define to 1 if you have the `log10l' function. */ +Comment: /* Define to 1 if you have the `logf' function. */ +Comment: /* Define to 1 if you have the `logl' function. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_MACHINE_ENDIAN_H */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_MACHINE_PARAM_H */ +Comment: /* Define if mbstate_t exists in wchar.h. */ +Comment: /* Define to 1 if you have the `memalign' function. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `modf' function. */ +Comment: /* Define to 1 if you have the `modff' function. */ +Comment: /* Define to 1 if you have the `modfl' function. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_NAN_H */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define if defines obsolete isinf function. */ +Comment: /* #undef _GLIBCXX_HAVE_OBSOLETE_ISINF */ +Comment: /* Define if defines obsolete isnan function. */ +Comment: /* #undef _GLIBCXX_HAVE_OBSOLETE_ISNAN */ +Comment: /* Define if openat is available in . */ +Comment: /* Define if poll is available in . */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `posix_memalign' function. */ +Comment: /* Define to 1 if POSIX Semaphores with sem_timedwait are available in + . */ +Comment: /* Define to 1 if you have the `powf' function. */ +Comment: /* Define to 1 if you have the `powl' function. */ +Comment: /* Define to 1 if you have the `qfpclass' function. */ +Comment: /* #undef _GLIBCXX_HAVE_QFPCLASS */ +Comment: /* Define to 1 if you have the `quick_exit' function. */ +Comment: /* Define if readlink is available in . */ +Comment: /* Define to 1 if you have the `secure_getenv' function. */ +Comment: /* Define to 1 if you have the `setenv' function. */ +Comment: /* Define to 1 if you have the `sincos' function. */ +Comment: /* Define to 1 if you have the `sincosf' function. */ +Comment: /* Define to 1 if you have the `sincosl' function. */ +Comment: /* Define to 1 if you have the `sinf' function. */ +Comment: /* Define to 1 if you have the `sinhf' function. */ +Comment: /* Define to 1 if you have the `sinhl' function. */ +Comment: /* Define to 1 if you have the `sinl' function. */ +Comment: /* Defined if sleep exists. */ +Comment: /* #undef _GLIBCXX_HAVE_SLEEP */ +Comment: /* Define to 1 if you have the `sockatmark' function. */ +Comment: /* Define to 1 if you have the `sqrtf' function. */ +Comment: /* Define to 1 if you have the `sqrtl' function. */ +Comment: /* Define if the header is supported. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define if strerror_l is available in . */ +Comment: /* Define if strerror_r is available in . */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `strtof' function. */ +Comment: /* Define to 1 if you have the `strtold' function. */ +Comment: /* Define to 1 if `d_type' is a member of `struct dirent'. */ +Comment: /* Define if strxfrm_l is available in . */ +Comment: /* Define if symlink is available in . */ +Comment: /* Define to 1 if the target runtime linker supports binding the same symbol + to different versions. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_SYS_FILIO_H */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have a suitable header file */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define if S_IFREG is available in . */ +Comment: /* #undef _GLIBCXX_HAVE_S_IFREG */ +Comment: /* Define if S_ISREG is available in . */ +Comment: /* Define to 1 if you have the `tanf' function. */ +Comment: /* Define to 1 if you have the `tanhf' function. */ +Comment: /* Define to 1 if you have the `tanhl' function. */ +Comment: /* Define to 1 if you have the `tanl' function. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the `timespec_get' function. */ +Comment: /* Define to 1 if the target supports thread-local storage. */ +Comment: /* Define if truncate is available in . */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define if unlinkat is available in . */ +Comment: /* Define to 1 if you have the `uselocale' function. */ +Comment: /* Defined if usleep exists. */ +Comment: /* #undef _GLIBCXX_HAVE_USLEEP */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Defined if vfwscanf exists. */ +Comment: /* Defined if vswscanf exists. */ +Comment: /* Defined if vwscanf exists. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Defined if wcstof exists. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_WINDOWS_H */ +Comment: /* Define if writev is available in . */ +Comment: /* Define to 1 if you have the header file. */ +Comment: /* #undef _GLIBCXX_HAVE_XLOCALE_H */ +Comment: /* Define to 1 if you have the `_acosf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ACOSF */ +Comment: /* Define to 1 if you have the `_acosl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ACOSL */ +Comment: /* Define to 1 if you have the `_aligned_malloc' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ALIGNED_MALLOC */ +Comment: /* Define to 1 if you have the `_asinf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ASINF */ +Comment: /* Define to 1 if you have the `_asinl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ASINL */ +Comment: /* Define to 1 if you have the `_atan2f' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ATAN2F */ +Comment: /* Define to 1 if you have the `_atan2l' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ATAN2L */ +Comment: /* Define to 1 if you have the `_atanf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ATANF */ +Comment: /* Define to 1 if you have the `_atanl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ATANL */ +Comment: /* Define to 1 if you have the `_ceilf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__CEILF */ +Comment: /* Define to 1 if you have the `_ceill' function. */ +Comment: /* #undef _GLIBCXX_HAVE__CEILL */ +Comment: /* Define to 1 if you have the `_cosf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__COSF */ +Comment: /* Define to 1 if you have the `_coshf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__COSHF */ +Comment: /* Define to 1 if you have the `_coshl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__COSHL */ +Comment: /* Define to 1 if you have the `_cosl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__COSL */ +Comment: /* Define to 1 if you have the `_expf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__EXPF */ +Comment: /* Define to 1 if you have the `_expl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__EXPL */ +Comment: /* Define to 1 if you have the `_fabsf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FABSF */ +Comment: /* Define to 1 if you have the `_fabsl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FABSL */ +Comment: /* Define to 1 if you have the `_finite' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FINITE */ +Comment: /* Define to 1 if you have the `_finitef' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FINITEF */ +Comment: /* Define to 1 if you have the `_finitel' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FINITEL */ +Comment: /* Define to 1 if you have the `_floorf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FLOORF */ +Comment: /* Define to 1 if you have the `_floorl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FLOORL */ +Comment: /* Define to 1 if you have the `_fmodf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FMODF */ +Comment: /* Define to 1 if you have the `_fmodl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FMODL */ +Comment: /* Define to 1 if you have the `_fpclass' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FPCLASS */ +Comment: /* Define to 1 if you have the `_frexpf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FREXPF */ +Comment: /* Define to 1 if you have the `_frexpl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__FREXPL */ +Comment: /* Define to 1 if you have the `_hypot' function. */ +Comment: /* #undef _GLIBCXX_HAVE__HYPOT */ +Comment: /* Define to 1 if you have the `_hypotf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__HYPOTF */ +Comment: /* Define to 1 if you have the `_hypotl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__HYPOTL */ +Comment: /* Define to 1 if you have the `_isinf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ISINF */ +Comment: /* Define to 1 if you have the `_isinff' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ISINFF */ +Comment: /* Define to 1 if you have the `_isinfl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ISINFL */ +Comment: /* Define to 1 if you have the `_isnan' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ISNAN */ +Comment: /* Define to 1 if you have the `_isnanf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ISNANF */ +Comment: /* Define to 1 if you have the `_isnanl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__ISNANL */ +Comment: /* Define to 1 if you have the `_ldexpf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__LDEXPF */ +Comment: /* Define to 1 if you have the `_ldexpl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__LDEXPL */ +Comment: /* Define to 1 if you have the `_log10f' function. */ +Comment: /* #undef _GLIBCXX_HAVE__LOG10F */ +Comment: /* Define to 1 if you have the `_log10l' function. */ +Comment: /* #undef _GLIBCXX_HAVE__LOG10L */ +Comment: /* Define to 1 if you have the `_logf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__LOGF */ +Comment: /* Define to 1 if you have the `_logl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__LOGL */ +Comment: /* Define to 1 if you have the `_modf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__MODF */ +Comment: /* Define to 1 if you have the `_modff' function. */ +Comment: /* #undef _GLIBCXX_HAVE__MODFF */ +Comment: /* Define to 1 if you have the `_modfl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__MODFL */ +Comment: /* Define to 1 if you have the `_powf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__POWF */ +Comment: /* Define to 1 if you have the `_powl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__POWL */ +Comment: /* Define to 1 if you have the `_qfpclass' function. */ +Comment: /* #undef _GLIBCXX_HAVE__QFPCLASS */ +Comment: /* Define to 1 if you have the `_sincos' function. */ +Comment: /* #undef _GLIBCXX_HAVE__SINCOS */ +Comment: /* Define to 1 if you have the `_sincosf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__SINCOSF */ +Comment: /* Define to 1 if you have the `_sincosl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__SINCOSL */ +Comment: /* Define to 1 if you have the `_sinf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__SINF */ +Comment: /* Define to 1 if you have the `_sinhf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__SINHF */ +Comment: /* Define to 1 if you have the `_sinhl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__SINHL */ +Comment: /* Define to 1 if you have the `_sinl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__SINL */ +Comment: /* Define to 1 if you have the `_sqrtf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__SQRTF */ +Comment: /* Define to 1 if you have the `_sqrtl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__SQRTL */ +Comment: /* Define to 1 if you have the `_tanf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__TANF */ +Comment: /* Define to 1 if you have the `_tanhf' function. */ +Comment: /* #undef _GLIBCXX_HAVE__TANHF */ +Comment: /* Define to 1 if you have the `_tanhl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__TANHL */ +Comment: /* Define to 1 if you have the `_tanl' function. */ +Comment: /* #undef _GLIBCXX_HAVE__TANL */ +Comment: /* Define to 1 if you have the `_wfopen' function. */ +Comment: /* #undef _GLIBCXX_HAVE__WFOPEN */ +Comment: /* Define to 1 if you have the `__cxa_thread_atexit' function. */ +Comment: /* #undef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT */ +Comment: /* Define to 1 if you have the `__cxa_thread_atexit_impl' function. */ +Comment: /* Define as const if the declaration of iconv() needs const. */ +Comment: /* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +Comment: /* Name of package */ +Comment: /* #undef _GLIBCXX_PACKAGE */ +Comment: /* Define to the address where bug reports for this package should be sent. */ +Comment: /* Define to the full name of this package. */ +Comment: /* Define to the full name and version of this package. */ +Comment: /* Define to the one symbol short name of this package. */ +Comment: /* Define to the home page for this package. */ +Comment: /* Define to the version of this package. */ +Comment: /* Define to 1 if you have the ANSI C header files. */ +Comment: /* Version number of package */ +Comment: /* #undef _GLIBCXX_VERSION */ +Comment: /* Enable large inode numbers on Mac OS X 10.5. */ +Comment: /* Number of bits in a file offset, on hosts where this is settable. */ +Comment: /* #undef _GLIBCXX_FILE_OFFSET_BITS */ +Comment: /* 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. */ +Comment: /* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +Comment: /* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +Comment: /* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +Comment: /* Define if C99 functions or macros in should be imported in + in namespace std for C++11. */ +Comment: /* 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. */ +Comment: /* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +Comment: /* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +Comment: /* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +Comment: /* Define if C99 functions or macros in should be imported in + in namespace std for C++98. */ +Comment: /* Define if the compiler supports C++11 atomics. */ +Comment: /* Define if global objects can be aligned to + std::hardware_destructive_interference_size. */ +Comment: /* Define to use concept checking code from the boost libraries. */ +Comment: /* #undef _GLIBCXX_CONCEPT_CHECKS */ +Comment: /* Define to 1 if a fully dynamic basic_string is wanted, 0 to disable, + undefined for platform defaults */ +Comment: /* Define if gthreads library is available. */ +Comment: /* Define to 1 if a full hosted library is built, or 0 if freestanding. */ +Comment: /* Define if compatibility should be provided for alternative 128-bit long + double formats. */ +Comment: /* Define if compatibility should be provided for -mlong-double-64. */ +Comment: /* Define to the letter to which size_t is mangled. */ +Comment: /* Define if C99 llrint and llround functions are missing from . */ +Comment: /* #undef _GLIBCXX_NO_C99_ROUNDING_FUNCS */ +Comment: /* Defined if no way to sleep is available. */ +Comment: /* #undef _GLIBCXX_NO_SLEEP */ +Comment: /* Define if ptrdiff_t is int. */ +Comment: /* #undef _GLIBCXX_PTRDIFF_T_IS_INT */ +Comment: /* Define if using setrlimit to set resource limits during "make check" */ +Comment: /* Define if size_t is unsigned int. */ +Comment: /* #undef _GLIBCXX_SIZE_T_IS_UINT */ +Comment: /* Define if static tzdata should be compiled into the library. */ +Comment: /* Define to the value of the EOF integer constant. */ +Comment: /* Define to the value of the SEEK_CUR integer constant. */ +Comment: /* Define to the value of the SEEK_END integer constant. */ +Comment: /* Define to use symbol versioning in the shared library. */ +Comment: /* Define to use darwin versioning in the shared library. */ +Comment: /* #undef _GLIBCXX_SYMVER_DARWIN */ +Comment: /* Define to use GNU versioning in the shared library. */ +Comment: /* Define to use GNU namespace versioning in the shared library. */ +Comment: /* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */ +Comment: /* Define to use Sun versioning in the shared library. */ +Comment: /* #undef _GLIBCXX_SYMVER_SUN */ +Comment: /* Define if C11 functions in should be imported into namespace std + in . */ +Comment: /* Define if C99 functions or macros from , , , + , and can be used or exposed. */ +Comment: /* Define if C99 functions in should be used in . + Using compiler builtins for these functions requires corresponding C99 + library functions to be present. */ +Comment: /* Define if C99 functions in should be imported in in + namespace std::tr1. */ +Comment: /* Define if C99 functions in should be imported in in + namespace std::tr1. */ +Comment: /* Define if C99 functions in should be imported in + in namespace std::tr1. */ +Comment: /* Define if wchar_t C99 functions in should be imported in + in namespace std::tr1. */ +Comment: /* Define if C99 functions or macros in should be imported in + in namespace std::tr1. */ +Comment: /* Define if C99 types in should be imported in in + namespace std::tr1. */ +Comment: /* Define if usable chdir is available in . */ +Comment: /* Define if usable chmod is available in . */ +Comment: /* Defined if clock_gettime syscall has monotonic and realtime clock support. + */ +Comment: /* #undef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL */ +Comment: /* Defined if clock_gettime has monotonic clock support. */ +Comment: /* Defined if clock_gettime has realtime clock support. */ +Comment: /* Define if ISO/IEC TR 24733 decimal floating point types are supported on + this host. */ +Comment: /* Define if /dev/random and /dev/urandom are available for + std::random_device. */ +Comment: /* Define if fchmod is available in . */ +Comment: /* Define if fchmodat is available in . */ +Comment: /* Define if fseeko and ftello are available. */ +Comment: /* Define if usable getcwd is available in . */ +Comment: /* Defined if gettimeofday is available. */ +Comment: /* Define if get_nprocs is available in . */ +Comment: /* Define if init_priority should be used for iostream initialization. */ +Comment: /* Define if LFS support is available. */ +Comment: /* Define if code specialized for long long should be used. */ +Comment: /* Define if lstat is available in . */ +Comment: /* Define if usable mkdir is available in . */ +Comment: /* Defined if nanosleep is available. */ +Comment: /* Define if NLS translations are to be used. */ +Comment: /* Define if pthreads_num_processors_np is available in . */ +Comment: /* #undef _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP */ +Comment: /* Define if pthread_cond_clockwait is available in . */ +Comment: /* Define if pthread_mutex_clocklock is available in . */ +Comment: /* Define if pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock are + available in . */ +Comment: /* Define if POSIX read/write locks are available in . */ +Comment: /* Define if /dev/random and /dev/urandom are available for the random_device + of TR1 (Chapter 5.1). */ +Comment: /* Define if usable realpath is available in . */ +Comment: /* Defined if sched_yield is available. */ +Comment: /* Define if _SC_NPROCESSORS_ONLN is available in . */ +Comment: /* Define if _SC_NPROC_ONLN is available in . */ +Comment: /* #undef _GLIBCXX_USE_SC_NPROC_ONLN */ +Comment: /* Define if sendfile is available in . */ +Comment: /* Define to restrict std::__basic_file<> to stdio APIs. */ +Comment: /* #undef _GLIBCXX_USE_STDIO_PURE */ +Comment: /* Define if struct stat has timespec members. */ +Comment: /* Define if sysctl(), CTL_HW and HW_NCPU are available in . */ +Comment: /* #undef _GLIBCXX_USE_SYSCTL_HW_NCPU */ +Comment: /* Define if obsolescent tmpnam is available in . */ +Comment: /* Define if c8rtomb and mbrtoc8 functions in should be imported + into namespace std in for C++20. */ +Comment: /* Define if c8rtomb and mbrtoc8 functions in should be imported + into namespace std in for -fchar8_t. */ +Comment: /* Define if utime is available in . */ +Comment: /* Define if utimensat and UTIME_OMIT are available in and + AT_FDCWD in . */ +Comment: /* Define if code specialized for wchar_t should be used. */ +Comment: /* Defined if Sleep exists. */ +Comment: /* #undef _GLIBCXX_USE_WIN32_SLEEP */ +Comment: /* Define to 1 if a verbose library is built, or 0 otherwise. */ +Comment: /* Defined if as can handle rdrand. */ +Comment: /* Defined if as can handle rdseed. */ +Comment: /* Define if a directory should be searched for tzdata files. */ +Comment: /* Define to 1 if mutex_timedlock is available. */ +Comment: /* Define for large files, on AIX-style hosts. */ +Comment: /* #undef _GLIBCXX_LARGE_FILES */ +Comment: /* Define if all C++11 floating point overloads are available in . */ +Comment: /* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP */ +Comment: /* Define if all C++11 integral type overloads are available in . */ +Comment: /* #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT */ +Comment: // _GLIBCXX_CXX_CONFIG_H +Comment: // Core algorithmic facilities -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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} + */ +Comment: // Function-Based Exception Support -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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. + */ +Comment: // +Comment: // ISO C++ 14882: 19.1 Exception classes +Comment: // +Comment: // -fno-exceptions Support -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // Else proceed normally. +Comment: // Helper for exception objects in +Comment: // Helper for exception objects in +Comment: // Helper for exception objects in +Comment: // Helpers for exception objects in +Comment: // Helpers for exception objects in +Comment: // Helpers for exception objects in +Comment: // Helpers for exception objects in +Comment: // Helpers for exception objects in +Comment: // ! HOSTED +Comment: // HOSTED +Comment: // namespace +Comment: // The -*- C++ -*- type traits classes for internal use in libstdc++ +Comment: // Copyright (C) 2000-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // Written by Gabriel Dos Reis +Comment: // +Comment: // This file provides some compile-time information about various types. +Comment: // These representations were designed, on purpose, to be constant-expressions +Comment: // and not types as found in . In particular, they +Comment: // can be used in control structures and the optimizer hopefully will do +Comment: // the obvious thing. +Comment: // +Comment: // Why integral expressions, and not functions nor types? +Comment: // Firstly, these compile-time entities are used as template-arguments +Comment: // so function return values won't work: We need compile-time entities. +Comment: // We're left with types and constant integral expressions. +Comment: // Secondly, from the point of view of ease of use, type-based compile-time +Comment: // information is -not- *that* convenient. One has to write lots of +Comment: // overloaded functions and to hope that the compiler will select the right +Comment: // one. As a net effect, the overall structure isn't very clear at first +Comment: // glance. +Comment: // Thirdly, partial ordering and overload resolution (of function templates) +Comment: // is highly costly in terms of compiler-resource. It is a Good Thing to +Comment: // keep these resource consumption as least as possible. +Comment: // +Comment: // See valarray_array.h for a case use. +Comment: // +Comment: // -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06. +Comment: // +Comment: // Update 2005: types are also provided and has been +Comment: // removed. +Comment: // +Comment: // N.B. The conversions to bool are needed due to the issue +Comment: // explained in c++/19404. +Comment: // Compare for equality of types. +Comment: // Holds if the template-argument is a void type. +Comment: // +Comment: // Integer types +Comment: // +Comment: // Thirteen specializations (yes there are eleven standard integer +Comment: // types; long long and unsigned long long are +Comment: // supported as extensions). Up to four target-specific __int +Comment: // types are supported as well. +Comment: // +Comment: // Floating point types +Comment: // +Comment: // three specializations (float, double and 'long double') +Comment: // +Comment: // Pointer types +Comment: // +Comment: // +Comment: // An arithmetic type is an integer type or a floating point type +Comment: // +Comment: // +Comment: // A scalar type is an arithmetic type or a pointer type +Comment: // +Comment: // +Comment: // For use in std::copy and std::find overloads for streambuf iterators. +Comment: // +Comment: // C++17 +Comment: // A type that is safe for use with memcpy, memmove, memcmp etc. +Comment: // Cannot use memcpy/memmove/memcmp on volatile types even if they are +Comment: // trivially copyable, so ensure __memcpyable +Comment: // and similar will be false. +Comment: // Whether two iterator types can be used with memcpy/memmove. +Comment: // Whether two iterator types can be used with memcmp. +Comment: // This trait only says it's well-formed to use memcmp, not that it +Comment: // gives the right answer for a given algorithm. So for example, std::equal +Comment: // needs to add additional checks that the types are integers or pointers, +Comment: // because other trivially copyable types can overload operator==. +Comment: // OK to use memcmp with pointers to trivially copyable types. +Comment: // Whether memcmp can be used to determine ordering for a type +Comment: // e.g. in std::lexicographical_compare or three-way comparisons. +Comment: // True for unsigned integer-like types where comparing each byte in turn +Comment: // as an unsigned char yields the right result. This is true for all +Comment: // unsigned integers on big endian targets, but only unsigned narrow +Comment: // character types (and std::byte) on little endian targets. +Comment: // is unsigned +Comment: // Whether two types can be compared using memcmp. +Comment: // std::byte can only be compared to itself, not to other types. +Comment: // +Comment: // Move iterator type +Comment: // +Comment: // Fallback implementation of the function in bits/stl_iterator.h used to +Comment: // remove the move_iterator wrapper. +Comment: // namespace +Comment: // extern "C++" +Comment: //_CPP_TYPE_TRAITS_H +Comment: // -*- C++ -*- +Comment: // Copyright (C) 2005-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the terms +Comment: // of the GNU General Public License as published by the Free Software +Comment: // Foundation; either version 3, or (at your option) any later +Comment: // version. +Comment: // This library is distributed in the hope that it will be useful, but +Comment: // WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Comment: // General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file ext/type_traits.h + * This file is a GNU extension to the Standard C++ Library. + */ +Comment: // Define a nested type if some predicate holds. +Comment: // Conditional expression for types. If true, first, if false, second. +Comment: // Given an integral builtin type, return the corresponding unsigned type. +Comment: // Declare but don't define. +Comment: // Given an integral builtin type, return the corresponding signed type. +Comment: // Declare but don't define. +Comment: // For use in string and vstring. +Comment: // For arithmetic promotions in and +Comment: // No nested __type member for non-integer non-floating point types, +Comment: // allows this type to be used for SFINAE to constrain overloads in +Comment: // and to only the intended types. +Comment: // Deducing the promoted type is done by __promoted_t<_Tp...>, +Comment: // then __promote is used to provide the nested __type member. +Comment: // namespace +Comment: // extern "C++" +Comment: // -*- C++ -*- +Comment: // Copyright (C) 2007-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the terms +Comment: // of the GNU General Public License as published by the Free Software +Comment: // Foundation; either version 3, or (at your option) any later +Comment: // version. +Comment: // This library is distributed in the hope that it will be useful, but +Comment: // WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Comment: // General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file ext/numeric_traits.h + * This file is a GNU extension to the Standard C++ Library. + */ +Comment: // Compile time constants for builtin types. +Comment: // In C++98 std::numeric_limits member functions are not constant expressions +Comment: // (that changed in C++11 with the addition of 'constexpr'). +Comment: // Even for C++11, this header is smaller than and can be used +Comment: // when only is_signed, digits, min, or max values are needed for integers, +Comment: // or is_signed, digits10, max_digits10, or max_exponent10 for floats. +Comment: // Unlike __is_integer (and std::is_integral) this trait is true for +Comment: // non-standard built-in integer types such as __int128 and __int20. +Comment: // The number of bits in the value representation. +Comment: // NB: these two are also available in std::numeric_limits as compile +Comment: // time constants, but is big and we can avoid including it. +Comment: // The initializers must be constants so that __max and __min are too. +Comment: // Enable __numeric_traits_integer for types where the __is_integer_nonstrict +Comment: // primary template doesn't give the right answer. +Comment: // We need to specify the width for some __intNN types because they +Comment: // have padding bits, e.g. the object representation of __int20 has 32 bits, +Comment: // but its width (number of bits in the value representation) is only 20. +Comment: // In strict modes __is_integer<__int128> is false, +Comment: // but we still want to define __numeric_traits_integer<__int128>. +Comment: /// Convenience alias for __numeric_traits. +Comment: // N.B. this only supports float, double and long double (no __float128 etc.) +Comment: // Only floating point types. See N1822. +Comment: // See above comment... +Comment: // namespace +Comment: // Pair implementation -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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} + */ +Comment: // for std::__decay_and_strip +Comment: // C++11 -*- C++ -*- +Comment: // Copyright (C) 2007-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file include/type_traits + * This is a Standard C++ Library header. + */ +Comment: /** + * @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 + * + * @{ + */ +Comment: /// integral_constant +Comment: /// The type used as a compile-time boolean with true value. +Comment: /// The type used as a compile-time boolean with false value. +Comment: /// @cond undocumented +Comment: /// bool_constant for C++11 +Comment: /// @endcond +Comment: /// Alias template for compile-time boolean constant types. +Comment: /// @since C++17 +Comment: // Metaprogramming helper types. +Comment: // Primary template. +Comment: /// Define a member typedef `type` only if a boolean constant is true. +Comment: // Partial specialization for true. +Comment: // __enable_if_t (std::enable_if_t for C++11) +Comment: // More efficient version of std::conditional_t for internal use (and C++11) +Comment: /// @cond undocumented +Comment: // A variadic alias template that resolves to its first argument. +Comment: // These are deliberately not defined. +Comment: // namespace detail +Comment: // Like C++17 std::dis/conjunction, but usable in C++11 and resolves +Comment: // to either true_type or false_type which allows for a more efficient +Comment: // implementation that avoids recursive class template instantiation. +Comment: /// @endcond +Comment: /// @cond undocumented +Comment: /* = void */ +Comment: /* = void */ +Comment: // namespace __detail +Comment: /// @endcond +Comment: /** @ingroup variable_templates + * @{ + */ +Comment: /// @} +Comment: // C++17 +Comment: // Forward declarations +Comment: /// @cond undocumented +Comment: // Helper functions that return false_type for incomplete classes, +Comment: // incomplete unions and arrays of known bound from those. +Comment: // __remove_cv_t (std::remove_cv_t for C++11). +Comment: /// @endcond +Comment: // Primary type categories. +Comment: /// is_void +Comment: /// @cond undocumented +Comment: // We want is_integral to be true (and make_signed/unsigned to work) +Comment: // even when libc doesn't provide working and related functions, +Comment: // so don't check _GLIBCXX_USE_WCHAR_T here. +Comment: // Conditionalizing on __STRICT_ANSI__ here will break any port that +Comment: // uses one of these types for size_t. +Comment: /// @endcond +Comment: /// is_integral +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_floating_point +Comment: /// is_array +Comment: /// is_pointer +Comment: /// is_lvalue_reference +Comment: /// is_rvalue_reference +Comment: /// is_member_object_pointer +Comment: /// is_member_function_pointer +Comment: /// is_enum +Comment: /// is_union +Comment: /// is_class +Comment: /// is_function +Comment: /// is_null_pointer (LWG 2247). +Comment: /// __is_nullptr_t (deprecated extension). +Comment: /// @deprecated Non-standard. Use `is_null_pointer` instead. +Comment: // Composite type categories. +Comment: /// is_reference +Comment: /// is_arithmetic +Comment: /// is_fundamental +Comment: /// is_object +Comment: /// is_scalar +Comment: /// is_compound +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_member_pointer +Comment: /// @cond undocumented +Comment: // Check if a type is one of the signed integer types. +Comment: // Check if a type is one of the unsigned integer types. +Comment: // Check if a type is one of the signed or unsigned integer types. +Comment: // __void_t (std::void_t for C++11) +Comment: /// @endcond +Comment: // Type properties. +Comment: /// is_const +Comment: /// is_volatile +Comment: /// is_trivial +Comment: /// is_trivially_copyable +Comment: /// is_standard_layout +Comment: /** is_pod + * @deprecated Deprecated in C++20. + * Use `is_standard_layout && is_trivial` instead. + */ +Comment: // Could use is_standard_layout && is_trivial instead of the builtin. +Comment: /** is_literal_type + * @deprecated Deprecated in C++17, removed in C++20. + * The idea of a literal type isn't useful. + */ +Comment: /// is_empty +Comment: /// is_polymorphic +Comment: /// is_final +Comment: /// @since C++14 +Comment: /// is_abstract +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_signed +Comment: /// is_unsigned +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// @cond undocumented +Comment: // Destructible and constructible type properties. +Comment: // In N3290 is_destructible does not say anything about function +Comment: // types and abstract types, see LWG 2049. This implementation +Comment: // describes function types as non-destructible and all complete +Comment: // object types as destructible, iff the explicit destructor +Comment: // call expression is wellformed. +Comment: /// @endcond +Comment: /// is_destructible +Comment: /// @cond undocumented +Comment: // is_nothrow_destructible requires that is_destructible is +Comment: // satisfied as well. We realize that by mimicing the +Comment: // implementation of is_destructible but refer to noexcept(expr) +Comment: // instead of decltype(expr). +Comment: /// @endcond +Comment: /// is_nothrow_destructible +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_constructible +Comment: /// is_default_constructible +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_copy_constructible +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_move_constructible +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_nothrow_constructible +Comment: /// is_nothrow_default_constructible +Comment: /// is_nothrow_copy_constructible +Comment: /// is_nothrow_move_constructible +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_assignable +Comment: /// is_copy_assignable +Comment: /// is_move_assignable +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_nothrow_assignable +Comment: /// is_nothrow_copy_assignable +Comment: /// is_nothrow_move_assignable +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_trivially_constructible +Comment: /// is_trivially_default_constructible +Comment: /// is_trivially_copy_constructible +Comment: /// is_trivially_move_constructible +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// is_trivially_assignable +Comment: /// is_trivially_copy_assignable +Comment: /// is_trivially_move_assignable +Comment: /// is_trivially_destructible +Comment: /// has_virtual_destructor +Comment: // type property queries. +Comment: /// alignment_of +Comment: /// rank +Comment: /// extent +Comment: // Type relations. +Comment: /// is_same +Comment: /// is_base_of +Comment: // helper trait for unique_ptr, shared_ptr, and span +Comment: /// is_nothrow_convertible_v +Comment: /// is_nothrow_convertible +Comment: // C++2a +Comment: // Const-volatile modifications. +Comment: /// remove_const +Comment: /// remove_volatile +Comment: /// remove_cv +Comment: /// add_const +Comment: /// add_volatile +Comment: /// add_cv +Comment: /// Alias template for remove_const +Comment: /// Alias template for remove_volatile +Comment: /// Alias template for remove_cv +Comment: /// Alias template for add_const +Comment: /// Alias template for add_volatile +Comment: /// Alias template for add_cv +Comment: // Reference transformations. +Comment: /// remove_reference +Comment: /// add_lvalue_reference +Comment: /// add_rvalue_reference +Comment: /// Alias template for remove_reference +Comment: /// Alias template for add_lvalue_reference +Comment: /// Alias template for add_rvalue_reference +Comment: // Sign modifications. +Comment: /// @cond undocumented +Comment: // Utility for constructing identically cv-qualified types. +Comment: // Utility for finding the unsigned versions of signed integral types. +Comment: // Select between integral and enum: not possible to be both. +Comment: // Choose unsigned integer type with the smallest rank and same size as _Tp +Comment: // With -fshort-enums, an enum may be as small as a char. +Comment: // wchar_t, char8_t, char16_t and char32_t are integral types but are +Comment: // neither signed integer types nor unsigned integer types, so must be +Comment: // transformed to the unsigned integer type with the smallest rank. +Comment: // Use the partial specialization for enumeration types to do that. +Comment: /// @endcond +Comment: // Given an integral/enum type, return the corresponding unsigned +Comment: // integer type. +Comment: // Primary template. +Comment: /// make_unsigned +Comment: // Integral, but don't define. +Comment: /// @cond undocumented +Comment: // Utility for finding the signed versions of unsigned integral types. +Comment: // Select between integral and enum: not possible to be both. +Comment: // Choose signed integer type with the smallest rank and same size as _Tp +Comment: // wchar_t, char16_t and char32_t are integral types but are neither +Comment: // signed integer types nor unsigned integer types, so must be +Comment: // transformed to the signed integer type with the smallest rank. +Comment: // Use the partial specialization for enumeration types to do that. +Comment: /// @endcond +Comment: // Given an integral/enum type, return the corresponding signed +Comment: // integer type. +Comment: // Primary template. +Comment: /// make_signed +Comment: // Integral, but don't define. +Comment: /// Alias template for make_signed +Comment: /// Alias template for make_unsigned +Comment: // Array modifications. +Comment: /// remove_extent +Comment: /// remove_all_extents +Comment: /// Alias template for remove_extent +Comment: /// Alias template for remove_all_extents +Comment: // Pointer modifications. +Comment: /// remove_pointer +Comment: /// add_pointer +Comment: /// Alias template for remove_pointer +Comment: /// Alias template for add_pointer +Comment: /** + * @brief Alignment type. + * + * The value of _Align is a default-alignment which shall be the + * most stringent alignment requirement for any C++ object type + * whose size is no greater than _Len (3.9). The member typedef + * type shall 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. + * + * @deprecated Deprecated in C++23. Uses can be replaced by an + * array std::byte[_Len] declared with alignas(_Align). + */ +Comment: /** + * @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. + */ +Comment: /// The value of the strictest alignment of _Types. +Comment: /// The storage. +Comment: /// @cond undocumented +Comment: // Decay trait for arrays and functions, used for perfect forwarding +Comment: // in make_pair, make_tuple, etc. +Comment: // false for functions +Comment: // N.B. DR 705. +Comment: // function decays to pointer +Comment: /// @endcond +Comment: /// decay +Comment: /// @cond undocumented +Comment: // Helper which adds a reference to a type when given a reference_wrapper +Comment: // __decay_t (std::decay_t for C++11). +Comment: /// @endcond +Comment: /// @cond undocumented +Comment: // Helper for SFINAE constraints +Comment: // __remove_cvref_t (std::remove_cvref_t for C++11). +Comment: /// @endcond +Comment: // Primary template. +Comment: /// Define a member typedef @c type to one of two argument types. +Comment: // Partial specialization for false. +Comment: /// common_type +Comment: // Sfinae-friendly common_type implementation: +Comment: /// @cond undocumented +Comment: // For several sfinae-friendly trait implementations we transport both the +Comment: // result information (as the member type) and the failure information (no +Comment: // member type). This is very similar to std::enable_if, but we cannot use +Comment: // that, because we need to derive from them as an implementation detail. +Comment: // if decay_t() : declval())> +Comment: // denotes a valid type, let C denote that type. +Comment: // Otherwise, if COND-RES(CREF(D1), CREF(D2)) denotes a type, +Comment: // let C denote the type decay_t. +Comment: // If sizeof...(T) is zero, there shall be no member type. +Comment: // If sizeof...(T) is one, the same type, if any, as common_type_t. +Comment: // If sizeof...(T) is two, ... +Comment: // If is_same_v is false or is_same_v is false, +Comment: // let C denote the same type, if any, as common_type_t. +Comment: // Otherwise, if decay_t() : declval())> +Comment: // denotes a valid type, let C denote that type. +Comment: // If sizeof...(T) is two, ... +Comment: // If sizeof...(T) is greater than two, ... +Comment: // Let C denote the same type, if any, as common_type_t. +Comment: // If there is such a type C, type shall denote the same type, if any, +Comment: // as common_type_t. +Comment: // Otherwise, there shall be no member type. +Comment: /// @endcond +Comment: /// The underlying type of an enum. +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /** Utility to simplify expressions used in unevaluated operands + * @since C++11 + * @ingroup utilities + */ +Comment: /// result_of +Comment: // Sfinae-friendly result_of implementation: +Comment: /// @cond undocumented +Comment: // Associate a tag type with a specialization of __success_type. +Comment: // [func.require] paragraph 1 bullet 1: +Comment: // [func.require] paragraph 1 bullet 2: +Comment: // [func.require] paragraph 1 bullet 3: +Comment: // [func.require] paragraph 1 bullet 4: +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2219. INVOKE-ing a pointer to member with a reference_wrapper +Comment: // as the object expression +Comment: // Used by result_of, invoke etc. to unwrap a reference_wrapper. +Comment: // [func.require] paragraph 1 bullet 5: +Comment: // __invoke_result (std::invoke_result for C++11) +Comment: /// @endcond +Comment: /// Alias template for aligned_storage +Comment: /// Alias template for decay +Comment: /// Alias template for enable_if +Comment: /// Alias template for conditional +Comment: /// Alias template for common_type +Comment: /// Alias template for underlying_type +Comment: /// Alias template for result_of +Comment: // C++14 +Comment: // c++17 or gnu++11 +Comment: /// A metafunction that always yields void, used for detecting valid types. +Comment: /// @cond undocumented +Comment: // Detection idiom. +Comment: // Detect whether _Op<_Args...> is a valid type, use default _Def if not. +Comment: // Implementation of the detection idiom (negative case). +Comment: // Implementation of the detection idiom (positive case). +Comment: // __cpp_concepts +Comment: // _Op<_Args...> if that is a valid type, otherwise _Default. +Comment: /** + * Use SFINAE to determine if the type _Tp has a publicly-accessible + * member type _NTYPE. + */ +Comment: // Internal type trait that allows us to sfinae-protect tuple_cat. +Comment: /// @endcond +Comment: /// @cond undocumented +Comment: // namespace __swappable_details +Comment: /// @endcond +Comment: // c++1z or gnu++11 +Comment: /// Metafunctions used for detecting swappable types: p0185r1 +Comment: /// is_swappable +Comment: /// is_nothrow_swappable +Comment: /// is_swappable_v +Comment: /// is_nothrow_swappable_v +Comment: // __cplusplus >= 201402L +Comment: /// @cond undocumented +Comment: // namespace __swappable_with_details +Comment: // Optimization for the homogenous lvalue case, not required: +Comment: // Optimization for the homogenous lvalue case, not required: +Comment: /// @endcond +Comment: /// is_swappable_with +Comment: /// is_nothrow_swappable_with +Comment: /// is_swappable_with_v +Comment: /// is_nothrow_swappable_with_v +Comment: // __cplusplus >= 201402L +Comment: // c++1z or gnu++11 +Comment: /// @cond undocumented +Comment: // __is_invocable (std::is_invocable for C++11) +Comment: // The primary template is used for invalid INVOKE expressions. +Comment: // For is_nothrow_invocable_r +Comment: // Used for valid INVOKE and INVOKE expressions. +Comment: /* is_void<_Ret> = */ +Comment: // For is_nothrow_invocable_r +Comment: // Used for INVOKE expressions to check the implicit conversion to R. +Comment: /* is_void<_Ret> = */ +Comment: // The type of the INVOKE expression. +Comment: // Unlike declval, this doesn't add_rvalue_reference, so it respects +Comment: // guaranteed copy elision. +Comment: // Used to check if _Res_t can implicitly convert to _Tp. +Comment: // This overload is viable if INVOKE(f, args...) can convert to _Tp. +Comment: // For is_invocable_r +Comment: /* Nothrow = */ +Comment: // For is_nothrow_invocable_r +Comment: // __is_nothrow_invocable (std::is_nothrow_invocable for C++11) +Comment: /// @endcond +Comment: /// std::invoke_result +Comment: /// std::invoke_result_t +Comment: /// std::is_invocable +Comment: /// std::is_invocable_r +Comment: /// std::is_nothrow_invocable +Comment: /// @cond undocumented +Comment: // This checks that the INVOKE expression is well-formed and that the +Comment: // conversion to R does not throw. It does *not* check whether the INVOKE +Comment: // expression itself can throw. That is done by __call_is_nothrow_ instead. +Comment: /// @endcond +Comment: /// std::is_nothrow_invocable_r +Comment: // C++17 +Comment: /** + * @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. + */ +Comment: /** + * @{ + * @ingroup variable_templates + */ +Comment: /// @} +Comment: /// has_unique_object_representations +Comment: /// @since C++17 +Comment: /// @ingroup variable_templates +Comment: /// is_aggregate - true if the type is an aggregate. +Comment: /// @since C++17 +Comment: /** is_aggregate_v - true if the type is an aggregate. + * @ingroup variable_templates + * @since C++17 + */ +Comment: // C++17 +Comment: /** * Remove references and cv-qualifiers. + * @since C++20 + * @{ + */ +Comment: /// @} +Comment: /** * Identity metafunction. + * @since C++20 + * @{ + */ +Comment: /// @} +Comment: /** Unwrap a reference_wrapper + * @since C++20 + * @{ + */ +Comment: /// @} +Comment: /** Decay type and if it's a reference_wrapper, unwrap it + * @since C++20 + * @{ + */ +Comment: /// @} +Comment: /// True for a type that is an array of known bound. +Comment: /// @ingroup variable_templates +Comment: /// @since C++20 +Comment: /// True for a type that is an array of unknown bound. +Comment: /// @ingroup variable_templates +Comment: /// @since C++20 +Comment: /// True for a type that is an array of known bound. +Comment: /// @since C++20 +Comment: /// True for a type that is an array of unknown bound. +Comment: /// @since C++20 +Comment: /// @since C++20 +Comment: /// @ingroup variable_templates +Comment: /// @since C++20 +Comment: /// True if `_Derived` is standard-layout and has a base class of type `_Base` +Comment: /// @since C++20 +Comment: /// @ingroup variable_templates +Comment: /// @since C++20 +Comment: // C++23 +Comment: /// Returns true only when called during constant evaluation. +Comment: /// @since C++20 +Comment: /// @cond undocumented +Comment: // [meta.trans.other], COMMON-REF(A, B) +Comment: // COND-RES(COPYCV(X, Y) &, COPYCV(Y, X) &) +Comment: // If A and B are both lvalue reference types, ... +Comment: // let C be remove_reference_t&& +Comment: // If A and B are both rvalue reference types, ... +Comment: // let D be COMMON-REF(const X&, Y&) +Comment: // If A is an rvalue reference and B is an lvalue reference, ... +Comment: // If A is an lvalue reference and B is an rvalue reference, ... +Comment: /// @endcond +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: // If sizeof...(T) is zero, there shall be no member type. +Comment: // If sizeof...(T) is one ... +Comment: /// @cond undocumented +Comment: // If sizeof...(T) is two ... +Comment: // If T1 and T2 are reference types and COMMON-REF(T1, T2) is well-formed, ... +Comment: // Otherwise, if basic_common_reference<...>::type is well-formed, ... +Comment: // Otherwise, if COND-RES(T1, T2) is well-formed, ... +Comment: // Otherwise, if common_type_t is well-formed, ... +Comment: // Otherwise, there shall be no member type. +Comment: // Otherwise, if sizeof...(T) is greater than two, ... +Comment: // Reuse __common_type_fold for common_reference +Comment: /// @endcond +Comment: // C++2a +Comment: /// @} group metaprogramming +Comment: // namespace std +Comment: // C++11 +Comment: // _GLIBCXX_TYPE_TRAITS +Comment: // for std::move / std::forward, and std::swap +Comment: // Move, forward and identity for C++11 + swap -*- C++ -*- +Comment: // Copyright (C) 2007-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file bits/move.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{utility} + */ +Comment: // Brings in std::declval too. +Comment: // Used, in C++03 mode too, by allocators, etc. +Comment: /** + * @brief Same as C++11 std::addressof + * @ingroup utilities + */ +Comment: /** + * @addtogroup utilities + * @{ + */ +Comment: /** + * @brief Forward an lvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + */ +Comment: /** + * @brief Forward an rvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: // declval, from type_traits. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2296. std::addressof should be constexpr +Comment: /** + * @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. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2598. addressof works on temporaries +Comment: // C++11 version of std::exchange for internal use. +Comment: /// @} group utilities +Comment: /** + * @addtogroup utilities + * @{ + */ +Comment: /** + * @brief Swaps two values. + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @return Nothing. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // DR 809. std::swap should be overloaded for array types. +Comment: /// Swap the contents of two arrays. +Comment: /// @} group utilities +Comment: // namespace +Comment: /* _MOVE_H */ +Comment: // for std::tuple_element, std::tuple_size +Comment: // Utilities used throughout the library -*- C++ -*- +Comment: // Copyright (C) 2004-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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 ``. + */ +Comment: /// Finds the size of a given tuple type. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2313. tuple_size should always derive from integral_constant +Comment: // 2770. tuple_size specialization is not SFINAE compatible +Comment: /// Gives the type of the ith element of a given tuple type. +Comment: // Duplicate of C++14's tuple_element_t for internal use in C++11 mode +Comment: // Return the index of _Tp in _Types, if it occurs exactly once. +Comment: // Otherwise, return sizeof...(_Types). +Comment: // more than one _Tp found +Comment: // The standard says this macro and alias template should be in but we +Comment: // define them here, to be available in , and too. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3378. tuple_size_v/tuple_element_t should be available when +Comment: // tuple_size/tuple_element are +Comment: // C++14 +Comment: // Stores a tuple of indices. Used by tuple and pair, and by bind() to +Comment: // extract the elements in a tuple. +Comment: // Builds an _Index_tuple<0, 1, 2, ..., _Num-1>. +Comment: // Clang defines __make_integer_seq for this purpose. +Comment: /// Class template integer_sequence +Comment: /// Alias template make_integer_sequence +Comment: /// Alias template index_sequence +Comment: /// Alias template make_index_sequence +Comment: /// Alias template index_sequence_for +Comment: // C++17 +Comment: // C++14 +Comment: // Need additional specializations to avoid ambiguities. +Comment: // namespace +Comment: // C++11 +Comment: /* _GLIBCXX_UTILITY_H */ +Comment: // -*- C++ -*- operator<=> three-way comparison support. +Comment: // Copyright (C) 2019-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of GCC. +Comment: // +Comment: // GCC is free software; you can redistribute it and/or modify +Comment: // it under the terms of the GNU General Public License as published by +Comment: // the Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // +Comment: // GCC is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file compare + * This is a Standard C++ Library header. + */ +Comment: // -*- C++ -*- +Comment: // Copyright (C) 2019-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file include/concepts + * This is a Standard C++ Library header. + * @ingroup concepts + */ +Comment: /** + * @defgroup concepts Concepts + * @ingroup utilities + * + * Concepts for checking type requirements. + */ +Comment: // [concepts.lang], language-related concepts +Comment: // namespace __detail +Comment: /// [concept.same], concept same_as +Comment: /// [concept.derived], concept derived_from +Comment: /// [concept.convertible], concept convertible_to +Comment: /// [concept.commonref], concept common_reference_with +Comment: /// [concept.common], concept common_with +Comment: // [concepts.arithmetic], arithmetic concepts +Comment: // namespace __detail +Comment: /// [concept.assignable], concept assignable_from +Comment: /// [concept.destructible], concept destructible +Comment: /// [concept.constructible], concept constructible_from +Comment: /// [concept.defaultinitializable], concept default_initializable +Comment: /// [concept.moveconstructible], concept move_constructible +Comment: /// [concept.copyconstructible], concept copy_constructible +Comment: // [concept.swappable], concept swappable +Comment: // namespace __cust_swap +Comment: // inline namespace __cust +Comment: // namespace ranges +Comment: // [concepts.object], Object concepts +Comment: // [concepts.compare], comparison concepts +Comment: // [concept.booleantestable], Boolean testability +Comment: // namespace __detail +Comment: // [concept.equalitycomparable], concept equality_comparable +Comment: // namespace __detail +Comment: // namespace __detail +Comment: // [concept.totallyordered], concept totally_ordered +Comment: // [concepts.callable], callable concepts +Comment: /// [concept.invocable], concept invocable +Comment: /// [concept.regularinvocable], concept regular_invocable +Comment: /// [concept.predicate], concept predicate +Comment: /// [concept.relation], concept relation +Comment: /// [concept.equiv], concept equivalence_relation +Comment: /// [concept.strictweakorder], concept strict_weak_order +Comment: // namespace +Comment: // C++2a +Comment: /* _GLIBCXX_CONCEPTS */ +Comment: // [cmp.categories], comparison category types +Comment: // less=0xff, equiv=0x00, greater=0x01, unordered=0x02 +Comment: // valid values +Comment: // comparisons +Comment: // valid values' definitions +Comment: // valid values +Comment: // comparisons +Comment: // valid values' definitions +Comment: // valid values +Comment: // comparisons +Comment: // valid values' definitions +Comment: // named comparison functions +Comment: // If any Ti is not a comparison category type, U is void. +Comment: // Otherwise, if at least one Ti is std::partial_ordering, +Comment: // U is std::partial_ordering. +Comment: // Otherwise, if at least one Ti is std::weak_ordering, +Comment: // U is std::weak_ordering. +Comment: // Otherwise, U is std::strong_ordering. +Comment: // namespace __detail +Comment: // [cmp.common], common comparison category type +Comment: // Partial specializations for one and zero argument cases. +Comment: // namespace __detail +Comment: // [cmp.concept], concept three_way_comparable +Comment: // Implementation of std::compare_three_way_result. +Comment: // It is undefined for a program to add specializations of +Comment: // std::compare_three_way_result, so the std::compare_three_way_result_t +Comment: // alias ignores std::compare_three_way_result and uses +Comment: // __detail::__cmp3way_res_impl directly instead. +Comment: // namespace __detail +Comment: /// [cmp.result], result of three-way comparison +Comment: /// [cmp.result], result of three-way comparison +Comment: // BUILTIN-PTR-THREE-WAY(T, U) +Comment: // This determines whether t <=> u results in a call to a built-in +Comment: // operator<=> comparing pointers. It doesn't work for function pointers +Comment: // (PR 93628). +Comment: // namespace __detail +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3530 BUILTIN-PTR-MEOW should not opt the type out of syntactic checks +Comment: // [cmp.object], typename compare_three_way +Comment: // Returns an integer with the same sign as the argument, and magnitude +Comment: // indicating the classification: zero=1 subnorm=2 norm=3 inf=4 nan=5 +Comment: // unordered, at least one argument is NaN +Comment: // return -1 for negative nan, +1 for positive nan, 0 otherwise. +Comment: // Names for the supported floating-point representations. +Comment: // IEEE +Comment: // x86 80-bit extended precision +Comment: // m68k 80-bit extended precision +Comment: // IBM 128-bit double-double +Comment: // std::bfloat16_t +Comment: // Identify the format used by a floating-point type. +Comment: // Identify these formats first, then assume anything else is IEEE. +Comment: // N.B. ARM __fp16 alternative format can be handled as binary16. +Comment: // IEEE binary16 (or ARM fp16). +Comment: // IEEE binary32 +Comment: // IEEE binary64 +Comment: // IEEE binary128 +Comment: // So we don't need to include and pollute the namespace. +Comment: // Used to unpack floating-point types that do not fit into an integer. +Comment: // Sign extend to get all ones or all zeros. +Comment: // If the sign bit was set, this flips all bits below it. +Comment: // This converts ones' complement to two's complement. +Comment: // As above but works on both parts of _Int. +Comment: // Bit-cast a floating-point value to an unsigned integer. +Comment: // All bits are equal, we're done. +Comment: // double-double +Comment: // Unpack the double-double into two parts. +Comment: // We never inspect the low double as a double, cast to integer. +Comment: // Compare the high doubles first and use result if unequal. +Comment: // For NaN the low double is unused, so if the high doubles +Comment: // are the same NaN, we don't need to compare the low doubles. +Comment: // Similarly, if the low doubles are +zero or -zero (which is +Comment: // true for all infinities and some other values), we're done. +Comment: // Otherwise, compare the low parts. +Comment: // For m68k the MSB of the significand is ignored for the +Comment: // greatest exponent, so either 0 or 1 is valid there. +Comment: // Set it before comparing, so that we never have 0 there. +Comment: // __op_eq_lt<_Tp, _Up> +Comment: // __op_eq_lt<_Tp, _Up> +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3465. compare_partial_order_fallback requires F < E +Comment: // __op_eq_lt_lt<_Tp, _Up> +Comment: // namespace __cmp_cust +Comment: // [cmp.alg], comparison algorithms +Comment: // [expos.only.func] synth-three-way +Comment: // [expos.only.func] synth-three-way-result +Comment: // namespace __detail +Comment: // concepts +Comment: // namespace std +Comment: // C++20 +Comment: // _COMPARE +Comment: /** + * @addtogroup utilities + * @{ + */ +Comment: /// Tag type for piecewise construction of std::pair objects. +Comment: /// Tag for piecewise construction of std::pair objects. +Comment: /// @cond undocumented +Comment: // Forward declarations. +Comment: // lib concepts +Comment: // C++11 +Comment: // C++11 +Comment: /// @endcond +Comment: /** + * @brief Struct holding two objects of arbitrary type. + * + * @tparam _T1 Type of first object. + * @tparam _T2 Type of second object. + * + * + * + * @headerfile utility + */ +Comment: ///< The type of the `first` member +Comment: ///< The type of the `second` member +Comment: ///< The first member +Comment: ///< The second member +Comment: ///< Copy constructor +Comment: ///< Move constructor +Comment: /// Swap the first members and then the second members. +Comment: // C++23 +Comment: // C++20 implementation using concepts, explicit(bool), fully constexpr. +Comment: /// Default constructor +Comment: /// @cond undocumented +Comment: // True if construction from _U1 and _U2 would create a dangling ref. +Comment: /// @endcond +Comment: /// Constructor accepting lvalues of `first_type` and `second_type` +Comment: /// Constructor accepting two values of arbitrary types +Comment: /// Converting constructor from a const `pair` lvalue +Comment: /// Converting constructor from a non-const `pair` rvalue +Comment: // C++23 +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// Copy assignment operator +Comment: /// Move assignment operator +Comment: /// Converting assignment from a const `pair` lvalue +Comment: /// Converting assignment from a non-const `pair` rvalue +Comment: // C++23 +Comment: // !__cpp_lib_concepts +Comment: // lib concepts +Comment: // C++11 +Comment: /// @relates pair @{ +Comment: /// Two pairs of the same type are equal iff their members are equal. +Comment: // !(three_way_comparison && concepts) +Comment: /** 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 + */ +Comment: // c++1z or gnu++11 +Comment: // Constrained free swap overload, see p0185r1 +Comment: // C++23 +Comment: // c++1z or gnu++11 +Comment: // __cplusplus >= 201103L +Comment: /// @} relates pair +Comment: /** + * @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. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 181. make_pair() unintended behavior +Comment: // NB: DR 706. +Comment: /// @} +Comment: // Various functions which give std::pair a tuple-like interface. +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// Partial specialization for std::pair +Comment: /// Partial specialization for std::pair +Comment: /// Partial specialization for std::pair +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /** @{ + * std::get overloads for accessing members of std::pair + */ +Comment: // C++23 +Comment: // C++14 +Comment: /// @} +Comment: // C++11 +Comment: // namespace std +Comment: /* _STL_PAIR_H */ +Comment: // Types used in iterator implementation -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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. + */ +Comment: // For __void_t, is_convertible +Comment: // Concepts and traits for use with iterators -*- C++ -*- +Comment: // Copyright (C) 2019-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file bits/iterator_concepts.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ +Comment: // to_address +Comment: // Pointer Traits -*- C++ -*- +Comment: // Copyright (C) 2011-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: /* Duplicate definition with unique_ptr.h. */ +Comment: /// @cond undocumented +Comment: // For a specialization `SomeTemplate` the member `type` is T, +Comment: // otherwise `type` is `__undefined`. +Comment: // For a specialization `SomeTemplate` and a type `U` the member +Comment: // `type` is `SomeTemplate`, otherwise there is no member `type`. +Comment: // Detect the element type of a pointer-like type. +Comment: // Use _Ptr::element_type if is a valid type. +Comment: /// @endcond +Comment: // Define pointer_traits

::pointer_to. +Comment: /** + * @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. + */ +Comment: // Do not define pointer_traits

::pointer_to if element type is void. +Comment: // Partial specialization defining pointer_traits::pointer_to(T&). +Comment: /** + * @brief Obtain a pointer to an object + * @param __r A reference to an object of type `element_type` + * @return `addressof(__r)` + */ +Comment: /// The pointer type. +Comment: /// The type pointed to. +Comment: /// The type used to represent the difference between two pointers. +Comment: /// A pointer to a different type. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3545. std::pointer_traits should be SFINAE-friendly +Comment: /** + * @brief Uniform interface to all pointer-like types + * @headerfile memory + * @ingroup pointer_abstractions + * @since C++11 + */ +Comment: /** + * @brief Partial specialization for built-in pointers. + * @headerfile memory + * @ingroup pointer_abstractions + * @since C++11 + */ +Comment: /// The pointer type +Comment: /// The type pointed to +Comment: /// Type used to represent the difference between two pointers +Comment: /// A pointer to a different type. +Comment: /// Convenience alias for rebinding pointers. +Comment: /** + * @brief Obtain address referenced by a pointer to an object + * @param __ptr A pointer to an object + * @return @c __ptr + * @ingroup pointer_abstractions + */ +Comment: /** + * @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 + */ +Comment: // C++2a +Comment: // namespace std +Comment: // identity, ranges::less +Comment: // Concept-constrained comparison implementations -*- C++ -*- +Comment: // Copyright (C) 2019-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file bits/ranges_cmp.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ +Comment: // not defined +Comment: // Define std::identity here so that and +Comment: // don't need to include to get it. +Comment: /// [func.identity] The identity function. +Comment: // Define this here, included by all the headers that need to define it. +Comment: // BUILTIN-PTR-CMP(T, <, U) +Comment: // This determines whether t < u results in a call to a built-in operator< +Comment: // comparing pointers. It doesn't work for function pointers (PR 93628). +Comment: // namespace __detail +Comment: // [range.cmp] Concept-constrained comparisons +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3530 BUILTIN-PTR-MEOW should not opt the type out of syntactic checks +Comment: /// ranges::equal_to function object type. +Comment: /// ranges::not_equal_to function object type. +Comment: /// ranges::less function object type. +Comment: /// ranges::greater function object type. +Comment: /// ranges::greater_equal function object type. +Comment: /// ranges::less_equal function object type. +Comment: // namespace ranges +Comment: // library concepts +Comment: // namespace std +Comment: // C++20 +Comment: // _RANGES_CMP_H +Comment: /** A sentinel type that can be used to check for the end of a range. + * + * For some iterator types the past-the-end sentinel value is independent + * of the underlying sequence, and a default sentinel can be used with them. + * For example, a `std::counted_iterator` keeps a count of how many elements + * remain, and so checking for the past-the-end value only requires checking + * if that count has reached zero. A past-the-end `std::istream_iterator` is + * equal to the default-constructed value, which can be easily checked. + * + * Comparing iterators of these types to `std::default_sentinel` is a + * convenient way to check if the end has been reached. + * + * @since C++20 + */ +Comment: /// A default sentinel value. +Comment: // namespace __detail +Comment: // The result type of iter_move(std::declval<_Tp>()) +Comment: // namespace __cust_imove +Comment: // inline namespace __cust +Comment: // namespace ranges +Comment: // __int128 is incrementable even if !integral<__int128> +Comment: // An iterator such that iterator_traits<_Iter> names a specialization +Comment: // generated from the primary template. +Comment: // ITER_TRAITS +Comment: // namespace __detail +Comment: // namespace __detail +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3446. indirectly_readable_traits ambiguity for types with both [...] +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3541. indirectly_readable_traits should be SFINAE-friendly for all types +Comment: // namespace __detail +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3420. cpp17-iterator should check [type] looks like an iterator first +Comment: // namespace __detail +Comment: // ITER_CONCEPT(I) is ITER_TRAITS(I)::iterator_concept if that is valid. +Comment: // Otherwise, ITER_TRAITS(I)::iterator_category if that is valid. +Comment: // Otherwise, random_access_tag if iterator_traits is not specialized. +Comment: // Otherwise, there is no ITER_CONCEPT(I) type. +Comment: // ITER_CONCEPT +Comment: // namespace __detail +Comment: /// Requirements for types that are readable by applying operator*. +Comment: /// Requirements for writing a value into an iterator's referenced object. +Comment: // namespace ranges::__detail +Comment: /// Requirements on types that can be incremented with ++. +Comment: // [indirectcallable], indirect callable requirements +Comment: // [indirectcallable.indirectinvocable], indirect callables +Comment: // not defined +Comment: // not defined +Comment: // namespace __detail +Comment: /// [projected], projected +Comment: // [alg.req], common algorithm requirements +Comment: /// [alg.req.ind.move], concept `indirectly_movable` +Comment: /// [alg.req.ind.copy], concept `indirectly_copyable` +Comment: // namespace __cust_iswap +Comment: // inline namespace __cust +Comment: // namespace ranges +Comment: /// [alg.req.ind.swap], concept `indirectly_swappable` +Comment: /// [alg.req.ind.cmp], concept `indirectly_comparable` +Comment: /// [alg.req.permutable], concept `permutable` +Comment: /// [alg.req.mergeable], concept `mergeable` +Comment: /// [alg.req.sortable], concept `sortable` +Comment: // This is the namespace for [range.access] CPOs. +Comment: // Poison pills so that unqualified lookup doesn't find std::begin. +Comment: // Simplified version of std::ranges::begin that only supports lvalues, +Comment: // for use by __range_iter_t below. +Comment: // namespace ranges::__cust_access +Comment: // Implementation of std::ranges::iterator_t, without using ranges::begin. +Comment: // namespace __detail +Comment: // C++20 library concepts +Comment: // namespace std +Comment: // C++20 +Comment: // _ITERATOR_CONCEPTS_H +Comment: /** + * @defgroup iterators Iterators + * Abstractions for uniform iterating through various underlying types. + */ +Comment: ///@{ +Comment: /** + * @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. + */ +Comment: ///@{ +Comment: /// Marking input iterators. +Comment: /// Marking output iterators. +Comment: /// Forward iterators support a superset of input iterator operations. +Comment: /// Bidirectional iterators support a superset of forward iterator +Comment: /// operations. +Comment: /// Random-access iterators support a superset of bidirectional +Comment: /// iterator operations. +Comment: /// Contiguous iterators point to objects stored contiguously in memory. +Comment: ///@} +Comment: /** + * @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?) + */ +Comment: /// One of the @link iterator_tags tag types@endlink. +Comment: /// The type "pointed to" by the iterator. +Comment: /// Distance between iterators is represented as this type. +Comment: /// This type represents a pointer-to-value_type. +Comment: /// This type represents a reference-to-value_type. +Comment: /** + * @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. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2408. SFINAE-friendly common_type/iterator_traits is missing in C++14 +Comment: // ! concepts +Comment: // ! C++11 +Comment: // C++11 +Comment: /// Partial specialization for object pointer types. +Comment: /** + * This function is not a part of the C++ standard but is syntactic + * sugar for internal library use only. + */ +Comment: ///@} +Comment: // namespace +Comment: /* _STL_ITERATOR_BASE_TYPES_H */ +Comment: // Functions used by iterators -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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(). + */ +Comment: // Concept-checking control -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // All places in libstdc++-v3 where these are used, or /might/ be used, or +Comment: // don't need to be used, or perhaps /should/ be used, are commented with +Comment: // "concept requirements" (and maybe some more text). So grep like crazy +Comment: // if you're looking for additional places to use these. +Comment: // Concept-checking code is off by default unless users turn it on via +Comment: // configure options or editing c++config.h. +Comment: // It is not supported for freestanding implementations. +Comment: // the checks are on +Comment: // enable/disable +Comment: // _GLIBCXX_CONCEPT_CHECK +Comment: // Debugging support implementation -*- C++ -*- +Comment: // Copyright (C) 2003-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file debug/assertions.h + * This file is a GNU debug extension to the Standard C++ Library. + */ +Comment: // _GLIBCXX_DEBUG_ASSERTIONS +Comment: // Forward declaration for the overloads of __distance. +Comment: // concept requirements +Comment: // concept requirements +Comment: // Forward declaration because of the qualified call in distance. +Comment: // Give better error if std::distance called with a non-Cpp17InputIterator. +Comment: /** + * @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. + */ +Comment: // concept requirements -- taken care of in __distance +Comment: // concept requirements +Comment: // concept requirements +Comment: // concept requirements +Comment: // Give better error if std::advance called with a non-Cpp17InputIterator. +Comment: /** + * @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. + */ +Comment: // concept requirements -- taken care of in __advance +Comment: // concept requirements +Comment: // concept requirements +Comment: // C++11 +Comment: // namespace +Comment: /* _STL_ITERATOR_BASE_FUNCS_H */ +Comment: // Iterators -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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. + */ +Comment: // The -*- C++ -*- dynamic memory management header. +Comment: // Copyright (C) 1994-2023 Free Software Foundation, Inc. +Comment: // This file is part of GCC. +Comment: // +Comment: // GCC is free software; you can redistribute it and/or modify +Comment: // it under the terms of the GNU General Public License as published by +Comment: // the Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // +Comment: // GCC is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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. + */ +Comment: // Exception Handling support header for -*- C++ -*- +Comment: // Copyright (C) 2016-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of GCC. +Comment: // +Comment: // GCC is free software; you can redistribute it and/or modify +Comment: // it under the terms of the GNU General Public License as published by +Comment: // the Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // +Comment: // GCC is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file bits/exception.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ +Comment: /** + * @defgroup exceptions Exceptions + * @ingroup diagnostics + * @since C++98 + * + * Classes and functions for reporting errors via exceptions. + * @{ + */ +Comment: /** + * @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). + */ +Comment: /** Returns a C-style character string describing the general cause + * of the current error. */ +Comment: /// @} +Comment: // namespace std +Comment: /** + * @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. */ +Comment: // This declaration is not useless: +Comment: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 +Comment: // See comment in eh_exception.cc. +Comment: // This declaration is not useless: +Comment: // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 +Comment: // See comment in eh_exception.cc. +Comment: /** If you write your own error handler to be called by @c new, it must + * be of this type. */ +Comment: /// Takes a replacement handler as the argument, returns the +Comment: /// previous handler. +Comment: /// Return the current new handler. +Comment: // namespace std +Comment: //@{ +Comment: /** 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. +*/ +Comment: // __cpp_sized_deallocation +Comment: // __cpp_aligned_new +Comment: // Default placement versions of operator new. +Comment: // Default placement versions of operator delete. +Comment: //@} +Comment: // extern "C++" +Comment: /// Pointer optimization barrier [ptr.launder] +Comment: // The program is ill-formed if T is a function type or +Comment: // (possibly cv-qualified) void. +Comment: // _GLIBCXX_HAVE_BUILTIN_LAUNDER +Comment: // __GCC_DESTRUCTIVE_SIZE +Comment: // C++17 +Comment: /// Tag type used to declare a class-specific operator delete that can +Comment: /// invoke the destructor before deallocating the memory. +Comment: /// Tag variable of type destroying_delete_t. +Comment: // Only define the feature test macro if the compiler supports the feature: +Comment: // C++20 +Comment: // nonstandard construct and destroy functions -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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} + */ +Comment: // for iterator_traits +Comment: // for advance +Comment: /* 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. + */ +Comment: // C++20 +Comment: // C++17 +Comment: /** + * Constructs an object in existing memory by invoking an allocated + * object's constructor with an initializer. + */ +Comment: // Allow std::_Construct to be used in constant expressions. +Comment: /** + * Destroy the object pointed to by a pointer type. + */ +Comment: /** + * 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. + */ +Comment: // A deleted destructor is trivial, this ensures we reject such types: +Comment: /** + * 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. + */ +Comment: // A deleted destructor is trivial, this ensures we reject such types: +Comment: // C++17 +Comment: // namespace std +Comment: /* _STL_CONSTRUCT_H */ +Comment: /** + * @addtogroup iterators + * @{ + */ +Comment: // Weaken iterator_category _Cat to _Limit if it is derived from that, +Comment: // otherwise use _Otherwise. +Comment: // Ignore warnings about std::iterator. +Comment: // 24.4.1 Reverse iterators +Comment: /** + * 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. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3435. three_way_comparable_with, [...]> +Comment: /** + * The default constructor value-initializes member @p current. + * If it is a pointer, that means it is zero-initialized. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 235 No specification of default ctor for reverse_iterator +Comment: // 1012. reverse_iterator default ctor should value initialize +Comment: /** + * This %iterator will move in the opposite direction that @p x does. + */ +Comment: /** + * The copy constructor is normal. + */ +Comment: /** + * A %reverse_iterator across other types can be copied if the + * underlying %iterator can be converted to the type of @c current. + */ +Comment: /** + * @return @c current, the %iterator used for underlying work. + */ +Comment: /** + * @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 + */ +Comment: /** + * @return A pointer to the value at @c --current + * + * This requires that @c --current is dereferenceable. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 1052. operator-> should also support smart pointers +Comment: /** + * @return @c *this + * + * Decrements the underlying iterator. + */ +Comment: /** + * @return The original value of @c *this + * + * Decrements the underlying iterator. + */ +Comment: /** + * @return @c *this + * + * Increments the underlying iterator. + */ +Comment: /** + * @return A reverse_iterator with the previous value of @c *this + * + * Increments the underlying iterator. + */ +Comment: /** + * @return A reverse_iterator that refers to @c current - @a __n + * + * The underlying iterator must be a Random Access Iterator. + */ +Comment: /** + * @return *this + * + * Moves the underlying iterator backwards @a __n steps. + * The underlying iterator must be a Random Access Iterator. + */ +Comment: /** + * @return A reverse_iterator that refers to @c current - @a __n + * + * The underlying iterator must be a Random Access Iterator. + */ +Comment: /** + * @return *this + * + * Moves the underlying iterator forwards @a __n steps. + * The underlying iterator must be a Random Access Iterator. + */ +Comment: /** + * @return The value at @c current - @a __n - 1 + * + * The underlying iterator must be a Random Access Iterator. + */ +Comment: ///@{ +Comment: /** + * @param __x A %reverse_iterator. + * @param __y A %reverse_iterator. + * @return A simple bool. + * + * Reverse iterators forward comparisons to their underlying base() + * iterators. + * + */ +Comment: // C++20 +Comment: // Additional, non-standard overloads to avoid ambiguities with greedy, +Comment: // unconstrained overloads in associated namespaces. +Comment: // C++20 +Comment: ///@} +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // DR 685. reverse_iterator/move_iterator difference has invalid signatures +Comment: // Same as C++14 make_reverse_iterator but used in C++11 mode too. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // DR 2285. make_reverse_iterator +Comment: /// Generator function for reverse_iterator. +Comment: // C++20 +Comment: // C++14 +Comment: // C++11 +Comment: // 24.4.2.2.1 back_insert_iterator +Comment: /** + * @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. + */ +Comment: /// A nested typedef for the type of whatever container you used. +Comment: /// The only way to create this %iterator is with a container. +Comment: /** + * @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. + */ +Comment: /// Simply returns *this. +Comment: /// Simply returns *this. (This %iterator does not @a move.) +Comment: /// Simply returns *this. (This %iterator does not @a move.) +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /// A nested typedef for the type of whatever container you used. +Comment: /// The only way to create this %iterator is with a container. +Comment: /** + * @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. + */ +Comment: /// Simply returns *this. +Comment: /// Simply returns *this. (This %iterator does not @a move.) +Comment: /// Simply returns *this. (This %iterator does not @a move.) +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /// A nested typedef for the type of whatever container you used. +Comment: /** + * The only way to create this %iterator is with a container and an + * initial position (a normal %iterator into the container). + */ +Comment: /** + * @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 + */ +Comment: /// Simply returns *this. +Comment: /// Simply returns *this. (This %iterator does not @a move.) +Comment: /// Simply returns *this. (This %iterator does not @a move.) +Comment: /** + * @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. + */ +Comment: /// @} group iterators +Comment: // namespace +Comment: // This iterator adapter is @a normal in the sense that it does not +Comment: // change the semantics of any of the operators of its iterator +Comment: // parameter. Its primary purpose is to convert an iterator that is +Comment: // not a class, e.g. a pointer, into an iterator that is a class. +Comment: // The _Container parameter exists solely so that different containers +Comment: // using this template can instantiate different types, even if the +Comment: // _Iterator parameter is the same. +Comment: // Allow iterator to const_iterator conversion +Comment: // Forward iterator requirements +Comment: // Bidirectional iterator requirements +Comment: // Random access iterator requirements +Comment: // Note: In what follows, the left- and right-hand-side iterators are +Comment: // allowed to vary in types (conceptually in cv-qualification) so that +Comment: // comparison between cv-qualified and non-cv-qualified iterators be +Comment: // valid. However, the greedy and unfriendly operators in std::rel_ops +Comment: // will make overload resolution ambiguous (when in scope) if we don't +Comment: // provide overloads whose operands are of the same type. Can someone +Comment: // remind me what generic programming is about? -- Gaby +Comment: // three-way comparison +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // According to the resolution of DR179 not only the various comparison +Comment: // operators but also operator- must accept mixed iterator/const_iterator +Comment: // parameters. +Comment: // DR 685. +Comment: // namespace +Comment: /** + * @addtogroup iterators + * @{ + */ +Comment: // C++20 +Comment: // 24.4.3 Move iterators +Comment: /** + * 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. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3435. three_way_comparable_with, [...]> +Comment: // This is P2520R0, a C++23 change, but we treat it as a DR against C++20. +Comment: // iterator_category defined in __move_iter_cat +Comment: // C++20 +Comment: // Note: See __normal_iterator operators note from Gaby to understand +Comment: // why we have these extra overloads for some move_iterator operators. +Comment: // ! C++20 +Comment: // DR 685. +Comment: // Overload for pointers that matches std::move_if_noexcept more closely, +Comment: // returning a constant iterator when we don't want to move. +Comment: // [iterators.common] Common iterators +Comment: // namespace __detail +Comment: /// An iterator/sentinel adaptor for representing a non-common range. +Comment: // Constrained special member functions +Comment: // 0 == _M_it, 1 == _M_sent, 2 == valueless +Comment: // [iterators.counted] Counted iterators +Comment: /// An iterator adaptor that keeps track of the distance to the end. +Comment: // value_type defined in __counted_iter_value_type +Comment: // iterator_concept defined in __counted_iter_concept +Comment: // iterator_category defined in __counted_iter_cat +Comment: // C++23 +Comment: // C++20 +Comment: /// @} group iterators +Comment: // C++11 +Comment: // These helper traits are used for deduction guides +Comment: // of associative containers. +Comment: // __cpp_deduction_guides +Comment: // namespace +Comment: // Debugging support implementation -*- C++ -*- +Comment: // Copyright (C) 2003-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file debug/debug.h + * This file is a GNU debug extension to the Standard C++ Library. + */ +Comment: /** 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. +*/ +Comment: // Debug mode namespaces. +Comment: /** + * @namespace std::__debug + * @brief GNU debug code, replaces standard behavior with debug behavior. + */ +Comment: /** @namespace __gnu_debug + * @brief GNU debug classes for public use. +*/ +Comment: // _GLIBCXX_DEBUG_MACRO_SWITCH_H +Comment: // For std::swap +Comment: // Default predicates for internal use -*- C++ -*- +Comment: // Copyright (C) 2013-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // namespace __ops +Comment: // namespace __gnu_cxx +Comment: // std::__bit_width +Comment: // -*- C++ -*- +Comment: // Copyright (C) 2018-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file include/bit + * This is a Standard C++ Library header. + */ +Comment: /** + * @defgroup bit_manip Bit manipulation + * @ingroup numerics + * + * Utilities for examining and manipulating individual bits. + * + * @{ + */ +Comment: /// Create a value of type `To` from the bits of `from`. +Comment: /** + * @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 + */ +Comment: /// @cond undocumented +Comment: // Variant for power of two _Nd which the compiler can +Comment: // easily pattern match. +Comment: // rotr(x, -r) +Comment: // Variant for power of two _Nd which the compiler can +Comment: // easily pattern match. +Comment: // rotl(x, -r) +Comment: // (_Nd > _Nd_ull) +Comment: // (_Nd > _Nd_ull) +Comment: // (_Nd > _Nd_ull) +Comment: // If the shift exponent equals _Nd then the correct result is not +Comment: // representable as a value of _Tp, and so the result is undefined. +Comment: // Want that undefined behaviour to be detected in constant expressions, +Comment: // by UBSan, and by debug assertions. +Comment: // If __x undergoes integral promotion then shifting by _Nd is +Comment: // not undefined. In order to make the shift undefined, so that +Comment: // it is diagnosed in constant expressions and by UBsan, we also +Comment: // need to "promote" the shift exponent to be too large for the +Comment: // promoted type. +Comment: /// @endcond +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: // [bit.rot], rotating +Comment: /// Rotate `x` to the left by `s` bits. +Comment: /// Rotate `x` to the right by `s` bits. +Comment: // [bit.count], counting +Comment: /// The number of contiguous zero bits, starting from the highest bit. +Comment: /// The number of contiguous one bits, starting from the highest bit. +Comment: /// The number of contiguous zero bits, starting from the lowest bit. +Comment: /// The number of contiguous one bits, starting from the lowest bit. +Comment: /// The number of bits set in `x`. +Comment: // [bit.pow.two], integral powers of 2 +Comment: /// True if `x` is a power of two, false otherwise. +Comment: /// The smallest power-of-two not less than `x`. +Comment: /// The largest power-of-two not greater than `x`. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3656. Inconsistent bit operations returning a count +Comment: /// The smallest integer greater than the base-2 logarithm of `x`. +Comment: /// Byte order constants +Comment: /** + * The platform endianness can be checked by comparing `std::endian::native` + * to one of `std::endian::big` or `std::endian::little`. + * + * @since C++20 + */ +Comment: // C++2a +Comment: /// @} +Comment: // namespace std +Comment: // C++14 +Comment: // _GLIBCXX_BIT +Comment: /* + * A constexpr wrapper for __builtin_memcmp. + * @param __num The number of elements of type _Tp (not bytes). + */ +Comment: // C++03 +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 187. iter_swap underspecified +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: //return __b < __a ? __b : __a; +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: //return __a < __b ? __b : __a; +Comment: /** + * @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. + */ +Comment: //return __comp(__b, __a) ? __b : __a; +Comment: /** + * @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. + */ +Comment: //return __comp(__a, __b) ? __b : __a; +Comment: // Fallback implementation of the function in bits/stl_iterator.h used to +Comment: // remove the __normal_iterator wrapper. See copy, fill, ... +Comment: // Reverse the __niter_base transformation to get a +Comment: // __normal_iterator back again (this assumes that __normal_iterator +Comment: // is only used to wrap random access iterators, like pointers). +Comment: // No need to wrap, iterator already has the right type. +Comment: // All of these auxiliary structs serve two purposes. (1) Replace +Comment: // calls to copy with memmove whenever possible. (Memmove, not memcpy, +Comment: // because the input and output ranges are permitted to overlap.) +Comment: // (2) If we're using random access iterators, then write the loop as +Comment: // a for loop with an explicit count. +Comment: // Helpers for streambuf iterators (either istream or ostream). +Comment: // NB: avoid including , relatively large. +Comment: // HOSTED +Comment: /** + * @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). + */ +Comment: // concept requirements +Comment: /** + * @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). + */ +Comment: // concept requirements +Comment: /** + * @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). + */ +Comment: // concept requirements +Comment: /** + * @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). + */ +Comment: // concept requirements +Comment: // Specialization: for char types we can use memset. +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: // Used by fill_n, generate_n, etc. to convert _Size to an integral type: +Comment: /** + * @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. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // DR 865. More algorithms that throw away information +Comment: // DR 426. search_n(), fill_n(), and generate_n() with negative n +Comment: // concept requirements +Comment: // For C++20 iterator_traits::value_type is non-volatile +Comment: // so __is_byte could be true, but we can't use memcmp with +Comment: // volatile data. +Comment: /** + * @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 + */ +Comment: // concept requirements +Comment: /// This is a helper function for the sort routines and for random.tcc. +Comment: // Precondition: __n > 0. +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: // 4-iterator version of std::equal for use in C++11. +Comment: // 4-iterator version of std::equal for use in C++11. +Comment: // C++11 +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: // C++14 +Comment: /** + * @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. + */ +Comment: /** + * @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 <. + */ +Comment: // concept requirements +Comment: // Both iterators refer to contiguous ranges of unsigned narrow characters, +Comment: // or std::byte, or big-endian unsigned integers, suitable for comparison +Comment: // using memcmp. +Comment: // Return a struct with two members, initialized to the smaller of x and y +Comment: // (or x if they compare equal) and the result of the comparison x <=> y. +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: // See PR 94006 +Comment: // three_way_comparison +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: /// This is an overload used by find algos for the Input Iterator case. +Comment: /// This is an overload used by find algos for the RAI case. +Comment: // FALLTHRU +Comment: // FALLTHRU +Comment: // FALLTHRU +Comment: // Efficiently compare identical prefixes: O(N) if sequences +Comment: // have the same elements in the same order. +Comment: // Establish __last2 assuming equal ranges by iterating over the +Comment: // rest of the list. +Comment: // We've seen this one before. +Comment: /** + * @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. + */ +Comment: // concept requirements +Comment: // C++11 +Comment: // namespace std +Comment: // NB: This file is included within many other C++ includes, as a way +Comment: // of getting the base algorithms. So, make sure that parallel bits +Comment: // come in too if requested. +Comment: // Allocators -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * 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. + */ +Comment: /** @file bits/allocator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ +Comment: // Define the base class to std::allocator. +Comment: // Base to std::allocator -*- C++ -*- +Comment: // Copyright (C) 2004-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // Allocator that wraps operator new -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: /** + * @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 + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2103. propagate_on_container_move_assignment +Comment: // NB: __n is permitted to be 0. The C++ standard says nothing +Comment: // about what the return value is when __n == 0. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3308. std::allocator().allocate(n) +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3190. allocator::allocate sometimes returns too little storage +Comment: // __p is not permitted to be a null pointer. +Comment: // ! C++20 +Comment: // namespace +Comment: /** + * @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. + */ +Comment: // Forward declarations -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * 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. + */ +Comment: /** @file bits/memoryfwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ +Comment: /** + * @defgroup allocators Allocators + * @ingroup memory + * + * Classes encapsulating memory operations. + * + * @{ + */ +Comment: /// Declare uses_allocator so it can be specialized in `` etc. +Comment: /// @} group memory +Comment: // namespace std +Comment: /** + * @addtogroup allocators + * @{ + */ +Comment: // Since C++20 the primary template should be used for allocator, +Comment: // but then it would have a non-trivial default ctor and dtor for C++20, +Comment: // but trivial for C++98-17, which would be an ABI incompatibility between +Comment: // different standard dialects. So C++20 still uses the allocator +Comment: // explicit specialization, with the historical ABI properties, but with +Comment: // the same members that are present in the primary template. +Comment: /** std::allocator specialization. + * + * @headerfile memory + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2103. std::allocator propagate_on_container_move_assignment +Comment: // As noted above, these members are present for C++20 to provide the +Comment: // same API as the primary template, but still trivial as in pre-C++20. +Comment: // No allocate member because it's ill-formed by LWG 3307. +Comment: // No deallocate member because it would be undefined to call it +Comment: // with any pointer which wasn't obtained from allocate. +Comment: // C++20 +Comment: // C++11 +Comment: /** + * @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 + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2103. std::allocator propagate_on_container_move_assignment +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3035. std::allocator's constructors should be constexpr +Comment: // Avoid implicit deprecation. +Comment: // C++20 +Comment: // Inherit everything else. +Comment: /** Equality comparison for std::allocator objects + * + * @return true, for all std::allocator objects. + * @relates std::allocator + */ +Comment: /// @cond undocumented +Comment: // Invalid allocator partial specializations. +Comment: // allocator_traits::rebind_alloc can be used to form a valid allocator type. +Comment: /// @endcond +Comment: /// @} group allocator +Comment: // Inhibit implicit instantiations for required instantiations, +Comment: // which are defined via explicit instantiations elsewhere. +Comment: // Undefine. +Comment: // namespace std +Comment: // Raw memory manipulators -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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} + */ +Comment: // copy +Comment: // __alloc_traits +Comment: // Allocator traits -*- C++ -*- +Comment: // Copyright (C) 2011-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file ext/alloc_traits.h + * This file is a GNU extension to the Standard C++ Library. + */ +Comment: // Allocator traits -*- C++ -*- +Comment: // Copyright (C) 2011-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /** + * @brief Uniform interface to all allocator types. + * @headerfile memory + * @ingroup allocators + * @since C++11 + */ +Comment: /// The allocator type +Comment: /// The allocated type +Comment: /** + * @brief The allocator's pointer type. + * + * @c Alloc::pointer if that type exists, otherwise @c value_type* + */ +Comment: // Select _Func<_Alloc> or pointer_traits::rebind<_Tp> +Comment: // Select _A2::difference_type or pointer_traits<_Ptr>::difference_type +Comment: // Select _A2::size_type or make_unsigned<_DiffT>::type +Comment: /** + * @brief The allocator's const pointer type. + * + * @c Alloc::const_pointer if that type exists, otherwise + * pointer_traits::rebind + */ +Comment: /** + * @brief The allocator's void pointer type. + * + * @c Alloc::void_pointer if that type exists, otherwise + * pointer_traits::rebind + */ +Comment: /** + * @brief The allocator's const void pointer type. + * + * @c Alloc::const_void_pointer if that type exists, otherwise + * pointer_traits::rebind + */ +Comment: /** + * @brief The allocator's difference type + * + * @c Alloc::difference_type if that type exists, otherwise + * pointer_traits::difference_type + */ +Comment: /** + * @brief The allocator's size type + * + * @c Alloc::size_type if that type exists, otherwise + * make_unsigned::type + */ +Comment: /** + * @brief How the allocator is propagated on copy assignment + * + * @c Alloc::propagate_on_container_copy_assignment if that type exists, + * otherwise @c false_type + */ +Comment: /** + * @brief How the allocator is propagated on move assignment + * + * @c Alloc::propagate_on_container_move_assignment if that type exists, + * otherwise @c false_type + */ +Comment: /** + * @brief How the allocator is propagated on swap + * + * @c Alloc::propagate_on_container_swap if that type exists, + * otherwise @c false_type + */ +Comment: /** + * @brief Whether all instances of the allocator type compare equal. + * + * @c Alloc::is_always_equal if that type exists, + * otherwise @c is_empty::type + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2466. allocator_traits::max_size() default behavior is incorrect +Comment: /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * + * Calls @c a.allocate(n) + */ +Comment: /** + * @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) + */ +Comment: /** + * @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) + */ +Comment: /** + * @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... + */ +Comment: /** + * @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() + */ +Comment: /** + * @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() + */ +Comment: /** + * @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 + */ +Comment: /// Partial specialization for std::allocator. +Comment: /// The allocator type +Comment: /// The allocated type +Comment: /// The allocator's pointer type. +Comment: /// The allocator's const pointer type. +Comment: /// The allocator's void pointer type. +Comment: /// The allocator's const void pointer type. +Comment: /// The allocator's difference type +Comment: /// The allocator's size type +Comment: /// How the allocator is propagated on copy assignment +Comment: /// How the allocator is propagated on move assignment +Comment: /// How the allocator is propagated on swap +Comment: /// Whether all instances of the allocator type compare equal. +Comment: /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * + * Calls @c a.allocate(n) + */ +Comment: /** + * @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) + */ +Comment: /** + * @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) + */ +Comment: /** + * @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. + */ +Comment: /** + * @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). + */ +Comment: /** + * @brief The maximum supported allocation size + * @param __a An allocator. + * @return @c __a.max_size() + */ +Comment: /** + * @brief Obtain an allocator to use when copying a container. + * @param __rhs An allocator. + * @return @c __rhs + */ +Comment: /// Explicit specialization for std::allocator. +Comment: /// The allocator type +Comment: /// The allocated type +Comment: /// The allocator's pointer type. +Comment: /// The allocator's const pointer type. +Comment: /// The allocator's void pointer type. +Comment: /// The allocator's const void pointer type. +Comment: /// The allocator's difference type +Comment: /// The allocator's size type +Comment: /// How the allocator is propagated on copy assignment +Comment: /// How the allocator is propagated on move assignment +Comment: /// How the allocator is propagated on swap +Comment: /// Whether all instances of the allocator type compare equal. +Comment: /// allocate is ill-formed for allocator +Comment: /// deallocate is ill-formed for allocator +Comment: /** + * @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. + */ +Comment: /** + * @brief Destroy an object of type `_Up` + * @param __a An allocator. + * @param __p Pointer to the object to destroy + * + * Invokes the destructor for `*__p`. + */ +Comment: /// max_size is ill-formed for allocator +Comment: /** + * @brief Obtain an allocator to use when copying a container. + * @param __rhs An allocator. + * @return `__rhs` + */ +Comment: /// @cond undocumented +Comment: // true if _Alloc::value_type is CopyInsertable into containers using _Alloc +Comment: // (might be wrong if _Alloc::construct exists but is not constrained, +Comment: // i.e. actually trying to use it would still be invalid. Use with caution.) +Comment: // std::allocator<_Tp> just requires CopyConstructible +Comment: // true if _Alloc::value_type is MoveInsertable into containers using _Alloc +Comment: // (might be wrong if _Alloc::construct exists but is not constrained, +Comment: // i.e. actually trying to use it would still be invalid. Use with caution.) +Comment: // std::allocator<_Tp> just requires MoveConstructible +Comment: // Trait to detect Allocator-like types. +Comment: /// @endcond +Comment: // C++11 +Comment: /// @cond undocumented +Comment: // To implement Option 3 of DR 431. +Comment: // Precondition: swappable allocators. +Comment: /** + * 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. + */ +Comment: /// @endcond +Comment: // namespace std +Comment: // _ALLOC_TRAITS_H +Comment: /** + * @brief Uniform interface to C++98 and C++11 allocators. + * @ingroup allocators +*/ +Comment: // C++11 allocators do not define reference or const_reference +Comment: // overload construct for non-standard pointer types +Comment: // overload destroy for non-standard pointer types +Comment: // ! C++11 +Comment: // C++11 +Comment: // namespace __gnu_cxx +Comment: /** @addtogroup memory + * @{ + */ +Comment: /// @cond undocumented +Comment: // Trivial types can have deleted constructors, but std::copy etc. +Comment: // only use assignment (or memmove) not construction, so we need an +Comment: // explicit check that construction from _Tp is actually valid, +Comment: // otherwise some ill-formed uses of std::uninitialized_xxx would +Comment: // compile without errors. This gives a nice clear error message. +Comment: // If the type is trivial we don't need to construct it, just assign to it. +Comment: // But trivial types can still have deleted or inaccessible assignment, +Comment: // so don't try to use std::copy or std::fill etc. if we can't assign. +Comment: /// @endcond +Comment: /** + * @brief Copies 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) + * + * Like copy(), but does not require an initialized output range. + */ +Comment: // _ValueType1 must be trivially-copyable to use memmove, so don't +Comment: // bother optimizing to std::copy if it isn't. +Comment: // XXX Unnecessary because std::copy would check it anyway? +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /** + * @brief Copies the value x into the range [first,last). + * @param __first An input iterator. + * @param __last An input iterator. + * @param __x The source value. + * @return Nothing. + * + * Like fill(), but does not require an initialized output range. + */ +Comment: // Trivial types do not need a constructor to begin their lifetime, +Comment: // so try to use std::fill to benefit from its memset optimization. +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // DR 1339. uninitialized_fill_n should return the end of its range +Comment: /** + * @brief Copies the value x into the range [first,first+n). + * @param __first An input iterator. + * @param __n The number of copies to make. + * @param __x The source value. + * @return Nothing. + * + * Like fill_n(), but does not require an initialized output range. + */ +Comment: // Trivial types do not need a constructor to begin their lifetime, +Comment: // so try to use std::fill_n to benefit from its optimizations. +Comment: // For arbitrary class types and floating point types we can't assume +Comment: // that __n > 0 and std::__size_to_integer(__n) > 0 are equivalent, +Comment: // so only use std::fill_n when _Size is already an integral type. +Comment: /// @cond undocumented +Comment: // Extensions: versions of uninitialized_copy, uninitialized_fill, +Comment: // and uninitialized_fill_n that take an allocator parameter. +Comment: // We dispatch back to the standard versions when we're given the +Comment: // default allocator. For nondefault allocators we do not use +Comment: // any of the POD optimizations. +Comment: // Extensions: __uninitialized_copy_move, __uninitialized_move_copy, +Comment: // __uninitialized_fill_move, __uninitialized_move_fill. +Comment: // All of these algorithms take a user-supplied allocator, which is used +Comment: // for construction and destruction. +Comment: // __uninitialized_copy_move +Comment: // Copies [first1, last1) into [result, result + (last1 - first1)), and +Comment: // move [first2, last2) into +Comment: // [result, result + (last1 - first1) + (last2 - first2)). +Comment: // __uninitialized_move_copy +Comment: // Moves [first1, last1) into [result, result + (last1 - first1)), and +Comment: // copies [first2, last2) into +Comment: // [result, result + (last1 - first1) + (last2 - first2)). +Comment: // __uninitialized_fill_move +Comment: // Fills [result, mid) with x, and moves [first, last) into +Comment: // [mid, mid + (last - first)). +Comment: // __uninitialized_move_fill +Comment: // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and +Comment: // fills [first2 + (last1 - first1), last2) with x. +Comment: /// @endcond +Comment: /// @cond undocumented +Comment: // Extensions: __uninitialized_default, __uninitialized_default_n, +Comment: // __uninitialized_default_a, __uninitialized_default_n_a. +Comment: // __uninitialized_default +Comment: // Fills [first, last) with value-initialized value_types. +Comment: // trivial types can have deleted assignment +Comment: // __uninitialized_default_n +Comment: // Fills [first, first + n) with value-initialized value_types. +Comment: // See uninitialized_fill_n for the conditions for using std::fill_n. +Comment: // __uninitialized_default_a +Comment: // Fills [first, last) with value_types constructed by the allocator +Comment: // alloc, with no arguments passed to the construct call. +Comment: // __uninitialized_default_n_a +Comment: // Fills [first, first + n) with value_types constructed by the allocator +Comment: // alloc, with no arguments passed to the construct call. +Comment: // __uninitialized_default_n_a specialization for std::allocator, +Comment: // which ignores the allocator and value-initializes the elements. +Comment: // __uninitialized_default_novalue +Comment: // Fills [first, last) with default-initialized value_types. +Comment: // __uninitialized_default_novalue_n +Comment: // Fills [first, first + n) with default-initialized value_types. +Comment: /// @endcond +Comment: /** + * @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. + */ +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /** + * @brief Default-initializes objects in the range [first,last). + * @param __first A forward iterator. + * @param __last A forward iterator. + * @since C++17 + */ +Comment: /** + * @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 + */ +Comment: /** + * @brief Value-initializes objects in the range [first,last). + * @param __first A forward iterator. + * @param __last A forward iterator. + * @since C++17 + */ +Comment: /** + * @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 + */ +Comment: /** + * @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 + */ +Comment: /** + * @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 + */ +Comment: // C++17 +Comment: /// @cond undocumented +Comment: // This class may be specialized for specific types. +Comment: // Also known as is_trivially_relocatable. +Comment: // Can't use memmove. Wrap the pointer so that __relocate_a_1 +Comment: // resolves to the non-trivial overload above. +Comment: /// @endcond +Comment: // C++11 +Comment: /// @} group memory +Comment: // namespace +Comment: /* _STL_UNINITIALIZED_H */ +Comment: // Vector implementation -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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} + */ +Comment: // std::initializer_list support -*- C++ -*- +Comment: // Copyright (C) 2008-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of GCC. +Comment: // +Comment: // GCC is free software; you can redistribute it and/or modify +Comment: // it under the terms of the GNU General Public License as published by +Comment: // the Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // +Comment: // GCC is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file initializer_list + * This is a Standard C++ Library header. + */ +Comment: // C++0x +Comment: /// initializer_list +Comment: // The compiler can call a private constructor. +Comment: // Number of elements. +Comment: // First element. +Comment: // One past the last element. +Comment: /** + * @brief Return an iterator pointing to the first element of + * the initializer_list. + * @param __ils Initializer list. + * @relates initializer_list + */ +Comment: /** + * @brief Return an iterator pointing to one past the last element + * of the initializer_list. + * @param __ils Initializer list. + * @relates initializer_list + */ +Comment: // C++11 +Comment: // _INITIALIZER_LIST +Comment: /// See bits/stl_deque.h's _Deque_base for an explanation. +Comment: // Do not use std::swap(_M_start, __x._M_start), etc as it loses +Comment: // information used by TBAA. +Comment: // Not defaulted, to enforce noexcept(true) even when +Comment: // !is_nothrow_move_constructible<_Tp_alloc_type>. +Comment: // ! (_GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR) +Comment: // _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR +Comment: // Kept for ABI compatibility. +Comment: // Kept for ABI compatibility. +Comment: /** + * @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. + */ +Comment: // Instantiating std::__relocate_a might cause an error outside the +Comment: // immediate context (in __relocate_object_a's noexcept-specifier), +Comment: // so only do it if we know the type can be move-inserted into *this. +Comment: // All callers have already checked _S_use_relocate() so just do it. +Comment: // C++11 +Comment: // [23.2.4.1] construct/copy/destroy +Comment: // (assign() and get_allocator() are also listed in this section) +Comment: /** + * @brief Creates a %vector with no elements. + */ +Comment: /** + * @brief Creates a %vector with no elements. + * @param __a An allocator object. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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). + */ +Comment: /** + * @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. + */ +Comment: /// Copy constructor with alternative allocator +Comment: /// Move constructor with alternative allocator +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * 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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /// Get a copy of the memory allocation object. +Comment: // iterators +Comment: /** + * Returns a read/write iterator that points to the first + * element in the %vector. Iteration is done in ordinary + * element order. + */ +Comment: /** + * Returns a read-only (constant) iterator that points to the + * first element in the %vector. Iteration is done in ordinary + * element order. + */ +Comment: /** + * Returns a read/write iterator that points one past the last + * element in the %vector. Iteration is done in ordinary + * element order. + */ +Comment: /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %vector. Iteration is done in + * ordinary element order. + */ +Comment: /** + * Returns a read/write reverse iterator that points to the + * last element in the %vector. Iteration is done in reverse + * element order. + */ +Comment: /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %vector. Iteration is done in + * reverse element order. + */ +Comment: /** + * Returns a read/write reverse iterator that points to one + * before the first element in the %vector. Iteration is done + * in reverse element order. + */ +Comment: /** + * 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. + */ +Comment: /** + * Returns a read-only (constant) iterator that points to the + * first element in the %vector. Iteration is done in ordinary + * element order. + */ +Comment: /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %vector. Iteration is done in + * ordinary element order. + */ +Comment: /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %vector. Iteration is done in + * reverse element order. + */ +Comment: /** + * 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. + */ +Comment: // [23.2.4.2] capacity +Comment: /** Returns the number of elements in the %vector. */ +Comment: /** Returns the size() of the largest possible %vector. */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** A non-binding request to reduce capacity() to size(). */ +Comment: /** + * Returns the total number of elements that the %vector can + * hold before needing to allocate more memory. + */ +Comment: /** + * Returns true if the %vector is empty. (Thus begin() would + * equal end().) + */ +Comment: /** + * @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. + */ +Comment: // element access +Comment: /** + * @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().) + */ +Comment: /** + * @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().) + */ +Comment: /// Safety check used only from at(). +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * Returns a read/write reference to the data at the first + * element of the %vector. + */ +Comment: /** + * Returns a read-only (constant) reference to the data at the first + * element of the %vector. + */ +Comment: /** + * Returns a read/write reference to the data at the last + * element of the %vector. + */ +Comment: /** + * Returns a read-only (constant) reference to the data at the + * last element of the %vector. + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // DR 464. Suggestion for new member functions in standard containers. +Comment: // data access +Comment: /** + * Returns a pointer such that [data(), data() + size()) is a valid + * range. For a non-empty %vector, data() == &front(). + */ +Comment: // [23.2.4.3] modifiers +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: /** + * 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. + */ +Comment: /** + * Memory expansion handler. Uses the member allocation function to + * obtain @a n bytes of memory, and then copies [first,last) into it. + */ +Comment: // Internal constructor functions follow. +Comment: // Called by the range constructor to implement [23.1.1]/9 +Comment: // Called by the second initialize_dispatch above +Comment: // Called by the second initialize_dispatch above +Comment: // Called by the first initialize_dispatch above and by the +Comment: // vector(n,value,a) constructor. +Comment: // Called by the vector(n) constructor. +Comment: // Internal assign functions follow. The *_aux functions do the actual +Comment: // assignment work for the range versions. +Comment: // Called by the range assign to implement [23.1.1]/9 +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 438. Ambiguity in the "do the right thing" clause +Comment: // Called by the range assign to implement [23.1.1]/9 +Comment: // Called by the second assign_dispatch above +Comment: // Called by the second assign_dispatch above +Comment: // Called by assign(n,t), and the range assign when it turns out +Comment: // to be the same thing. +Comment: // Internal insert functions follow. +Comment: // Called by the range insert to implement [23.1.1]/9 +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 438. Ambiguity in the "do the right thing" clause +Comment: // Called by the range insert to implement [23.1.1]/9 +Comment: // Called by the second insert_dispatch above +Comment: // Called by the second insert_dispatch above +Comment: // Called by insert(p,n,x), and the range insert when it turns out to be +Comment: // the same thing. +Comment: // Called by resize(n). +Comment: // A value_type object constructed with _Alloc_traits::construct() +Comment: // and destroyed with _Alloc_traits::destroy(). +Comment: // Called by insert(p,x) and other functions when insertion needs to +Comment: // reallocate or move existing elements. _Arg is either _Tp& or _Tp. +Comment: // Either move-construct at the end, or forward to _M_insert_aux. +Comment: // Try to emplace at the end, otherwise forward to _M_insert_aux. +Comment: // Emplacing an rvalue of the correct type can use _M_insert_rval. +Comment: // Called by _M_fill_insert, _M_insert_aux etc. +Comment: // Called by constructors to check initial size. +Comment: // std::distance(begin(), end()) cannot be greater than PTRDIFF_MAX, +Comment: // and realistically we can't store more than PTRDIFF_MAX/sizeof(T) +Comment: // (even if std::allocator_traits::max_size says we can). +Comment: // Internal erase functions follow. +Comment: // Called by erase(q1,q2), clear(), resize(), _M_fill_assign, +Comment: // _M_assign_aux. +Comment: // Constant-time move assignment when source object's memory can be +Comment: // moved, either because the source's allocator will move too +Comment: // or because the allocators are equal. +Comment: // Do move assignment when it might not be possible to move source +Comment: // object's memory, resulting in a linear-time operation. +Comment: // The rvalue's allocator cannot be moved and is not equal, +Comment: // so we need to individually move each element. +Comment: /** + * @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. + */ +Comment: /** + * @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. + */ +Comment: // three-way comparison +Comment: /// See std::vector::swap(). +Comment: // see +Comment: // Provide the strong exception-safety guarantee when emplacing a +Comment: // vector into a variant, but only if move assignment cannot throw. +Comment: // namespace __detail::__variant +Comment: // C++17 +Comment: // namespace std +Comment: /* _STL_VECTOR_H */ +Comment: // vector specialization -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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} + */ +Comment: // functional_hash.h header -*- C++ -*- +Comment: // Copyright (C) 2007-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // Declarations for hash functions. -*- C++ -*- +Comment: // Copyright (C) 2010-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // Hash function implementation for the nontrivial specialization. +Comment: // All of them are based on a primitive that hashes a pointer to a +Comment: // byte array. The actual hash algorithm is not guaranteed to stay +Comment: // the same from release to release -- it may be updated or tuned to +Comment: // improve hash quality or speed. +Comment: // A similar hash primitive, using the FNV hash algorithm. This +Comment: // algorithm is guaranteed to stay the same from release to release. +Comment: // (although it might not produce the same values on different +Comment: // machines.) +Comment: // namespace +Comment: /** @defgroup hashes Hashes + * @ingroup functors + * + * Hashing functors taking a variable type and returning a @c std::size_t. + * + * @{ + */ +Comment: /// Primary class template hash. +Comment: // Private rather than deleted to be non-trivially-copyable. +Comment: // Helper struct for SFINAE-poisoning non-enum types. +Comment: // Private rather than deleted to be non-trivially-copyable. +Comment: // Helper struct for hash with enum types. +Comment: /// Primary class template hash, usable for enum types only. +Comment: // Use with non-enum types still SFINAES. +Comment: /// Partial specializations for pointer types. +Comment: // Explicit specializations for integer types. +Comment: /// Explicit specialization for bool. +Comment: /// Explicit specialization for char. +Comment: /// Explicit specialization for signed char. +Comment: /// Explicit specialization for unsigned char. +Comment: /// Explicit specialization for wchar_t. +Comment: /// Explicit specialization for char8_t. +Comment: /// Explicit specialization for char16_t. +Comment: /// Explicit specialization for char32_t. +Comment: /// Explicit specialization for short. +Comment: /// Explicit specialization for int. +Comment: /// Explicit specialization for long. +Comment: /// Explicit specialization for long long. +Comment: /// Explicit specialization for unsigned short. +Comment: /// Explicit specialization for unsigned int. +Comment: /// Explicit specialization for unsigned long. +Comment: /// Explicit specialization for unsigned long long. +Comment: // A hash function similar to FNV-1a (see PR59406 for how it differs). +Comment: /// Specialization for float. +Comment: // 0 and -0 both hash to zero. +Comment: /// Specialization for double. +Comment: // 0 and -0 both hash to zero. +Comment: /// Specialization for long double. +Comment: /// @} group hashes +Comment: /** 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. + */ +Comment: // namespace +Comment: // _FUNCTIONAL_HASH_H +Comment: // C++23 +Comment: // Ignore warnings about std::iterator. +Comment: // three-way comparison +Comment: // Do not use std::swap(_M_start, __x._M_start), etc as it loses +Comment: // information used by TBAA. +Comment: // Not defaulted, to enforce noexcept(true) even when +Comment: // !is_nothrow_move_constructible<_Bit_alloc_type>. +Comment: /** + * @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. + */ +Comment: // assign(), a generalized assignment member function. Two +Comment: // versions: one that takes a count, and one that takes a range. +Comment: // The range version is a member template, so we dispatch on whether +Comment: // or not the type is an integer. +Comment: // [23.2.5]/1, third-to-last entry in synopsis listing +Comment: // Precondition: __first._M_offset == 0 && __result._M_offset == 0. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // DR 464. Suggestion for new member functions in standard containers. +Comment: // N.B. DR 464 says nothing about vector but we need something +Comment: // here due to the using-declaration in __gnu_debug::vector. +Comment: // vector class. +Comment: // Fill a partial word. +Comment: // Fill N full words, as if using memset, but usable in constant expressions. +Comment: // DR 1182. +Comment: /// std::hash specialization for vector. +Comment: // C++11 +Comment: // namespace std +Comment: // Implementation of std::reference_wrapper -*- C++ -*- +Comment: // Copyright (C) 2004-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // Implementation of INVOKE -*- C++ -*- +Comment: // Copyright (C) 2016-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // forward +Comment: /** + * @addtogroup utilities + * @{ + */ +Comment: // Used by __invoke_impl instead of std::forward<_Tp> so that a +Comment: // reference_wrapper is converted to an lvalue-reference. +Comment: /// Invoke a callable object. +Comment: // INVOKE: Invoke a callable object and convert the result to R. +Comment: // C++11 or C++14 +Comment: // C++11 or C++14 +Comment: // namespace std +Comment: // C++11 +Comment: // _GLIBCXX_INVOKE_H +Comment: // for unary_function and binary_function +Comment: // Functor implementations -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @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} + */ +Comment: // 20.3.1 base classes +Comment: /** @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. + * + * @{ + */ +Comment: /** + * Helper for defining adaptable unary function objects. + * @deprecated Deprecated in C++11, no longer in the standard since C++17. + */ +Comment: /// @c argument_type is the type of the argument +Comment: /// @c result_type is the return type +Comment: /** + * Helper for defining adaptable binary function objects. + * @deprecated Deprecated in C++11, no longer in the standard since C++17. + */ +Comment: /// @c first_argument_type is the type of the first argument +Comment: /// @c second_argument_type is the type of the second argument +Comment: /// @c result_type is the return type +Comment: /** @} */ +Comment: // 20.3.2 arithmetic +Comment: /** @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. + * + * @{ + */ +Comment: // undefined +Comment: // Ignore warnings about unary_function and binary_function. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// Returns the sum +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /// One of the @link arithmetic_functors math functors@endlink. +Comment: /** @} */ +Comment: // 20.3.3 comparisons +Comment: /** @defgroup comparison_functors Comparison Classes + * @ingroup functors + * + * The library provides six wrapper functors for all the basic comparisons + * in C++, like @c <. + * + * @{ + */ +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: // Partial specialization of std::greater for pointers. +Comment: // Partial specialization of std::less for pointers. +Comment: // Partial specialization of std::greater_equal for pointers. +Comment: // Partial specialization of std::less_equal for pointers. +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: // True if there is no viable operator> member function. +Comment: // False if we can call T.operator>(U) +Comment: // True if there is no overloaded operator> for these operands. +Comment: // False if we can call operator>(T,U) +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: // True if there is no viable operator< member function. +Comment: // False if we can call T.operator<(U) +Comment: // True if there is no overloaded operator< for these operands. +Comment: // False if we can call operator<(T,U) +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: // True if there is no viable operator>= member function. +Comment: // False if we can call T.operator>=(U) +Comment: // True if there is no overloaded operator>= for these operands. +Comment: // False if we can call operator>=(T,U) +Comment: /// One of the @link comparison_functors comparison functors@endlink. +Comment: // True if there is no viable operator<= member function. +Comment: // False if we can call T.operator<=(U) +Comment: // True if there is no overloaded operator<= for these operands. +Comment: // False if we can call operator<=(T,U) +Comment: // C++14 +Comment: /** @} */ +Comment: // 20.3.4 logical operations +Comment: /** @defgroup logical_functors Boolean Operations Classes + * @ingroup functors + * + * The library provides function objects for the logical operations: + * `&&`, `||`, and `!`. + * + * @{ + */ +Comment: /// One of the @link logical_functors Boolean operations functors@endlink. +Comment: /// One of the @link logical_functors Boolean operations functors@endlink. +Comment: /// One of the @link logical_functors Boolean operations functors@endlink. +Comment: /// One of the @link logical_functors Boolean operations functors@endlink. +Comment: /// One of the @link logical_functors Boolean operations functors@endlink. +Comment: /// One of the @link logical_functors Boolean operations functors@endlink. +Comment: /** @} */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // DR 660. Missing Bitwise Operations. +Comment: // C++14 +Comment: // 20.3.5 negators +Comment: /** @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. + * + * @{ + */ +Comment: /// One of the @link negators negation functors@endlink. +Comment: /// One of the @link negators negation functors@endlink. +Comment: /// One of the @link negators negation functors@endlink. +Comment: /// One of the @link negators negation functors@endlink. +Comment: /** @} */ +Comment: // 20.3.7 adaptors pointers functions +Comment: /** @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. + * + * @{ + */ +Comment: /// One of the @link pointer_adaptors adaptors for function pointers@endlink. +Comment: /// One of the @link pointer_adaptors adaptors for function pointers@endlink. +Comment: /// One of the @link pointer_adaptors adaptors for function pointers@endlink. +Comment: /// One of the @link pointer_adaptors adaptors for function pointers@endlink. +Comment: /** @} */ +Comment: // Partial specialization, avoids confusing errors in e.g. std::set. +Comment: // 20.3.8 adaptors pointers members +Comment: /** @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. + * + * @{ + */ +Comment: /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. +Comment: /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. +Comment: /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. +Comment: /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. +Comment: /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. +Comment: /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. +Comment: /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. +Comment: /// One of the @link ptrmem_adaptors adaptors for member pointers@endlink. +Comment: // Mem_fun adaptor helper functions. There are only two: +Comment: // mem_fun and mem_fun_ref. +Comment: /** @} */ +Comment: // namespace +Comment: // Functor implementations -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @file backward/binders.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ +Comment: // Suppress deprecated warning for this file. +Comment: // 20.3.6 binders +Comment: /** @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). + * @{ + */ +Comment: /// One of the @link binders binder functors@endlink. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 109. Missing binders for non-const sequence elements +Comment: /// One of the @link binders binder functors@endlink. +Comment: /// One of the @link binders binder functors@endlink. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 109. Missing binders for non-const sequence elements +Comment: /// One of the @link binders binder functors@endlink. +Comment: /** @} */ +Comment: // namespace +Comment: /* _BACKWARD_BINDERS_H */ +Comment: /* _STL_FUNCTION_H */ +Comment: /// @cond undocumented +Comment: /** + * 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. + */ +Comment: // Ignore warnings about unary_function and binary_function. +Comment: /// Derives from @c unary_function, as appropriate. +Comment: /// Derives from @c binary_function, as appropriate. +Comment: /// If we have found a result_type, extract it. +Comment: /** + * Base class for any function object that has a weak result type, as + * defined in 20.8.2 [func.require] of C++11. + */ +Comment: /// Retrieve the result type for a function type. +Comment: /// Retrieve the result type for a varargs function type. +Comment: /// Retrieve the result type for a function pointer. +Comment: /// Retrieve the result type for a varargs function pointer. +Comment: // Let _Weak_result_type_impl perform the real work. +Comment: // A pointer to member function has a weak result type. +Comment: // A pointer to data member doesn't have a weak result type. +Comment: /** + * Strip top-level cv-qualifiers from the function object and let + * _Weak_result_type_memfun perform the real work. + */ +Comment: // ! C++20 +Comment: /// @endcond +Comment: /** + * @brief Primary class template for reference_wrapper. + * @ingroup functors + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2993. reference_wrapper conversion from T&& +Comment: // 3041. Unnecessary decay in reference_wrapper +Comment: /// @relates reference_wrapper @{ +Comment: /// Denotes a reference should be taken to a variable. +Comment: /// Denotes a const reference should be taken to a variable. +Comment: /// std::ref overload to prevent wrapping a reference_wrapper +Comment: /// std::cref overload to prevent wrapping a reference_wrapper +Comment: /// @} +Comment: // namespace std +Comment: // C++11 +Comment: // _GLIBCXX_REFWRAP_H +Comment: // Range access functions for containers -*- C++ -*- +Comment: // Copyright (C) 2010-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // common_type_t, make_signed_t +Comment: // reverse_iterator +Comment: /** + * @brief Return an iterator pointing to the first element of + * the container. + * @param __cont Container. + */ +Comment: /** + * @brief Return an iterator pointing to the first element of + * the const container. + * @param __cont Container. + */ +Comment: /** + * @brief Return an iterator pointing to one past the last element of + * the container. + * @param __cont Container. + */ +Comment: /** + * @brief Return an iterator pointing to one past the last element of + * the const container. + * @param __cont Container. + */ +Comment: /** + * @brief Return an iterator pointing to the first element of the array. + * @param __arr Array. + */ +Comment: /** + * @brief Return an iterator pointing to one past the last element + * of the array. + * @param __arr Array. + */ +Comment: // These overloads must be declared for cbegin and cend to use them. +Comment: /** + * @brief Return an iterator pointing to the first element of + * the const container. + * @param __cont Container. + */ +Comment: /** + * @brief Return an iterator pointing to one past the last element of + * the const container. + * @param __cont Container. + */ +Comment: /** + * @brief Return a reverse iterator pointing to the last element of + * the container. + * @param __cont Container. + */ +Comment: /** + * @brief Return a reverse iterator pointing to the last element of + * the const container. + * @param __cont Container. + */ +Comment: /** + * @brief Return a reverse iterator pointing one past the first element of + * the container. + * @param __cont Container. + */ +Comment: /** + * @brief Return a reverse iterator pointing one past the first element of + * the const container. + * @param __cont Container. + */ +Comment: /** + * @brief Return a reverse iterator pointing to the last element of + * the array. + * @param __arr Array. + */ +Comment: /** + * @brief Return a reverse iterator pointing one past the first element of + * the array. + * @param __arr Array. + */ +Comment: /** + * @brief Return a reverse iterator pointing to the last element of + * the initializer_list. + * @param __il initializer_list. + */ +Comment: /** + * @brief Return a reverse iterator pointing one past the first element of + * the initializer_list. + * @param __il initializer_list. + */ +Comment: /** + * @brief Return a reverse iterator pointing to the last element of + * the const container. + * @param __cont Container. + */ +Comment: /** + * @brief Return a reverse iterator pointing one past the first element of + * the const container. + * @param __cont Container. + */ +Comment: // C++14 +Comment: /** + * @brief Return the size of a container. + * @param __cont Container. + */ +Comment: /** + * @brief Return the size of an array. + */ +Comment: /** + * @brief Return whether a container is empty. + * @param __cont Container. + */ +Comment: /** + * @brief Return whether an array is empty (always false). + */ +Comment: /** + * @brief Return whether an initializer_list is empty. + * @param __il Initializer list. + */ +Comment: /** + * @brief Return the data pointer of a container. + * @param __cont Container. + */ +Comment: /** + * @brief Return the data pointer of a const container. + * @param __cont Container. + */ +Comment: /** + * @brief Return the data pointer of an array. + * @param __array Array. + */ +Comment: /** + * @brief Return the data pointer of an initializer list. + * @param __il Initializer list. + */ +Comment: // C++20 +Comment: // C++17 +Comment: // namespace +Comment: // C++11 +Comment: // _GLIBCXX_RANGE_ACCESS_H +Comment: // Vector implementation (out of line) -*- C++ -*- +Comment: // Copyright (C) 2001-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /* + * + * 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. + */ +Comment: /** @file bits/vector.tcc + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{vector} + */ +Comment: // PR 106434 +Comment: // __x could be an existing element of this vector, so make a +Comment: // copy of it before _M_insert_aux moves elements around. +Comment: // replacement allocator cannot free existing storage +Comment: // We need to construct a temporary because something in __args... +Comment: // could alias one of the elements of the container and so we +Comment: // need to use it before _M_insert_aux moves elements around. +Comment: // The order of the three operations is dictated by the C++11 +Comment: // case, where the moves could alter a new element belonging +Comment: // to the existing vector. This is an issue only for callers +Comment: // taking the element by lvalue ref (see last bullet of C++11 +Comment: // [res.on.arguments]). +Comment: // Make local copies of these members because the compiler thinks +Comment: // the allocator can alter them if 'this' is globally reachable. +Comment: // See _M_realloc_insert above. +Comment: // Make local copies of these members because the compiler thinks +Comment: // the allocator can alter them if 'this' is globally reachable. +Comment: // Make local copies of these members because the compiler +Comment: // thinks the allocator can alter them if 'this' is globally +Comment: // reachable. +Comment: // vector +Comment: // namespace std +Comment: // namespace std +Comment: // C++11 +Comment: /* _VECTOR_TCC */ +Comment: // -*- C++ -*- +Comment: // Copyright (C) 2018-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // operator new(size_t, void*) +Comment: // size_t, max_align_t, byte +Comment: // -*- C++ -*- forwarding header. +Comment: // Copyright (C) 1997-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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). + */ +Comment: // +Comment: // ISO C++ 14882: 18.1 Types +Comment: // +Comment: /*===---- 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 + * + *===-----------------------------------------------------------------------=== + */ +Comment: /* + * 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. + */ +Comment: /* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is + * enabled. */ +Comment: /* + * __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. + */ +Comment: /* 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. */ +Comment: /*===---- __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 + * + *===-----------------------------------------------------------------------=== + */ +Comment: /*===---- __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 + * + *===-----------------------------------------------------------------------=== + */ +Comment: /* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +Comment: /* defined(__need_ptrdiff_t) */ +Comment: /*===---- __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 + * + *===-----------------------------------------------------------------------=== + */ +Comment: /* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +Comment: /*defined(__need_size_t) */ +Comment: /* defined(__need_rsize_t) */ +Comment: /*===---- __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 + * + *===-----------------------------------------------------------------------=== + */ +Comment: /* defined(__need_wchar_t) */ +Comment: /*===---- __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 + * + *===-----------------------------------------------------------------------=== + */ +Comment: /* 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. + */ +Comment: /* defined(__need_NULL) */ +Comment: /*===---- __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 + * + *===-----------------------------------------------------------------------=== + */ +Comment: /* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +Comment: /* defined(__need_nullptr_t) */ +Comment: /* defined(__need_unreachable) */ +Comment: /*===---- __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 + * + *===-----------------------------------------------------------------------=== + */ +Comment: // Define 'max_align_t' to match the GCC definition. +Comment: /* defined(__need_max_align_t) */ +Comment: /*===---- __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 + * + *===-----------------------------------------------------------------------=== + */ +Comment: /* + * When -fbuiltin-headers-in-system-modules is set this is a non-modular header + * and needs to behave as if it was textual. + */ +Comment: /* defined(__need_offsetof) */ +Comment: /* 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 */ +Comment: /* __need_wint_t */ +Comment: /* __MVS__ */ +Comment: // We handle size_t, ptrdiff_t, and nullptr_t in c++config.h. +Comment: // C++11 +Comment: /// std::byte +Comment: // namespace std +Comment: // C++17 +Comment: // extern "C++" +Comment: // _GLIBCXX_CSTDDEF +Comment: // __throw_bad_array_new_length +Comment: // allocator_arg_t, __use_alloc +Comment: // Uses-allocator Construction -*- C++ -*- +Comment: // Copyright (C) 2010-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: /// @cond undocumented +Comment: // This is used for std::experimental::erased_type from Library Fundamentals. +Comment: // This also supports the "type-erased allocator" protocol from the +Comment: // Library Fundamentals TS, where allocator_type is erased_type. +Comment: // The second condition will always be false for types not using the TS. +Comment: /// [allocator.tag] +Comment: /// [allocator.uses.trait] +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2586. Wrong value category used in scoped_allocator_adaptor::construct +Comment: // C++17 +Comment: // C++14 +Comment: // C++14 +Comment: /// @endcond +Comment: // namespace std +Comment: // uninitialized_construct_using_alloc +Comment: // Utility functions for uses-allocator construction -*- C++ -*- +Comment: // Copyright (C) 2019-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @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} + */ +Comment: // for placement operator new +Comment: // for tuple, make_tuple, make_from_tuple +Comment: // -*- C++ -*- +Comment: // Copyright (C) 2007-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file include/tuple + * This is a Standard C++ Library header. + */ +Comment: // for std::pair +Comment: // for std::allocator_arg_t +Comment: // for std::tuple_size etc. +Comment: // for std::__invoke +Comment: // for std::ranges::subrange +Comment: // Utilities for representing and manipulating ranges -*- C++ -*- +Comment: // Copyright (C) 2019-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file bits/ranges_util.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ranges} + */ +Comment: // Core concepts and definitions for -*- C++ -*- +Comment: // Copyright (C) 2019-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file bits/ranges_base.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ranges} + */ +Comment: // -*- C++ -*- +Comment: // Copyright (C) 2019-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file bits/max_size_type.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ +Comment: // -*- C++ -*- +Comment: // Copyright (C) 2019-2023 Free Software Foundation, Inc. +Comment: // +Comment: // This file is part of the GNU ISO C++ Library. This library is free +Comment: // software; you can redistribute it and/or modify it under the +Comment: // terms of the GNU General Public License as published by the +Comment: // Free Software Foundation; either version 3, or (at your option) +Comment: // any later version. +Comment: // This library is distributed in the hope that it will be useful, +Comment: // but WITHOUT ANY WARRANTY; without even the implied warranty of +Comment: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +Comment: // GNU General Public License for more details. +Comment: // Under Section 7 of GPL version 3, you are granted additional +Comment: // permissions described in the GCC Runtime Library Exception, version +Comment: // 3.1, as published by the Free Software Foundation. +Comment: // You should have received a copy of the GNU General Public License and +Comment: // a copy of the GCC Runtime Library Exception along with this program; +Comment: // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +Comment: // . +Comment: /** @file include/numbers + * This is a Standard C++ Library header. + */ +Comment: /** @defgroup math_constants Mathematical constants + * @ingroup numerics + * @{ + */ +Comment: /// Namespace for mathematical constants +Comment: /// @cond undocumented +Comment: /// @endcond +Comment: /// e +Comment: /// log_2 e +Comment: /// log_10 e +Comment: /// pi +Comment: /// 1/pi +Comment: /// 1/sqrt(pi) +Comment: /// log_e 2 +Comment: /// log_e 10 +Comment: /// sqrt(2) +Comment: /// sqrt(3) +Comment: /// 1/sqrt(3) +Comment: /// The Euler-Mascheroni constant +Comment: /// The golden ratio, (1+sqrt(5))/2 +Comment: /* e */ +Comment: /* log_2 e */ +Comment: /* log_10 e */ +Comment: /* pi */ +Comment: /* 1/pi */ +Comment: /* 1/sqrt(pi) */ +Comment: /* log_e 2 */ +Comment: /* log_e 10 */ +Comment: /* sqrt(2) */ +Comment: /* sqrt(3) */ +Comment: /* 1/sqrt(3) */ +Comment: /* The Euler-Mascheroni constant */ +Comment: /* The golden ratio, (1+sqrt(5))/2 */ +Comment: // USE_FLOAT128 +Comment: // namespace numbers +Comment: /// @} +Comment: // namespace std +Comment: // C++20 +Comment: // _GLIBCXX_NUMBERS +Comment: // This header implements unsigned and signed integer-class types (as per +Comment: // [iterator.concept.winc]) that are one bit wider than the widest supported +Comment: // integer type. +Comment: // +Comment: // The set of integer types we consider includes __int128 and unsigned __int128 +Comment: // (when they exist), even though they are really integer types only in GNU +Comment: // mode. This is to obtain a consistent ABI for these integer-class types +Comment: // across strict mode and GNU mode. +Comment: // When both operands are below this threshold then the +Comment: // multiplication can be safely computed in the base precision. +Comment: // Otherwise, perform the multiplication in four steps, by +Comment: // decomposing the LHS and the RHS into 2*x+a and 2*y+b, +Comment: // respectively, and computing 4*x*y + 2*x*b + 2*y*a + a*b. +Comment: // The non-trivial case: the dividend has its MSB set and the +Comment: // divisor doesn't. In this case we compute ((LHS/2)/RHS)*2 +Comment: // in the base precision. This quantity is either the true +Comment: // quotient or one less than the true quotient. +Comment: // Arithmetic right shift. +Comment: // namespace __detail +Comment: // namespace ranges +Comment: // namespace +Comment: // C++20 && library concepts +Comment: // _GLIBCXX_MAX_SIZE_TYPE_H +Comment: // Part of the constraints of ranges::borrowed_range +Comment: // namespace __detail +Comment: // Poison pills so that unqualified lookup doesn't find std::end. +Comment: // std::reverse_iterator copy-initializes its member. +Comment: // std::reverse_iterator copy-initializes its member. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3403. Domain of ranges::ssize(E) doesn't match ranges::size(E) +Comment: // Return the wider of ptrdiff_t and make-signed-like-t<__size_type>. +Comment: // For strict-ansi modes integral<__int128> is false +Comment: // Must be one of __max_diff_type or __max_size_type. +Comment: // namespace __cust_access +Comment: /// [range.range] The range concept. +Comment: /// [range.range] The borrowed_range concept. +Comment: /// [range.sized] The sized_range concept. +Comment: // defined in +Comment: // not defined +Comment: // Returns true iff _Tp has exactly one public base class that's a +Comment: // specialization of view_interface. +Comment: // namespace __detail +Comment: /// [range.view] The ranges::view_base type. +Comment: /// [range.view] The ranges::enable_view boolean. +Comment: /// [range.view] The ranges::view concept. +Comment: // [range.refinements] +Comment: /// A range for which ranges::begin returns an output iterator. +Comment: /// A range for which ranges::begin returns an input iterator. +Comment: /// A range for which ranges::begin returns a forward iterator. +Comment: /// A range for which ranges::begin returns a bidirectional iterator. +Comment: /// A range for which ranges::begin returns a random access iterator. +Comment: /// A range for which ranges::begin returns a contiguous iterator. +Comment: /// A range for which ranges::begin and ranges::end return the same type. +Comment: // If _To is an lvalue-reference, return const _Tp&, otherwise const _Tp&&. +Comment: // namespace __cust_access +Comment: // namespace __detail +Comment: /// A range which can be safely converted to a view. +Comment: // [range.iter.ops] range iterator operations +Comment: // cannot decrement a non-bidirectional iterator +Comment: // n and bound must not lead in opposite directions: +Comment: // cannot decrement a non-bidirectional iterator +Comment: /// Type returned by algorithms instead of a dangling iterator or subrange. +Comment: // namespace ranges +Comment: // namespace std +Comment: // library concepts +Comment: // C++20 +Comment: // _GLIBCXX_RANGES_BASE_H +Comment: // C++20 24.5 [range.utility] Range utilities +Comment: // namespace __detail +Comment: /// The ranges::view_interface class template +Comment: // not defined +Comment: // namespace __detail +Comment: // defined in +Comment: /// The ranges::subrange class template +Comment: // Needs to inspect _S_store_size. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3433. subrange::advance(n) has UB when n < 0 +Comment: // namespace ranges +Comment: // The following ranges algorithms are used by , and are defined here +Comment: // so that can avoid including all of . +Comment: // namespace ranges +Comment: // namespace std +Comment: // library concepts +Comment: // C++20 +Comment: // _RANGES_UTIL_H +Comment: /** + * @addtogroup utilities + * @{ + */ +Comment: // Using EBO for elements that are tuples causes ambiguous base errors. +Comment: // Use the Empty Base-class Optimization for empty, non-final types. +Comment: /** + * 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. + */ +Comment: /** + * 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). + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2729. Missing SFINAE on std::pair::operator= +Comment: // C++23 +Comment: // C++23 +Comment: // C++23 +Comment: // C++23 +Comment: // Basis case of inheritance recursion. +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2729. Missing SFINAE on std::pair::operator= +Comment: // C++23 +Comment: // C++23 +Comment: // C++23 +Comment: // C++23 +Comment: // Concept utility functions, reused in conditionally-explicit +Comment: // constructors. +Comment: // Constraint for a non-explicit constructor. +Comment: // True iff each Ti in _Types... can be constructed from Ui in _UTypes... +Comment: // and every Ui is implicitly convertible to Ti. +Comment: // Constraint for a non-explicit constructor. +Comment: // True iff each Ti in _Types... can be constructed from Ui in _UTypes... +Comment: // but not every Ui is implicitly convertible to Ti. +Comment: // Partial specialization used when a required precondition isn't met, +Comment: // e.g. when sizeof...(_Types) != sizeof...(_UTypes). +Comment: /// Primary class template, tuple +Comment: // Constraint for non-explicit default constructor +Comment: // Constraint for explicit default constructor +Comment: // Constraint for non-explicit constructors +Comment: // Constraint for non-explicit constructors +Comment: // Condition for noexcept-specifier of an assignment operator. +Comment: // Condition for noexcept-specifier of a constructor. +Comment: // Constraint for tuple(_UTypes&&...) where sizeof...(_UTypes) == 1. +Comment: // Constraint for tuple(_UTypes&&...) where sizeof...(_UTypes) > 1. +Comment: /* 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. + */ +Comment: // If TUPLE is convertible to the single element in *this, +Comment: // then TUPLE should match tuple(UTypes&&...) instead. +Comment: // If TUPLE and *this each have a single element of the same type, +Comment: // then TUPLE should match a copy/move constructor instead. +Comment: // Return true iff sizeof...(Types) == 1 && tuple_size_v == 1 +Comment: // and the single element in Types can be initialized from TUPLE, +Comment: // or is the same type as tuple_element_t<0, TUPLE>. +Comment: // C++23 +Comment: // C++23 +Comment: // Allocator-extended constructors. +Comment: // C++23 +Comment: // tuple assignment +Comment: // C++23 +Comment: // tuple swap +Comment: // C++23 +Comment: // Explicit specialization, zero-element tuple. +Comment: /* no-op */ +Comment: // We need the default since we're going to define no-op +Comment: // allocator constructors. +Comment: // No-op allocator constructors. +Comment: /// Partial specialization, 2-element tuple. +Comment: /// Includes construction and assignment from a pair. +Comment: // Constraint for non-explicit default constructor +Comment: // Constraint for explicit default constructor +Comment: // Constraint for non-explicit constructors +Comment: // Constraint for non-explicit constructors +Comment: // C++23 +Comment: // C++23 +Comment: // C++23 +Comment: // Allocator-extended constructors. +Comment: // C++23 +Comment: // C++23 +Comment: // Tuple assignment. +Comment: // C++23 +Comment: // C++23 +Comment: // C++23 +Comment: /// class tuple_size +Comment: /// Trait to get the Ith element type from a tuple. +Comment: // Deleted overload to improve diagnostics for invalid indices +Comment: /// Return a reference to the ith element of a tuple. +Comment: /// Return a const reference to the ith element of a const tuple. +Comment: /// Return an rvalue reference to the ith element of a tuple rvalue. +Comment: /// Return a const rvalue reference to the ith element of a const tuple rvalue. +Comment: /// @cond undocumented +Comment: // Deleted overload chosen for invalid indices. +Comment: /// @endcond +Comment: /// Return a reference to the unique element of type _Tp of a tuple. +Comment: /// Return a reference to the unique element of type _Tp of a tuple rvalue. +Comment: /// Return a const reference to the unique element of type _Tp of a tuple. +Comment: /// Return a const reference to the unique element of type _Tp of +Comment: /// a const tuple rvalue. +Comment: // This class performs the comparison operations on tuples +Comment: // three_way_comparison +Comment: // NB: DR 705. +Comment: /// Create a tuple containing copies of the arguments +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2275. Why is forward_as_tuple not constexpr? +Comment: /// Create a tuple of lvalue or rvalue references to the arguments +Comment: // Declarations of std::array and its std::get overloads, so that +Comment: // std::tuple_cat can use them if is included before . +Comment: /// @cond undocumented +Comment: // Returns the std::tuple equivalent of a tuple-like type. +Comment: // Combines several std::tuple's into a single one. +Comment: // Computes the result type of tuple_cat given a set of tuple-like types. +Comment: // Helper to determine the index set for the first tuple-like +Comment: // type of a given set. +Comment: // Performs the actual concatenation by step-wise expanding tuple-like +Comment: // objects into the elements, which are finally forwarded into the +Comment: // result tuple. +Comment: /// @endcond +Comment: /// Create a `tuple` containing all elements from multiple tuple-like objects +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2301. Why is tie not constexpr? +Comment: /// Return a tuple of lvalue references bound to the arguments +Comment: /// Exchange the values of two tuples +Comment: // c++1z or gnu++11 +Comment: // Constrained free swap overload, see p0185r1 +Comment: // C++23 +Comment: // c++1z or gnu++11 +Comment: /// Exchange the values of two const tuples (if const elements can be swapped) +Comment: // A class (and instance) which can be used in 'tie' when an element +Comment: // of a tuple is not required. +Comment: // _GLIBCXX14_CONSTEXPR +Comment: // 2933. PR for LWG 2773 could be clearer +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2773. Making std::ignore constexpr +Comment: /** 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 + */ +Comment: /// Partial specialization for tuples +Comment: // See stl_pair.h... +Comment: /** "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. + */ +Comment: // Unpack a std::tuple into a type trait and use its value. +Comment: // For cv std::tuple<_Up> the result is _Trait<_Tp, cv _Up...>::value. +Comment: // For cv std::tuple<_Up>& the result is _Trait<_Tp, cv _Up&...>::value. +Comment: // Otherwise the result is false (because we don't know if std::get throws). +Comment: // C++17 +Comment: // C++23 +Comment: /// @} +Comment: // namespace std +Comment: // C++11 +Comment: // _GLIBCXX_TUPLE +Comment: // construct_at +Comment: // pair +Comment: /** @addtogroup allocators + * @{ + */ +Comment: // Not specified by C++20, used internally +Comment: // C++23 +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3527. uses_allocator_construction_args handles rvalue pairs +Comment: // of rvalue references incorrectly +Comment: // C++23 +Comment: /// @} +Comment: // namespace std +Comment: // C++20 +Comment: // _USES_ALLOCATOR_ARGS +Comment: // __int_traits +Comment: /// Class memory_resource +Comment: /** + * @ingroup pmr + * @headerfile memory_resource + * @since C++17 + */ +Comment: // key function +Comment: // C++17 23.12.3 Class template polymorphic_allocator +Comment: /// Class template polymorphic_allocator +Comment: /** + * @ingroup pmr + * @headerfile memory_resource + * @since C++17 + */ +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 2975. Missing case for pair construction in polymorphic allocators +Comment: // C++2a +Comment: // make_obj_using_allocator +Comment: // _GLIBCXX_RESOLVE_LIB_DEFECTS +Comment: // 3683. operator== for polymorphic_allocator cannot deduce template arg +Comment: // namespace pmr +Comment: /// Partial specialization for std::pmr::polymorphic_allocator +Comment: /// The allocator type +Comment: /// The allocated type +Comment: /// The allocator's pointer type. +Comment: /// The allocator's const pointer type. +Comment: /// The allocator's void pointer type. +Comment: /// The allocator's const void pointer type. +Comment: /// The allocator's difference type +Comment: /// The allocator's size type +Comment: /** @{ + * A `polymorphic_allocator` does not propagate when a + * container is copied, moved, or swapped. + */ +Comment: /// @} +Comment: /// Whether all instances of the allocator type compare equal. +Comment: /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * + * Calls `a.allocate(n)`. + */ +Comment: /** + * @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)`. + */ +Comment: /** + * @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)`. + */ +Comment: /** + * @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. + */ +Comment: /** + * @brief Destroy an object of type `_Up` + * @param __a An allocator. + * @param __p Pointer to the object to destroy + * + * Calls `p->_Up()`. + */ +Comment: /** + * @brief The maximum supported allocation size + * @return `numeric_limits::max() / sizeof(value_type)` + */ +Comment: // namespace std +Comment: // C++17 +Comment: // _GLIBCXX_MEMORY_RESOURCE_H +Comment: // namespace pmr +Comment: // namespace std +Comment: // C++17 +Comment: // namespace std +Comment: // C++20 +Comment: /* _GLIBCXX_VECTOR */ +# ifndef _GLIBCXX_VECTOR # define _GLIBCXX_VECTOR 1 # pragma GCC system_header # include < bits / requires_hosted . h > # include < bits / stl_algobase . h > # include < bits / allocator . h > # include < bits / stl_construct . h > # include < bits / stl_uninitialized . h > # include < bits / stl_vector . h > # include < bits / stl_bvector . h > # include < bits / refwrap . h > # include < bits / range_access . h > # ifndef _GLIBCXX_EXPORT_TEMPLATE # include < bits / vector . tcc > # endif # ifdef _GLIBCXX_DEBUG # include < debug / vector > # endif # if __cplusplus >= 201703L # include < bits / memory_resource . h > namespace std _GLIBCXX_VISIBILITY ( default ) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { template < typename _Tp > using vector = std :: vector < _Tp , polymorphic_allocator < _Tp >> ; } # ifdef _GLIBCXX_DEBUG namespace _GLIBCXX_STD_C :: pmr { template < typename _Tp > using vector = _GLIBCXX_STD_C :: vector < _Tp , std :: pmr :: polymorphic_allocator < _Tp >> ; } # endif _GLIBCXX_END_NAMESPACE_VERSION } # endif # if __cplusplus > 201703L namespace std _GLIBCXX_VISIBILITY ( default ) { _GLIBCXX_BEGIN_NAMESPACE_VERSION # define __cpp_lib_erase_if 202002L template < typename _Tp , typename _Alloc , typename _Predicate > _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 < typename _Tp , typename _Alloc , typename _Up > _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 } # endif # endif \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 0f554026..661d13a3 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -32,6 +32,26 @@ ], "cwd": "${workspaceFolder}" }, + { + "type": "lldb", + "request": "launch", + "name": "ASTVisitor", + "program": "${workspaceFolder}/build/ASTVisitor", + "args": [ + "/home/ykiko/C++/clice/test.cpp", + ], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Module", + "program": "${workspaceFolder}/build/Module", + "args": [ + "/home/ykiko/C++/clice/main.cpp", + ], + "cwd": "${workspaceFolder}" + }, //{ // "type": "lldb", // "request": "attach", diff --git a/CMakeLists.txt b/CMakeLists.txt index 5968692f..399c0e86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ set(LLVM_LIBS clangAST clangASTMatchers clangBasic + clangDependencyScanning clangDriver clangFormat clangFrontend @@ -46,7 +47,6 @@ set(LLVM_LIBS clangToolingInclusions clangToolingInclusionsStdlib clangToolingSyntax - LLVMFrontendOpenMP ) set(LINK_LIBS @@ -89,6 +89,7 @@ if(CLICE_EXAMPLES) add_example(ASTVisitor docs/examples/ASTVisitor.cpp) add_example(CodeCompletion docs/examples/CodeCompletion.cpp) + add_example(Module docs/examples/Module.cpp) add_example(Preamble docs/examples/Preamble.cpp) add_example(Preprocessor docs/examples/Preprocessor.cpp) add_example(TreeTransform docs/examples/TreeTransform.cpp) diff --git a/docs/clangd2.md b/docs/clangd2.md new file mode 100644 index 00000000..59478c19 --- /dev/null +++ b/docs/clangd2.md @@ -0,0 +1,64 @@ +"architectural issue" here actually means the issue which can be solved but need to make a lot of modification to clangd. Currently, such big modification can be hard to push because of lack resource in clangd as mentioned [here](https://github.com/clangd/clangd/issues/1690#issuecomment-1619735578). I am a university student, also a c++ enthusiast and a vscode user. So I have a lot of time that I can dedicate to things I am interested in.. At first, I just want to wonder whether I can make some efforts to clangd. But gradually, I found it could be better to rewrite a new LSP. After evaluating the project scale, I think it's possible to complete for just one person (about 4w~ lines and ccls is also written by one person). Then I start to dive into clangd source code and learn the clang base. So far, I have known how to build preamble, how to build AST, how to traverse AST and so on. All of them are done with clang's C++ API. Next step is putting them together into final program. However, before the actual implementation, I need to plan out its structure. + +At first, how to manage message? LSP is also a type of server, and the common event-driven model is sufficient. I plan to use libuv as the event library, with the main thread handling requests and distributing tasks, while the thread pool executes the actual tasks. This is slightly different from clangd's current model; clangd doesn't use a thread pool, but rather creates a new thread for each file and uses semaphore to limit the number of active threads. + +Then we need to handle TU. I decided to use a different policy with clangd, which is not to build the preamble for the file until the first edit, and headers will reuse the AST in the source file by default, also until first edit. In this way, we can reduce a lot of memory usage, speed up the loading (building preamble always needs more time compared to normal AST building) and support non self contained header. This can be very useful, people actually only need to modify a few files in big projects like LLVM. And today I found Sam also reported this [issue](https://github.com/clangd/clangd/issues/391). Another important problem is how to interact with C++20 modules, I am still exploring this. + +Next is about indexing, current indexer in clangd seems to be efficient enough, so I think I would reuse it and make only some small modifications to record more information. Also, I am wondering whether we can modify the absolute path to relative path in the index, so issue like [support offline background index preparation](https://github.com/clangd/clangd/issues/587)。It shouldn't be hard to implement. + +Following is discussion on some specific LSP features: + +## Semantic Highlight + +There are several issues around it. + +- [provide semantic information for each token](https://github.com/clangd/clangd/issues/1115) +- [no AST node for explicit template instantiations](https://github.com/clangd/clangd/issues/358) +- [class name does not get a coloring in constructor call ](https://github.com/clangd/clangd/issues/501) +- [store implicit specializations as distinct symbols in the index, with their own refs](https://github.com/clangd/clangd/issues/536) +- [distinguish between type template parameter and non-type template parameter highlightings](https://github.com/clangd/clangd/issues/787) +- [modifiers are wrong in semantic token for destructor](https://github.com/clangd/clangd/issues/872) + +Mainly about wrong or not enough information in the semantic highlight. I would like to support detail information for each token, then we can solve all of them. + +## Hint + +- [simplify inlay hints](https://github.com/clangd/clangd/issues/824) +- [make the type hint length limit configurable](https://github.com/clangd/clangd/issues/1357) +- [support go-to-definition on type names in inlay hints](https://github.com/clangd/clangd/issues/1535) +- [use namespace alias but not original namespace name](https://github.com/clangd/clangd/issues/542) +- [support folding range on directive](https://github.com/clangd/clangd/issues/1661) +- [documentation for struct member fields not working correctly](https://github.com/clangd/clangd/issues/564) +- [make the hover box more compact](https://github.com/clangd/clangd/issues/747) +- [padding inlay hints](https://github.com/clangd/clangd/issues/923) +- [struct members and enum values are not shown on type hover](https://github.com/clangd/clangd/issues/959) +- [show length of string literal in hover](https://github.com/clangd/clangd/issues/1016) +- [show type hints for init-captures](https://github.com/clangd/clangd/issues/1163) + +Most of these problems are about hint. Providing options to allow users to configure them will be fine. + +## Action + +- [add implementation](https://github.com/clangd/clangd/issues/445) +- [revert if](https://github.com/clangd/clangd/issues/466) +- [move constructor argument into member](https://github.com/clangd/clangd/issues/454) +- [modify function parameters](https://github.com/clangd/clangd/issues/460) +- [expand macro one level](https://github.com/clangd/clangd/issues/820) + +Providing more actions will be helpful. + +## Code Completion + +- [improve code completion inside template](https://github.com/clangd/clangd/issues/443) +- [resolve the type of lambda auto parameters](https://github.com/clangd/clangd/issues/493) +- [don't include template completion when inside the template class](https://github.com/clangd/clangd/issues/678) +- [can I disable snippet](https://github.com/clangd/clangd/issues/727) +- [no completion for definition of non-public member functions](https://github.com/clangd/clangd/issues/880) +- [outside function definition won't complete default arguments](https://github.com/clangd/clangd/issues/753) +- [postfix completions](https://github.com/clangd/clangd/issues/850) +- [list free functions alongside methods in autocompletion](https://github.com/clangd/clangd/issues/893) +- [type information lost during auto deduction in templates](https://github.com/clangd/clangd/issues/897) +- [completion member field listing order w.r.t. C++20 designated initializers](https://github.com/clangd/clangd/issues/965) +- [completion of pointers to functions and function objects](https://github.com/clangd/clangd/issues/968) + +These issues around code completion could be hardest to resolve. We need to modify the `Parser` and `SemaComplete` in clang to support them. Some are about templates, improving `HeuristicResolver` will resolve them. \ No newline at end of file diff --git a/docs/clice.md b/docs/clice.md index 2a4ab003..3697a1ab 100644 --- a/docs/clice.md +++ b/docs/clice.md @@ -1,111 +1,65 @@ -`clangd.md`侧重于对 clangd 源码的分析,仅仅是分析里面的关键部分,作为我们编写代码的参考。但是最终我们是要有我们自己的架构的,所以有必要自顶向下的对项目模块进行一下规划。 +# clice -整体上来看,clice 的模型很简单,只是一个实现了 LSP 协议的 Server,所以一般的服务器模型也适用于它。 +这个文件详细描述了 clice 的项目架构以及诸多实现细节。 -## Overview +# Overview -首先整个服务器底层需要有线程池和事件循环来处理事件(异步逻辑),具体有哪些事件后文会详细讨论。我们打算使用 C++20 来编写,所以可以使用协程来简化异步代码的编写。相比于 clangd 中的回调函数套回调函数,这可以大大提高代码可维护性。 +clice 是一个 C++ 的 [LSP](https://microsoft.github.io/language-server-protocol/),旨在解决 clangd 中现存的诸多问题。下面是我认为 clangd 中一些现存的需要迫切去解决的问题: -## Event +## Index -现在我们要讨论有哪些事件需要处理,这里就要根据 LSP 来具体分析了。 +- [preamble-less first build](https://github.com/clangd/clangd/issues/391) +- [C++20 module support](https://github.com/clangd/clangd/issues/1293) +- [support non self contained header](https://github.com/clangd/clangd/issues/45) +- [add an option to build ASTs for files in the CDB on startup](https://github.com/clangd/clangd/issues/589) +- [support offline background index preparation](https://github.com/clangd/clangd/issues/587) +- [give the user some way to control the order in which files are indexed](https://github.com/clangd/clangd/issues/523) +- [improve template instantiation and dependent types](https://github.com/clangd/clangd/issues/1095) -### Server Lifecycle +## Completion -这里主要是处理和服务器生命周期相关的消息,比如初始化,关闭,等等。这些消息需要最优先处理。由于 cLang 上游代码时不时可能会崩溃,所以重启对于 clice 来说是比较常见的。 +- [improve code completion inside template](https://github.com/clangd/clangd/issues/443) +- [resolve the type of lambda auto parameters](https://github.com/clangd/clangd/issues/493) +- [don't include template completion when inside the template class](https://github.com/clangd/clangd/issues/678) +- [can I disable snippet](https://github.com/clangd/clangd/issues/727) +- [no completion for definition of non-public member functions](https://github.com/clangd/clangd/issues/880) +- [outside function definition won't complete default arguments](https://github.com/clangd/clangd/issues/753) +- [postfix completions](https://github.com/clangd/clangd/issues/850) +- [list free functions alongside methods in autocompletion](https://github.com/clangd/clangd/issues/893) +- [type information lost during auto deduction in templates](https://github.com/clangd/clangd/issues/897) +- [completion member field listing order w.r.t. C++20 designated initializers](https://github.com/clangd/clangd/issues/965) +- [completion of pointers to functions and function objects](https://github.com/clangd/clangd/issues/968) ->理想情况是对线程进行隔离,一个线程的编译器挂了不影响其它的线程,这个还需要进一步研究。 +## Hint -值得注意的是 clice 希望额外支持插件功能,所以需要利用 LSP 中的 registerCapability 这个消息格式。 - -### Text Document Synchronization - -这个是和文档同步相关的消息,比如文档打开,关闭,修改等等。这个消息是最频繁的,所以需要尽可能的优化。 - ->目前 clangd 在一个文件打开的时候就会在后台发起编译这个文件的预编译头的任务,具体的策略需要进一步研究。 +- [simplify inlay hints](https://github.com/clangd/clangd/issues/824) +- [make the type hint length limit configurable](https://github.com/clangd/clangd/issues/1357) +- [support go-to-definition on type names in inlay hints](https://github.com/clangd/clangd/issues/1535) +- [use namespace alias but not original namespace name](https://github.com/clangd/clangd/issues/542) +- [support folding range on directive](https://github.com/clangd/clangd/issues/1661) +- [documentation for struct member fields not working correctly](https://github.com/clangd/clangd/issues/564) +- [make the hover box more compact](https://github.com/clangd/clangd/issues/747) +- [padding inlay hints](https://github.com/clangd/clangd/issues/923) +- [struct members and enum values are not shown on type hover](https://github.com/clangd/clangd/issues/959) +- [show length of string literal in hover](https://github.com/clangd/clangd/issues/1016) +- [show type hints for init-captures](https://github.com/clangd/clangd/issues/1163) -### Language Features +## Semantic Highlight -首先对 LSP 支持的功能进行概览: LSP 3.17 currently: +- [provide semantic information for each token](https://github.com/clangd/clangd/issues/1115) +- [no AST node for explicit template instantiations](https://github.com/clangd/clangd/issues/358) +- [class name does not get a coloring in constructor call ](https://github.com/clangd/clangd/issues/501) +- [store implicit specializations as distinct symbols in the index, with their own refs](https://github.com/clangd/clangd/issues/536) +- [distinguish between type template parameter and non-type template parameter highlightings](https://github.com/clangd/clangd/issues/787) +- [modifiers are wrong in semantic token for destructor](https://github.com/clangd/clangd/issues/872) -- Goto Declaration: 跳转到声明 -- Goto Definition: 跳转到定义 -- Goto Type Definition: 跳转到类型定义 -- Goto Implementation: 跳转到实现 -- Find References: 查找所有引用 -- Prepare Call Hierarchy: 没搞懂 -- Call Hierarchy Incoming Calls: 没搞懂 -- Call Hierarchy Outgoing Calls: 没搞懂 -- Prepare Type Hierarchy: 没搞懂 -- Type Hierarchy Supertypes: 没搞懂 -- Type Hierarchy Subtypes: 没搞懂 -- Document Highlights: 没搞懂 -- Document Link: 用来处理文件链接跳转,例如点击一个文件名跳转到文件 -- Document Link Resolve: 没搞懂 -- Hover: 悬停提示 -- Code Lens: 没搞懂 -- Code Lens Refresh Request: 没搞懂 -- Folding Range: 把某段代码折叠起来 -- Selection Range: 没搞懂 -- Document Symbols: 列出文档中的所有符号,可以用于 vscode 左边那个 Outline -- Semantic Tokens: 用于语义高亮 -- Inline Value: 没搞懂 -- Inline Value Refresh: 没搞懂 -- Inlay Hint: 用于内嵌提示,比如函数参数或者`auto`的类型 -- Inlay Hint Resolve: 没搞懂 -- Inlay Hint Refresh: 刷新内嵌提示 -- Monikers: 没搞懂 -- Completion: 代码补全 -- Completion Item Resolve: 解决重载函数的代码补全 -- PublishDiagnostics Notification: 发出诊断信息 -- Pull Diagnostics: 没搞懂 -- Signature Help Request: 请求函数签名信息 -- Code Action: 重构等操作(还有那个 quick fix) -- Code Action Resolve: 没搞懂 -- Document Color: 没搞懂 -- Color Presentation: 没搞懂 -- Document Formatting: 格式化 -- Document Range Formatting: 只格式化某个部分 -- Document on Type Formatting: 没搞懂 -- Rename: 重命名 -- Prepare Rename: 解决重命名 -- Linked Editing Range: 没搞懂 +## Action -这些任务从最终实现的角度来说可以主要分成三种: -1. CodeCompletion 这个需要利用 CodeCompletionConsumer 调用 Clang 提供的接口来实现,然而我们实际上可以做一些更加复杂的分析(clangd 目前没有做)。比如判断当前的是不是在 Template 语境下从而决定补全`sizeof`的时候要不要补全`...`。在补全成员的时候,似乎我们也可以获取`expr.f`中的父对象的类型,从而根据它的类型来做一些补全。有待进一步研究。 -2. Semantic Tokens 等基于当前 AST 的操作,则是遍历 AST 渲染 Token 即可。 -3. 剩下很多的,例如 Find References 等等等查询功能,都是在已经索引好的文件中进行查询,不需要对语法树进行什么改动。 - -### DependentNameResolver - -对于一个`DependentNameType`我们要分情况处理 - -最一般的`DependentNameType`可以用如下形式的正则表达式处理 `typename T<...>[::T2|::template T2<...>]*` - -首先我们要讨论希望化简到什么结果,例如对于 - -```cpp -typename std::vector>::reference -``` - -我们希望得到 - -```cpp -std::vector& -``` - -对于 - -```cpp -typename std::vector>::value_type::reference -``` - -我们希望得到 - -```cpp -T& -``` - -无论如何我们需要递归进行处理 +- [add implementation](https://github.com/clangd/clangd/issues/445) +- [revert if](https://github.com/clangd/clangd/issues/466) +- [move constructor argument into member](https://github.com/clangd/clangd/issues/454) +- [modify function parameters](https://github.com/clangd/clangd/issues/460) +- [expand macro one level](https://github.com/clangd/clangd/issues/820) +## \ No newline at end of file diff --git a/docs/examples/ASTVisitor.cpp b/docs/examples/ASTVisitor.cpp index fb316201..3b80a8bf 100644 --- a/docs/examples/ASTVisitor.cpp +++ b/docs/examples/ASTVisitor.cpp @@ -640,127 +640,31 @@ public: bool TraverseTranslationUnitDecl(clang::TranslationUnitDecl* decl) { for(auto it = decl->decls_begin(), end = decl->decls_end(); it != end; ++it) { - auto decl = *it; - if(sourceManager.isInMainFile(decl->getLocation())) { - TraverseDecl(*it); - } + TraverseDecl(*it); + if(sourceManager.getFilename(sourceManager.getSpellingLoc(it->getLocation())) == + "/usr/include/c++/13/bits/stl_vector.h") {} } return true; } - bool VisitDecl(clang::Decl* decl) { - llvm::outs() << "Visiting Decl: " << decl->getDeclKindName() << "\n"; - return true; - } - - // bool VisitTypeAliasDecl(clang::TypeAliasDecl* decl) {} - - // bool FieldDeclecl(clang::FieldDecl* decl) { - // llvm::outs() << "Visiting FieldDeclecl: " << decl->getDeclKindName() << "\n"; - // return true; - // } - // - // bool WalkUpFromCXXRecordDecl(clang::CXXRecordDecl* decl) { - // llvm::outs() << "Visiting CXXRecordDecl\n"; - // // clang::TemplateSpecializationType t; - // clang::TemplateSpecializationTypeLoc loc; - // - // return true; - //} - // - void addAngle(clang::SourceLocation l, clang::SourceLocation r) { - l.dump(sourceManager); - r.dump(sourceManager); - } - - VISIT(DeclaratorDecl) { - for(unsigned i = 0; i < node->getNumTemplateParameterLists(); ++i) { - if(auto params = node->getTemplateParameterList(i)) { - addAngle(params->getLAngleLoc(), params->getRAngleLoc()); - } + VISIT(ClassTemplateDecl) { + clang::DeclRefExpr* node2; + if(node->getName() == "vector") { + node->getLocation().dump(sourceManager); } return true; } +}; - VISIT(TagDecl) { - for(unsigned i = 0; i < node->getNumTemplateParameterLists(); ++i) { - if(auto params = node->getTemplateParameterList(i)) { - addAngle(params->getLAngleLoc(), params->getRAngleLoc()); - } - } - return true; - } +class CommentHandler : public clang::CommentHandler { - VISIT(FunctionDecl) { - if(auto args = node->getTemplateSpecializationArgsAsWritten()) { - addAngle(args->getLAngleLoc(), args->getRAngleLoc()); - } - return true; - } - - VISIT(TemplateDecl) { - if(auto params = node->getTemplateParameters()) { - addAngle(params->getLAngleLoc(), params->getRAngleLoc()); - } - return true; - } - - VISIT(ClassTemplateSpecializationDecl) { - if(auto args = node->getTemplateArgsAsWritten()) { - addAngle(args->getLAngleLoc(), args->getRAngleLoc()); - } - return true; - } - - VISIT(ClassTemplatePartialSpecializationDecl) { - if(auto params = node->getTemplateParameters()) { - addAngle(params->getLAngleLoc(), params->getRAngleLoc()); - } - return true; - } - - VISIT(VarTemplateSpecializationDecl) { - if(auto args = node->getTemplateArgsAsWritten()) { - addAngle(args->LAngleLoc, args->RAngleLoc); - } - return true; - } - - VISIT(VarTemplatePartialSpecializationDecl) { - if(auto params = node->getTemplateParameters()) { - addAngle(params->getLAngleLoc(), params->getRAngleLoc()); - } - return true; - } - - VISIT(CXXNamedCastExpr) { - addAngle(node->getAngleBrackets().getBegin(), node->getAngleBrackets().getEnd()); - return true; - } - - VISIT(OverloadExpr) { - addAngle(node->getLAngleLoc(), node->getRAngleLoc()); - return true; - } - - VISIT(CXXDependentScopeMemberExpr) { - addAngle(node->getLAngleLoc(), node->getRAngleLoc()); - return true; - } - - VISIT(DependentScopeDeclRefExpr) { - addAngle(node->getLAngleLoc(), node->getRAngleLoc()); - return true; - } - - VISIT_TYPE(TemplateSpecializationTypeLoc) { - addAngle(node.getLAngleLoc(), node.getRAngleLoc()); - return true; - } - - VISIT_TYPE(DependentTemplateSpecializationTypeLoc) { - addAngle(node.getLAngleLoc(), node.getRAngleLoc()); - return true; + bool HandleComment(clang::Preprocessor& PP, clang::SourceRange Comment) override { + auto& sm = PP.getSourceManager(); + std::string CommentText = std::string(sm.getCharacterData(Comment.getBegin()), + sm.getCharacterData(Comment.getEnd()) - + sm.getCharacterData(Comment.getBegin())); + llvm::outs() << "Comment: " << CommentText << "\n"; + return false; } }; @@ -801,7 +705,10 @@ int main(int argc, const char** argv) { std::terminate(); } - clang::syntax::TokenCollector collector{instance->getPreprocessor()}; + auto& pp = instance->getPreprocessor(); + pp.addCommentHandler(new CommentHandler()); + clang::syntax::TokenCollector collector{pp}; + // pp.addCommentHandler(new CommentHandler()); if(auto error = action.Execute()) { llvm::errs() << "Failed to execute action: " << error << "\n"; @@ -811,13 +718,25 @@ int main(int argc, const char** argv) { clang::syntax::TokenBuffer buffer = std::move(collector).consume(); buffer.indexExpandedTokens(); + auto& sm = instance->getSourceManager(); + auto& fm = instance->getFileManager(); + + auto entry = fm.getFileRef("/usr/include/c++/13/vector"); + auto id = sm.translateFile(*entry); + auto tokens = buffer.spelledTokens(id); + + for(auto token: tokens) { + llvm::outs() << token.text(sm) << " "; + token.location().dump(sm); + } + auto tu = instance->getASTContext().getTranslationUnitDecl(); ASTVistor visitor{instance->getPreprocessor(), buffer, instance->getASTContext(), instance->getSema(), buffer}; - visitor.TraverseDecl(tu); + // visitor.TraverseDecl(tu); action.EndSourceFile(); }; diff --git a/docs/examples/Module.cpp b/docs/examples/Module.cpp index d339b34c..f439d115 100644 --- a/docs/examples/Module.cpp +++ b/docs/examples/Module.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -9,48 +8,164 @@ #include #include -namespace fs = std::filesystem; +class CodeCompleteConsumer : public clang::CodeCompleteConsumer { +private: + std::shared_ptr Allocator; + clang::CodeCompletionTUInfo CCTUInfo; + +public: + CodeCompleteConsumer() : + clang::CodeCompleteConsumer(clang::CodeCompleteOptions{}), + Allocator(std::make_shared()), CCTUInfo(Allocator) {} + + clang::CodeCompletionAllocator& getAllocator() override { return *Allocator; } + + clang::CodeCompletionTUInfo& getCodeCompletionTUInfo() override { return CCTUInfo; } + + void ProcessCodeCompleteResults(clang::Sema& S, + clang::CodeCompletionContext Context, + clang::CodeCompletionResult* Results, + unsigned NumResults) override { + llvm::outs() << NumResults << " code completion results\n"; + auto kind = Context.getKind(); + if(kind == clang::CodeCompletionContext::CCC_DotMemberAccess) { + auto type = Context.getBaseType(); + type->dump(); + } + // auto contexts = Context.getVisitedContexts(); + // for(auto c: contexts) { + // // llvm::outs() << " Kind: " << c->getDeclKindName() << "\n"; + // // for(auto d: c->decls()) { + // // // d->dump(); + // // } + // } + // + llvm::outs() << "code completion results:\n"; + // switch(Context.getKind()) { + // case clang::CodeCompletionContext::CCC_Attribute: { + // } + // case clang::CodeCompletionContext::CCC_DotMemberAccess: { + // const auto type = Context.getBaseType(); + // if(type->isDependentType()) { + // + // if(const auto dependentType = type->getAs()) { + // auto qualifers = dependentType->getQualifier(); + // // qualifers->getKind() -> clang::NestedNameSpecifier::SpecifierKind; + // // auto t = qualifers->getAsType(); + // // TODO: 看是否能根据主模板一路把依赖名替换下去,直到变成非依赖名 + // } else if(const auto dependentType = + // type->getAs()) { + // } + // } + // break; + // } + // /* ... */ + // default: { + // llvm::outs() << " Kind: " << Context.getKind() << "\n"; + // } + //} + + for(unsigned i = 0; i < NumResults; ++i) { + clang::CodeCompletionResult& Result = Results[i]; + + switch(Result.Kind) { + case clang::CodeCompletionResult::RK_Declaration: { + llvm::outs() << " Declaration: "; + llvm::outs() << Result.Declaration->getNameAsString() << "\n"; + break; + } + + case clang::CodeCompletionResult::RK_Keyword: { + llvm::outs() << " Keyword: "; + llvm::outs() << Result.Keyword << "\n"; + break; + } + + case clang::CodeCompletionResult::RK_Macro: { + llvm::outs() << " Macro: "; + llvm::outs() << Result.Macro->getName() << "\n"; + break; + } + + case clang::CodeCompletionResult::RK_Pattern: { + llvm::outs() << " Pattern: "; + llvm::outs() << Result.Pattern->getAsString() << "\n"; + break; + } + } + } + } + + void ProcessOverloadCandidates(clang::Sema& S, + unsigned CurrentArg, + OverloadCandidate* Candidates, + unsigned NumCandidates, + clang::SourceLocation OpenParLoc, + bool Braced) override {} +}; int main(int argc, const char** argv) { - assert(argc == 2 && "Usage: Preamble "); - llvm::outs() << "running Preamble...\n"; + assert(argc == 2 && "Usage: Preprocessor "); + llvm::outs() << "running ASTVisitor...\n"; - std::vector args = { - "/home/ykiko/Project/C++/clice/external/llvm/bin/clang++", - "-Xclang", - "-no-round-trip-args", - "-std=c++20", - argv[1], - "-c", - }; + std::string err; + auto CDB = clang::tooling::CompilationDatabase::loadFromDirectory( + "/home/ykiko/C++/clice/docs/examples/temp/build", + err); + + if(!CDB) { + llvm::errs() << "Failed to load compilation database: " << err << "\n"; + std::terminate(); + } + + using namespace clang::tooling::dependencies; + DependencyScanningService service{ScanningMode::DependencyDirectivesScan, + ScanningOutputFormat::P1689}; + DependencyScanningTool tool{service}; + auto cmd = CDB->getCompileCommands("/home/ykiko/C++/clice/docs/examples/temp/src/D.cppm")[0]; + auto dep = tool.getP1689ModuleDependencyFile(cmd, cmd.Directory); + if(auto error = dep.takeError()) { + llvm::errs() << "Failed to get module dependency file: " << error << "\n"; + std::terminate(); + } + for(auto& file: dep->Requires) { + llvm::outs() << "Module Name: " << file.ModuleName << "\n"; + } auto instance = std::make_unique(); + clang::DiagnosticIDs* ids = new clang::DiagnosticIDs(); + clang::DiagnosticOptions* diag_opts = new clang::DiagnosticOptions(); + clang::DiagnosticConsumer* consumer = new clang::TextDiagnosticPrinter(llvm::errs(), diag_opts); + clang::DiagnosticsEngine* engine = new clang::DiagnosticsEngine(ids, diag_opts, consumer); + instance->setDiagnostics(engine); + auto invocation = std::make_shared(); + std::vector args{ + "/usr/local/bin/clang++", + "-std=gnu++20", + "-x", + "c++-module", + "-fmodule-output=/home/ykiko/C++/clice/docs/examples/temp/build/CMakeFiles/test_modules.dir/D.pcm", + "-fmodule-file=B=/home/ykiko/C++/clice/docs/examples/temp/build/CMakeFiles/test_modules.dir/B.pcm", + "-fmodule-file=C=/home/ykiko/C++/clice/docs/examples/temp/build/CMakeFiles/test_modules.dir/C.pcm", + "-fmodule-file=A=/home/ykiko/C++/clice/docs/examples/temp/build/CMakeFiles/test_modules.dir/A.pcm", + "/home/ykiko/C++/clice/docs/examples/temp/src/D.cppm", + "-Xclang", + "-no-round-trip-args", + }; + invocation = clang::createInvocation(args, {}); - invocation->getFrontendOpts(); - auto tmp = llvm::MemoryBuffer::getFile(argv[1]); - if(auto error = tmp.getError()) { - llvm::errs() << "Failed to get file: " << error.message() << "\n"; - std::terminate(); - } - llvm::MemoryBuffer* buffer = tmp->release(); - - auto VFS = llvm::vfs::getRealFileSystem(); - auto bounds = clang::ComputePreambleBounds(invocation->getLangOpts(), *buffer, false); + auto& codeCompletionAt = invocation->getFrontendOpts().CodeCompletionAt; + codeCompletionAt.FileName = "/home/ykiko/C++/clice/docs/examples/temp/src/D.cppm"; + codeCompletionAt.Line = std::stoi(argv[1]); + codeCompletionAt.Column = std::stoi(argv[2]); + // clang::CompilerInvocation::CreateFromArgs(*invocation, args, instance->getDiagnostics()); instance->setInvocation(std::move(invocation)); - instance->createDiagnostics( - new clang::TextDiagnosticPrinter(llvm::errs(), new clang::DiagnosticOptions()), - true); - - /// NOTICE: if preamble is stored in memory, the code below is necessary - if(auto VFSWithRemapping = - createVFSFromCompilerInvocation(instance->getInvocation(), instance->getDiagnostics(), VFS)) - VFS = VFSWithRemapping; - instance->createFileManager(VFS); + instance->setCodeCompletionConsumer(new CodeCompleteConsumer()); if(!instance->createTarget()) { llvm::errs() << "Failed to create target\n"; @@ -59,18 +174,30 @@ int main(int argc, const char** argv) { clang::SyntaxOnlyAction action; - auto& mainInput = instance->getFrontendOpts().Inputs[0]; - if(!action.BeginSourceFile(*instance, mainInput)) { + if(!action.BeginSourceFile(*instance, instance->getFrontendOpts().Inputs[0])) { llvm::errs() << "Failed to begin source file\n"; std::terminate(); } + clang::syntax::TokenCollector collector{instance->getPreprocessor()}; + if(auto error = action.Execute()) { llvm::errs() << "Failed to execute action: " << error << "\n"; std::terminate(); } - instance->getASTContext().getTranslationUnitDecl()->dump(); + clang::syntax::TokenBuffer buffer = std::move(collector).consume(); + buffer.indexExpandedTokens(); + + auto tu = instance->getASTContext().getTranslationUnitDecl(); + // tu->dump(); + // ASTVistor visitor{instance->getPreprocessor(), + // buffer, + // instance->getASTContext(), + // instance->getSema(), + // buffer}; + // visitor.TraverseDecl(tu); action.EndSourceFile(); -} +}; + diff --git a/docs/examples/Preprocessor.cpp b/docs/examples/Preprocessor.cpp index e843564b..6339f747 100644 --- a/docs/examples/Preprocessor.cpp +++ b/docs/examples/Preprocessor.cpp @@ -144,7 +144,6 @@ int main(int argc, const char** argv) { clang::Preprocessor& pp = instance->getPreprocessor(); auto& sm = pp.getSourceManager(); - // pp.setTokenWatcher([&](const clang::Token& token) { // llvm::outs() << "Token: " << pp.getSpelling(token); // auto loc = sm.getSpellingLoc(token.getLocation()); diff --git a/include/Clang/Module.h b/include/Clang/Module.h new file mode 100644 index 00000000..e69de29b diff --git a/include/Clang/Preamble.h b/include/Clang/Preamble.h index 6ef7af19..c8bb38a9 100644 --- a/include/Clang/Preamble.h +++ b/include/Clang/Preamble.h @@ -9,7 +9,7 @@ private: Directive directive; clang::PrecompiledPreamble data; - Preamble(clang::PrecompiledPreamble&& preamble) : data(std::move(preamble)) {} + // Preamble(clang::PrecompiledPreamble&& preamble) : data(std::move(preamble)) {} public: static std::unique_ptr diff --git a/test.cpp b/test.cpp index 226b8de7..3b3a25f2 100644 --- a/test.cpp +++ b/test.cpp @@ -1,15 +1 @@ -#if 1 - -int x = 1; - -#else - -int y = 2; - -#endif - -#ifdef X - -int y = 2; - -#endif \ No newline at end of file +#include