Namespaces
Variants
Views
Actions

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

From cppreference.com
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)

(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)

Elementary string conversions
(C++17)
(C++17)
Stacktrace
 
 
template< class Allocator2 >

friend bool operator==( const basic_stacktrace& lhs,

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

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

                 const basic_stacktrace<Allocator2>& rhs ) noexcept;
(2) (since C++23)
1) Checks if the contents of lhs and rhs are equal, that is, they have the same number of elements and each element in lhs compares equal with the element in rhs at the same position.
Equivalent to return std::equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());.
2) Returns the relative order of the numbers of stacktrace entries in lhs and rhs if they are not equal. Otherwise (if the numbers of elements of lhs and rhs are equal), returns the lexicographical order of the elements of lhs and rhs.
Equivalent to
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());
.

These function templates are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::basic_stacktrace<Allocator> is an associated class of the arguments.

The <, <=, >, >=, and != operators are synthesized from operator<=> and operator== respectively.

Contents

[edit] Parameters

lhs, rhs - basic_stacktraces whose contents to compare

[edit] Return value

1) true if the contents of lhs and rhs are equal, false otherwise.
2) lhs.size() <=> rhs.size() if the result is not std::strong_order::equal, the lexicographical order of the elements of lhs and rhs otherwise.

[edit] Complexity

1-2) Constant if lhs and rhs are of different size, linear in the size of lhs otherwise.

[edit] Example