From 6b58e8ff4bf7472201bb77880e77b2946c60ff3d Mon Sep 17 00:00:00 2001 From: Henner Zeller Date: Tue, 24 Mar 2020 13:04:16 -0700 Subject: [PATCH] Fix compile on C++11; fix missing include. PiperOrigin-RevId: 302729990 --- common/strings/obfuscator.cc | 4 +++- common/util/bijective_map_test.cc | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/strings/obfuscator.cc b/common/strings/obfuscator.cc index e9da8b6f3..7c8bf8b3b 100644 --- a/common/strings/obfuscator.cc +++ b/common/strings/obfuscator.cc @@ -17,6 +17,7 @@ #include #include "absl/status/status.h" +#include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" #include "absl/strings/string_view.h" #include "common/util/logging.h" @@ -29,7 +30,8 @@ bool Obfuscator::encode(absl::string_view key, absl::string_view value) { absl::string_view Obfuscator::operator()(absl::string_view input) { if (decode_mode) { - const auto p = translator_.find_reverse(input); // hetergeneous lookup + // TODO(b/152331548): make hetergeneous lookup work on C++11 + const auto p = translator_.find_reverse(std::string(input)); return (p != nullptr) ? *p : input; } else { const std::string* str = translator_.insert_using_value_generator( diff --git a/common/util/bijective_map_test.cc b/common/util/bijective_map_test.cc index 8456bc860..8569aa63b 100644 --- a/common/util/bijective_map_test.cc +++ b/common/util/bijective_map_test.cc @@ -108,6 +108,7 @@ TEST(BijectiveMapTest, InsertRandom) { EXPECT_EQ(*ABSL_DIE_IF_NULL(m.insert_using_value_generator("f", gen)), 3); } +#if 0 // TODO(b/152331548): make work with C++11 // Testing heterogenous lookup: internally stored std::string, supporting // copy-less lookup with absl::string_view. using StringMapType = BijectiveMap