Код: Выделить всё
#include
namespace test {
template
class A {
public:
friend auto foo(const A& obj) { return 1; }
};
template
void bar(Function f, Args&&... args) {
const auto result = std::invoke(f, std::forward(args)...);
// do stuff with result
}
} // namespace test
auto main() -> int {
test::A value;
test::bar(foo, value); // results in compile time error
test::bar(test::foo, value); // results in compile time error
return 0;
}
Вероятно, он должен что-то делать с поиском, зависящим от аргументов, но я не могу этого понять.>
Подробнее здесь: https://stackoverflow.com/questions/726 ... meter-resu
Мобильная версия