|
Boost Users : |
From: roblin_at_[hidden]
Date: 2006-12-07 10:50:49
Hi all,
I was trying to understand the use of boost::ref and boost::cref and
wrote this little snippet:
#include <iostream>
#include <boost/ref.hpp>
#include <string>
using namespace std;
int main(int argc,char** argv)
{
boost::reference_wrapper<string const> ref=boost::cref(string("yoh"));
const string das("bla");
const string & dasref=das;
cout<<"das ref is "<<dasref<<endl;
cout<<"ref is "<<ref.get()<<endl;
return 0;
}
I am confused by what I get when I run this:
das ref is bla
ref is bla
I was expecting:
das ref is bla
ref is yoh
What am I doing wrong there ??
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