JUCE: FixedSizeFunction< len, Ret(Args...)> Class Template Reference

JUCE

- Main Page
- Related Pages
- Topics
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Loading...
Searching...
No Matches
Public Member Functions | List of all members
FixedSizeFunction< len, Ret(Args...)> Class Template Reference
juce_core » containers

A type similar to `std::function` that holds a callable object. More...

`#include <juce_FixedSizeFunction.h>`

## Public Member Functions
| FixedSizeFunction () noexcept=default
| Create an empty function.
| FixedSizeFunction (std::nullptr_t) noexcept
| Create an empty function.
| FixedSizeFunction (const FixedSizeFunction &)=delete
template<typename Callable , typename Fn = Decay<Callable>, IntIfValidConversion< Callable > = 0>
| FixedSizeFunction (Callable &&callable)
| Forwards the passed Callable into the internal storage buffer.
| FixedSizeFunction (FixedSizeFunction &&other) noexcept
| Move constructor.
template<size_t otherLen, std::enable_if_t<(otherLen< len), int > = 0>
| FixedSizeFunction (FixedSizeFunction< otherLen, Ret(Args...)> &&other) noexcept
| Converting constructor from smaller FixedSizeFunctions.
FixedSizeFunction & | operator= (std::nullptr_t) noexcept
| Nulls this instance.
FixedSizeFunction & | operator= (const FixedSizeFunction &)=delete
template<typename Callable , IntIfValidConversion< Callable > = 0>
FixedSizeFunction & | operator= (Callable &&callable)
| Assigns a new callable to this instance.
template<size_t otherLen, std::enable_if_t<(otherLen< len), int > = 0>
FixedSizeFunction & | operator= (FixedSizeFunction< otherLen, Ret(Args...)> &&other) noexcept
| Move assignment from smaller FixedSizeFunctions.
FixedSizeFunction & | operator= (FixedSizeFunction &&other) noexcept
| Move assignment operator.
| ~FixedSizeFunction () noexcept
| Destructor.
Ret | operator() (Args... args) const
| If this instance is currently storing a callable object, calls that object, otherwise throws `std::bad_function_call`.
| operator bool () const noexcept
| Returns true if this instance currently holds a callable.

## Detailed Description

template<size_t len, typename Ret, typename... Args>
class FixedSizeFunction< len, Ret(Args...)>

A type similar to `std::function` that holds a callable object.

Unlike `std::function`, the callable object will always be stored in a buffer of size `len` that is internal to the FixedSizeFunction instance. This in turn means that creating a FixedSizeFunction instance will never allocate, making FixedSizeFunctions suitable for use in realtime contexts.

## Constructor & Destructor Documentation

## ◆ FixedSizeFunction() [1/6]

template<size_t len, typename Ret , typename... Args>

FixedSizeFunction< len, Ret(Args...)>::FixedSizeFunction | ( |  | ) |
| defaultnoexcept

Create an empty function.

## ◆ FixedSizeFunction() [2/6]

template<size_t len, typename Ret , typename... Args>

FixedSizeFunction< len, Ret(Args...)>::FixedSizeFunction | ( | std::nullptr_t |  | ) |
| noexcept

Create an empty function.

## ◆ FixedSizeFunction() [3/6]

template<size_t len, typename Ret , typename... Args>

FixedSizeFunction< len, Ret(Args...)>::FixedSizeFunction | ( | const FixedSizeFunction< len, Ret(Args...)> & |  | ) |
| delete

## ◆ FixedSizeFunction() [4/6]

template<size_t len, typename Ret , typename... Args>
template<typename Callable , typename Fn = Decay<Callable>, IntIfValidConversion< Callable > = 0>

FixedSizeFunction< len, Ret(Args...)>::FixedSizeFunction | ( | Callable && | callable | ) |

Forwards the passed Callable into the internal storage buffer.

References jassert.

## ◆ FixedSizeFunction() [5/6]

template<size_t len, typename Ret , typename... Args>

FixedSizeFunction< len, Ret(Args...)>::FixedSizeFunction | ( | FixedSizeFunction< len, Ret(Args...)> && | other | ) |
| noexcept

Move constructor.

## ◆ FixedSizeFunction() [6/6]

template<size_t len, typename Ret , typename... Args>
template<size_t otherLen, std::enable_if_t<(otherLen< len), int > = 0>

FixedSizeFunction< len, Ret(Args...)>::FixedSizeFunction | ( | FixedSizeFunction< otherLen, Ret(Args...)> && | other | ) |
| noexcept

Converting constructor from smaller FixedSizeFunctions.

## ◆ ~FixedSizeFunction()

template<size_t len, typename Ret , typename... Args>

FixedSizeFunction< len, Ret(Args...)>::~FixedSizeFunction | ( |  | ) |
| noexcept

Destructor.

## Member Function Documentation

## ◆ operator=() [1/5]

template<size_t len, typename Ret , typename... Args>

FixedSizeFunction & FixedSizeFunction< len, Ret(Args...)>::operator= | ( | std::nullptr_t |  | ) |
| noexcept

Nulls this instance.

## ◆ operator=() [2/5]

template<size_t len, typename Ret , typename... Args>

FixedSizeFunction & FixedSizeFunction< len, Ret(Args...)>::operator= | ( | const FixedSizeFunction< len, Ret(Args...)> & |  | ) |
| delete

## ◆ operator=() [3/5]

template<size_t len, typename Ret , typename... Args>
template<typename Callable , IntIfValidConversion< Callable > = 0>

FixedSizeFunction & FixedSizeFunction< len, Ret(Args...)>::operator= | ( | Callable && | callable | ) |

Assigns a new callable to this instance.

## ◆ operator=() [4/5]

template<size_t len, typename Ret , typename... Args>
template<size_t otherLen, std::enable_if_t<(otherLen< len), int > = 0>

FixedSizeFunction & FixedSizeFunction< len, Ret(Args...)>::operator= | ( | FixedSizeFunction< otherLen, Ret(Args...)> && | other | ) |
| noexcept

Move assignment from smaller FixedSizeFunctions.

## ◆ operator=() [5/5]

template<size_t len, typename Ret , typename... Args>

FixedSizeFunction & FixedSizeFunction< len, Ret(Args...)>::operator= | ( | FixedSizeFunction< len, Ret(Args...)> && | other | ) |
| noexcept

Move assignment operator.

## ◆ operator()()

template<size_t len, typename Ret , typename... Args>

Ret FixedSizeFunction< len, Ret(Args...)>::operator() | ( | Args... | args | ) | const

If this instance is currently storing a callable object, calls that object, otherwise throws `std::bad_function_call`.

## ◆ operator bool()

template<size_t len, typename Ret , typename... Args>

FixedSizeFunction< len, Ret(Args...)>::operator bool | ( |  | ) | const
| explicitnoexcept

Returns true if this instance currently holds a callable.

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

- juce_FixedSizeFunction.h