[libc-commits] [libc] [libc][cpp] reverse_iterator support (PR #85702)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Tue Mar 19 09:40:53 PDT 2024
================
@@ -45,9 +48,29 @@ template <class T, size_t N> struct array {
LIBC_INLINE constexpr iterator begin() { return Data; }
LIBC_INLINE constexpr const_iterator begin() const { return Data; }
+ LIBC_INLINE constexpr const_iterator cbegin() const { return begin(); }
LIBC_INLINE constexpr iterator end() { return Data + N; }
LIBC_INLINE constexpr const_iterator end() const { return Data + N; }
+ LIBC_INLINE constexpr const_iterator cend() const { return end(); }
+
+ LIBC_INLINE constexpr reverse_iterator rbegin() {
+ return reverse_iterator{end()};
+ }
+ LIBC_INLINE constexpr const_reverse_iterator rbegin() const {
+ return const_reverse_iterator{end()};
+ }
+ LIBC_INLINE constexpr const_reverse_iterator crbegin() const {
+ return rbegin();
+ }
+
+ LIBC_INLINE constexpr reverse_iterator rend() {
+ return reverse_iterator{begin()};
+ }
+ LIBC_INLINE constexpr const_reverse_iterator rend() const {
+ return const_reverse_iterator{begin()};
+ }
+ LIBC_INLINE constexpr const_reverse_iterator crend() const { return rend(); }
----------------
nickdesaulniers wrote:
Coincidentally, I think some WG21 are in Tokyo right now, and this came up for discussion. @lntue pointed me to a discussion in #libcxx channel of llvm discord where Mark de Wever said:
> Going forward it seems LEWG is happy to leave nodiscard to implementors 🙂 @philnik regarding your nodiscard ideas, did you ask MSVC STL what they do? @ldionne can you put nodiscard on the agenda for our next meeting?
https://github.com/llvm/llvm-project/pull/85702
More information about the libc-commits
mailing list