From 242a5950ba54d5a18191cfe26ba90ef8bacfe2f3 Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 27 Jul 2019 14:32:00 -0400 Subject: [PATCH] distinguish boost::none from false --- src/utils/MoneroUtils.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/MoneroUtils.h b/src/utils/MoneroUtils.h index 5328854..7239c3a 100644 --- a/src/utils/MoneroUtils.h +++ b/src/utils/MoneroUtils.h @@ -84,7 +84,7 @@ namespace MoneroUtils string serialize(const boost::property_tree::ptree& node); - // // TODO: template implementation here, could move to MoneroUtils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation + // TODO: template implementation here, could move to MoneroUtils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation template boost::property_tree::ptree toPropertyTree(const vector> types) { boost::property_tree::ptree typeNodes; for (const auto& type : types) { @@ -93,7 +93,7 @@ namespace MoneroUtils return typeNodes; } - // // TODO: template implementation here, could move to MoneroUtils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation + // TODO: template implementation here, could move to MoneroUtils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation template boost::property_tree::ptree toPropertyTree(const vector types) { boost::property_tree::ptree typeNodes; for (const auto& type : types) { @@ -115,7 +115,7 @@ namespace MoneroUtils // resolve one value none if (val1 == boost::none || val2 == boost::none) { - if (resolveDefined == false) return boost::none; // TODO: boost::optional equality comparitor wokrs like this? + if (resolveDefined != boost::none && *resolveDefined == false) return boost::none; else return val1 == boost::none ? val2 : val1; } @@ -134,7 +134,7 @@ namespace MoneroUtils // resolve one value none if (val1 == boost::none || val2 == boost::none) { - if (resolveDefined == false) return boost::none; // TODO: boost::optional equality comparitor wokrs like this? + if (resolveDefined != boost::none && *resolveDefined == false) return boost::none; else return val1 == boost::none ? val2 : val1; } @@ -159,7 +159,7 @@ namespace MoneroUtils // resolve one value none if (val1 == boost::none || val2 == boost::none) { - if (resolveDefined == false) return boost::none; // TODO: boost::optional equality comparitor wokrs like this? + if (resolveDefined != boost::none && *resolveDefined == false) return boost::none; else return val1 == boost::none ? val2 : val1; }