mrdocs::Overload
Combines multiple callable types into a single overloaded function object.
Synopsis
Declared in <mrdocs/ADT/Overload.hpp>
template<class... Ts>
struct Overload
: Ts...
Description
This is the canonical "overloaded pattern" implemented as a class template. It inherits from all provided callables and brings in their operator()s, so the resulting object can be called with whichever overload matches.
Typical use‐cases include visiting std::variant and building small ad‐hoc pattern‐matching style dispatchers.
auto f = fn::makeOverload(
[](int i) { return i * 2; },
[](const std::string& s) { return s.size(); }
);
auto a = f(21); // calls int overload
auto b = f(std::string("hello")); // calls string overload
Member Functions
Name |
Description |
|
Constructs an Overload from the given callables. |
Non-Member Functions
Name |
Description |
Factory function that creates an Overload from the given callables. |
Template Parameters
| Name | Description |
|---|---|
Ts |
The callable types to combine (lambdas, function objects, etc.) |
Created with MrDocs