why "[]" operands is not working with vectors? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why "[]" operands is not working with vectors?

my line of code vector<int>::iterator ti = find(p.begin(),p.end(),p[it]); error: "no operator \"[]\" matches these operands -- operand types are: std::vector<int, std::allocator<int>> [ std::_Vector_iterator<std::_Vector_val<std::conditional_t<true, std::_Simple_types<int>, std::_Vec_iter_types<int, size_t, ptrdiff_t, int *, const int *, int &, const int &>>>> ]", "startLineNumber": 15, "startColumn": 56, "endLineNumber": 15, "endColumn": 56 }

7th Jun 2020, 5:41 PM
Abhishek Dimri
Abhishek Dimri - avatar
2 Answers
+ 1
What is 'it' in p[it]? Error says 'it' is not int. Please share some more code snippet.
7th Jun 2020, 5:50 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
0
I didn't found find call
8th Jun 2020, 5:14 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar