tribool serialization

I've been trying to write serialization code for tribool, and I'm completely dumbfounded at this point. I'm using the "split free" approach, but no matter how I phrase things, the compiler never seems to believe that I've written code to de/serialize tribool. Here's an example of what doesn't work: template <class Archive> void save(Archive& ar, const boost::logic::tribool& b, const unsigned int version) { // irrelevant } template <class Archive> void load(Archive& ar, boost::logic::tribool& b, const unsigned int version) { // irrelevant } BOOST_SERIALIZATION_SPLIT_FREE(boost::logic::tribool); This *seems* correct, but the compiler complains that "tribool has no member named serialize". While this is true, the split-free technique means it won't be requested. Our code uses the split-free approach for other classes, so I'm fairly certain I know how to do it correctly. Is there something magical about tribool that makes this approach break? More importantly, is there a known way to de/serialize tribool? Thanks. -- Austin Bingham "If I were creating the world I wouldn't mess about with butterflies and daffodils. I would have started with lasers, eight o'clock, Day One!" Evil

Try putting your code into either the boost::logic::tribool or boost::serialzation Robert Ramey Austin Bingham wrote:
I've been trying to write serialization code for tribool, and I'm completely dumbfounded at this point. I'm using the "split free" approach, but no matter how I phrase things, the compiler never seems to believe that I've written code to de/serialize tribool. Here's an example of what doesn't work:
namespace boost { namespace logic {
template <class Archive> void save(Archive& ar, const boost::logic::tribool& b, const unsigned int version) { // irrelevant }
template <class Archive> void load(Archive& ar, boost::logic::tribool& b, const unsigned int version) { // irrelevant } } }
BOOST_SERIALIZATION_SPLIT_FREE(boost::logic::tribool);
This *seems* correct, but the compiler complains that "tribool has no member named serialize". While this is true, the split-free technique means it won't be requested.
Our code uses the split-free approach for other classes, so I'm fairly certain I know how to do it correctly. Is there something magical about tribool that makes this approach break? More importantly, is there a known way to de/serialize tribool? Thanks.
participants (2)
-
Austin Bingham
-
Robert Ramey