|`Optional(m)` | `argument` is `optional<>` that contains a value matching `m`. (For testing whether an `optional<>` is set, check for equality with `nullopt`. You may need to use `Eq(nullopt)` if the inner type doesn't have `==`.)|
|`VariantWith<T>(m)` | `argument` is `variant<>` that holds the alternative of type T with a value matching `m`.|
|`Ref(variable)` | `argument` is a reference to `variable`.|
|`TypedEq<type>(value)` | `argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)`whenthemockfunctionisoverloaded.|
<!--mdformaton-->
Except`Ref()`, these matchers make a *copy* of `value`incaseit'smodifiedor
|`DoubleNear(a_double, max_abs_error)` | `argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`),treatingtwoNaNsasunequal.|
|`FloatNear(a_float, max_abs_error)` | `argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`),treatingtwoNaNsasunequal.|
|`NanSensitiveDoubleNear(a_double, max_abs_error)` | `argument` is a `double` value close to `a_double` (absolute error <= `max_abs_error`),treatingtwoNaNsasequal.|
|`NanSensitiveFloatNear(a_float, max_abs_error)` | `argument` is a `float` value close to `a_float` (absolute error <= `max_abs_error`),treatingtwoNaNsasequal.|
|`BeginEndDistanceIs(m)` | `argument` is a container whose `begin()` and `end()` iterators are separated by a number of increments matching `m`. E.g. `BeginEndDistanceIs(2)` or `BeginEndDistanceIs(Lt(2))`. For containers that define a `size()` method, `SizeIs(m)`maybemoreefficient.|
|`ContainerEq(container)` | The same as `Eq(container)`exceptthatthefailuremessagealsoincludeswhichelementsareinonecontainerbutnottheother.|
|`Contains(e)` | `argument` contains an element that matches `e`,whichcanbeeitheravalueoramatcher.|
|`Each(e)` | `argument` is a container where *every* element matches `e`,whichcanbeeitheravalueoramatcher.|
|`ElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, where the *i*-th element matches `ei`,whichcanbeavalueoramatcher.|
|`ElementsAreArray({e0, e1, ..., en})`, `ElementsAreArray(a_container)`, `ElementsAreArray(begin, end)`, `ElementsAreArray(array)`, or `ElementsAreArray(array, count)` | The same as `ElementsAre()`exceptthattheexpectedelementvalues/matcherscomefromaninitializerlist,STL-stylecontainer,iteratorrange,orC-stylearray.|
|`IsEmpty()` | `argument` is an empty container (`container.empty()`).|
|`IsSubsetOf({e0, e1, ..., en})`, `IsSubsetOf(a_container)`, `IsSubsetOf(begin, end)`, `IsSubsetOf(array)`, or `IsSubsetOf(array, count)` | `argument` matches `UnorderedElementsAre(x0, x1, ..., xk)` for some subset `{x0, x1, ..., xk}`oftheexpectedmatchers.|
|`IsSupersetOf({e0, e1, ..., en})`, `IsSupersetOf(a_container)`, `IsSupersetOf(begin, end)`, `IsSupersetOf(array)`, or `IsSupersetOf(array, count)` | Some subset of `argument` matches `UnorderedElementsAre(`expected matchers`)`.|
|`Pointwise(m, container)`, `Pointwise(m, {e0, e1, ..., en})` | `argument` contains the same number of elements as in `container`, and for all i, (the i-th element in `argument`, the i-th element in `container`) match `m`, which is a matcher on 2-tuples. E.g. `Pointwise(Le(), upper_bounds)` verifies that each element in `argument` doesn't exceed the corresponding element in `upper_bounds`.Seemoredetailbelow.|
|`SizeIs(m)` | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2))`.|
|`UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under *some* permutation of the elements, each element matches an `ei` (for a different `i`),whichcanbeavalueoramatcher.|
|`UnorderedElementsAreArray({e0, e1, ..., en})`, `UnorderedElementsAreArray(a_container)`, `UnorderedElementsAreArray(begin, end)`, `UnorderedElementsAreArray(array)`, or `UnorderedElementsAreArray(array, count)` | The same as `UnorderedElementsAre()`exceptthattheexpectedelementvalues/matcherscomefromaninitializerlist,STL-stylecontainer,iteratorrange,orC-stylearray.|
|`WhenSorted(m)` | When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSorted(ElementsAre(1, 2, 3))` verifies that `argument`containselements1,2,and3,ignoringorder.|
|`WhenSortedBy(comparator, m)` | The same as `WhenSorted(m)`, except that the given comparator instead of `<` is used to sort `argument`. E.g. `WhenSortedBy(std::greater(), ElementsAre(3, 2, 1))`.|
<!--mdformaton-->
**Notes:**
*Thesematcherscanalsomatch:
1.anativearraypassedbyreference(e.g.in`Foo(const int (&a)[5])`),
|`Field(&class::field, m)` | `argument.field` (or `argument->field` when `argument` is a plain pointer) matches matcher `m`, where `argument`isanobjectoftype_class_.|
|`Key(e)` | `argument.first` matches `e`, which can be either a value or a matcher. E.g. `Contains(Key(Le(5)))` can verify that a `map` contains a key `<= 5`.|
|`Pair(m1, m2)` | `argument` is an `std::pair` whose `first` field matches `m1` and `second` field matches `m2`.|
|`Property(&class::property, m)` | `argument.property()` (or `argument->property()` when `argument` is a plain pointer) matches matcher `m`, where `argument`isanobjectoftype_class_.|
|`AllOf(m1, m2, ..., mn)` | `argument` matches all of the matchers `m1` to `mn`.|
|`AllOfArray({m0, m1, ..., mn})`, `AllOfArray(a_container)`, `AllOfArray(begin, end)`, `AllOfArray(array)`, or `AllOfArray(array, count)` | The same as `AllOf()`exceptthatthematcherscomefromaninitializerlist,STL-stylecontainer,iteratorrange,orC-stylearray.|
|`AnyOf(m1, m2, ..., mn)` | `argument` matches at least one of the matchers `m1` to `mn`.|
|`AnyOfArray({m0, m1, ..., mn})`, `AnyOfArray(a_container)`, `AnyOfArray(begin, end)`, `AnyOfArray(array)`, or `AnyOfArray(array, count)` | The same as `AnyOf()`exceptthatthematcherscomefromaninitializerlist,STL-stylecontainer,iteratorrange,orC-stylearray.|
|`Not(m)` | `argument` doesn't match matcher `m`.|
|`MATCHER_P(IsDivisibleBy, n, "") { *result_listener << "where the remainder is " << (arg % n); return (arg % n) == 0; }` | Defines a macher `IsDivisibleBy(n)` to match a number divisible by `n`.|
|`MATCHER_P2(IsBetween, a, b, std::string(negation ? "isn't" : "is") + " between " + PrintToString(a) + " and " + PrintToString(b)) { return a <= arg && arg <= b; }` | Defines a matcher `IsBetween(a, b)` to match a value in the range [`a`, `b`].|
|`Return(value)` | Return `value`. If the type of `value` is different to the mock function's return type, `value`isconvertedtothelattertype<i>atthetimetheexpectationisset</i>,notwhentheactionisexecuted.|
|`ReturnArg<N>()` | Return the `N`-th(0-based)argument.|
|`DeleteArg<N>()` | Delete the `N`-th(0-based)argument,whichmustbeapointer.|
|`SaveArg<N>(pointer)` | Save the `N`-th (0-based) argument to `*pointer`.|
|`SaveArgPointee<N>(pointer)` | Save the value pointed to by the `N`-th (0-based) argument to `*pointer`.|
|`SetArgReferee<N>(value)` | Assign value to the variable referenced by the `N`-th(0-based)argument.|
|`SetArgPointee<N>(value)` | Assign `value` to the variable pointed by the `N`-th(0-based)argument.|
|`SetArgumentPointee<N>(value)` | Same as `SetArgPointee<N>(value)`.Deprecated.Willberemovedinv1.7.0.|
|`SetArrayArgument<N>(first, last)` | Copies the elements in source range [`first`, `last`) to the array pointed to by the `N`-th(0-based)argument,whichcanbeeitherapointeroraniterator.Theactiondoesnottakeownershipoftheelementsinthesourcerange.|
|`SetErrnoAndReturn(error, value)` | Set `errno` to `error` and return `value`.|
|`InvokeArgument<N>(arg1, arg2, ..., argk)` | Invoke the mock function's `N`-th (0-based) argument, which must be a function or a functor, with the `k`arguments.|