Commit c02bb5f6 by Abseil Team Committed by Copybara-Service

Add internal traits to absl::Span for lifetimebound detection

PiperOrigin-RevId: 621169753
Change-Id: Ib6d7b248e14f29f1f91c24b8e1cf9703962b0e36
parent f5227676
......@@ -138,6 +138,7 @@ cc_test(
"//absl/container:fixed_array",
"//absl/container:inlined_vector",
"//absl/hash:hash_testing",
"//absl/meta:type_traits",
"//absl/strings",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
......
......@@ -138,6 +138,7 @@ absl_cc_test(
absl::inlined_vector
absl::hash_testing
absl::strings
absl::type_traits
GTest::gmock_main
)
......
......@@ -185,6 +185,7 @@ class Span {
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using size_type = size_t;
using difference_type = ptrdiff_t;
using absl_internal_is_view = std::true_type;
static const size_type npos = ~(size_type(0));
......
......@@ -31,10 +31,15 @@
#include "absl/container/fixed_array.h"
#include "absl/container/inlined_vector.h"
#include "absl/hash/hash_testing.h"
#include "absl/meta/type_traits.h"
#include "absl/strings/str_cat.h"
namespace {
static_assert(!absl::type_traits_internal::IsOwner<absl::Span<int>>::value &&
absl::type_traits_internal::IsView<absl::Span<int>>::value,
"Span is a view, not an owner");
MATCHER_P(DataIs, data,
absl::StrCat("data() ", negation ? "isn't " : "is ",
testing::PrintToString(data))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment