• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <stacktrace>

    std::basic_stacktrace::operator<=>

    template <class Allocator2>
    friend bool operator<=>(const basic_stacktrace& x,
                            const basic_stacktrace<Allocator2>& y) noexcept;
    

    概要

    basic_stacktrace同士の等値比較を行う。

    戻り値

    if (x.size() != y.size()) {
      return x.size() <=> y.size();
    }
    else {
      return lexicographical_compare_three_way(x.begin(), x.end(), y.begin(), y.end());
    }
    

    備考

    • この演算子により、operator<operator<=operator>operator>=が使用可能になる

    #include <cassert>
    #include <stacktrace>
    
    void g() {
      std::stacktrace a = std::stacktrace::current();
      std::stacktrace c = a;
    
      assert((a <=> c) == 0);
    }
    
    void f() {
      g();
    }
    
    int main() {
      f();
    }
    

    出力

    バージョン

    言語

    • C++23

    処理系

    関連項目