search for an enum in a structure in a vector in c++
<p>I have an <code>enum</code>, a structure with this <code>enum</code> as a member and a vector of these structures as such: </p>

<pre><code>enum TickerType { tt1, tt2, tt3 };
struct Ticker {
  std::string name;
  TickerType type;
};
std::vector&lt;Ticker&gt; vect;
</code></pre>

<p>I want to search for an element in <code>vect</code> which is of type <code>tt1</code>. For which I declared</p>

<pre><code>struct find_ticker
{
  const TickerType type;
  find_ticker(TickerType type) : type(type) {};
  bool operator () ( const Ticker&amp; ticker ) const
  {
    return ticker.type == type;
  }
};
</code></pre>

<p>and looked with:</p>

<pre><code> if ( std::find ( vect.begin(), vect.end(), find_ticker ( tt1 ) ) != tickers.end() ) 
</code></pre>

<p>But I get</p>

<blockquote>
<pre><code>error: no match for ‘operator==’ (operand types are ‘Dfp::Ticker’ and
 ‘const {anonymous}::find_ticker’) ||   { return *__it == _M_value; }
</code></pre>
</blockquote>

<p>*Dfp is the global namespace of the application and find_ticker is defined in an anoymous namespace in the implementation file where I need it</p>