Boost logo

Boost Users :

Subject: Re: [Boost-users] serilalization of union
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-07 12:09:22


AMDG

niranjan bangera wrote:
> union myunion
> {
>
> uint32_t a;
> float t;
>
> template <class Archive>
> void serialize(Archive & ar, const unsigned int file_version)
> {
>
> ar & a;
> ar & t;
>
> }

This is undefined behavior. a and t cannot both be valid at the same time.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net