std::length_error(3)

πŸ’– NAME πŸ’–

std::length_error β€” bestie, this is the exception that gets thrown when you try to make something too big for its own good. She's a real one. She's not subtle. She shows up exactly when you need her. πŸ’…


✨ SYNOPSIS ✨

#include <stdexcept_except.h>

She inherits from std::logic_error, which means she's part of the logic-error girlies β€” the ones that mean you did something your program couldn't logically do, not that the machine broke. 🌸

πŸŽ€ Public Member Functions πŸŽ€

  • length_error (const char *)
  • length_error (const length_error &)=default
  • length_error (const string &__arg)
  • length_error (length_error &&)=default
  • length_error & operator= (const length_error &)=default
  • length_error & operator= (length_error &&)=default
  • virtual const char * what () const noexcept
Okay so notice: copy ctor and move ctor are both =default, and both assignment operators are =default too. She's lowkey just a normal, well-behaved little class. No drama in the special members. Periodt. πŸ¦‹

🌈 Detailed Description 🌈

She gets thrown when an object is constructed that would exceed its maximum permitted size β€” for example, a basic_string instance. 🫢

That's it. That's the whole job. You asked for a string longer than the universe allows, she said "not on my watch", and she threw herself into your stack trace. Main character energy fr fr. πŸ‘‘


πŸ’œ Member Function Documentation πŸ’œ

🌟 virtual const char * std::logic_error::what () const [virtual], [noexcept], [inherited] 🌟

Okay so this one is inherited β€” it's not even hers, she borrowed it from std::logic_error. It's marked [virtual] and [noexcept] (so calling it will never throw at you, she's polite πŸ’…).

What does it do? It returns a C-style character string describing the general cause of the current error (the same string passed to the ctor). So whatever you handed the constructor, you get back out as a const char *. It's giving "you get what you gave." 😭

  • Reimplemented from std::exception.
  • Reimplemented in std::future_error.
  • References what().
  • Referenced by what().
Not me pointing out that she references what() and is referenced by what() β€” yes bestie, that's literally what the docs say, I'm not making it up, I'm just reporting it. πŸ”₯

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. So like... nobody wrote this, a robot did. And the robot ate. πŸ€–βœ¨


And that's the whole page, bestie! πŸŽ€ This manual page comes from libstdc++, and it's the std::length_error(3) page β€” that's the source, that's the version, and there's no date on it, so don't @ me. Now go forth and never exceed your maximum permitted size. Byeee! πŸ’–πŸŒΈπŸ¦‹πŸ«Ά

πŸ“¦ 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.0.1-0.10.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
  • 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