WPILibC++ 2023.4.3
wpi::unique_function< FunctionT > Class Template Reference

unique_function is a type-erasing functor similar to std::function. More...

Detailed Description

template<typename FunctionT>
class wpi::unique_function< FunctionT >

unique_function is a type-erasing functor similar to std::function.

It can hold move-only function objects, like lambdas capturing unique_ptrs. Accordingly, it is movable but not copyable.

It supports const-qualification:

  • unique_function<int() const> has a const operator(). It can only hold functions which themselves have a const operator().
  • unique_function<int()> has a non-const operator(). It can hold functions with a non-const operator(), like mutable lambdas.

The documentation for this class was generated from the following file: