noexcept(noexcept(_M_current == __s))
{ return _M_current == __s; }
+ template<__detail::__not_a_const_iterator _CIt>
+ requires __detail::__constant_iterator<_CIt> && convertible_to<_It, _CIt>
+ constexpr
+ operator _CIt() const&
+ { return _M_current; }
+
+ template<__detail::__not_a_const_iterator _CIt>
+ requires __detail::__constant_iterator<_CIt> && convertible_to<_It, _CIt>
+ constexpr
+ operator _CIt() &&
+ { return std::move(_M_current); }
+
constexpr bool
operator<(const basic_const_iterator& __y) const
noexcept(noexcept(_M_current < __y._M_current))
ftms = {
name = ranges_as_const;
values = {
- v = 202207;
+ v = 202311;
cxxmin = 23;
};
};
// from version.def line 1549
#if !defined(__cpp_lib_ranges_as_const)
# if (__cplusplus >= 202100L)
-# define __glibcxx_ranges_as_const 202207L
+# define __glibcxx_ranges_as_const 202311L
# if defined(__glibcxx_want_all) || defined(__glibcxx_want_ranges_as_const)
-# define __cpp_lib_ranges_as_const 202207L
+# define __cpp_lib_ranges_as_const 202311L
# endif
# endif
#endif /* !defined(__cpp_lib_ranges_as_const) && defined(__glibcxx_want_ranges_as_const) */
// { dg-do run { target c++23 } }
#include <iterator>
+#include <ranges>
#include <array>
#include <concepts>
#include <string_view>
std::unreachable_sentinel_t> );
}
+void
+test04()
+{
+ // Example from P2836R1
+ auto f = [](std::vector<int>::const_iterator i) {};
+
+ auto v = std::vector<int>();
+ {
+ auto i1 = ranges::cbegin(v); // returns vector<T>::const_iterator
+ f(i1); // okay
+ }
+
+ auto t = v | std::views::take_while([](int const x) { return x < 100; });
+ {
+ auto i2 = ranges::cbegin(t); // returns basic_const_iterator<vector<T>::iterator>
+ f(i2); // was an error in C++23 before P2836R1
+ f(std::move(i2)); // same
+ }
+}
+
int
main()
{
test02<const std::vector<bool>, true>();
test03();
+ test04();
}
#include <ranges>
-#if __cpp_lib_ranges_as_const != 202207L
+#if __cpp_lib_ranges_as_const != 202311L
# error "Feature-test macro __cpp_lib_ranges_as_const has wrong value in <ranges>"
#endif
# error "Feature-test macro __cpp_lib_ranges_as_rvalue has wrong value in <version>"
#endif
-#if __cpp_lib_ranges_as_const != 202207L
+#if __cpp_lib_ranges_as_const != 202311L
# error "Feature-test macro __cpp_lib_ranges_as_const has wrong value in <version>"
#endif