mirror of
https://github.com/boostorg/mysql.git
synced 2026-02-02 09:02:09 +00:00
Added operator== between rows and owning rows
This commit is contained in:
@@ -9,10 +9,10 @@ namespace mysql
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
template <typename TLeft, typename TRight>
|
||||
inline bool container_equals(
|
||||
const std::vector<T>& lhs,
|
||||
const std::vector<T>& rhs
|
||||
const std::vector<TLeft>& lhs,
|
||||
const std::vector<TRight>& rhs
|
||||
)
|
||||
{
|
||||
if (lhs.size() != rhs.size()) return false;
|
||||
|
||||
@@ -43,11 +43,23 @@ public:
|
||||
inline bool operator==(const row& lhs, const row& rhs) { return lhs.values() == rhs.values(); }
|
||||
inline bool operator!=(const row& lhs, const row& rhs) { return !(lhs == rhs); }
|
||||
|
||||
inline bool operator==(const std::vector<owning_row>& lhs, const std::vector<owning_row>& rhs)
|
||||
// Allow comparisons between vectors of rows and owning rows
|
||||
template <
|
||||
typename RowTypeLeft,
|
||||
typename RowTypeRight,
|
||||
typename=std::enable_if_t<std::is_base_of_v<row, RowTypeLeft> && std::is_base_of_v<row, RowTypeRight>>
|
||||
>
|
||||
inline bool operator==(const std::vector<RowTypeLeft>& lhs, const std::vector<RowTypeRight>& rhs)
|
||||
{
|
||||
return detail::container_equals(lhs, rhs);
|
||||
}
|
||||
inline bool operator!=(const std::vector<owning_row>& lhs, const std::vector<owning_row>& rhs)
|
||||
|
||||
template <
|
||||
typename RowTypeLeft,
|
||||
typename RowTypeRight,
|
||||
typename=std::enable_if_t<std::is_base_of_v<row, RowTypeLeft> && std::is_base_of_v<row, RowTypeRight>>
|
||||
>
|
||||
inline bool operator!=(const std::vector<RowTypeLeft>& lhs, const std::vector<RowTypeRight>& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user