Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-06-06 11:34:12


Hmmm - I think I understand better what you want.

I'm not sure the easiest way to do it.

Maybe one might specialize nvp<char [] &>(...

The "standard" way would be to make a derivation of xml_archive

But I would have to think about it some more.

Robert Ramey

Dan Thill wrote:
> Thank you for the fast reply, Robert.
>
>> Another idea is to cast your character array to a ...
>> character array - like static_cast< int [64] &>(my array address)
>> but that would require a constant size which might not work
>> for you.
>
> I'm not certain I quite understand this. Perhaps I didn't get my
> thoughts down coherently. I'm seeking to write my serialization like
> this (sorry I forgot to include this in my initial msg):
>
> char some_array[5] = "test";
> ....
> ar & make_nvp("some_array", make_char_array(some_array, 5));
>
>
> And obtain the following output:
>
> output.xml:
> ...
> <some_array>test</some_array>
>
> output.txt:
> .... 4 test ....
> ---------------------------
>
> My aforementioned make_char_array() works fine for text archives--just
> not when the result is composed with make_nvp().
>
>
>> Finally you can use the blunt instrument approach.
>>
>> save(....
>> std::string temp_string;
>> // copy data into temp_string
>> ar << temp_string
>>
>> load
>> .. do the opposite.
>
> Which is pretty much what my serialization wrapper is doing (this is
> in fact, what I wrote initially, before trying to make it a
> serialization wrapper). While I can certainly do the blunt approach,
> it will require me to split my serialization function :(


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