//===-- Self contained functional header ------------------------*- 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 LLVM_LIBC_UTILS_CPP_FUNCTIONAL_H #define LLVM_LIBC_UTILS_CPP_FUNCTIONAL_H namespace __llvm_libc { namespace cpp { template class Function; template class Function { Ret (*func)(Params...) = nullptr; public: constexpr Function() = default; template constexpr Function(Func &&f) : func(f) {} constexpr Ret operator()(Params... params) { return func(params...); } }; } // namespace cpp } // namespace __llvm_libc #endif // LLVM_LIBC_UTILS_CPP_FUNCTIONAL_H