feat: implementation of gsl::dyn_array (#1228)
* feat: implementation of gsl::dyn_array Implement gsl::dyn_array<T, Allocator> as specified by the CppCoreGuidlines here: https://github.com/isocpp/CppCoreGuidelines/blob/master/docs/dyn_array.md Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
b2f6bec48e
commit
a75212b9f3
11 files changed
+1364
-24
No files matched your search
@@ -32,14 +32,14 @@
|
||||
#include <vector> // for vector
|
||||
|
||||
// the string_view include and macro are used in the deduction guide verification
|
||||
#if (defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L))
|
||||
#if defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201703L)
|
||||
#ifdef __has_include
|
||||
#if __has_include(<string_view>)
|
||||
#include <string_view>
|
||||
#define HAS_STRING_VIEW
|
||||
#endif // __has_include(<string_view>)
|
||||
#endif // __has_include
|
||||
#endif // (defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L))
|
||||
#endif // defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201703L)
|
||||
#if defined(__cplusplus) && __cplusplus >= 202002L
|
||||
#include <span>
|
||||
#endif // __cplusplus >= 202002L
|
||||
@@ -1211,7 +1211,7 @@ TEST(span_test, default_constructible)
|
||||
|
||||
TEST(span_test, std_container_ctad)
|
||||
{
|
||||
#if (defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L))
|
||||
#if defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201703L)
|
||||
// this test is just to verify that these compile
|
||||
{
|
||||
std::vector<int> v{1, 2, 3, 4};
|
||||
@@ -1230,7 +1230,7 @@ TEST(span_test, std_container_ctad)
|
||||
static_assert(std::is_same<decltype(sp), gsl::span<const char>>::value);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif // defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201703L)
|
||||
}
|
||||
|
||||
TEST(span_test, front_back)
|
||||
@@ -1296,13 +1296,13 @@ TEST(span_test, conversions)
|
||||
{
|
||||
int arr[5] = {1, 2, 3, 4, 5};
|
||||
|
||||
#if defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L)
|
||||
#if defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201703L)
|
||||
span s = arr;
|
||||
span cs = s;
|
||||
#else
|
||||
#else // ^^^ deduction guides /// no deduction guides vvv
|
||||
span<int, 5> s = arr;
|
||||
span<int, 5> cs = s;
|
||||
#endif
|
||||
#endif // defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201703L)
|
||||
|
||||
EXPECT_TRUE(cs.size() == s.size());
|
||||
EXPECT_TRUE(cs.data() == s.data());
|
||||
|
||||
Reference in new issue
Block a user