2021-05-23 10:37:30 -07:00
|
|
|
#if __has_include(<span>)
|
|
|
|
|
#include <span>
|
|
|
|
|
#endif
|
2021-06-06 19:51:14 -07:00
|
|
|
#include "wpi/span.h"
|
2021-05-23 10:37:30 -07:00
|
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
|
|
void func1(wpi::span<const int> x) {}
|
|
|
|
|
#ifdef __cpp_lib_span
|
|
|
|
|
void func2(std::span<const int> x) {}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
void func4(wpi::span<int> x) {}
|
|
|
|
|
#ifdef __cpp_lib_span
|
|
|
|
|
void func5(std::span<int> x) {}
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-06-06 19:51:14 -07:00
|
|
|
TEST(Span, ConvertStdSpan) {
|
2021-05-23 10:37:30 -07:00
|
|
|
func1(wpi::span<const int>{});
|
|
|
|
|
func1(wpi::span<int>{});
|
|
|
|
|
#ifdef __cpp_lib_span
|
|
|
|
|
func1(std::span<const int>{});
|
|
|
|
|
func1(std::span<int>{});
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __cpp_lib_span
|
|
|
|
|
func2(wpi::span<const int>{});
|
|
|
|
|
func2(wpi::span<int>{});
|
|
|
|
|
func2(std::span<const int>{});
|
|
|
|
|
func2(std::span<int>{});
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
//func4(wpi::span<const int>{});
|
|
|
|
|
func4(wpi::span<int>{});
|
|
|
|
|
#ifdef __cpp_lib_span
|
|
|
|
|
//func4(std::span<const int>{});
|
|
|
|
|
func4(std::span<int>{});
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __cpp_lib_span
|
|
|
|
|
//func5(wpi::span<const int>{});
|
|
|
|
|
func5(wpi::span<int>{});
|
|
|
|
|
//func5(std::span<const int>{});
|
|
|
|
|
func5(std::span<int>{});
|
|
|
|
|
#endif
|
|
|
|
|
}
|