简体   繁体   中英

forward_list::splice_after( const_iterator pos, forward_list& other, const_iterator i ) functionality

I'm reading different interpretations of the way this function should work.

cplusplus.com says that this function should "move the element directly AFTER i".
Yet cppreference.com says that it splices the element AT i.
MSvisual studio agrees with cplusplus.com. However what is actually the correct behaviour? I tend to think moving "after i" is more logical (& doesn't take N time to find the preceding node).

(PS: no forward-list tag?)

23.3.4.6

void splice_after(const_iterator position, forward_list& x, const_iterator i);
void splice_after(const_iterator position, forward_list&& x, const_iterator i);

Effects: Inserts the element following i into *this, following position, and removes it from x. The result is unchanged if position == i or position == ++i. Pointers and references to *i continue to refer to the same element but as a member of *this. Iterators to *i (including i itself) continue to refer to the same element, but now behave as iterators into *this, not into x.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM