Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_stacktrace<Allocator>::size

      From cppreference.com
      <cpp‎ |utility‎ |basic stacktrace
       
       
      Diagnostics library
       
       
      size_type size()constnoexcept;
      (since C++23)

      Returns the number of entries in the stacktrace.

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      The number of entries in the stacktrace.

      [edit]Complexity

      Constant.

      [edit]Example

      The following code usessize to display the number of entries in the current stacktrace:

      Run this code
      #include <stacktrace>#include <iostream> int main(){auto trace= std::stacktrace::current(); std::cout<<"trace contains "<< trace.size()<<" entries.\n";}

      Possible output:

      trace contains 3 entries.

      [edit]See also

      checks whether thebasic_stacktrace is empty
      (public member function)[edit]
      returns the maximum possible number of stacktrace entries
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/basic_stacktrace/size&oldid=128948"

      [8]ページ先頭

      ©2009-2025 Movatter.jp