ITCH 5.0 Market Data Handler 1.0.0
NASDAQ ITCH 5.0 Market Data Feed Handler
Loading...
Searching...
No Matches
b2bits::delegate_detail::CallbackPtr< R, Args > Struct Template Reference

Type-erased callback storage. More...

Detailed Description

template<class R, class... Args>
struct b2bits::delegate_detail::CallbackPtr< R, Args >

Type-erased callback storage.

Stores a function pointer for a specific signature (R(Args...)). Provides type-safe assignment and invocation of the callback.

The callback includes a void* parameter as the first argument for accessing the handler object stored in the delegate's inline storage.

Template Parameters
RReturn type of the callback
ArgsArgument types of the callback

#include <core/src/impl/Delegate.h>

Public Types

using return_type = R
 Return type of this callback.
using args_type = ArgsPack<Args...>
 Argument types as a pack.
using pointer_type = R (*)(Args...)
 Function pointer type.

Public Member Functions

void assign (pointer_type p)
 Assign a function pointer to this callback.
operator() (Args... args)
 Invoke the callback with provided arguments.

Public Attributes

pointer_type ptr_ = nullptr
 Function pointer (nullptr if not assigned).

Member Typedef Documentation

◆ args_type

template<class R, class... Args>
using b2bits::delegate_detail::CallbackPtr< R, Args >::args_type = ArgsPack<Args...>

Argument types as a pack.

◆ pointer_type

template<class R, class... Args>
using b2bits::delegate_detail::CallbackPtr< R, Args >::pointer_type = R (*)(Args...)

Function pointer type.

◆ return_type

template<class R, class... Args>
using b2bits::delegate_detail::CallbackPtr< R, Args >::return_type = R

Return type of this callback.

Member Function Documentation

◆ assign()

template<class R, class... Args>
void b2bits::delegate_detail::CallbackPtr< R, Args >::assign ( pointer_type p)
inline

Assign a function pointer to this callback.

Parameters
pFunction pointer to store

◆ operator()()

template<class R, class... Args>
R b2bits::delegate_detail::CallbackPtr< R, Args >::operator() ( Args... args)
inline

Invoke the callback with provided arguments.

Calls the stored function pointer if assigned, otherwise returns default-constructed return value.

Parameters
argsArguments to forward to the callback
Returns
Result of callback invocation or default R()

Member Data Documentation

◆ ptr_

template<class R, class... Args>
pointer_type b2bits::delegate_detail::CallbackPtr< R, Args >::ptr_ = nullptr

Function pointer (nullptr if not assigned).

Referenced by b2bits::delegate_detail::CallbackPtr< R, void *, Args... >::operator()().


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