Skip to content

Commit

Permalink
Refs #6616. Remove constness from error map
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Mar 10, 2014
1 parent 41b954d commit 2bbe163
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions Code/Mantid/QtPropertyBrowser/src/ParameterPropertyManager.cpp
Expand Up @@ -15,10 +15,13 @@ ParameterPropertyManager::ParameterPropertyManager(QObject *parent)
*/
double ParameterPropertyManager::error(const QtProperty* property) const
{
if (!m_errors.contains(property))
// Cast for searching purposes
auto prop = const_cast<QtProperty*>(property);

if (!m_errors.contains(prop))
throw std::runtime_error("Parameter doesn't have error value set");

return m_errors[property];
return m_errors[prop];
}

/**
Expand All @@ -27,7 +30,10 @@ double ParameterPropertyManager::error(const QtProperty* property) const
*/
bool ParameterPropertyManager::isErrorSet(const QtProperty* property) const
{
return m_errors.contains(property);
// Cast for searching purposes
auto prop = const_cast<QtProperty*>(property);

return m_errors.contains(prop);
}

/**
Expand Down
Expand Up @@ -55,7 +55,7 @@ public Q_SLOTS:

private:
/// Property error values
QMap<const QtProperty*, double> m_errors;
QMap<QtProperty*, double> m_errors;
};

#endif // PARAMETERPROPERTYMANAGER_H

0 comments on commit 2bbe163

Please sign in to comment.