What is the difference between a custom transform and a user-defined operator?

In the context of operator overloading, what is the difference between a user transformation and a user-defined operator?

+3
source share
3 answers

"Custom conversions let you specify object conversions with constructors or transform functions. Custom transforms are implicitly used in addition to standard transforms to transform initializers, function arguments, return function values, expression operands, iteration expression management, choice statements, and explicit type conversions."

http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=/com.ibm.xlcpp8a.doc/language/ref/cplr383.htm

, () ++, .

http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html

0

:

  • , ( , )

  • - operator DESTTYPE()

, operator , .

(: [class.conv] ++.)

+4

There is C++no concept of user statements that can be overloaded. Only existing operators, with the exception of a few ( . , . * , :: , ?: , Sizeof ), can be overloaded.

+1
source

Source: https://habr.com/ru/post/1796440/


All Articles