AK: Conform SimpleIterator to the random access iterator requirements

This requires pulling in some of the STL, but the result is that our
iterator is now STL Approved ™️ and our containers can be
auto-conformed to Swift protocols.
This commit is contained in:
Andrew Kaster 2024-08-05 23:45:36 -06:00 committed by Andrew Kaster
commit 756ef2c722
Notes: github-actions[bot] 2024-08-17 23:45:35 +00:00
6 changed files with 109 additions and 26 deletions

View file

@ -27,6 +27,14 @@ TEST_CASE(ints)
EXPECT_EQ(ints[2], 2);
}
TEST_CASE(conforms_to_iterator_procotol)
{
static_assert(std::random_access_iterator<FixedArray<int>::Iterator>);
static_assert(std::random_access_iterator<FixedArray<int>::ConstIterator>);
static_assert(std::random_access_iterator<FixedArray<int const>::Iterator>);
static_assert(std::random_access_iterator<FixedArray<int const>::ConstIterator>);
}
TEST_CASE(swap)
{
FixedArray<int> first = FixedArray<int>::must_create_but_fixme_should_propagate_errors(4);