overload default reconcile values

This commit is contained in:
woodser
2019-06-12 18:06:08 -04:00
parent adfa617837
commit 7c6c06cd8e
+10
View File
@@ -117,6 +117,11 @@ namespace MoneroUtils
throw runtime_error("Cannot reconcile non-booleans");
}
template <class T>
boost::optional<T> reconcile(const boost::optional<T>& val1, const boost::optional<T>& val2) {
return reconcile(val1, val2, boost::none, boost::none, boost::none);
}
template <class T, typename std::enable_if<std::is_same<T, bool>::value, T>::type* = nullptr>
boost::optional<bool> reconcile(const boost::optional<T>& val1, const boost::optional<T>& val2, boost::optional<bool> resolveDefined, boost::optional<bool> resolveTrue, boost::optional<bool> resolveMax) {
cout << "reconcile(" << val1 << ", " << val2 << ")" << endl;
@@ -139,5 +144,10 @@ namespace MoneroUtils
throw runtime_error("Cannot reconcile booleans");
}
template <class T, typename std::enable_if<std::is_same<T, bool>::value, T>::type* = nullptr>
boost::optional<bool> reconcile(const boost::optional<T>& val1, const boost::optional<T>& val2) {
return reconcile(val1, val2, boost::none, boost::none, boost::none);
}
}
#endif /* MoneroUtils_h */