Reputation: 6958
I'm used to the template syntax for a fully specialized template:
template<typename T>
struct S {};
template<>
struct S<int> {}; // Fully specialized
But I have no idea that I could use it as an argument:
void fn(std::function<> lambda){
}
int main() {
fn([](){ std::cout << "Hello"; });
}
Does the above mean "give me a fully specialized std::function as a parameter" ?
Why hasn't it the template <> std::function
syntax?
Upvotes: 1
Views: 63
Reputation: 45444
It appears (see this documentation of std::function
) that the C++ standard does not provide for a fully specialized version of std::function<signature>
, i.e. a default such as signature=void()
. Thus, if your code compiled, then the C++ standard library used was not fully standard compliant. You should file a bug report.
Upvotes: 1