std::stackt...source_file(3)
β¨ NAME β¨
std::stacktrace_entry::source_file - std::stacktrace_entry::source_file
This is the page for the source_file member of std::stacktrace_entry, bestie β and the manual name up top is std::stackt...source_file(3) from the C++ Standard Libary manual. (Yes, that spelling is straight from the header. π) We're folding it in here instead of copy-pasting the header line, because we're cute like that. π
πΈ Synopsis πΈ
std::string source_file() const; (since C++23)
Okay so it returns the presumed or actual name of the source file that lexically contains the expression or statement whose evaluation is represented by *this, or an empty string 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. periodt.
π Parameters π
(none) β literally none, bestie. Cute and low-maintenance. π
π¦ Return value π¦
The name of the source file specified above on success, an empty string on failure other than allocation failure. Slay.
π Exceptions π
Throws std::bad_alloc if memory for the internal data structures or the resulting string cannot be allocated. So if allocation says no, it's giving std::bad_alloc. π
π₯ Notes π₯
The presumed name of the source file is what the predefined macro __FILE__ expands to, and it can be changed by the #line directive. iykyk.
This section is incomplete Reason: definition of "actual name" is missing (LWG issue 3507)
Custom allocators support for this function is not provided, because the implementations usually require platform specific allocations, system calls and a lot of CPU intensive work, while a custom allocator does not provide benefits for this function as the platform specific operations take an order of magnitude more time than the allocation. No cap, that's the whole note. β¨
π§ Example π§
This section is incomplete Reason: no example
No example bestie, the example section is literally incomplete. π
π See also π
file_nameβ return the file name represented by this object (public member function ofstd::source_location)
π Categories π
- Todo with reason
- Todo no example
xoxo, your Unix bestie π β footer source/version/date, folded into this cute sign-off: http://cppreference.com, 2024.06.10, and page std::stackt...source_file(3). Bye bestie, go read your stack traces responsibly. πΈ
π¦ 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