diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/kstd/include/kstd/vector | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/kstd/include/kstd/vector b/libs/kstd/include/kstd/vector index de5c059..f8e9ce2 100644 --- a/libs/kstd/include/kstd/vector +++ b/libs/kstd/include/kstd/vector @@ -728,6 +728,21 @@ namespace kstd value_type * m_data{}; }; + //! Check if the content of two vectors is equal. + template<typename ValueType, typename Allocator> + constexpr auto operator==(vector<ValueType, Allocator> const & lhs, vector<ValueType, Allocator> const & rhs) -> bool + { + return std::ranges::equal(lhs, rhs); + } + + //! Perform a lexicographical comparison of the content of two vectors. + template<typename ValueType, typename Allocator> + constexpr auto operator<=>(vector<ValueType, Allocator> const & lhs, vector<ValueType, Allocator> const & rhs) + -> decltype(std::declval<ValueType const &>() <=> std::declval<ValueType const &>()) + { + return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + } + } // namespace kstd #endif |
