|
Boost Users : |
Subject: Re: [Boost-users] Simple serialization of int*
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-01-29 00:45:41
pointers to primitive types are not serializable by default.
If they were, then ALL the int values would have to be
tracked - most likely not what you want.
try wrapping your int in a class and serialize a pointer
to that class.
Robert Ramey
Sahrah wrote:
> Hi all,
>
> I am looking for a solution to do this:
>
> int p1 = 5;
> int* test;
> test = &p1;
> std::ofstream out("test.bin");
> boost::archive::binary_oarchive ar(out);
> ar << test;
>
> it does not compile.
>
> I get:
>
> Error 9 error C2228: left of '.serialize' must have class/struct/union
> c:\...\boost_1_37_0\boost\serialization\access.hpp
>
> I am using MSVC9. Boost 1.37.0
>
> thanks,
>
> Sahrah
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