c++11 - Is it possible to auto add some code, when I add class member variables -
i'm boost newbie.
i know possible
when add class member variable(at header file) automatically generate code
// classa.h file class classa { public: int a; // in fact a,b,c structure. int b; // add "int c;" void save(); // want auto generate code @ save() void load(); }
when add "int c;"
// classa.cpp void classa::save() { somestream << << b; // use boost::serialize // want auto replace above code next // somestream << << b << c; } void classa::load() { somestream >> >> b; // replace above // somestream >> >> b >> c; // same order } enter code here
it possible? using boost mpl? macro?
i have variable add lot.
the closest can std::tuple<int,int> data
can grow std::tuple<int,int,int>
, see here how print them.
Comments
Post a Comment