std::bad_alloc(3)
π NAME π
std::bad_alloc β the exception that new might just throw at you, bestie. No cap.
β¨ SYNOPSIS β¨
#include <new_except.h>
She inherits from std::exception. Classic family tree moment.
π Public Member Functions
_GLIBCXX26_CONSTEXPR bad_alloc (const bad_alloc &)=default
_GLIBCXX26_CONSTEXPR bad_alloc & operator= (const bad_alloc &)=default
virtual constexpr const char * what () const noexcept
πΈ Detailed Description πΈ
Okay so, real talk: std::bad_alloc is the exception that new possibly throws. Emphasis on possibly β she's not committing to anything, she's just saying it's on the table.
bad_alloc β or any of the classes derived from it, because the whole girlies family is welcome β is what gets used to report allocation errors coming from the throwing forms of new. Like, if you asked new for memory and new couldn't deliver, this is the notification you get. It's giving "we need to talk." π
π Member Function Documentation π
virtual constexpr const char * std::bad_alloc::what () const [inline], [constexpr], [virtual], [noexcept]
THE girl. π
She returns a C-style character string that describes the general cause of the current error. That's it, that's the job β a little const char * telling you what went wrong in the vaguest possible way. π
Reimplemented from std::exception. So yeah, she's over here doing her own version of the family classic.
π¦ Author π¦
Generated automatically by Doxygen for libstdc++ from the source code. So nobody hand-wrote this one, she simply materialised. Main character behaviour fr fr. β¨
Okay bestie, that's the whole page! It's from the libstdc++ library and the footer is literally just the word libstdc++ (Library Functions Manual energy), and as for the dateβ¦ she left it blank, iconic, she's timeless. π«Ά Mwah, go catch that exception. π
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms