" ++ *这"轰然 [英] "++*this" crashing

查看:83
本文介绍了" ++ *这"轰然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在递增列表迭代器m_item在我的.cpp文件中


i am incrementing a list iterator "m_item" in my .cpp file


m_item ++
m_item++



m_item._ptr-> _next显示有效项目。


但在图书馆重载函数中用于++


1> _Myt_iter operator ++(int)

2> {// postincrement

3> _Myt_iter _Tmp = * this;

4> ++ * this;

5> return(_Tmp);

6> }


(第4行)++ *这是崩溃...它没有在下一个

指针中显示任何项目。


有什么问题?


谢谢,

srinivas

m_item._ptr->_next is showing the valid item.

but in the library overloaded function for ++

1 >_Myt_iter operator++(int)
2 > { // postincrement
3 > _Myt_iter _Tmp = *this;
4 > ++*this;
5 > return (_Tmp);
6 > }

(line 4)++*this is crashing...it is not showing any item in its next
pointer.

what is the problem?

thanks,
srinivas

推荐答案



srinivas napsal:

srinivas napsal:

hi,

i am increment a a list iterator" m_item"在我的.cpp文件中

i am incrementing a list iterator "m_item" in my .cpp file

m_item ++
m_item++



m_item._ptr-> _next显示有效项目。


但在图书馆重载函数中用于++


1> _Myt_iter operator ++(int)

2> {// postincrement

3> _Myt_iter _Tmp = * this;

4> ++ * this;

5> return(_Tmp);

6> }


(第4行)++ *这是崩溃...它没有在下一个

指针中显示任何项目。


有什么问题?


谢谢,

srinivas


m_item._ptr->_next is showing the valid item.

but in the library overloaded function for ++

1 >_Myt_iter operator++(int)
2 > { // postincrement
3 > _Myt_iter _Tmp = *this;
4 > ++*this;
5 > return (_Tmp);
6 > }

(line 4)++*this is crashing...it is not showing any item in its next
pointer.

what is the problem?

thanks,
srinivas



你应该在这里发布最小化的可编辑的崩溃示例。

没有它我们只能猜测。

You should post here minimized compilable example which crashes.
Without it we can only guess.


hi Ondra
感谢您的回复。


是对另一个迭代器的迭代器赋值有效吗?

i发现这个赋值正在产生问题。
hi Ondra
thanks for reply.

is assignment of an iterator to another iterator valid?
i have found this assignment is creating problem.

> m_iter_item = iter_item;
m_iter_item ++;
>m_iter_item = iter_item;
m_iter_item++;



srinivas


Ondra Holub写道:

srinivas

Ondra Holub wrote:


srinivas napsal:
srinivas napsal:

hi,

i am递增列表迭代器m_item在我的.cpp文件中

i am incrementing a list iterator "m_item" in my .cpp file

m_item ++
m_item++



m_item._ptr-> _next显示有效项目。


但在图书馆重载函数中用于++


1> _Myt_iter operator ++(int)

2> {// postincrement

3> _Myt_iter _Tmp = * this;

4> ++ * this;

5> return(_Tmp);

6> }


(第4行)++ *这是崩溃...它没有在下一个

指针中显示任何项目。


有什么问题?


谢谢,

srinivas

m_item._ptr->_next is showing the valid item.

but in the library overloaded function for ++

1 >_Myt_iter operator++(int)
2 > { // postincrement
3 > _Myt_iter _Tmp = *this;
4 > ++*this;
5 > return (_Tmp);
6 > }

(line 4)++*this is crashing...it is not showing any item in its next
pointer.

what is the problem?

thanks,
srinivas



你应该在这里发布最小化的可编辑的崩溃示例。

没有它我们只能猜测。


You should post here minimized compilable example which crashes.
Without it we can only guess.




srinivas napsal:

srinivas napsal:

hi Ondra

感谢您的回复。


是将迭代器赋值给另一个有效的迭代器吗?

i发现这个赋值正在产生问题。 />
hi Ondra
thanks for reply.

is assignment of an iterator to another iterator valid?
i have found this assignment is creating problem.

m_iter_item = iter_item;

m_iter_item ++;
m_iter_item = iter_item;
m_iter_item++;



一般来说,它是有效的。我认为你有不正确的operator =。我不知道你的迭代器的内部结构,所以我只是猜测。

In general, it is valid. I think you have incorrect operator=. I do not
know internal structures of your iterator, so I am only guessing.


>

srinivas


Ondra Holub写道:
>
srinivas

Ondra Holub wrote:

srinivas napsal:
srinivas napsal:

hi,

i am递增列表迭代器m_item在我的.cpp文件中

>

m_item ++

>

m_item._ptr-> _next是显示有效项目。

>

但是在库中重载函数为++

>

1> _Myt_iter operator ++(int)

2> {// postincrement

3> _Myt_iter _Tmp = * this;

4> ++ * this;

5> return(_Tmp);

6> }

>

(第4行)++ *这是崩溃......它没有在下一个显示任何项目

指针。

>

有什么问题?

>

谢谢,

srinivas

i am incrementing a list iterator "m_item" in my .cpp file
>
m_item++
>
m_item._ptr->_next is showing the valid item.
>
but in the library overloaded function for ++
>
1 >_Myt_iter operator++(int)
2 > { // postincrement
3 > _Myt_iter _Tmp = *this;
4 > ++*this;
5 > return (_Tmp);
6 > }
>
(line 4)++*this is crashing...it is not showing any item in its next
pointer.
>
what is the problem?
>
thanks,
srinivas



你应该在这里发布最小化崩溃的可编译示例。

没有它我们只能猜测。

You should post here minimized compilable example which crashes.
Without it we can only guess.


这篇关于" ++ *这"轰然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆