Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::to_string

      From cppreference.com
      <cpp‎ |utility‎ |stacktrace entry
       
       
      Diagnostics library
       
       
      Defined in header<stacktrace>
      (since C++23)

      Returns a string with a description off.

      The standard recommends that the description should provide information about the contained evaluation, including information fromf.source_file() andf.source_line().

      Contents

      [edit]Parameters

      f - astacktrace_entry whose description is to be returned

      [edit]Return value

      A string with a description off.

      [edit]Exceptions

      May throw implementation-defined exceptions.

      [edit]Notes

      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

      Run this code
      #include <stacktrace>#include <string>#include <iostream> int main(){auto st= std::stacktrace::current();std::cout<<"Description of an empty stacktrace entry:\n"+std::to_string(std::stacktrace_entry{})<<'\n';if(st.size()>0){std::cout<<"Description of a non-empty stacktrace entry:\n"+std::to_string(st[0])<<'\n';}}

      Possible output:

      Description of an empty stacktrace entry: Description of a non-empty stacktrace entry:0x0000000000402DE9 in ./prog.exe

      [edit]See also

      (C++23)
      returns a string with a description of thebasic_stacktrace
      (function template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/stacktrace_entry/to_string&oldid=129004"

      [8]ページ先頭

      ©2009-2025 Movatter.jp