serialization of boolean values hardcoded to '1' and '0'

I was wondering why in the archive library the input and output text streams are hardcoded with the boolalpha bit as unset, e.g. (is >> std::noboolalpha;)? Specifically the code is in the directory: boost_1_35_0/boost/archive/impl/ In basic_text_iprimitive.ipp template<class IStream> BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_text_iprimitive<IStream>::basic_text_iprimitive( IStream &is_, bool no_codecvt ) : is(is_), flags_saver(is_), precision_saver(is_), archive_locale(NULL), locale_saver(is_) { if(! no_codecvt){ archive_locale.reset( add_facet( std::locale::classic(), new codecvt_null<BOOST_DEDUCED_TYPENAME IStream::char_type> ) ); is.imbue(* archive_locale); } is >> std::noboolalpha; } and basic_text_oprimitive.ipp template<class OStream> BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_text_oprimitive<OStream>::basic_text_oprimitive( OStream & os_, bool no_codecvt ) : os(os_), flags_saver(os_), precision_saver(os_), archive_locale(NULL), locale_saver(os_) { if(! no_codecvt){ archive_locale.reset( add_facet( std::locale::classic(), new codecvt_null<BOOST_DEDUCED_TYPENAME OStream::char_type> ) ); os.imbue(* archive_locale); } os << std::noboolalpha; } Andrew McDonald Software Engineer "Zufall ist nur der Ausdruck unserer Unfähigkeit, den Dingen auf Grund zu kommen" - Albert Einstein

I don't remember now. Probably to minimize wasted space. Robert Ramey Andrew McDonald wrote:
I was wondering why in the archive library the input and output text streams are hardcoded with the boolalpha bit as unset, e.g. (is >> std::noboolalpha;)?
Specifically the code is in the directory: boost_1_35_0/boost/archive/impl/
In basic_text_iprimitive.ipp
template<class IStream> BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_text_iprimitive<IStream>::basic_text_iprimitive( IStream &is_, bool no_codecvt ) : is(is_), flags_saver(is_), precision_saver(is_), archive_locale(NULL), locale_saver(is_) { if(! no_codecvt){ archive_locale.reset( add_facet( std::locale::classic(), new codecvt_null<BOOST_DEDUCED_TYPENAME IStream::char_type> ) ); is.imbue(* archive_locale); } is >> std::noboolalpha; }
and basic_text_oprimitive.ipp
template<class OStream> BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_text_oprimitive<OStream>::basic_text_oprimitive( OStream & os_, bool no_codecvt ) : os(os_), flags_saver(os_), precision_saver(os_), archive_locale(NULL), locale_saver(os_) { if(! no_codecvt){ archive_locale.reset( add_facet( std::locale::classic(), new codecvt_null<BOOST_DEDUCED_TYPENAME OStream::char_type> ) ); os.imbue(* archive_locale); } os << std::noboolalpha; }
Andrew McDonald Software Engineer
"Zufall ist nur der Ausdruck unserer Unfähigkeit, den Dingen auf Grund zu kommen" - Albert Einstein

Thanks for answering Robert. I was just wondering if maybe there was `something' besides that (minimize space). I can probably get the SCM group to patch the library for me but since, in my limited experience, streams are noboolalpha by default, it would be cool if it wasn't hardcoded. :) Maybe you were trying to avoid support problems? Andrew ] I don't remember now. Probably to minimize wasted space. ] Robert Ramey ] Andrew McDonald wrote: ] > I was wondering why in the archive library the input and output text ] > streams are hardcoded with the boolalpha bit as unset, e.g. (is >> ] > std::noboolalpha;)?
participants (2)
-
Andrew McDonald
-
Robert Ramey