std::variant
的visitor用lambda可以用 C++备忘录013:lambda overload详解 中提到的lambda overload实现,也可以借助于if constexpr
#include <iostream>
#include <type_traits>
#include <variant>
#include <string>
template <typename ... Ts>
struct overload : Ts... {
constexpr overloaded(Ts... ts)
noexcept(