
To serialize the tree use template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & type; ar & name; ar & parent; } I'm not sure what binValue is supposed to be but the following might work better here template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & name; ar & type; ar & attribute_list; } string name; int type; string attribute_list; .. "??" <luckyzhangwei@gmail.com> wrote in message news:c7b1c0080907080014u7f117ec7s8b0b874d115c235@mail.gmail.com... i want to serialize a self-defined tree to a binary file and vice-versa. The data structure is as follows: