When calling a function using a function pointer we sometimes use the C syntax
and sometimes the syntax allowed by C++
is there any consensus on what is the best style? I'd like for us to consistently use one or the other.
Or is there something else we should be doing with modern C++ instead of function pointers (though I'm afraid we may be stuck on this one in many cases because of backward compatibility reasons)?
Preferred bikeshed colors?
I have seen a few projects start to use std::function (available since C++11). I haven’t used it myself, but when I first saw it used I went searching for pros & cons versus function pointers. I found the following StackOverflow article at the time which described them well.