简体   繁体   English

forward_list :: splice_after(const_iterator pos,forward_list&other,const_iterator i)功能

[英]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". cplusplus.com说这个函数应该“在我之后直接移动元素”。
Yet cppreference.com says that it splices the element AT i. 然而cppreference.com说它拼接了AT i元素。
MSvisual studio agrees with cplusplus.com. MSvisual studio同意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). 我倾向于认为移动“在i之后”更合乎逻辑(并且没有花费N时间来找到前一个节点)。

(PS: no forward-list tag?) (PS:没有前瞻性标签?)

23.3.4.6 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. 效果:将i后面的元素插入* this,跟随位置,并将其从x中删除。 The result is unchanged if position == i or position == ++i. 如果position == i或position == ++ i,结果不会改变。 Pointers and references to *i continue to refer to the same element but as a member of *this. 指针和对* i的引用继续引用相同的元素,但作为* this的成员。 Iterators to *i (including i itself) continue to refer to the same element, but now behave as iterators into *this, not into x. 迭代到* i(包括我自己)继续引用相同的元素,但现在表现为迭代器到* this,而不是x。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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