I have the following piece of code:
for (auto v_it = v.begin(); v_it != v.end(); ++v_it)
where the v is a vector with some elements. I needed to write a custom begin() and end() functions for my custom iterator, where begin() points to the first element in the data structure (container) and end() on the pointer after the last element in the data structure.
Is it possible to have access to the v in v.begin() in my begin() method, if the method is defined as const_iterator begin() const { ... }, because as now I have a array (table) of linked lists in my class, where I just pass the table to the begin and end methods, but when I have the vector v I am not sure how to get the first and last element of these?
Thank you very much!
Aucun commentaire:
Enregistrer un commentaire