Namespaces
Variants

operator==, operator<=> (std::basic_stacktrace)

From cppreference.net
template < class Allocator2 >

friend bool operator == ( const basic_stacktrace & lhs,

const basic_stacktrace < Allocator2 > & rhs ) noexcept ;
(1) (C++23 起)
template < class Allocator2 >

friend std:: strong_ordering
operator <=> ( const basic_stacktrace & lhs,

const basic_stacktrace < Allocator2 > & rhs ) noexcept ;
(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 )

return cmp ;
else
return std:: lexicographical_compare_three_way ( lhs. begin ( ) , lhs. end ( ) ,

rhs. begin ( ) , rhs. end ( ) ) ;
.

这些函数模板对普通的 非限定查找 限定查找 不可见,仅当 std::basic_stacktrace<Allocator> 作为参数的关联类时,才能通过 实参依赖查找 找到它们。

< <= > >= != 运算符分别由 operator <=> operator == 自动合成。

目录

参数

lhs, rhs - 要比较内容的 basic_stacktrace 对象

返回值

1) true lhs rhs 的内容相等时, false 表示其他情况。
2) lhs. size ( ) <=> rhs. size ( ) 若结果不是 std::strong_order::equal ,则按 lhs rhs 元素的字典序排列。

复杂度

1,2) lhs rhs 大小不同时为常数时间复杂度,否则与 lhs 的大小成线性关系。

示例