Opened 9 years ago

Last modified 9 years ago

#9253 new Feature Requests

Support for serializing std::u16string

Reported by: learner.cpp@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

Hi: I would like to use the boot serialization library with the C++11 std::u16string type. When I use it with a text archive I get the following error. Could you elaborate on the plans by when we will be having support for this. For now, we can get workaround the issue by writing our own non-intrusive "load" and "save" methods for u16string, but would prefer built in serialization support for it like std::string.

Please find below the stack trace for the error.

Thanks

boost/include/boost/serialization/access.hpp: In instantiation of 'static void boost::serialization::access::serialize(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive; T = std::basic_string<char16_t>]': boost/include/boost/serialization/serialization.hpp:102:5: required from 'void boost::serialization::serialize(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive; T = std::basic_string<char16_t>]' boost/include/boost/serialization/serialization.hpp:161:9: required from 'void boost::serialization::serialize_adl(Archive&, T&, unsigned int) [with Archive = boost::archive::text_oarchive; T = std::basic_string<char16_t>]' boost/include/boost/archive/detail/oserializer.hpp:148:5: required from 'void boost::archive::detail::oserializer<Archive, T>::save_object_data(boost::archive::detail::basic_oarchive&, const void*) const [with Archive = boost::archive::text_oarchive; T = std::basic_string<char16_t>]' boost/include/boost/archive/detail/oserializer.hpp:101:1: required from 'class boost::archive::detail::oserializer<boost::archive::text_oarchive, std::basic_string<char16_t> >' boost/include/boost/archive/detail/oserializer.hpp:253:13: required from 'static void boost::archive::detail::save_non_pointer_type<Archive>::save_standard::invoke(Archive&, const T&) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_oarchive]' boost/include/boost/archive/detail/oserializer.hpp:308:9: required from 'static void boost::archive::detail::save_non_pointer_type<Archive>::invoke(Archive&, const T&) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_oarchive]' boost/include/boost/archive/detail/oserializer.hpp:314:9: required from 'static void boost::archive::detail::save_non_pointer_type<Archive>::invoke(Archive&, T&) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_oarchive]' boost/include/boost/archive/detail/oserializer.hpp:525:5: required from 'void boost::archive::save(Archive&, T&) [with Archive = boost::archive::text_oarchive; T = std::basic_string<char16_t>]' boost/include/boost/archive/detail/common_oarchive.hpp:69:9: required from 'void boost::archive::detail::common_oarchive<Archive>::save_override(T&, int) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_oarchive]' boost/include/boost/archive/basic_text_oarchive.hpp:113:9: required from 'void boost::archive::basic_text_oarchive<Archive>::save_override(T&, int) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_oarchive]' boost/include/boost/archive/detail/interface_oarchive.hpp:63:9: required from 'Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_oarchive]' main.cpp:39:15: required from here

boost/include/boost/serialization/access.hpp:151:9: error: 'class std::basic_string<char16_t>' has no member named 'serialize' boost/include/boost/serialization/access.hpp: In instantiation of 'static void boost::serialization::access::serialize(Archive&, T&, unsigned int) [with Archive = boost::archive::text_iarchive; T = std::basic_string<char16_t>]': boost/include/boost/serialization/serialization.hpp:102:5: required from 'void boost::serialization::serialize(Archive&, T&, unsigned int) [with Archive = boost::archive::text_iarchive; T = std::basic_string<char16_t>]' boost/include/boost/serialization/serialization.hpp:161:9: required from 'void boost::serialization::serialize_adl(Archive&, T&, unsigned int) [with Archive = boost::archive::text_iarchive; T = std::basic_string<char16_t>]' boost/include/boost/archive/detail/iserializer.hpp:188:5: required from 'void boost::archive::detail::iserializer<Archive, T>::load_object_data(boost::archive::detail::basic_iarchive&, void*, unsigned int) const [with Archive = boost::archive::text_iarchive; T = std::basic_string<char16_t>]' boost/include/boost/archive/detail/iserializer.hpp:120:1: required from 'class boost::archive::detail::iserializer<boost::archive::text_iarchive, std::basic_string<char16_t> >' boost/include/boost/archive/detail/iserializer.hpp:387:13: required from 'static void boost::archive::detail::load_non_pointer_type<Archive>::load_standard::invoke(Archive&, const T&) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_iarchive]' boost/include/boost/archive/detail/iserializer.hpp:439:9: required from 'static void boost::archive::detail::load_non_pointer_type<Archive>::invoke(Archive&, T&) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_iarchive]' boost/include/boost/archive/detail/iserializer.hpp:592:5: required from 'void boost::archive::load(Archive&, T&) [with Archive = boost::archive::text_iarchive; T = std::basic_string<char16_t>]' boost/include/boost/archive/detail/common_iarchive.hpp:66:9: required from 'void boost::archive::detail::common_iarchive<Archive>::load_override(T&, int) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_iarchive]' boost/include/boost/archive/basic_text_iarchive.hpp:98:9: required from 'void boost::archive::basic_text_iarchive<Archive>::load_override(T&, int) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_iarchive]' boost/include/boost/archive/text_iarchive.hpp:115:9: required from 'void boost::archive::text_iarchive_impl<Archive>::load_override(T&, int) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_iarchive]' boost/include/boost/archive/detail/interface_iarchive.hpp:60:9: required from 'Archive& boost::archive::detail::interface_iarchive<Archive>::operator>>(T&) [with T = std::basic_string<char16_t>; Archive = boost::archive::text_iarchive]' main.cpp:55:15: required from here boost/include/boost/serialization/access.hpp:151:9: error: 'class std::basic_string<char16_t>' has no member named 'serialize'

Thanks

Change History (1)

comment:1 by Robert Ramey, 9 years ago

how about attaching your own implementation so I can see what it looks like

Note: See TracTickets for help on using tickets.