tribool serialization

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

tribool serialization

Austin Bingham
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
_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: tribool serialization

Robert Ramey
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.



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users