Operators with boost::reference_wrapper

2 Sep
2005
2 Sep
'05
12:15 p.m.
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.
7230
Age (days ago)
7230
Last active (days ago)
0 comments
1 participants
participants (1)
-
Edson Tadeu