user2836797
user2836797

Reputation:

What does void() mean when used as a template parameter?

I am struggling to find an answer to this question mainly because I don't know how I would look it up as there are no relative search-terms or concepts I can think of. It is an unusual syntax to my eyes.

In the following code, what does void() mean?

std::deque<std::function<void()>>

Upvotes: 2

Views: 86

Answers (1)

Brian Bi
Brian Bi

Reputation: 119069

void() is the type of a function that takes no arguments and has void return type. An object of type std::function<void()> is therefore an object you can call with no arguments, which will return no value when called.

Upvotes: 5

Related Questions