xte::visitor {}

Defined in header <xte/func/visitor.hpp>

Derives from multiple functors and inherits their call operators.


Definition

template<typename... Fns>
struct visitor : Fns... {
	using Fns::operator()...;
};

template<typename... Fns>
visitor(Fns...) -> visitor<Fns...>;


Example

auto f = xte::visitor {
	[](int) { std::println("a"); },
	[](double) { std::println("b"); },
	[](bool) { std::println("c"); }
};

f(3.14159);
Output:
b
[View in Compiler Explorer]