Passing a this
pointer assigned to another one works fine, but passing just it itself directly doesn't as below:
table_row* table_row::deserialize_row(std::string src_serialized_row) {
std::stringstream ss(src_serialized_row);
boost::archive::text_iarchive ia(ss);
table_row * dest = this;
ia >> dest; // this is fine, compiles.
return dest;
}
table_row* table_row::deserialize_row(std::string src_serialized_row) {
std::stringstream ss(src_serialized_row);
boost::archive::text_iarchive ia(ss);
ia >> this; //error, >> operator does not match [error]
return this;
}
[error] I don't really understand this. I'm passing the same pointer in both code examples, right? Why would it be an error?