From 27bc6203b3e25eadda736f6995fdb4ca52f8efbd Mon Sep 17 00:00:00 2001 From: Scott Dixon Date: Fri, 19 Apr 2024 11:51:04 -0700 Subject: [PATCH] Fix for span of pointers (#117) fixes #115 --- cetlvast/suites/unittest/test_pf20_span.cpp | 13 +++++++++++++ include/cetl/pf20/span.hpp | 1 - 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cetlvast/suites/unittest/test_pf20_span.cpp b/cetlvast/suites/unittest/test_pf20_span.cpp index 8615c562..5e35d5ed 100644 --- a/cetlvast/suites/unittest/test_pf20_span.cpp +++ b/cetlvast/suites/unittest/test_pf20_span.cpp @@ -997,4 +997,17 @@ TEST(TestSpanCopyCtor, CopyCetlSpanToFromDynamic) ASSERT_EQ(fixture.data(), subject.data()); } +TEST(TestSpanPtrTypes, ViewOfPointerArray) +{ + const char* names[] { + "dan", + "doug", + "ernst", + "fred" + }; + cetl::pf20::span subject(names); + ASSERT_EQ(4, subject.size()); + ASSERT_STREQ("doug", subject[1]); +} + } // namespace diff --git a/include/cetl/pf20/span.hpp b/include/cetl/pf20/span.hpp index cbd2192f..7a5cb5af 100644 --- a/include/cetl/pf20/span.hpp +++ b/include/cetl/pf20/span.hpp @@ -488,7 +488,6 @@ class span // +----------------------------------------------------------------------+ // | Required Properties // +----------------------------------------------------------------------+ - static_assert(not std::is_pointer::value, "Can not be a pointer type"); static_assert(sizeof(element_type) != 0u, "Must have non zero element size"); // +----------------------------------------------------------------------+