std::find() on a vector of pointers
<p>I want to search through a vector of pointers to and compare the pointers to an <code>int</code>. My initial idea was to use <code>std::find()</code> but i realized that I cannot compare a pointer to an <code>int</code>.</p>

<p>Example:</p>

<pre><code>if(std::find(myvector.begin(), myvector.end(), 0) != myvector.end()
{
   //do something
}
</code></pre>

<p><code>myvector</code> is a vector containing pointers to a class object, i.e., <code>vector&lt;MyClass*&gt; myvector</code>.<code>MyClass</code> contains a method <code>getValue()</code> which will return an integer value and I basically want to go through the vector and check each object's <code>getValue()</code> return value to determine what i do.</p>

<p>Using the previous example:</p>

<pre><code>if(std::find(myvector.begin(), myvector.end(), 0) != myvector.end()
{
   //Output 0
}
else if(std::find(myvector.begin(), myvector.end(), 1) != myvector.end()
{
   //Output 1
}
else if(std::find(myvector.begin(), myvector.end(), 2) != myvector.end()
{
   //Output 2
}
</code></pre>

<p>Its almost like an absolute condition where if any pointer's value in my vector is a 0, i output zero, i output 0. If no zero is found, i look to see if there is a 1. If 1 is found, i output 1. Etc, etc..</p>