[Solved] C++ vectors (instead of arrays)


#include <algorithm>

//...

bool isKeyword( const std::string &s )
{
   return ( std::find( keyword_list.begin(), keyword_list.end(), s ) != keyword_list.end() );
}

If the vector would be sorted then you could use standard algorithm std::binary_search

For example

#include <algorithm>

//...

bool isKeyword( const std::string &s )
{
   return ( std::binary_search( keyword_list.begin(), keyword_list.end(), s ) );
}

2

solved C++ vectors (instead of arrays)