operator==, operator<=>(std::basic_stacktrace)
出自cppreference.com
< cpp | utility | basic stacktrace
template< class Allocator2 > friend bool operator==( const basic_stacktrace& lhs, |
(1) | (C++23 起) |
template< class Allocator2 > friend std::strong_ordering |
(2) | (C++23 起) |
1) 檢查 lhs 與 rhs 的內容是否相等,即它們擁有相同元素個數且 lhs 中的每個元素比較都等於 rhs 中相同位置的元素。
等價於 return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); 。
2) 返回 lhs 與 rhs 中的棧蹤跡條目個數的相對順序,若它們不相等。否則(若 lhs 與 rhs 的元素個數相等),則返回 lhs 與 rhs 的元素的字典順序。
等價於
if (auto cmp = lhs.size() <=> rhs.size(); cmp != 0)
if (auto cmp = lhs.size() <=> rhs.size(); cmp != 0)
return cmp;
else
return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(),
這些函數模板對常規的無限定或有限定查找不可見,而只能在 std::basic_stacktrace<Allocator> 為實參的關聯類時由實參依賴查找找到。
<
、<=
、>
、>=
及 !=
運算符分別從 operator<=> 與 operator== 合成。
目錄 |
[編輯] 參數
lhs, rhs | - | 要比較內容的 basic_stacktrace
|
[編輯] 返回值
1) 若 lhs 與 rhs 的內容相等則為 true,否則為 false。
2) lhs.size() <=> rhs.size(),若其結果不是 std::strong_order::equal,否則為 lhs 與 rhs 的元素的字典順序。
[編輯] 複雜度
1,2) 若 lhs 與 rhs 大小不同則為常數,否則與 lhs 的大小成線性。
[編輯] 示例
本節未完成 原因:暫無示例 |