diff options
author | 2016-01-05 14:05:27 -0800 | |
---|---|---|
committer | 2016-01-05 14:05:27 -0800 | |
commit | 1c579361cd1e088dd5e05a394b1561a73e3667ba (patch) | |
tree | ec464b9ac18113dc052744b6714eebbc7c6cc34d /tensorflow/core/lib/strings/str_util.h | |
parent | 208350a6092f9faa473daf8b6eb6a80e9f9518f1 (diff) |
Added 'logging' import to control_flow_ops which is used in the file but not imported.
Change: 110842260
Diffstat (limited to 'tensorflow/core/lib/strings/str_util.h')
-rw-r--r-- | tensorflow/core/lib/strings/str_util.h | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/tensorflow/core/lib/strings/str_util.h b/tensorflow/core/lib/strings/str_util.h index cd972e2371..134a49e631 100644 --- a/tensorflow/core/lib/strings/str_util.h +++ b/tensorflow/core/lib/strings/str_util.h @@ -81,9 +81,7 @@ void TitlecaseString(string* s, StringPiece delimiters); // Join functionality template <typename T> -string Join(const std::vector<T>& s, const char* sep); -template <typename T> -string Join(const gtl::ArraySlice<T>& s, const char* sep); +string Join(const T& s, const char* sep); struct AllowEmpty { bool operator()(StringPiece sp) const { return true; } @@ -110,31 +108,16 @@ bool SplitAndParseAsInts(StringPiece text, char delim, // ------------------------------------------------------------------ // Implementation details below -namespace internal { template <typename T> -string JoinHelper(typename gtl::ArraySlice<T>::const_iterator begin, - typename gtl::ArraySlice<T>::const_iterator end, - const char* sep) { +string Join(const T& s, const char* sep) { string result; bool first = true; - for (typename gtl::ArraySlice<T>::const_iterator it = begin; it != end; - ++it) { - tensorflow::strings::StrAppend(&result, (first ? "" : sep), *it); + for (const auto& x : s) { + tensorflow::strings::StrAppend(&result, (first ? "" : sep), x); first = false; } return result; } -} // namespace internal - -template <typename T> -string Join(const std::vector<T>& s, const char* sep) { - return Join<T>(gtl::ArraySlice<T>(s), sep); -} - -template <typename T> -string Join(const gtl::ArraySlice<T>& s, const char* sep) { - return internal::JoinHelper<T>(s.begin(), s.end(), sep); -} inline std::vector<string> Split(StringPiece text, char delim) { return Split(text, delim, AllowEmpty()); |