From: David Reiss Date: Tue, 31 Aug 2010 16:51:26 +0000 (+0000) Subject: THRIFT-507. Stop using boost::lexical_cast in the compiler X-Git-Tag: 0.5.0~89 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=aca320d3955c39ce7c05de16d748e103daf074a4;p=common%2Fthrift.git THRIFT-507. Stop using boost::lexical_cast in the compiler We were using boost::lexical_cast to convert an integer to a string, but using a stringstream is only slightly more complicated. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991252 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/compiler/cpp/src/parse/t_field.h b/compiler/cpp/src/parse/t_field.h index 4217a517..fb58ca7c 100644 --- a/compiler/cpp/src/parse/t_field.h +++ b/compiler/cpp/src/parse/t_field.h @@ -21,7 +21,7 @@ #define T_FIELD_H #include -#include +#include #include "t_doc.h" @@ -117,7 +117,9 @@ class t_field : public t_doc { // This is not the same function as t_type::get_fingerprint_material, // but it does the same thing. std::string get_fingerprint_material() const { - return boost::lexical_cast(key_) + ":" + + std::ostringstream keystm; + keystm << key_; + return keystm.str() + ":" + ((req_ == T_OPTIONAL) ? "opt-" : "") + type_->get_fingerprint_material(); } diff --git a/compiler/cpp/src/parse/t_scope.h b/compiler/cpp/src/parse/t_scope.h index 91ec3127..cbb92cf4 100644 --- a/compiler/cpp/src/parse/t_scope.h +++ b/compiler/cpp/src/parse/t_scope.h @@ -22,8 +22,8 @@ #include #include +#include -#include #include "t_type.h" #include "t_service.h" #include "t_const.h" @@ -157,7 +157,9 @@ class t_scope { t_enum* tenum = (t_enum*)ttype; t_enum_value* enum_value = tenum->get_constant_by_value(const_val->get_integer()); if (enum_value == NULL) { - throw "Couldn't find a named value in enum " + tenum->get_name() + " for value " + boost::lexical_cast(const_val->get_integer()); + std::ostringstream valstm; + valstm << const_val->get_integer(); + throw "Couldn't find a named value in enum " + tenum->get_name() + " for value " + valstm.str(); } const_val->set_identifier(enum_value->get_name()); const_val->set_enum(tenum);