LLVM  13.0.0git
Classes | Namespaces | Typedefs
FunctionExtras.h File Reference
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/Support/MemAlloc.h"
#include "llvm/Support/type_traits.h"
#include <memory>
#include <type_traits>
Include dependency graph for FunctionExtras.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  llvm::unique_function< FunctionT >
 unique_function is a type-erasing functor similar to std::function. More...
 
class  llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >
 
struct  llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::IsSizeLessThanThresholdT< T, class >
 
struct  llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::CallbacksHolder< CallableT, CalledAs, Enable >
 
struct  llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::CallbacksHolder< CallableT, CalledAs, EnableIfTrivial< CallableT > >
 
struct  llvm::detail::UniqueFunctionBase< ReturnT, ParamTs >::CalledAs< T >
 
class  llvm::unique_function< R(P...)>
 
class  llvm::unique_function< R(P...) const >
 

Namespaces

 llvm
 
 llvm::detail
 

Typedefs

template<typename T >
using llvm::detail::EnableIfTrivial = std::enable_if_t< llvm::is_trivially_move_constructible< T >::value &&std::is_trivially_destructible< T >::value >
 
template<typename CallableT , typename ThisT >
using llvm::detail::EnableUnlessSameType = std::enable_if_t<!std::is_same< remove_cvref_t< CallableT >, ThisT >::value >
 
template<typename CallableT , typename Ret , typename... Params>
using llvm::detail::EnableIfCallable = std::enable_if_t< std::is_void< Ret >::value||std::is_convertible< decltype(std::declval< CallableT >()(std::declval< Params >()...)), Ret >::value >
 

Detailed Description

This file provides a collection of function (or more generally, callable) type erasure utilities supplementing those provided by the standard library in <function>.

It provides unique_function, which works like std::function but supports move-only callable objects and const-qualification.

Future plans:

Note that LLVM's utilities are greatly simplified by not supporting allocators.

If the standard library ever begins to provide comparable facilities we can consider switching to those.

Definition in file FunctionExtras.h.