Code refactoring.

This commit is contained in:
Adam Gu
2018-07-06 11:01:23 +08:00
parent 1d64421e33
commit 3b13cc74f7
33 changed files with 199 additions and 191 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
#include "calc_client.h"
#include <iostream>
#include "boost/lexical_cast.hpp"
#include "webcc/logger.h"
// Set to 0 to test our own calculator server created with webcc.
@@ -80,8 +81,8 @@ bool CalcClient::Calc(const std::string& operation,
// Convert the result from string to double.
try {
*result = boost::lexical_cast<double>(result_str);
} catch (boost::bad_lexical_cast&) {
*result = std::stod(result_str);
} catch (const std::exception&) {
return false;
}