3. The method indexOf, part of the List interface, returns the index of the first occurrence of an object in a List. What does the following code fragment do?
#include <iostream>
#include <list>
int main() {
std::list<int> myList = {10, 20, 30, 40, 50};
int value = 30;
auto it = std::find(myList.begin(), myList.end(), value);
if (it != myList.end()) {
int index = std::distance(myList.begin(), it);
std::cout << "Index of " << value << " in the list: " << index << std::endl;
} else {
std::cout << value << " not found in the list" << std::endl;
}
return 0;
}