
Robert Ramey wrote:
Wang Yun wrote:
Hi, all
I do some tests and found it's ok to save/load wstring into/from text_oarchive, Am I very lucky? or it's safe to do this?
All archives in the serialization library include code to serialize all "primitive" types. For purposes of this discussion, std::wstring is considered a primitive type. In general, we have strived to maintain archive classes independent to any particular data type. That is - any data type should work with any archive.
When do I need to use text_woarchive?
When you want to store using wide characters (ie unicode) rather than multi-byte characters of a specific locale.
Thanks,
Your welcome
Robert Ramey
I understand now, thanks. And I have another question, in the version 1.34's document(from cvs), in the Pending issues, you say "Floating point values which are number cannot be serialized to text base archives.". Is this means that if I want to save same float or double value, I can only use binary_archive? If I still want to use text or xml archive, I think maybe I can use a wrapper class like: class BinaryFloat { void serialize() { // save/load _value's binary in text string, like "0xABCDEFGH" // and also save some platform info so I can use this portablely. } private: float _value; }; Do you think this is ok? Thanks, Wang Yun