title: How to use void parameter when using template in C++
body: <p>I want to make a function to test the running time of the incoming function.
  I use templates to make it applicable to many functions.</p>
  <p>I omitted the code for counting time.
  like this:</p>
  <pre><code>template&lt;typename F&gt;
  void get_run_time(F func)
  {
  //time start
   func;
  //time end
  }
  </code></pre>
  <p>But if a function I pass in is <code>void</code>, an error will be report and prompt me to add <code>F=void</code>.
  I tried to add it, but it didn't work. I can change void to bool, but it's very strange.</p>
  <p>Another problem is that I want to test a function time and run my whole code normally .So I increased the return value.
  like this:</p>
  <pre><code>template&lt;typename F&gt;
  F get_run_time(F func)
  {
  //time start
   F tf=func;
  //time end
   return tf;
  }
  </code></pre>
  <p>But the actual test time is obviously wrong. I guess it starts to run the function when it return .How can it get the running results before continuing with the following code?</p>