[libcxx-commits] [libcxx] [libc++] Implement `bind_back` (PR #81055)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 12 11:12:49 PDT 2024


================
@@ -0,0 +1,362 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <functional>
+
+// template<class F, class... Args>
+//   constexpr unspecified bind_back(F&& f, Args&&... args);
+
+#include <functional>
+
+#include <cassert>
+#include <concepts>
+#include <tuple>
+#include <utility>
+
+#include "callable_types.h"
+#include "types.h"
+
+constexpr void test_basic_bindings() {
----------------
ldionne wrote:

Do we have any test that we can return e.g. a reference from the function and it won't get decayed? I couldn't find any, but maybe I missed them.

If we don't have any, we should also add a similar test for `bind_front` while we're at it, it's pretty easy to test.

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


More information about the libcxx-commits mailing list