STL iterator "de-referencing" question
I was writing something and made the statement:
And it threw a memory fault, changed it to
And it worked fine. I realize what the latter does, but my question is why the first one doesn't work? If I "dereference" the iterator, wouldn't it be the same as:
return vector_name[vector_name.size() - 1];
Or is there something different about iterators? I know you can use them by just dereferencing them as if they were pointers...but I've heard from a few people that they're not "really" pointers..but they act it, can anybody give me some insight here? I'd hate to make the same mistake again :(.