How to Write a Lambda Wrapping a Function with Optional Return Value
问题 I have tried to write a lambda that measures the execution time of arbitrary functions. With a lot of help I have managed that for C++14 and functions having a return value, see Measure execution time of arbitrary functions with C++14 lambda. Then I wanted my code to also work with C++11, therefore I have implemented the same idea with template functions. Finally I have realized that this code does not work for functions having no return value. It has been quite simple to generalize the