aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib/strings/str_util.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-05-02 11:45:15 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-02 11:48:03 -0700
commit1ea4a77c6ccd2c783aedb2ccaf76f46b018c12c5 (patch)
tree933fc3ff71c8393b5254c33f6efedb28d2ccc67d /tensorflow/core/lib/strings/str_util.cc
parent9b6cba1d739e36ec2da59a593afb09bf17307650 (diff)
Replaced calls to tensorflow::StringPiece::ToString with std::string conversions.
That is, instances of sp.ToString() are replaced with std::string(sp). This will allow tensorflow::StringPiece::ToString to be removed, which is necessary before it can be replaced with absl::string_view. PiperOrigin-RevId: 195126422
Diffstat (limited to 'tensorflow/core/lib/strings/str_util.cc')
-rw-r--r--tensorflow/core/lib/strings/str_util.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/tensorflow/core/lib/strings/str_util.cc b/tensorflow/core/lib/strings/str_util.cc
index 4598b8ccc7..cab8f81585 100644
--- a/tensorflow/core/lib/strings/str_util.cc
+++ b/tensorflow/core/lib/strings/str_util.cc
@@ -332,7 +332,7 @@ string StringReplace(StringPiece s, StringPiece oldsub, StringPiece newsub,
bool replace_all) {
// TODO(jlebar): We could avoid having to shift data around in the string if
// we had a StringPiece::find() overload that searched for a StringPiece.
- string res = s.ToString();
+ string res = std::string(s);
size_t pos = 0;
while ((pos = res.find(oldsub.data(), pos, oldsub.size())) != string::npos) {
res.replace(pos, oldsub.size(), newsub.data(), newsub.size());
@@ -449,7 +449,7 @@ bool SplitAndParseAsFloats(StringPiece text, char delim,
return SplitAndParseAsInts<float>(text, delim,
[](StringPiece str, float* value) {
return strings::safe_strtof(
- str.ToString().c_str(), value);
+ std::string(str).c_str(), value);
},
result);
}