#include <utility>
template<typename F>
class A {
public:
A(const F& f) : _f(f) {}
A(F&& f) : _f(std::move(f)) {}
private:
F _f;
};
template<typename F>
A<F> MakeA(F&& f) {
return A<F>(std::forward<F>(f));
}
void foo() {}
int main() {
auto a = MakeA([]{}); // OK
auto b = MakeA(&foo); // OK
auto c = MakeA(foo); // <-- Error with overloading
}
I2luY2x1ZGUgPHV0aWxpdHk+Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBGPgpjbGFzcyBBIHsKcHVibGljOgogIEEoY29uc3QgRiYgZikgOiBfZihmKSB7fQogIEEoRiYmIGYpIDogX2Yoc3RkOjptb3ZlKGYpKSB7fQoKcHJpdmF0ZToKICBGIF9mOwp9OwoKdGVtcGxhdGU8dHlwZW5hbWUgRj4KQTxGPiBNYWtlQShGJiYgZikgewogIHJldHVybiBBPEY+KHN0ZDo6Zm9yd2FyZDxGPihmKSk7Cn0KCnZvaWQgZm9vKCkge30KCmludCBtYWluKCkgewoJYXV0byBhID0gTWFrZUEoW117fSk7IC8vIE9LCglhdXRvIGIgPSBNYWtlQSgmZm9vKTsgLy8gT0sKCWF1dG8gYyA9IE1ha2VBKGZvbyk7ICAvLyA8LS0gRXJyb3Igd2l0aCBvdmVybG9hZGluZwp9