mirror-llvm-project/libcxx/include/__functional/function_ref.h
Hui a434fe87cc
[libc++] Implement std::function_ref (#186692)
Papers:
- P0792R14: function_ref: a type-erased callable reference
- P3948R1 constant_wrapper is the only tool needed for passing constant
expressions via function arguments
- P3961R1 Less double indirection in function_ref (RU-220)

LWG issues:
- LWG4256: Incorrect constraints for function_ref constructors from
nontype_t
- LWG4425: CTAD function_ref of data member pointer should produce
noexcept signature

Fixes #189606
Fixes #105376
Fixes #189604
Fixes #171321
Fixes #171387

---------

Co-authored-by: Xiaoyang Liu <siujoeng.lau@gmail.com>
Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2026-07-25 17:44:55 +01:00

33 lines
1 KiB
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___FUNCTIONAL_FUNCTION_REF_H
#define _LIBCPP___FUNCTIONAL_FUNCTION_REF_H
#include <__config>
#include <__functional/function_ref_common.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
#if _LIBCPP_STD_VER >= 26
// NOLINTBEGIN(readability-duplicate-include)
# define _LIBCPP_FUNCTION_REF_CV
# include <__functional/function_ref_impl.h>
# undef _LIBCPP_FUNCTION_REF_CV
# define _LIBCPP_FUNCTION_REF_CV const
# include <__functional/function_ref_impl.h>
# undef _LIBCPP_FUNCTION_REF_CV
// NOLINTEND(readability-duplicate-include)
#endif // _LIBCPP_STD_VER >= 26
#endif // _LIBCPP___FUNCTIONAL_FUNCTION_REF_H