int main()
{
int x = 1;
auto ref = std::ref(x);
if (x < ref)
{
...
}
}
In the above code, I made an int variable and a reference_wrapper<int> variable, and then compared them, and it works well.
However, If I change the type int to string, It raises a compile error like this.
binary '<': 'std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
I thought that reference_wrapper<string> would be implicitly converted to string, but wouldn't.
Are there any rules that prevent implicit conversion from reference_wrapper<string> to string?