adding front and back

This commit is contained in:
Jordan Maples [MSFT]
2019-11-19 16:03:55 -08:00
parent 7e99e76c97
commit 7004ef506c
2 changed files with 27 additions and 1 deletions
+14 -1
View File
@@ -893,7 +893,7 @@ TEST_CASE("subspan")
{
span<int, 5> av = arr;
CHECK((av.subspan<1>().size() == 4));
CHECK(decltype(av.subspan<1>())::extent == 4);
CHECK(decltype(av.subspan<1>())::extent == 4);
}
{
@@ -1562,3 +1562,16 @@ TEST_CASE("default_constructible")
CHECK((!std::is_default_constructible<span<int, 42>>::value));
}
TEST_CASE("front_back")
{
int arr[5] = {1,2,3,4,5};
span<int> s{arr};
CHECK(s.front() == 1);
CHECK(s.back() == 5);
span<int> s2;
CHECK_THROWS_AS(s2.front(), fail_fast);
CHECK_THROWS_AS(s2.back(), fail_fast);
}