Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::to_string

      From cppreference.com
      <cpp‎ |utility‎ |basic stacktrace
       
       
      Diagnostics library
       
       
      Defined in header<stacktrace>
      template<class Allocator>
      std::string to_string(conststd::basic_stacktrace<Allocator>& st);
      (since C++23)

      Returns a string with a description ofst.

      The description of abasic_stacktrace typically contains description of its entries, although the number of lines is not required to be equal tosize().

      Contents

      [edit]Parameters

      st - abasic_stacktrace whose description is to be returned

      [edit]Return value

      A string with a description ofst.

      [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 trace= std::stacktrace::current();std::cout<<std::to_string(trace)<<'\n';}

      Possible output:

       0# 0x0000000000402D97 in ./prog.exe 1# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 2# 0x0000000000402CA9 in ./prog.exe

      [edit]See also

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

      [8]ページ先頭

      ©2009-2025 Movatter.jp