In erase function of stl of list (auto it=l.begin()+3) does not work…But it++ works…it++ means it+1…how it +1 works but auto it=l.begin()+3 not…
List Stl ll video.....confusion
Ambuj this is because lists are not provided contiguous memory, hence this won’t work!
You can use such thing with vectors
Why it +1 is working …it will also search for next contiguous memory only…
You can’t do it+1 as well!, you can only do it++ which automatically moves iterator to next element as current element has access only to next one!
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.