template<typename... Ts>
struct Overloader : Ts...
{
using Ts::operator()...; // exposes operator() from every base
};
int main()
{
auto o = Overloader{ [] (auto const& a) {std::cout << a;},
[] (float f) {std::cout << std::setprecision(3) << f;} };
}
https://en.cppreference.com/w/cpp/language/using_declaration
不试一下我都看不出这能不能编译通过……
--
FROM 124.217.188.*