Boost logo

Boost Users :

Subject: [Boost-users] Clarification on Array, UNION serialization
From: niranjan bangera (niranjannina_at_[hidden])
Date: 2009-02-18 01:23:03


Hi all,
           I want to clarify myself in serialization of union and array,
Please clarify my doubts.

Boost Version:1.36.0
Compiler
:/_TOOLS_/dist/gnu-gcc-/4.1.1-binutils-2.16.1/x86_64-pc-linux2.4/bin/gcc

class A {
union my_union {

         uint64_t array1[ 4];
         int64_t array2[4];
         double dbl [4];
         uint32_t array3 [ 8 ];
         int32_t array4 [ 8 ];
         float flt [ 8];
         uint16_t array5[ 16 ];
         int16_t array6[ 16 ];
         uint8_t array7 [ 32 ];
         int8_t arrray8[ 32 ];
}
              my_union my_obj;
              friend class boost::serialization::access;
              template<class Archive>
              void serialize(Archive & ar, const unsigned int file_version)
              {
                   ar & my_obj.array1;
               }
};
Is it safe to do it, or any othe optimised method is there to do it?

how to serialize a dynamicaly allocated array

struc my_struct{
                               int x;
}

struct new_struct {
{

my_struct **my_var; ///my_struct is a structure defined before this
structure.

}

In this case do i need to serialize each element int the array manually,
Pointed By my_var

Is there other some other way to do it...

Thanks,
Niranjan



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