Skip to content

Commit

Permalink
Enable inplace_vector for comparison operators
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorostsa committed Dec 17, 2024
1 parent a59fbcf commit 9f7349d
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1356,46 +1356,46 @@ namespace hpx::detail {
}
};

template <typename T, std::size_t NA, std::size_t NB>
[[nodiscard]] constexpr auto operator==(small_vector<T, NA> const& a,
small_vector<T, NB> const& b) noexcept -> bool
template <typename T, std::size_t NA, std::size_t NB, typename alloc, bool emulate_inplace_vector>
[[nodiscard]] constexpr auto operator==(small_vector<T, NA, alloc, emulate_inplace_vector> const& a,
small_vector<T, NB, alloc, emulate_inplace_vector> const& b) noexcept -> bool
{
return std::equal(a.begin(), a.end(), b.begin(), b.end());
}

template <typename T, std::size_t NA, std::size_t NB>
[[nodiscard]] constexpr auto operator!=(small_vector<T, NA> const& a,
small_vector<T, NB> const& b) noexcept -> bool
template <typename T, std::size_t NA, std::size_t NB, typename alloc, bool emulate_inplace_vector>
[[nodiscard]] constexpr auto operator!=(small_vector<T, NA, alloc, emulate_inplace_vector> const& a,
small_vector<T, NB, alloc, emulate_inplace_vector> const& b) noexcept -> bool
{
return !(a == b);
}

template <typename T, std::size_t NA, std::size_t NB>
[[nodiscard]] constexpr auto operator<(small_vector<T, NA> const& a,
small_vector<T, NB> const& b) noexcept -> bool
template <typename T, std::size_t NA, std::size_t NB, typename alloc, bool emulate_inplace_vector>
[[nodiscard]] constexpr auto operator<(small_vector<T, NA, alloc, emulate_inplace_vector> const& a,
small_vector<T, NB, alloc, emulate_inplace_vector> const& b) noexcept -> bool
{
return std::lexicographical_compare(
a.begin(), a.end(), b.begin(), b.end());
}

template <typename T, std::size_t NA, std::size_t NB>
[[nodiscard]] constexpr auto operator>=(small_vector<T, NA> const& a,
small_vector<T, NB> const& b) noexcept -> bool
template <typename T, std::size_t NA, std::size_t NB, typename alloc, bool emulate_inplace_vector>
[[nodiscard]] constexpr auto operator>=(small_vector<T, NA, alloc, emulate_inplace_vector> const& a,
small_vector<T, NB, alloc, emulate_inplace_vector> const& b) noexcept -> bool
{
return !(a < b);
}

template <typename T, std::size_t NA, std::size_t NB>
[[nodiscard]] constexpr auto operator>(small_vector<T, NA> const& a,
small_vector<T, NB> const& b) noexcept -> bool
template <typename T, std::size_t NA, std::size_t NB, typename alloc, bool emulate_inplace_vector>
[[nodiscard]] constexpr auto operator>(small_vector<T, NA, alloc, emulate_inplace_vector> const& a,
small_vector<T, NB, alloc, emulate_inplace_vector> const& b) noexcept -> bool
{
return std::lexicographical_compare(
b.begin(), b.end(), a.begin(), a.end());
}

template <typename T, std::size_t NA, std::size_t NB>
[[nodiscard]] constexpr auto operator<=(small_vector<T, NA> const& a,
small_vector<T, NB> const& b) noexcept -> bool
template <typename T, std::size_t NA, std::size_t NB, typename alloc, bool emulate_inplace_vector>
[[nodiscard]] constexpr auto operator<=(small_vector<T, NA, alloc, emulate_inplace_vector> const& a,
small_vector<T, NB, alloc, emulate_inplace_vector> const& b) noexcept -> bool
{
return !(a > b);
}
Expand Down

0 comments on commit 9f7349d

Please sign in to comment.