Now that Envoy is using c++17, std::string_view is available. To avoid a huge change to replace all uses in the code, absl::string_view will become an alias for std::string_view if we #define ABSL_USES_STD_STRING_VIEW (see https://github...
I'm trying to link a program compiled with c++17 against a library compiled with c++11 that has absl::string_view in its api. Because my program gets std::string_view and the library has absl::string_view, they are binary incompatible and this can't be done. It would be nice if I...
99 // absl::string_view sv = obj.ReturnAString(); 100 // 101 // // GOOD use of string_view: str outlives sv 102 // std::string str = obj.ReturnAString(); 103 // absl::string_view sv = str; 104 // 105 // Due to lifetime issues, a `string_view...
However, beware of binding a `string_view` to a 86 // temporary value: 87 // 88 // // BAD use of string_view: lifetime problem 89 // absl::string_view sv = obj.ReturnAString(); 90 // 91 // // GOOD use of string_view: str outlives sv 92 // std::s...
("foo"); std::string s2("bar"); std::string s3("baz"); absl::string_view p1(s1); absl::string_view p2(s2); absl::string_view p3(s3); typedef std::map<absl::string_view, int> TestMap; TestMap map; map.insert(std::make_pair(p1, 0)); map.insert(std::ma...
Everything is working till I try to run the script. I get the following error: g++ -std=c++11 -Wl,-rpath='$ORIGIN/lib' -Iinclude -Llib main.cpp -ltensorflow_cc -o exec In file included from include/tensorflow/core/platform/tensor_coding.h:22:0, ...
// A `string_view` provides a lightweight view into the string data provided by // a `std::string`, double-quoted string literal, character array, or even // another `string_view`. A `string_view` does *not* own the string to which it ...
The C++17 std::string_view has a constexpr substr() : https://en.cppreference.com/w/cpp/string/basic_string_view/substr While the absl version of substr() can not be used in a constexpr abseil-cpp/absl/strings/string_view.h Line 385 in 0...
However, beware of binding a `string_view` to a // temporary value: // // // BAD use of string_view: lifetime problem // absl::string_view sv = obj.ReturnAString(); // // // GOOD use of string_view: str outlives sv // std::string str = obj.ReturnAString()...
// absl::string_view sv = obj.ReturnAString(); // // // GOOD use of string_view: str outlives sv // std::string str = obj.ReturnAString(); // absl::string_view sv = str; // // Due to lifetime issues, a `string_view` is sometimes a poor choice for a ...