[libcxx-commits] [PATCH] D103273: [libc++] Update all the pre-defined iterator types for C++20

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 28 06:21:02 PDT 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/include/iterator:465
+
+    constexpr ostreambuf_iterator() noexcept = default; // since C++20
     ostreambuf_iterator(ostream_type& s) noexcept;
----------------
ldionne wrote:
> @tcanens I think this one is missing from cppreference: https://en.cppreference.com/w/cpp/iterator/ostreambuf_iterator/ostreambuf_iterator
It'll be DRed out of existence by p2325r3, so I bet it's not worth fixing on cppreference.
(See my LWG reflector thread of last week, "Must `ostreambuf_iterator<char>().failed() == false`?".)
There's an executive design decision to be made here as to whether we should just go ahead and implement p2325 (although it seems like both me and Louis have relatively independently made decisions to implement not-p2325). Either p2325 or not-p2325 would suffice to unblock @mordante AIUI.


================
Comment at: libcxx/include/iterator:863
+#if _LIBCPP_STD_VER > 17
+    _LIBCPP_INLINE_VISIBILITY constexpr back_insert_iterator() noexcept = default;
+#endif
----------------
I strongly recommend removing the redundant `constexpr` and `noexcept`, for cleanliness' sake. (Defaulted functions are always constexpr-auto and noexcept-auto.)
Ditto line 908, 1075, 1200; already OK on line 954.


================
Comment at: libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp:58
   static_assert(std::same_as<typename Traits::value_type, void>);
-  static_assert(std::same_as<typename Traits::difference_type, Diff>);
+  static_assert(std::same_as<typename Traits::difference_type, std::ptrdiff_t>);
   static_assert(std::same_as<typename Traits::reference, void>);
----------------
Nice! :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103273/new/

https://reviews.llvm.org/D103273



More information about the libcxx-commits mailing list