Specialize gsl::at for span

span being a view and not a container, the generic version of gsl::at is not valid any more for span.
This commits adds a specialization of gsl::at for span
This commit is contained in:
ericLemanissier
2016-08-23 12:18:36 +02:00
parent 93b3258e36
commit 134f2db5d9
2 changed files with 15 additions and 0 deletions
+7
View File
@@ -1354,6 +1354,13 @@ SUITE(span_tests)
CHECK(match[0].first == f_it);
CHECK(match[0].second == (f_it + 1));
}
TEST(interop_with_gsl_at)
{
int arr[5] = {1, 2, 3, 4, 5};
span<int> s{arr};
CHECK(at(s,0) == 1 && at(s,1) == 2);
}
}
int main(int, const char* []) { return UnitTest::RunAllTests(); }