Sean Farrow wrote:
> Hi:
> I am writing some non-intrusive serialization code for other c++
> classes.
> I am trying to serialize the wxString class from the wxWidgets
> library.
> I have the following code:
> namespace boost {
> namespace serialization {
>
> template<class Archive>
> void serialize(Archive & ar, wxString & str, const unsigned int
> version)
> {
>                 ar & str.ToStdWstring();
> }
> }
> }
> I noticed the following two typedefs in the wxWidgets code:
>     typedef std::wstring wxStdWideString;
>     typedef std::basic_string<wchar_t> wxStdWideString;
> only one of these is executed.
> I then wrote a second unintrusive serialization class:
> namespace boost {
>                 namespace serialization {
>                                 template<class Archive>
> void serialize(Archive & ar, wxString & str, const unsigned int
> version)
> {
>                 ar & str;
> }
>                 }
> }
> I am getting the following error, using visual c++ 2010:
>      1>c:\program files
> (x86)\boost\boost\archive\basic_xml_oarchive.hpp(92): error C2664:
> 'boost::mpl::assertion_failed' : cannot convert parameter 1 from
> 'boost::mpl::failed
> ************boost::serialization::is_wrapper<T>::* ***********' to
> 'boost::mpl::assert<false>::type'    
>                  with
>                  [
>                      T=const wxStdWideString
>                  ]
> Given that I have written code to serialize the wxStdWideString
> typedef, does anyone know what is happening? Are typedefs ignored
> with boost serialization. Currently using 1.47. 
> Cheers
> Sean.
seems to me that all you should really need to do is to
 
#include <boost/serialization/string.hpp>
 
this includes serialization implemenations for std::wstring and std::string.
The typedefs you've included above only create some aliases with
weird upper/lower case names.  This shouldn't affect anything.
 
Robert Ramey