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.
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, notExcept
type.For the second one, it stands to reason that there should be no copying, because
throw Except()
throws a temporaryExcept
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)
tocatch(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.