&& is already short-circuit evaluation

abusing ? : seems unnecessary

if m_stops empty -> just return false
then try find -> judge if the term can be found (result of find is not the end of m_stops)
This commit is contained in:
shenleban tongying 2022-08-23 05:51:08 -04:00
parent 758f468e3a
commit 5608a8f79c

View File

@ -50,7 +50,7 @@ bool StopList::setFile(const string &filename)
// faster than find() in this case. // faster than find() in this case.
bool StopList::isStop(const string &term) const bool StopList::isStop(const string &term) const
{ {
return m_stops.empty() ? false : m_stops.find(term) != m_stops.end(); return !m_stops.empty() && m_stops.find(term) != m_stops.end();
} }
} }