KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I thought &*vector::end() was undefined behavior... until I saw some post refer to Stroustrup's code : void vector_pointer_test(element_t* first, element_t* last, int number_of_times) { vector<element_t> container(first, last); // &*container.begin() gets us a pointer to the first element sort(&*container.begin(), &*container.end()); unique(&*container.begin(), &*container.end()); } Is dereferencing an end() iterator undefined behavior, or is it valid?
Tags (comma-separated)
Save Edits
Cancel