I was reading this article about parallel programming and I came across a return statement that I don’t quite understand. I’ve read about namespaces and Boost::Chrono::steady_clock, though I’ve never used either in practice, I understand their purposes.
This is the line of code found in the run_tests function which puzzles me:
return boost::chrono::duration <double, boost::milli> (end - start).count();
What’s going on here exactly? Shouldn’t an object name come before .count()? Is there some overloading of the - operator in Chrono?
is the name of a class template.
Is an instantiation of a class template, that is, a class.
Creates a temporary object of that type, initialized with the value of the expression
end-start.Invokes the
.count()method of the temporary object.Returns the result of the
.count()method.