[libcxx-commits] [PATCH] D132327: [libc++] Implement P2445R1 (`std::forward_like`)

Igor Zhukov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 21 21:44:57 PDT 2022


fsb4000 added inline comments.


================
Comment at: libcxx/include/__utility/forward_like.h:25
+
+template <class _Tp, class _Utp>
+[[nodiscard]] constexpr auto&& forward_like(_Utp&& __ux) noexcept {
----------------
philnik wrote:
> Or is there a reason for the `t`?
Originally they were `_Ty` and `_Uty` but I noticed that libc++ uses `_Tp` so I renamed `y` to `p`.
Sure, I can remove the `t`.


================
Comment at: libcxx/include/utility:45-60
+template <typename T, typename U>
+using __override_ref_t = std::conditional_t<std::is_rvalue_reference_v<T>,
+                                            std::remove_reference_t<U> &&, U &>;
+template <typename T, typename U>
+using __copy_const_t =
+    std::conditional_t<std::is_const_v<std::remove_reference_t<T>>,
+                       U const, U>;
----------------
philnik wrote:
> Why do you have (AFAICT non-existent) implementation details in the synopsis? You are also missing a `// since C++23` after `forwrward_like`.
I copied from https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2445r1.pdf

Yes, I will add `// since C++23` and I look at the standard.


================
Comment at: libcxx/test/std/utilities/utility/forward_like/forward_like.msvc/test.compile.pass.cpp:1-12
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
----------------
philnik wrote:
> Two license headers seem weird. Are you sure the LLVM license header should be here?
Maybe you're right.
Now I looked how charconv.msvc was made:

https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/charconv/charconv.msvc/test.pass.cpp

and

https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp

So probably I should do the same.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132327



More information about the libcxx-commits mailing list