diff --git a/include/cereal/archives/xml.hpp b/include/cereal/archives/xml.hpp index 58f51c9c9..755b80ced 100644 --- a/include/cereal/archives/xml.hpp +++ b/include/cereal/archives/xml.hpp @@ -114,14 +114,14 @@ namespace cereal @param indent Whether to indent each line of XML @param outputType Whether to output the type of each serialized object as an attribute @param sizeAttributes Whether dynamically sized containers output the size=dynamic attribute */ - explicit Options( int precision = std::numeric_limits::max_digits10, - bool indent = true, - bool outputType = false, - bool sizeAttributes = true ) : - itsPrecision( precision ), - itsIndent( indent ), - itsOutputType( outputType ), - itsSizeAttributes( sizeAttributes ) + explicit Options( int precision_ = std::numeric_limits::max_digits10, + bool indent_ = true, + bool outputType_ = false, + bool sizeAttributes_ = true ) : + itsPrecision( precision_ ), + itsIndent( indent_ ), + itsOutputType( outputType_ ), + itsSizeAttributes( sizeAttributes_ ) { } /*! @name Option Modifiers @@ -136,6 +136,8 @@ namespace cereal */ //! @{ + //! Sets the precision used for floaing point numbers + Options & precision( int value ){ itsPrecision = value; return * this; } //! Whether to indent each line of XML Options & indent( bool enable ){ itsIndent = enable; return *this; } //! Whether to output the type of each serialized object as an attribute diff --git a/include/cereal/details/polymorphic_impl.hpp b/include/cereal/details/polymorphic_impl.hpp index 772f02fdb..32e2881f8 100644 --- a/include/cereal/details/polymorphic_impl.hpp +++ b/include/cereal/details/polymorphic_impl.hpp @@ -115,8 +115,10 @@ namespace cereal all registered mappings between base and derived types. */ struct PolymorphicCasters { + //! Maps from a derived type index to a set of chainable casters + using DerivedCasterMap = std::unordered_map>; //! Maps from base type index to a map from derived type index to caster - std::unordered_map>> map; + std::unordered_map map; std::multimap reverseMap; @@ -241,7 +243,7 @@ namespace cereal auto & baseMap = StaticObject::getInstance().map; { - auto & derivedMap = baseMap.insert( {baseKey, {}} ).first->second; + auto & derivedMap = baseMap.insert( {baseKey, PolymorphicCasters::DerivedCasterMap{}} ).first->second; auto & derivedVec = derivedMap.insert( {derivedKey, {}} ).first->second; derivedVec.push_back( this ); }