Skip to content

[libc++] The rest of P2278R4 (cdata, as_const_view, span changes) #102301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_print`` ``202207L``
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_as_const`` *unimplemented*
``__cpp_lib_ranges_as_const`` ``202311L``
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_as_rvalue`` ``202207L``
---------------------------------------------------------- -----------------
Expand Down
10 changes: 5 additions & 5 deletions libcxx/docs/Status/Cxx23Issues.csv
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
"`LWG3762 <https://wg21.link/LWG3762>`__","``generator::iterator::operator==`` should pass by reference","November 2022","","",""
"`LWG3764 <https://wg21.link/LWG3764>`__","``reference_wrapper::operator()`` should propagate noexcept","November 2022","|Complete|","17.0",""
"`LWG3765 <https://wg21.link/LWG3765>`__","``const_sentinel`` should be constrained","November 2022","","","|ranges|"
"`LWG3766 <https://wg21.link/LWG3766>`__","``view_interface::cbegin`` is underconstrained","November 2022","","","|ranges|"
"`LWG3766 <https://wg21.link/LWG3766>`__","``view_interface::cbegin`` is underconstrained","November 2022","|Complete|","20.0","|ranges|"
"`LWG3770 <https://wg21.link/LWG3770>`__","``const_sentinel_t`` is missing","November 2022","","","|ranges|"
"`LWG3773 <https://wg21.link/LWG3773>`__","``views::zip_transform`` still requires ``F`` to be ``copy_constructible`` when empty pack","November 2022","","","|ranges|"
"`LWG3774 <https://wg21.link/LWG3774>`__","``<flat_set>`` should include ``<compare>``","November 2022","","","|flat_containers|"
Expand Down Expand Up @@ -252,7 +252,7 @@
"`LWG3664 <https://wg21.link/LWG3664>`__","`LWG 3392 <https://wg21.link/LWG3392>`__ ``broke std::ranges::distance(a, a+3)``","February 2023","","","|ranges|"
"`LWG3720 <https://wg21.link/LWG3720>`__","Restrict the valid types of ``arg-id`` for width and precision in ``std-format-spec``","February 2023","|Complete|","17.0","|format|"
"`LWG3756 <https://wg21.link/LWG3756>`__","Is the ``std::atomic_flag`` class signal-safe?","February 2023","","",""
"`LWG3769 <https://wg21.link/LWG3769>`__","``basic_const_iterator::operator==`` causes infinite constraint recursion","February 2023","","","|spaceship|"
"`LWG3769 <https://wg21.link/LWG3769>`__","``basic_const_iterator::operator==`` causes infinite constraint recursion","February 2023","|Complete|","20.0","|spaceship|"
"`LWG3807 <https://wg21.link/LWG3807>`__","The feature test macro for ``ranges::find_last`` should be renamed","February 2023","","","|ranges|"
"`LWG3811 <https://wg21.link/LWG3811>`__","``views::as_const`` on ``ref_view<T>`` should return ``ref_view<const T>``","February 2023","","","|ranges|"
"`LWG3820 <https://wg21.link/LWG3820>`__","``cartesian_product_view::iterator::prev`` is not quite right","February 2023","","","|ranges|"
Expand All @@ -271,7 +271,7 @@
"`LWG3849 <https://wg21.link/LWG3849>`__","``cartesian_product_view::iterator``'s default constructor is overconstrained","February 2023","","","|ranges|"
"`LWG3850 <https://wg21.link/LWG3850>`__","``views::as_const`` on ``empty_view<T>`` should return ``empty_view<const T>``","February 2023","","","|ranges|"
"`LWG3851 <https://wg21.link/LWG3851>`__","``chunk_view::inner-iterator`` missing custom ``iter_move`` and ``iter_swap``","February 2023","","","|ranges|"
"`LWG3853 <https://wg21.link/LWG3853>`__","``basic_const_iterator<volatile int*>::operator->`` is ill-formed","February 2023","","",""
"`LWG3853 <https://wg21.link/LWG3853>`__","``basic_const_iterator<volatile int*>::operator->`` is ill-formed","February 2023","|Complete|","20.0",""
"`LWG3857 <https://wg21.link/LWG3857>`__","``basic_string_view`` should allow explicit conversion when only traits vary","February 2023","|Complete|","17.0",""
"`LWG3860 <https://wg21.link/LWG3860>`__","``range_common_reference_t`` is missing","February 2023","|Complete|","17.0","|ranges|"
"`LWG3866 <https://wg21.link/LWG3866>`__","Bad Mandates for ``expected::transform_error`` overloads","February 2023","|Complete|","17.0",""
Expand All @@ -293,12 +293,12 @@
"`LWG3836 <https://wg21.link/LWG3836>`__","``std::expected<bool, E1>`` conversion constructor ``expected(const expected<U, G>&)`` should take precedence over ``expected(U&&)`` with operator ``bool``","February 2023","|Complete|","18.0",""
"`LWG3843 <https://wg21.link/LWG3843>`__","``std::expected<T,E>::value() &`` assumes ``E`` is copy constructible","February 2023","|Complete|","17.0",""
"`LWG3847 <https://wg21.link/LWG3847>`__","``ranges::to`` can still return views","February 2023","|Complete|","17.0","|ranges|"
"`LWG3862 <https://wg21.link/LWG3862>`__","``basic_const_iterator``'s ``common_type`` specialization is underconstrained","February 2023","","",""
"`LWG3862 <https://wg21.link/LWG3862>`__","``basic_const_iterator``'s ``common_type`` specialization is underconstrained","February 2023","|Complete|","20.0",""
"`LWG3865 <https://wg21.link/LWG3865>`__","Sorting a range of ``pairs``","February 2023","|Complete|","17.0","|ranges|"
"`LWG3869 <https://wg21.link/LWG3869>`__","Deprecate ``std::errc`` constants related to UNIX STREAMS","February 2023","|Complete|","19.0",""
"`LWG3870 <https://wg21.link/LWG3870>`__","Remove ``voidify``","February 2023","","",""
"`LWG3871 <https://wg21.link/LWG3871>`__","Adjust note about ``terminate``","February 2023","","",""
"`LWG3872 <https://wg21.link/LWG3872>`__","``basic_const_iterator`` should have custom ``iter_move``","February 2023","","",""
"`LWG3872 <https://wg21.link/LWG3872>`__","``basic_const_iterator`` should have custom ``iter_move``","February 2023","|Complete|","20.0",""
"`LWG3875 <https://wg21.link/LWG3875>`__","``std::ranges::repeat_view<T, IntegerClass>::iterator`` may be ill-formed","February 2023","|Complete|","17.0","|ranges|"
"`LWG3876 <https://wg21.link/LWG3876>`__","Default constructor of ``std::layout_XX::mapping`` misses precondition","February 2023","","",""
"`LWG3877 <https://wg21.link/LWG3877>`__","Incorrect constraints on ``const``-qualified monadic overloads for ``std::expected``","February 2023","|Complete|","17.0",""
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx23Papers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"`P1899R3 <https://wg21.link/P1899R3>`__","``stride_view``","July 2022","","","|ranges|"
"`P2093R14 <https://wg21.link/P2093R14>`__","Formatted output","July 2022","|Complete|","18.0","|format|"
"`P2165R4 <https://wg21.link/P2165R4>`__","Compatibility between ``tuple``, ``pair`` and ``tuple-like`` objects","July 2022","","",""
"`P2278R4 <https://wg21.link/P2278R4>`__","``cbegin`` should always return a constant iterator","July 2022","","","|ranges|"
"`P2278R4 <https://wg21.link/P2278R4>`__","``cbegin`` should always return a constant iterator","July 2022","|Complete|","20.0","|ranges|"
"`P2286R8 <https://wg21.link/P2286R8>`__","Formatting Ranges","July 2022","|Complete|","16.0","|format| |ranges|"
"`P2291R3 <https://wg21.link/P2291R3>`__","Add Constexpr Modifiers to Functions ``to_chars`` and ``from_chars`` for Integral Types in ``<charconv>`` Header","July 2022","|Complete|","16.0",""
"`P2302R4 <https://wg21.link/P2302R4>`__","``std::ranges::contains``","July 2022","|Complete|","19.0","|ranges|"
Expand Down
1 change: 1 addition & 0 deletions libcxx/docs/Status/Cxx2c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Paper Status
.. [#note-P2944R3] Implemented comparisons for ``reference_wrapper`` only.
.. [#note-P2422R1] Libc++ keeps the ``nodiscard`` attributes as a conforming extension.
.. [#note-P2997R1] This paper is applied as DR against C++20. (MSVC STL and libstdc++ will do the same.)
.. [#note-P2836R1] This paper is applies as DR against C++23 (MSVC STL and libstdc++ have done the same);

.. _issues-status-cxx2c:

Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx2cIssues.csv
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"`LWG3809 <https://wg21.link/LWG3809>`__","Is ``std::subtract_with_carry_engine<uint16_t>`` supposed to work","Kona November 2023","","",""
"`LWG3892 <https://wg21.link/LWG3892>`__","Incorrect formatting of nested ranges and tuples","Kona November 2023","|Complete|","17.0","|format|"
"`LWG3897 <https://wg21.link/LWG3897>`__","``inout_ptr`` will not update raw pointer to 0","Kona November 2023","|Complete|","19.0",""
"`LWG3946 <https://wg21.link/LWG3946>`__","The definition of ``const_iterator_t`` should be reworked","Kona November 2023","","",""
"`LWG3946 <https://wg21.link/LWG3946>`__","The definition of ``const_iterator_t`` should be reworked","Kona November 2023","|Complete|","20.0",""
"`LWG3947 <https://wg21.link/LWG3947>`__","Unexpected constraints on ``adjacent_transform_view::base()``","Kona November 2023","","","|ranges|"
"`LWG3948 <https://wg21.link/LWG3948>`__","``possibly-const-range and as-const-pointer`` should be ``noexcept``","Kona November 2023","","","|ranges|"
"`LWG3949 <https://wg21.link/LWG3949>`__","``std::atomic<bool>``'s trivial destructor dropped in C++17 spec wording","Kona November 2023","","",""
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx2cPapers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"`P2819R2 <https://wg21.link/P2819R2>`__","Add tuple protocol to complex","Kona November 2023","|Complete|","19.0",""
"`P2937R0 <https://wg21.link/P2937R0>`__","Freestanding: Remove ``strtok``","Kona November 2023","","",""
"`P2833R2 <https://wg21.link/P2833R2>`__","Freestanding Library: inout expected span","Kona November 2023","","",""
"`P2836R1 <https://wg21.link/P2836R1>`__","``std::basic_const_iterator`` should follow its underlying type's convertibility","Kona November 2023","","","|DR|"
"`P2836R1 <https://wg21.link/P2836R1>`__","``std::basic_const_iterator`` should follow its underlying type's convertibility","Kona November 2023","|Complete| [#note-P2836R1]","20.0","|DR|"
"`P2264R7 <https://wg21.link/P2264R7>`__","Make ``assert()`` macro user friendly for C and C++","Kona November 2023","","",""
"`P1673R13 <https://wg21.link/P1673R13>`__","A free function linear algebra interface based on the BLAS","Kona November 2023","","",""
"","","","","",""
Expand Down
4 changes: 3 additions & 1 deletion libcxx/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ set(files
__iterator/bounded_iter.h
__iterator/common_iterator.h
__iterator/concepts.h
__iterator/const_iterator.h
__iterator/counted_iterator.h
__iterator/cpp17_iterator_concepts.h
__iterator/data.h
Expand Down Expand Up @@ -635,14 +636,15 @@ set(files
__random/weibull_distribution.h
__ranges/access.h
__ranges/all.h
__ranges/as_const_view.h
__ranges/as_rvalue_view.h
__ranges/chunk_by_view.h
__ranges/common_view.h
__ranges/concepts.h
__ranges/const_access.h
__ranges/container_compatible_range.h
__ranges/counted.h
__ranges/dangling.h
__ranges/data.h
__ranges/drop_view.h
__ranges/drop_while_view.h
__ranges/elements_view.h
Expand Down
10 changes: 9 additions & 1 deletion libcxx/include/__algorithm/ranges_reverse_copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD

namespace ranges {

template <ranges::bidirectional_range _Range>
_LIBCPP_HIDE_FROM_ABI constexpr ranges::subrange<reverse_iterator<ranges::iterator_t<_Range>>,
reverse_iterator<ranges::iterator_t<_Range>>>
__reverse_range(_Range&& __range) {
auto __first = ranges::begin(__range);
return {std::make_reverse_iterator(ranges::next(__first, ranges::end(__range))), std::make_reverse_iterator(__first)};
}

template <class _InIter, class _OutIter>
using reverse_copy_result = in_out_result<_InIter, _OutIter>;

Expand All @@ -49,7 +57,7 @@ struct __reverse_copy {
requires indirectly_copyable<iterator_t<_Range>, _OutIter>
_LIBCPP_HIDE_FROM_ABI constexpr reverse_copy_result<borrowed_iterator_t<_Range>, _OutIter>
operator()(_Range&& __range, _OutIter __result) const {
auto __ret = ranges::copy(std::__reverse_range(__range), std::move(__result));
auto __ret = ranges::copy(std::ranges::__reverse_range(__range), std::move(__result));
return {ranges::next(ranges::begin(__range), ranges::end(__range)), std::move(__ret.out)};
}
};
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__format/range_default_formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include <__format/formatter.h>
#include <__format/range_formatter.h>
#include <__iterator/back_insert_iterator.h>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
#include <__ranges/data.h>
#include <__ranges/from_range.h>
#include <__ranges/size.h>
#include <__type_traits/conditional.h>
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__format/range_formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include <__format/formatter_output.h>
#include <__format/parser_std_format_spec.h>
#include <__iterator/back_insert_iterator.h>
#include <__ranges/access.h>
#include <__ranges/concepts.h>
#include <__ranges/data.h>
#include <__ranges/from_range.h>
#include <__ranges/size.h>
#include <__type_traits/remove_cvref.h>
Expand Down
Loading
Loading