18 lines
498 B
C++
18 lines
498 B
C++
|
|
namespace psl {
|
|
|
|
/// usage:
|
|
/// const auto visitor = overloads {
|
|
/// [](type_1 v){...},
|
|
/// [](type_2 v){...},
|
|
/// ...
|
|
/// };
|
|
/// visitor will then be an object with an overloaded function call op
|
|
/// which accepts type_1, type_2, etc
|
|
/// got this code from https://en.cppreference.com/w/cpp/utility/variant/visit
|
|
/// seems to need C++20 to work but haven't researched to double check
|
|
template <class... Ts> struct overloads : Ts... {
|
|
using Ts::operator()...;
|
|
};
|
|
|
|
} // namespace psl
|