diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-06-27 19:06:50 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-06-29 13:40:07 -0700 |
commit | 47cdd6319c74a7b823843aad5ff3fa370ed1e6ef (patch) | |
tree | 216e88f36dbb5ba0b933f0a5ec3c2a151e972589 /host/lib/rfnoc/nocscript | |
parent | 412a7053cc0698fd8e1a09d9c40ec2f96cf629af (diff) | |
download | uhd-47cdd6319c74a7b823843aad5ff3fa370ed1e6ef.tar.gz uhd-47cdd6319c74a7b823843aad5ff3fa370ed1e6ef.tar.bz2 uhd-47cdd6319c74a7b823843aad5ff3fa370ed1e6ef.zip |
uhd: Replaced many lexical_cast with appropriate C++11 equivalents
Diffstat (limited to 'host/lib/rfnoc/nocscript')
-rw-r--r-- | host/lib/rfnoc/nocscript/expression.cpp | 16 | ||||
-rw-r--r-- | host/lib/rfnoc/nocscript/expression.hpp | 3 |
2 files changed, 9 insertions, 10 deletions
diff --git a/host/lib/rfnoc/nocscript/expression.cpp b/host/lib/rfnoc/nocscript/expression.cpp index 257e0b447..4f7d98108 100644 --- a/host/lib/rfnoc/nocscript/expression.cpp +++ b/host/lib/rfnoc/nocscript/expression.cpp @@ -54,12 +54,12 @@ expression_literal::expression_literal( if (_val.substr(0, 2) == "0x") { _int_val = uhd::cast::hexstr_cast<int>(_val); } else { - _int_val = boost::lexical_cast<int>(_val); + _int_val = std::stoi(_val); } break; case expression::TYPE_DOUBLE: - _double_val = boost::lexical_cast<double>(_val); + _double_val = std::stod(_val); break; case expression::TYPE_BOOL: @@ -67,7 +67,7 @@ expression_literal::expression_literal( _bool_val = true; } else { // lexical cast to bool is too picky - _bool_val = bool(boost::lexical_cast<int>(_val)); + _bool_val = bool(std::stoi(_val)); } break; @@ -77,7 +77,7 @@ expression_literal::expression_literal( std::vector<std::string> subtoken_list; boost::split(subtoken_list, str_vec, boost::is_any_of(", "), boost::token_compress_on); for(const std::string &t: subtoken_list) { - _int_vector_val.push_back(boost::lexical_cast<int>(t)); + _int_vector_val.push_back(std::stoi(t)); } break; } @@ -142,11 +142,11 @@ bool expression_literal::to_bool() const { switch (_type) { case TYPE_INT: - return bool(boost::lexical_cast<int>(_val)); + return bool(std::stoi(_val)); case TYPE_STRING: return not _val.empty(); case TYPE_DOUBLE: - return bool(boost::lexical_cast<double>(_val)); + return bool(std::stod(_val)); case TYPE_BOOL: return _bool_val; case TYPE_INT_VECTOR: @@ -205,11 +205,11 @@ std::string expression_literal::repr() const { switch (_type) { case TYPE_INT: - return boost::lexical_cast<std::string>(_int_val); + return std::to_string(_int_val); case TYPE_STRING: return _val; case TYPE_DOUBLE: - return boost::lexical_cast<std::string>(_double_val); + return std::to_string(_double_val); case TYPE_BOOL: return _bool_val ? "TRUE" : "FALSE"; case TYPE_INT_VECTOR: diff --git a/host/lib/rfnoc/nocscript/expression.hpp b/host/lib/rfnoc/nocscript/expression.hpp index 1acd02009..6cf649a59 100644 --- a/host/lib/rfnoc/nocscript/expression.hpp +++ b/host/lib/rfnoc/nocscript/expression.hpp @@ -17,7 +17,6 @@ #include <uhd/exception.hpp> #include <boost/shared_ptr.hpp> -#include <boost/lexical_cast.hpp> #include <boost/function.hpp> #include <boost/make_shared.hpp> #include <vector> @@ -300,7 +299,7 @@ class expression_function : public expression_container const std::string &name, const boost::shared_ptr<function_table> func_table ); - ~expression_function(){}; + ~expression_function(){} //! Add an argument expression virtual void add(expression::sptr new_expr); |