operator==, operator<=>(std::basic_stacktrace)
來自 cppreference.com
< cpp | 工具庫 | 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) 如果結果不是 std::strong_order::equal,則為 lhs.size() <=> rhs.size(),否則為 lhs 和 rhs 元素的字典序。
[編輯] 複雜度
1,2) 如果 lhs 和 rhs 大小不同,則為常數時間;否則,與 lhs 的大小成線性關係。
[編輯] 示例
本節不完整 原因:無示例 |