解引用运算符重载如何真正起作用? [英] How does dereference operator overloading really work?

查看:83
本文介绍了解引用运算符重载如何真正起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对此有好感吗?这本教科书我已经为此花了很多钱?具体来说,我试图用2个级别取消引用

类型转换而不是1,即


X< T> - > z => Y'LT; T> - > z => T * - > z



* X< T> => * Y< T> => * T

Y< T>转换必须以表达式temp完成。在X的方法体内无法完成




我想我有点工作 - >运算符,但相同的

技术对*运算符不起作用。 *似乎消耗了



Joe Seigh

Is there a good write on this. The textbooks I have fluff over
on this? Specifically, I trying to dereference with 2 levels
of type conversion not 1, i.e.

X<T> -> z => Y<T> -> z => T* -> z
and
*X<T> => *Y<T> => *T
The Y<T> conversion has to be done as an expression temp. It cannot be done
inside a method body for X.

I think I sort of had it working for the -> operator but the same
technique doesn''t work for the * operator. The * appears to getting
consumed.

Joe Seigh

推荐答案

Joe Seigh写道:
Joe Seigh wrote:
这是否写得很好。这本教科书我对此嗤之以鼻?具体来说,我尝试用2级来取消引用类型转换而不是1,即,< T> X< X>。 - > z => Y'LT; T> - > z => T * - > z

* X< T> => * Y< T> => * T

Y< T>转换必须以表达式temp完成。在X的方法体内部无法完成。

我认为我有点工作 - >运算符,但相同的技术对*运算符不起作用。 *似乎被消耗了。
Is there a good write on this. The textbooks I have fluff over
on this? Specifically, I trying to dereference with 2 levels
of type conversion not 1, i.e.

X<T> -> z => Y<T> -> z => T* -> z
and
*X<T> => *Y<T> => *T
The Y<T> conversion has to be done as an expression temp. It cannot be done
inside a method body for X.

I think I sort of had it working for the -> operator but the same
technique doesn''t work for the * operator. The * appears to getting
consumed.




我真的没有得到你想要做的事情。也许张贴一大块o

代码主要编译并告诉我们你想做什么?



I don''t really get what you''re trying to do. Maybe posting a chunk o
code that mostly compiles and show us what you''d like to do ?


Joe Seigh写道:
Joe Seigh wrote:
这是否写得很好。这本教科书我对此嗤之以鼻?


呃......有人换了键盘上的''''和''''键吗?

具体来说,我试图取消引用具有2级的类型转换而不是1,即,X< T> - > z => Y'LT; T> - > z => T * - > z

* X< T> => * Y< T> => * T

Y< T>转换必须以表达式temp完成。在X的方法体内部无法完成。

我认为我有点工作 - >运算符,但相同的技术对*运算符不起作用。 *似乎消耗了
Is there a good write on this. The textbooks I have fluff over
on this?
Uh... Did somebody swap the ''?'' and ''.'' keys on your keyboard?
Specifically, I trying to dereference with 2 levels
of type conversion not 1, i.e.

X<T> -> z => Y<T> -> z => T* -> z
and
*X<T> => *Y<T> => *T
The Y<T> conversion has to be done as an expression temp. It cannot be done
inside a method body for X.

I think I sort of had it working for the -> operator but the same
technique doesn''t work for the * operator. The * appears to getting
consumed.




对不起,我完全不知道你在问什么。

-Kevin

-

我的电子邮件地址有效,但会定期更改。

要联系我,请使用地址来自最近的帖子。



I''m sorry, I have absolutely no idea what you are asking.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.





Gianni Mariani写道:


Gianni Mariani wrote:


Joe Seigh wrote:
这是否写得很好。这本教科书我对此嗤之以鼻?具体来说,我尝试用2级来取消引用类型转换而不是1,即,< T> X< X>。 - > z => Y'LT; T> - > z => T * - > z

* X< T> => * Y< T> => * T

Y< T>转换必须以表达式temp完成。在X的方法体内部无法完成。

我认为我有点工作 - >运算符,但相同的技术对*运算符不起作用。 *似乎被消耗了。
Is there a good write on this. The textbooks I have fluff over
on this? Specifically, I trying to dereference with 2 levels
of type conversion not 1, i.e.

X<T> -> z => Y<T> -> z => T* -> z
and
*X<T> => *Y<T> => *T
The Y<T> conversion has to be done as an expression temp. It cannot be done
inside a method body for X.

I think I sort of had it working for the -> operator but the same
technique doesn''t work for the * operator. The * appears to getting
consumed.



我真的不知道你想要做什么。也许发布一大块代码,主要编译并告诉我们你想做什么?



I don''t really get what you''re trying to do. Maybe posting a chunk o
code that mostly compiles and show us what you''d like to do ?




T * X< T> :: operator - >();


提供一级转换。我不想要那个。像

Y< T> X< T> :: operator - >();

T * Y< T> :: operator - >();

我需要Y< T> ;温度生成。严格来说,我认为没有

重载 - >应该是需要的。类型转换应该足够

如果我有一个来自X< T>的转换路径了。到T *。


Joe Seigh



T * X<T>::operator ->();

gives one level of conversion. I don''t want that. Something like
Y<T> X<T>::operator ->();
T * Y<T>::operator ->();
I need a Y<T> temp generated. Strictly speaking, I would think no
overloading of -> should be needed. Type conversion should be sufficient
if I have a conversion path from X<T> to T*.

Joe Seigh


这篇关于解引用运算符重载如何真正起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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