title: Should I pass an std::function by const-reference?
body: <p>Let's say I have a function which takes an <code>std::function</code>:</p>
  
  <pre><code>void callFunction(std::function&lt;void()&gt; x)
  {
      x();
  }
  </code></pre>
  
  <p>Should I pass <code>x</code> by const-reference instead?:</p>
  
  <pre><code>void callFunction(const std::function&lt;void()&gt;&amp; x)
  {
      x();
  }
  </code></pre>
  
  <p>Does the answer to this question change depending on what the function does with it? For example if it is a class member function or constructor which stores or initializes the <code>std::function</code> into a member variable.</p>