template <typename T>
class RefMatcher
Ref(variable) matches any argument that is a reference to
'variable'. This matcher is polymorphic as it can match any
super type of the type of 'variable'.
The RefMatcher template class implements Ref(variable). It can
only be instantiated with a reference type. This prevents a user
from mistakenly using Ref(x) to match a non-reference function
argument. For example, the following will righteously cause a
compiler error:
int n;
Matcher
<int
> m1 = Ref(n); // This won't compile.
Matcher
<int
&
> m2 = Ref(n); // This will compile.