Checking an unsuccessful registry search

An instrument registry runs this C++17 search with the required headers included. No operation changes the vector during or after the search.


C++
std::vector codes{210, 315, 420};
auto pos = std::find(codes.begin(), codes.end(), 515);


Complete the safety rule using an expression that calls end() directly on codes. Write the expression without spaces: reading *pos is permitted only when pos is not equal to .

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More C++ Standard Library Questions: