i'm doing some serialization work. i have pursued two strategies, both of which work, but have different limitations. the first wasn't portable. the second coopts boost's strategy, but since boost relies on a template serialization function, it can't be used with a virtual method, which is an important consideration in the existing codebase i am working with. so i am left either manually overloading accessor methods (not plausible) or setting a boolean flag that tells the serialization class whether it's in pack or extract mode (inelegant and usually error prone).

does anyone have a better solution than setting a mode-flag?