Как проверить, есть ли у моего массива элемент, который я ищу?
В Java я бы сделал что-то вроде этого:
Foo someObject = new Foo(someParameter);
Foo foo;
//search through Foo[] arr
for(int i = 0; i < arr.length; i++){
if arr[i].equals(someObject)
foo = arr[i];
}
if (foo == null)
System.out.println("Not found!");
else
System.out.println("Found!");
Но в С++ я не думаю, что мне разрешено искать, если объект имеет значение null, и что будет решением С++?