From: Tim King Date: Fri, 2 Dec 2016 23:10:17 +0000 (-0800) Subject: Cleaning up Statistics::copyFrom to avoid casts. X-Git-Tag: cvc5-1.0.0~5956 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c05da2e3418f71ea7d9d8d59c76dc6773ead608b;p=cvc5.git Cleaning up Statistics::copyFrom to avoid casts. --- diff --git a/src/util/statistics.cpp b/src/util/statistics.cpp index 8384a7bb1..368335f7e 100644 --- a/src/util/statistics.cpp +++ b/src/util/statistics.cpp @@ -52,10 +52,10 @@ StatisticsBase& StatisticsBase::operator=(const StatisticsBase& stats) { void Statistics::copyFrom(const StatisticsBase& stats) { // This is ugly, but otherwise we have to introduce a "friend" relation for // Base to its derived class (really obnoxious). - StatSet::const_iterator i_begin = ((const Statistics*) &stats)->d_stats.begin(); - StatSet::const_iterator i_end = ((const Statistics*) &stats)->d_stats.end(); - for(StatSet::const_iterator i = i_begin; i != i_end; ++i) { - SExprStat* p = new SExprStat((*i)->getName(), (*i)->getValue()); + const StatisticsBase::const_iterator i_begin = stats.begin(); + const StatisticsBase::const_iterator i_end = stats.end(); + for(StatisticsBase::const_iterator i = i_begin; i != i_end; ++i) { + SExprStat* p = new SExprStat((*i).first, (*i).second); d_stats.insert(p); } }