Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::stacktrace_entry::source_file

      From cppreference.com
      <cpp‎ |utility‎ |stacktrace entry
       
       
      Diagnostics library
       
       
      std::string source_file()const;
      (since C++23)

      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.

      Eithersource_file returns the presumed source file name andsource_line returns the presumed line number, orsource_file returns the actual source file name andsource_line returns the actual line number.

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      The name of the source file specified above on success, an empty string on failure other than allocation failure.

      [edit]Exceptions

      Throwsstd::bad_alloc if memory for the internal data structures or the resulting string cannot be allocated.

      [edit]Notes

      The presumed name of the source file is what the predefined macro__FILE__ expands to, and can be changed by the#line directive.

      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.

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      return the file name represented by this object
      (public member function ofstd::source_location)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/stacktrace_entry/source_file&oldid=126242"

      [8]ページ先頭

      ©2009-2025 Movatter.jp