Hello Boost-users,
I'm trying to save a simple class to xml_woarchive:
class StringContainer
{
std::map mStrings;
friend class boost::serialization::access;
template<class TArchive>
void serialize(TArchive& ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_NVP(mStrings);
}
public:
typedef std::map StringMap;
StringContainer() {}
~StringContainer() {}
void addString (const std::string& id, const std::wstring& str);
bool isStringExists (const std::string& id) const;
const std::wstring& getString(const std::string& id) const;
void removeString (const std::string& id);
};
// somewhere in main code:
StringContainer sc;
sc.addString("fps.profilerfl", L"FPS: ");
sc.addString("triangles.profilerfl", L"Triangles: ");
std::wofstream outfs("strings.xml");
assert(outfs.good());
boost::archive::xml_woarchive oa(outfs);
oa << BOOST_SERIALIZATION_NVP(sc);
But somewhere after it (i think it is in xml_woarchive destructor) my
program falls with "Debug Assertion Failed" (I'm using VC7.1) message:
HEAP[test.exe]: Invalid Address specified to RtlValidateHeap( 011B0000, 011F29E8 )
Unhandled exception at 0x77f767cd in test.exe: User breakpoint.
By the way, xml file writes as expected:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<sc class_id="0" tracking_level="0" version="0">
<mStrings class_id="1" tracking_level="0" version="0">
<count>2</count>
<item class_id="2" tracking_level="0" version="0">
<first>fps.profilerfl</first>
<second>FPS: </second>
</item>
<item>
<first>triangles.profilerfl</first>
<second>Triangles: </second>
</item>
</mStrings>
</sc>
What i'm doing incorrectly?
--
Mike Lapshin