Although boost::reference_wrapper has a casting operator to T&, when I use any operator on a reference_wrapper, I get a compiler error stating that "boost::reference_wrapper<T> does not define this operator or a conversion to a type acceptable to the predefined operator".
E.g, this should compile, but doesn't:
#include <string>
#include <iostream>
#include <boost/ref.hpp>
using namespace std;
using namespace boost;
void main() {
string s1 = "alfa";
string s2 = "beta";
reference_wrapper<string> rs1 (s1);
reference_wrapper<string> rs2 (s2);
bool test = rs1 < rs2; // Error here
cout << rs1; // Error here too
}
Why is that? I'm using MSVC 7.1.