DryChem 1.0.0
A generic, compile-time C++ toolbox with no dependencies for the modern computational chemistry project.
Loading...
Searching...
No Matches
CppUtils::Testing Namespace Reference

Namespaces

namespace  details
 

Functions

template<typename F, typename... TArgs>
constexpr decltype(auto) timeAndInvoke (F &&f, TArgs &&... args)
 

Function Documentation

◆ timeAndInvoke()

template<typename F, typename... TArgs>
decltype(auto) CppUtils::Testing::timeAndInvoke ( F && f,
TArgs &&... args )
constexpr

A function that invokes another function and times how long it took to invoke said function.

Template Parameters
F- The type of the function we are calling
...TArgs- The types of the arguments passed to the function f
Parameters
f- The function to invoke
args- The parameters of the function we are invoking
Returns
Because we have two different pieces of information to return, the result of the invoked function (unless it is a void function) and the time it took to invoke the function, we return an object of the detatils::ReturnType struct. The preferred way to collect this information is through structured binding.

Need to handle void f(args...) case differently from auto f(args...) case