Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::basic_stacktrace<Allocator>::rend,std::basic_stacktrace<Allocator>::crend

      From cppreference.com
      <cpp‎ |utility‎ |basic stacktrace
       
       
      Diagnostics library
       
       
      const_reverse_iterator rend()  constnoexcept;
      (1)(since C++23)
      const_reverse_iterator crend()constnoexcept;
      (2)(since C++23)

      Returns a reverse iterator pointing past the last entry of the reversedbasic_stacktrace. It corresponds to the iterator preceding the first entry of the originalbasic_stacktrace. This iterator acts as a placeholder, attempting to dereference it results in undefined behavior.

      range-rbegin-rend.svg

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      The end iterator of the reversedbasic_stacktrace.

      [edit]Complexity

      Constant.

      [edit]Example

      Run this code
      #include <algorithm>#include <iostream>#include <stacktrace> int main(){auto trace= std::stacktrace::current();auto empty_trace=std::stacktrace{}; // Print stacktrace.std::for_each(trace.rbegin(), trace.rend(),[](constauto& f){std::cout<< f<<'\n';}); if(empty_trace.rbegin()== empty_trace.rend())std::cout<<"stacktrace 'empty_trace' is indeed empty.\n";}

      Possible output:

      0x0000000000402A29 in ./prog.exe__libc_start_main in /lib/x86_64-linux-gnu/libc.so.60x0000000000402BA5 in ./prog.exestacktrace 'empty_trace' is indeed empty.

      [edit]See also

      returns a reverse iterator to the beginning
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/basic_stacktrace/rend&oldid=129028"

      [8]ページ先頭

      ©2009-2025 Movatter.jp