
21 Nov
2006
21 Nov
'06
7:14 p.m.
Eric Niebler wrote:
I recently discovered something new (to me) about rvalues and const volatile references. It seems an rvalue will not bind to one. This property can be used to prevent misuses such as the one above.
New to me too.
To solve John's problem, regex_match() can be defined to take a "std::string const volatile &", and then it merely casts the volatile away inside.
Yikes a const_cast.
(Note: this doesn't work on any msvc compilers, which will happily bind temporaries to const volatile references.)
:-( I don't suppose that there is any way to poison the existing overloads with functions that *only* bind to rvalues? Just checking :-) Thanks, John.