What is the difference between the iterators defined here.
vector
//put 10 values into vec
const vector
vector
The difference here is what we are promising not to change. With regard to p, it is p itself that can’t be changed. With q, it is what q points to that can’t be changed.
Example:
*p = 0; //OK to change vec where p points,
p = vec.end();//error: l-value specifies const object
//can’t change p itself
q = vec.end();//OK to change q
*q = 0; //error l-value specifies const object
//can’t change vec where q points.
You might also like to view...
To move from one comment to the next, you click the Next button in the:
A) Comments group on the View Tab. B) Comments group on the Review Tab. C) Review group on the Comments Tab. D) View group on the Comments Tab.
How are hackers commonly categorized?
What will be an ideal response?