Boost logo

Boost Users :

From: Edson Tadeu (e.tadeu_at_[hidden])
Date: 2005-09-02 13:15:59


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.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net