mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Adopt llvm::function_ref for callbacks that aren't persisted.
...removing a few other constructs that were doing the same thing (mostly from me). No functionality change. Swift SVN r23294
This commit is contained in:
@@ -102,28 +102,6 @@ inline void for_each3(const Container1 &c1, const Container2 &c2,
|
||||
|
||||
/// @}
|
||||
|
||||
/// @{
|
||||
|
||||
/// Declares a member \c type that is a std::function compatible with the given
|
||||
/// callable type.
|
||||
///
|
||||
/// \tparam T A callable type, such as a lambda.
|
||||
template <typename T>
|
||||
struct as_function : public as_function<decltype(&T::operator())> {};
|
||||
|
||||
template <typename L, typename R, typename... Args>
|
||||
struct as_function<R(L::*)(Args...) const> {
|
||||
using type = std::function<R(Args...)>;
|
||||
};
|
||||
|
||||
/// @}
|
||||
|
||||
/// Returns a std::function that can call a lambda without copying it.
|
||||
template <typename L>
|
||||
static typename as_function<L>::type makeStackLambda(const L &theLambda) {
|
||||
return std::cref(theLambda);
|
||||
}
|
||||
|
||||
/// A range of iterators.
|
||||
template<typename Iterator>
|
||||
class IteratorRange {
|
||||
|
||||
Reference in New Issue
Block a user