title: Mixing pointers and references in function definition in C++
body: <p>I have a function that has two instances of classes as arguments:</p>
  
  <pre><code>void cookPasta(const Tomato&amp; tomato, const Meat* meat)
  {
      if (meat != nullptr)
          cookPastaWithMeat(tomato, *meat);
      else
          cookPastaWithoutMeat(tomato);
  }
  </code></pre>
  
  <p>As the function shows, an instance of <code>Tomato</code> is always required, whereas <code>Meat</code> is optional and a <code>nullptr</code> can be passed instead. I do this to allow the <code>cookPasta</code> function to be called even if the user has never declared an instance of the <code>Meat</code> class.</p>
  
  <p>Is it bad practice to mix references and pointers in the function signature?</p>