WPILibC++  2020.3.2-60-g3011ebe
FunctionExtras.h File Reference
#include "wpi/Compiler.h"
#include "wpi/PointerIntPair.h"
#include "wpi/PointerUnion.h"
#include <memory>

Go to the source code of this file.


class  wpi::unique_function< FunctionT >
class  wpi::unique_function< ReturnT(ParamTs...)>
struct  wpi::unique_function< ReturnT(ParamTs...)>::StorageUnionT::OutOfLineStorageT


 WPILib C++ utilities (wpiutil) namespace.

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.

Future plans:

  • Add a function that provides const, volatile, and ref-qualified support, which doesn't work with std::function.
  • Provide support for specifying multiple signatures to type erase callable objects with an overload set, such as those produced by generic lambdas.
  • Expand to include a copyable utility that directly replaces std::function but brings the above improvements.

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.