Skip to content

Commit

Permalink
Fix shadowing issue for #401, recent osx compile issue re: #354
Browse files Browse the repository at this point in the history
  • Loading branch information
AzothAmmo committed May 5, 2017
1 parent 950aca4 commit fcef0da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
18 changes: 10 additions & 8 deletions include/cereal/archives/xml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>::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<double>::max_digits10,
bool indent_ = true,
bool outputType_ = false,
bool sizeAttributes_ = true ) :
itsPrecision( precision_ ),
itsIndent( indent_ ),
itsOutputType( outputType_ ),
itsSizeAttributes( sizeAttributes_ )
{ }

/*! @name Option Modifiers
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions include/cereal/details/polymorphic_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::type_index, std::vector<PolymorphicCaster const *>>;
//! Maps from base type index to a map from derived type index to caster
std::unordered_map<std::type_index, std::unordered_map<std::type_index, std::vector<PolymorphicCaster const*>>> map;
std::unordered_map<std::type_index, DerivedCasterMap> map;

std::multimap<std::type_index, std::type_index> reverseMap;

Expand Down Expand Up @@ -241,7 +243,7 @@ namespace cereal
auto & baseMap = StaticObject<PolymorphicCasters>::getInstance().map;

{
auto & derivedMap = baseMap.insert( {baseKey, {}} ).first->second;
auto & derivedMap = baseMap.insert( {baseKey, PolymorphicCasters::DerivedCasterMap{}} ).first->second;

This comment has been minimized.

Copy link
@headupinclouds

headupinclouds Aug 15, 2017

Contributor

For reference, this should address #339

auto & derivedVec = derivedMap.insert( {derivedKey, {}} ).first->second;
derivedVec.push_back( this );
}
Expand Down

0 comments on commit fcef0da

Please sign in to comment.