[libcxx-commits] [libcxx] [libc++] P2770R0: "Stashing stashing iterators for proper flattening" (PR #66033)

Jakub Mazurkiewicz via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 12 12:29:31 PDT 2023


================
@@ -0,0 +1,39 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___RANGES_HELPERS_H
+#define _LIBCPP___RANGES_HELPERS_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+namespace ranges {
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI constexpr _Tp& __as_lvalue(_Tp&& __t) {
----------------
JMazurkiewicz wrote:

> Can you apply the `[[lifetimebound]]` attribute to the parameter and see if it still works?

I've applied it and no error has occurred in `range.join` tests. I've also updated `range.adaptor.helpers/as-lvalue.cpp` test to verify that calling function with prvalue gives a warning.

https://github.com/llvm/llvm-project/pull/66033


More information about the libcxx-commits mailing list