title: Template functor wrapper that can return a void or non-void value
body: <p>How to return an arbitrary type (either void or non-void) from a template functor wrapper? I use the wrapper for pre- and post- conditions, so I need to store the returned value in a local variable before returning it from wrapper. But when the returned type is void the compiler gives and error, because variables can't have a void type. What can be done here?</p>
  
  <pre><code>template &lt;typename Functor, typename... Args&gt;
  auto Decorate(Functor f, Args&amp;&amp;... args)
  -&gt; decltype(f(std::forward&lt;Args&gt;(args)...)) {
      // preconditions
      const auto result = f(std::forward&lt;Args&gt;(args)...);
      // postconditions
      return result;
  }
  </code></pre>