xieite::visitor {}

Defined in header <xieite/fn/visitor.hpp>

Derives from multiple functors and inherits their call operators.


Definition

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

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


Example

int main() {
	auto f = xieite::visitor(
		[](int) { std::print("a\n"); },
		[](double) { std::print("b\n"); },
		[](bool) { std::print("c\n"); }
	);

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