开发者

Can anyone explain this paragraph of the current C++0x standard draft?

开发者 https://www.devze.com 2023-02-23 05:42 出处:网络
Can anyone explain this statement from ISO N3242 §3.2, 2nd point A member of a set of candidate functions is odr-used if it is selected by

Can anyone explain this statement from ISO N3242 §3.2, 2nd point

A member of a set of candidate functions is odr-used if it is selected by overload resolution when referred to from a potentiallyevaluated expression. [ Note: This covers calls to named functions (5.2.2), operator overloading (Clause 13),user-defined conversions (12.3.2), allocation function for placement new (5.3.4), as well as non-default initialization(8.5).

ISO Standard 2003 : says

开发者_运维百科

An overloaded function is used if it is selected by overload resolution when referred to from a potentially-evaluated expression. [Note: this covers calls to named functions (5.2.2), operator overloading (clause 13), user-defined conversions (12.3.2), allocation function for placement new (5.3.4), as well as non-default initialization (8.5).

What is the actual difference in these statements?

Can any one explain this with the help of an example/program?


The terminology "overloaded function" is (slightly) ambiguous between referring to the member or to the set. C++11 clarifies that functions that are never selected from a potentially-evaluated expression are not odr-used.

The term "odr-used" is new with C++11. It essentially means that the given object might be represented in the final, compiled binary file, and that the one-definition rule applies.


The paragraph was changed to fix the Core Issue #1174. There you can find the example which shows the difference.

0

精彩评论

暂无评论...
验证码 换一张
取 消