The correct implementation for a post-decrement operator for a doubly linked lis
ID: 3869397 • Letter: T
Question
The correct implementation for a post-decrement operator for a doubly linked list iterator is (done as an inline function) node_iterator operator --0 { node_iterator original(*this): current = current rightarrow previous(): return original: } node_iterator operator --(int) { node_iterator original(*this): current = current rightarrow previous(): return original: } node_iterator operator --(int) { node_iterator original = current: current = current rightarrow next0: return original: } node_iterator operator --(int) { current = current rightarrow previous(): return *this: }Explanation / Answer
Question 22:
The correct implementation for a post-decrement operator for a doubly linked list iterator is( done as an inline
function)
Answer: Option
b) node_iterator operator --(int) {
node_iterattor original(*this);
current=current->previous();
return original;
}
Explanation:
const_iterator operator--(int) {
const_iterator ret=*this;
itm = itm->prev;
return ret;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.