- stacktrace[meta header]
- std[meta namespace]
- basic_stacktrace[meta class]
- function[meta id-type]
- cpp23[meta cpp]
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());
}
- size()[link size.md]
- lexicographical_compare_three_way[link /reference/algorithm/lexicographical_compare_three_way.md]
- begin()[link begin.md]
- end()[link end.md]
- この演算子により、
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();
}
- current()[link current.md]
- C++23
- Clang: ??
- GCC: 12 [mark verified]
- Visual C++: ??