Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e9.22## #114

Closed
l3518563 opened this issue Apr 20, 2017 · 0 comments
Closed

e9.22## #114

l3518563 opened this issue Apr 20, 2017 · 0 comments

Comments

@l3518563
Copy link

l3518563 commented Apr 20, 2017

大神,刚看了9.22的代码相关问题的讨论,学习到了很多东西,现在我有一个疑问:
++cursor;
mid = iv.begin() + cursor;
这两句中如果++cursor,那第二句的mid是不是会随着向后移动一位,如果是的话我的理解是每次循环mid都向后移动一位那while循环会历遍iv,结果应该是每个等于给定值的元素前都会添加一个*2的新元素。可是编译结果确实是在中间位置以后就没有再插入元素了。我想不太明白其中的道理,希望能解答一下。
ps:我试着删除了++cursor,发现编译结果没有改变,意味着什么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant