Check if value exists in array?

How can I check if a value exists inside of an array.

Something like this:
1
2
3
4
if(99 in ourArray)
{
   //Do stuff
}

Last edited on
You could use std::find.

1
2
3
4
if (std::find(std::begin(ourArray), std::end(ourArray), 99) != std::end(ourArray))
{
	// Do stuff
}


http://www.cplusplus.com/reference/algorithm/find/
Topic archived. No new replies allowed.