You are trying to return an iterator in the same way that a warning says that you are on a line:
return m_searchLogical_it;
To get a raw pointer to an element, which is the return type of getFirst
, you need to get a pointer to the m_searchLogical_it
object. To do this, you need to dereference the iterator to get the object, then take the address of the object:
return &*m_serchLogical_it;
If I can further suggest; you use an iterator ( m_searchLogical_it
) and a loop counter ( i
) when all you need to use is an iterator:
for(m_searchLogical_it = begin(m_FVSearchVector); m_searchLogical_it != end(m_FVSearchVector); ++m_searchLogical_it) { if(m_searchLogical_it->ml_sensorId == sensorId) { return &*m_searchLogical_it; } }
source share