I\'ve got a list of elements, say, integers and I want to check if my variable (another integer) is one of the elements from the list. In python I\'d do:
my_list
Declare additional helper function like this:
template
bool vectorContains(const vector& v, I& t)
{
bool found = (std::find(v.begin(), v.end(), t) != v.end());
return found;
}
And use it like this:
void Project::AddPlatform(const char* platform)
{
if (!vectorContains(platforms, platform))
platforms.push_back(platform);
}
Snapshot of example can be found here:
https://github.com/tapika/cppscriptcore/blob/b7f3d62747494a52a440482e841ffb016a3fc56e/SolutionProjectModel/Project.cpp#L13