Consider the following piece of code:
struct Bar {
void operator()() {}
};
int main() {
std::cout << std::boolalpha << std::is_function<Bar>::value <<
}
The output is false.
No surprises here since functor Bar does not qualify as a function type §8.3.5 Functions [dcl.fct].
Now consider the following piece of code:
struct Bar {
void operator()() {}
};
int main() {
std::cout << std::boolalpha << std::is_function<Bar()>::value << std::endl;
^^
}
Notice the parentheses after Bar. The output is true.
How is Bar() qualified as a function type?
My guess is that it's a case of most vexing parse, but how can it be since it's in the template argument list?
Aucun commentaire:
Enregistrer un commentaire