I read about using function declarations , and I wanted to compile the last example. It:
#include <iostream>
template <typename... Ts>
struct Overloader : Ts... {
using Ts::operator()...;
};
template <typename... T>
constexpr auto make_overloader(T&&... t) {
return Overloader<T...>{std::forward<T>(t)...};
}
int main() {
auto o = make_overloader([] (auto const& a) {std::cout << a;},
[] (float f) {std::cout << 13 << f;});
}
Even if I already know and understand what he will do, I would like to compile and test it. However, neither clang-4.0 nor g ++ - 7.0 seem to be able to compile it at the moment. Is there any place with any compiler, could I try it?
source
share