Skip to content

Commit

Permalink
add assert contiguous
Browse files Browse the repository at this point in the history
  • Loading branch information
alfC committed Jan 22, 2025
1 parent 99a8ad1 commit 31658c1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,19 @@ auto main() -> int { // NOLINT(readability-function-cognitive-complexity,bugpro

#if (__cplusplus >= 202002L)
static_assert(
std::is_base_of_v<
std::contiguous_iterator_tag,
decltype(arr.cbegin())::iterator_category
>
std::is_base_of_v<
std::contiguous_iterator_tag,
decltype(arr.cbegin())::iterator_category
>
);

static_assert( std::contiguous_iterator<decltype(arr.begin())> );
static_assert( std::contiguous_iterator<decltype(arr.end() )> );

static_assert( std::contiguous_iterator<decltype(arr.cbegin())> );
static_assert( std::contiguous_iterator<decltype(arr.cend() )> );
#endif

// std::copy(arr.begin(), arr.end(), vec2.begin());
BOOST_TEST( arr.cbegin().stride() == 1 );
BOOST_TEST( arr.cend().stride() == 1 );
Expand Down

0 comments on commit 31658c1

Please sign in to comment.