I think adding compress() / uncompress() functions would be elegant, and providing the constructor you wrote as syntactic sugar is already the best practice. At least that is how I usually do it:
class myclass
{
public:
MyClass();
~MyClass():
MyClass(CompressedData& data);
compress(CompressedData& data) const; // or serialize() ... or save() ...
uncompress(CompressedData& data);
// ...
};
class myclass
{
public:
MyClass();
~MyClass():
MyClass(CompressedData& data);
compress(CompressedData& data) const; // or serialize() ... or save() ...
uncompress(CompressedData& data);
// ...
};
To copy to clipboard, switch view to plain text mode
Bookmarks