Passing unique_ptr compiles to more indirections than passing raw or even wrapped pointer

80 Views Asked by At

I'm using godbolt.org to compare the compiled code, with -O3 as optimization flag.

I tried a few things, as currently I'm trying to optimize some code, and so I came to this:

enter image description here

So it comes out that passing unique_ptr requires more indirections than passing a raw or even wrapped pointer. Why does it happen, and how can I overcome it?

0

There are 0 best solutions below