std::stackt...source_line(3)
π NAME π
Okay bestie, welcome to the std::stackt...source_line(3) page from the C++ Standard Libary manual β yes, that manual name is exactly how it appears, no cap. The function is std::stacktrace_entry::source_line, and it's here to hand you a line number: 1-based, lexically related to the evaluation that *this represents. If it can't do that, it gives you 0 on failure other than allocation failure, e.g. when *this is empty. β¨
β¨ Synopsis β¨
std::uint_least32_t source_line() const; (since C++23)
Returns a 1-based line number that lexically relates to the evaluation represented by *this, or 0 on failure other than allocation failure, e.g. when *this is empty.
Either source_file returns the presumed source file name and source_line returns the presumed line number, or source_file returns the actual source file name and source_line returns the actual line number. That's the whole either/or vibe, periodt. π
πΈ Parameters πΈ
(none) β literally nothing to pass in. π
π¦ Return value π¦
The line number specified above on success, 0 on failure other than allocation failure. No cap. β¨
π₯ Exceptions π₯
Throws std::bad_alloc if memory for the internal data structures cannot be allocated. That's the only exception tea here. π
π Notes π
The presumed line number is what the predefined macro __LINE__ expands to, and can be changed by the #line directive. Big preprocessor energy, iykyk.
This section is incomplete Reason: definition of "actual line number" is missing (LWG issue 3507)
This function is not required to be noexcept because getting source line requires allocation on some platforms. So yeah, allocation can be part of the plot. π
π§ Example π§
This section is incomplete Reason: no example
No example, bestie β the example section is literally off getting boba. π
π See also π
lineβ return the line number represented by this object (public member function ofstd::source_location)
π Categories π
- Todo with reason
- Todo no example
Bye bestie π«Ά β this cutie's source/version/date sign-off is http://cppreference.com, 2024.06.10, with the footer title std::stackt...source_line(3). πβ¨π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms