xieite::visitor {}

Defined in fragment xieite:visitor
(header-only: <xieite/fn/visitor.hpp>)


Derives from multiple functors and inherits their call operators.


Declaration

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


Example

import std;
import xieite;

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