Skip to content

Commit a2c5138

Browse files
Handle __static_bounded_iter
1 parent 258f34f commit a2c5138

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

libcxx/include/__iterator/static_bounded_iter.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ struct __static_bounded_iter_storage<_Iterator, 0> {
7070
// it can be computed from the start of the range.
7171
//
7272
// The operations on which this iterator wrapper traps are the same as `__bounded_iter`.
73-
template <class _Iterator, size_t _Size, class = __enable_if_t<__libcpp_is_contiguous_iterator<_Iterator>::value> >
73+
template <class _Iterator, size_t _Size>
7474
struct __static_bounded_iter {
75+
static_assert(__libcpp_is_contiguous_iterator<_Iterator>::value,
76+
"Only contiguous iterators can be adapted by __static_bounded_iter.");
77+
7578
using value_type = typename iterator_traits<_Iterator>::value_type;
7679
using difference_type = typename iterator_traits<_Iterator>::difference_type;
7780
using pointer = typename iterator_traits<_Iterator>::pointer;

libcxx/test/libcxx/iterators/contiguous_iterators.verify.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
#include <deque>
1919
#include <vector>
20+
#include <array>
2021

2122
// expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Only contiguous iterators can be adapted by __bounded_iter.}}
22-
std::__bounded_iter<std::deque<int>::iterator> bit;
23+
std::__bounded_iter<std::deque<int>::iterator> bounded_iter;
24+
// expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Only contiguous iterators can be adapted by __static_bounded_iter.}}
25+
std::__static_bounded_iter<std::deque<int>::iterator, 42> statically_bounded_iter;

0 commit comments

Comments
 (0)