Container Operators
Overloaded operators for container comparison. More...
Operators Index
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator!= (const Lhs_T &lhs, const Rhs_T &rhs) |
|
Non-equality operator for containers. More... | |
template <class Lhs_T, class Rhs_T> | |
| constexpr auto | operator== (const Lhs_T &lhs, const Rhs_T &rhs) |
|
Equality operator for containers. More... | |
Description
Overloaded operators for container comparison.
Within test cases, overloaded operators support direct and expressive comparison of standard containers, such as vectors and strings. These operators enable clear, concise assertions when verifying equality or inequality of container contents.
In addition to generic operators, specialised equality and inequality operators are available for container types where dedicated handling improves correctness or efficiency, while preserving modern C++ semantics.
- Examples
Operators
operator!=()
| nodiscard constexpr |
Non-equality operator for containers.
Constructs an ne_ comparator object from the two container operands and returns it. The comparator evaluates to true if the containers are not equal in content or order.
The operator is enabled only for types recognised as containers by the framework's type traits.
- Template Parameters
-
Lhs_T The left-hand container type, constrained to recognised container types.
Rhs_T The right-hand container type, constrained to recognised container types.
- Parameters
-
[in] lhs The left hand side container operand.
[in] rhs The right hand side container operand.
- Returns
A comparator object that evaluates to true if the containers are not equal.
Definition at line 124 of file operators-inlines.h.
operator==()
| nodiscard constexpr |
Equality operator for containers.
Constructs an eq_ comparator object from the two container operands and returns it. The comparator evaluates to true if the containers are equal in content and order.
The operator is enabled only for types recognised as containers by the framework's type traits.
- Template Parameters
-
Lhs_T The left-hand container type, constrained to recognised container types.
Rhs_T The right-hand container type, constrained to recognised container types.
- Parameters
-
[in] lhs The left hand side container operand.
[in] rhs The right hand side container operand.
- Returns
A comparator object that evaluates to true if the containers are equal.
Definition at line 106 of file operators-inlines.h.
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.