STL iterator "de-referencing" question
Hey,
I was writing something and made the statement:
Code:
return *(vector_name.end());
And it threw a memory fault, changed it to
Code:
return vector_name[vector_name.size() - 1];
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:
Code:
object_name a;
return a;
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 :(.