c++ - 关于 throw 和拷贝构造
ringa_lee
ringa_lee 2017-04-17 13:51:18
0
1
562
ringa_lee
ringa_lee

ringa_lee

reply all(1)
Ty80

There is no problem with the first picture here and there is no need to copy it. Because the parameters you capture are of Except& type, not Except type.

For the second one, it stands to reason that there should be no copying, because throw Except() throws a temporary Except object, and what is captured is its reference, so there is no need to construct another object. of.

The second output result should be changed from catch(Except& e) to catch(Except e).

throw Except() It should not only be able to compile in VS, but at least there will be no problem under g++4.8.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template