Skip to content

Commit f5289a1

Browse files
committed
add comment
1 parent 23deda3 commit f5289a1

File tree

1 file changed

+3
-0
lines changed
  • libcxx/include/__iterator

1 file changed

+3
-0
lines changed

libcxx/include/__iterator/prev.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n)
3939
return __x;
4040
}
4141

42+
// LWG 3197
43+
// It is unclear what the implications of "BidirectionalIterator" in the standard are.
44+
// However, calling std::prev(non-bidi-iterator) is obviously an error and we should catch it at compile time.
4245
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
4346
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 _InputIter prev(_InputIter __it) {
4447
static_assert(__has_bidirectional_iterator_category<_InputIter>::value,

0 commit comments

Comments
 (0)