I'm new to BOOST_AUTO and here is a basic question.
I defined my own class and used it with BOOST_AUTO. According to the tutorial:
If your define your own type, the Typeof Library cannot handle it unless you let it know about this type. You tell the Typeof Library about a type (or template) by the means of "registering" this type/template.
But my code below doesn't register anything and runs correctly in VC++2010. Is this registration really necessary. Did I do anything wrong?
#include <boost/typeof/typeof.hpp>
using namespace std;
namespace NS1 {
struct X {
X(const X& x){s=x.s+1;}
X(){s=3;}
int s;
};
}
int _tmain(int argc, _TCHAR* argv[])
{
NS1::X x;
BOOST_AUTO(y,x);
cout << y.s << endl;
return 0;
}
output:4