fixing codecvt for libstc++ broke things for libc++

This should work for everything
This commit is contained in:
Robert Ramey
2015-10-24 22:14:27 -07:00
parent ae4c2321af
commit edf1dffd70
5 changed files with 22 additions and 8 deletions

View File

@@ -69,7 +69,11 @@ public:
m_locale(s.getloc())
{}
~basic_ios_locale_saver(){
// libc++ doesn't support std::[w]ostream.sync()
// but gcc will throw an error if sync() isn't invoked
#ifndef _LIBCPP_VERSION
m_ios.sync();
#endif
m_ios.imbue(m_locale);
}
private:

View File

@@ -119,9 +119,10 @@ basic_text_iprimitive<IStream>::basic_text_iprimitive(
locale_saver(is)
{
if(! no_codecvt){
is.imbue(archive_locale);
is_.sync();
is_.imbue(archive_locale);
}
is >> std::noboolalpha;
is_ >> std::noboolalpha;
}
#else
{}

View File

@@ -93,9 +93,14 @@ basic_text_oprimitive<OStream>::basic_text_oprimitive(
locale_saver(os)
{
if(! no_codecvt){
os.imbue(archive_locale);
// libc++ doesn't support std::wostream.sync()
// but gcc will throw an error if sync() isn't invoked
#ifndef _LIBCPP_VERSION
os_.sync();
#endif
os_.imbue(archive_locale);
}
os << std::noboolalpha;
os_ << std::noboolalpha;
}
#else
{}

View File

@@ -163,8 +163,8 @@ xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
is_.getloc(),
new boost::archive::detail::utf8_codecvt_facet
);
is.sync();
is.imbue(l);
is_.sync();
is_.imbue(l);
}
if(0 == (flags & no_header))
init();

View File

@@ -125,8 +125,12 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
os_.getloc(),
new boost::archive::detail::utf8_codecvt_facet
);
os.sync();
os.imbue(l);
// libc++ doesn't support std::[w]ostream.sync()
// but gcc will throw an error if sync() isn't invoked
#ifndef _LIBCPP_VERSION
os_.sync();
#endif
os_.imbue(l);
}
if(0 == (flags & no_header))
this->init();