Files
clang-p2996/libc/utils/CPP/Functional.h
Siva Chandra Reddy 675eea46f0 [libc][NFC] Rename cpp::function to cpp::Function.
Summary: Just to be consistent with other names in cpp.

Reviewers: abrachet

Subscribers: tschuett, libc-commits

Tags: #libc-project

Differential Revision: https://reviews.llvm.org/D79189
2020-04-30 11:58:26 -07:00

31 lines
929 B
C++

//===-- 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 <typename Func> class Function;
template <typename Ret, typename... Params> class Function<Ret(Params...)> {
Ret (*func)(Params...) = nullptr;
public:
constexpr Function() = default;
template <typename Func> 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