Should I delete pointer passed to a function as argument?
<p>So I was reading some Stack Overflow answers about deleting pointer arguments particularly these ones(<a href="https://stackoverflow.com/questions/10502442/new-operator-in-function-call">1</a>,<a href="https://stackoverflow.com/questions/11854529/new-operator-in-function-parameter">2</a>), because I am building a function, that requires a pointer as an argument.</p>

<p>A simplified version of the function is below:</p>

<pre><code>void draw(Shape * b)
{
    //Draws code....
}
</code></pre>

<p>No what I am confused about here is deletion. For example, if the function is called like this:</p>

<pre><code>Shape * c;
draw(&amp;c);
</code></pre>

<p>Then I don't have to delete anything. But if it is like this:</p>

<pre><code>draw(new Shape{});
</code></pre>

<p>then I have to. So basically, my question is, how should I go about deleting if the <code>new</code> keyword is used in the parameter. There are no possible exceptions that could be thrown in the functions, so no need for RAII. Any ideas? Please don't suggest anything involving smart pointers, because that is what I already will do, this question is curiosity. Also, please answer knowing that the function can take both the new operator, or an existing pointer, basically meaning I need a way to differentiate between both. Also, for my links: These don't really answer my question, because most of them just depend on smart pointers, or one call or the other.</p>