ITCH 5.0 Market Data Handler 1.0.0
NASDAQ ITCH 5.0 Market Data Feed Handler
Loading...
Searching...
No Matches
Delegate.h File Reference

Multi-signature type-safe delegate implementation. More...

Detailed Description

Multi-signature type-safe delegate implementation.

This file provides a flexible delegate (callback) mechanism that supports multiple function signatures in a single delegate object. The delegate can store any callable object (lambda, function pointer, functor) and invoke it with different argument types based on compile-time signature matching.

Key features:

  • Type-safe callback storage and invocation
  • Support for multiple function signatures
  • Small object optimization (128-byte inline storage)
  • Move semantics and perfect forwarding
  • Compile-time signature validation
Example:
// Define a delegate supporting two signatures
using MyDelegate = Delegate<
void(int), // Signature 1
void(std::string) // Signature 2
>;
MyDelegate delegate;
// Attach a handler that supports both signatures
delegate.attach([](auto value) {
std::cout << "Received: " << value << std::endl;
});
// Invoke with different argument types
delegate(42); // Calls void(int) signature
delegate("hello"); // Calls void(std::string) signature
#include "impl/Delegate.h"

Classes

class  b2bits::Delegate< Fs >
 Multi-signature delegate (callback) container. More...

Namespaces

namespace  b2bits