template-project-cpp
Loading...
Searching...
No Matches
tpcpp::OpCollector< Ts > Struct Template Reference

Helper class to collect call operators from all lambdas. More...

#include <visitors/helpers.hpp>

Inheritance diagram for tpcpp::OpCollector< Ts >:
[legend]
Collaboration diagram for tpcpp::OpCollector< Ts >:
[legend]

Detailed Description

template<class... Ts>
struct tpcpp::OpCollector< Ts >

Helper class to collect call operators from all lambdas.

Use this class with std::visit, in the following way:

auto v1 = [](bool) -> int { return 1; };
auto v2 = [](double) -> int { return 1; };
std::visit(OpCollector{v1, v2}, variant);
Note
OpCollector also works with n-ary operators. For example:
auto v = [](bool, double) -> int { return 1; };
std::visit(OpCollector{v}, variant);
Helper class to collect call operators from all lambdas.
Definition helpers.hpp:20

Definition at line 20 of file helpers.hpp.


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