mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Use wpi::span instead of wpi::ArrayRef across all libraries (#3414)
- Remove ArrayRef.h - Add SpanExtras.h for a couple of convenience functions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#if __has_include(<span>)
|
||||
#include <span>
|
||||
#endif
|
||||
#include "wpi/ArrayRef.h"
|
||||
#include "wpi/span.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@@ -9,17 +9,13 @@ void func1(wpi::span<const int> x) {}
|
||||
#ifdef __cpp_lib_span
|
||||
void func2(std::span<const int> x) {}
|
||||
#endif
|
||||
void func3(wpi::ArrayRef<int> x) {}
|
||||
|
||||
void func4(wpi::span<int> x) {}
|
||||
#ifdef __cpp_lib_span
|
||||
void func5(std::span<int> x) {}
|
||||
#endif
|
||||
void func6(wpi::MutableArrayRef<int> x) {}
|
||||
|
||||
TEST(Span, ConvertArrayRefStdSpan) {
|
||||
func1(wpi::ArrayRef<int>{});
|
||||
func1(wpi::MutableArrayRef<int>{});
|
||||
TEST(Span, ConvertStdSpan) {
|
||||
func1(wpi::span<const int>{});
|
||||
func1(wpi::span<int>{});
|
||||
#ifdef __cpp_lib_span
|
||||
@@ -28,25 +24,12 @@ TEST(Span, ConvertArrayRefStdSpan) {
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_lib_span
|
||||
func2(wpi::ArrayRef<int>{});
|
||||
func2(wpi::MutableArrayRef<int>{});
|
||||
func2(wpi::span<const int>{});
|
||||
func2(wpi::span<int>{});
|
||||
func2(std::span<const int>{});
|
||||
func2(std::span<int>{});
|
||||
#endif
|
||||
|
||||
func3(wpi::ArrayRef<int>{});
|
||||
func3(wpi::MutableArrayRef<int>{});
|
||||
func3(wpi::span<const int>{});
|
||||
func3(wpi::span<int>{});
|
||||
#ifdef __cpp_lib_span
|
||||
func3(std::span<const int>{});
|
||||
func3(std::span<int>{});
|
||||
#endif
|
||||
|
||||
//func4(wpi::ArrayRef<int>{});
|
||||
func4(wpi::MutableArrayRef<int>{});
|
||||
//func4(wpi::span<const int>{});
|
||||
func4(wpi::span<int>{});
|
||||
#ifdef __cpp_lib_span
|
||||
@@ -55,20 +38,9 @@ TEST(Span, ConvertArrayRefStdSpan) {
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_lib_span
|
||||
//func5(wpi::ArrayRef<int>{});
|
||||
func5(wpi::MutableArrayRef<int>{});
|
||||
//func5(wpi::span<const int>{});
|
||||
func5(wpi::span<int>{});
|
||||
//func5(std::span<const int>{});
|
||||
func5(std::span<int>{});
|
||||
#endif
|
||||
|
||||
//func6(wpi::ArrayRef<int>{});
|
||||
func6(wpi::MutableArrayRef<int>{});
|
||||
//func6(wpi::span<const int>{});
|
||||
func6(wpi::span<int>{});
|
||||
#ifdef __cpp_lib_span
|
||||
//func6(std::span<const int>{});
|
||||
func6(std::span<int>{});
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user