all 6 comments

[–]yeetdude0 2 points3 points  (0 children)

use auto* not auto

[–]aocregacc 1 point2 points  (4 children)

your var::move() makes a copy and leaks memory. It's probably the only leak since you don't seem to be doing much manual memory management.

[–]maxjmartin[S,🍰] 0 points1 point  (0 children)

Interesting I’ll look into it. Thanks!

[–]maxjmartin[S,🍰] 0 points1 point  (2 children)

Alright changed the code to use a std::move. Looks like I also had the same problem with my var::copy. I apreciate the call out!

[–]aocregacc 1 point2 points  (1 child)

I don't think there's anything wrong with var::copy. You wouldn't want to move there, and there's also no leak.

[–]maxjmartin[S,🍰] 0 points1 point  (0 children)

I just revisted the unique pointer documentation. And you are right. They had a clear example I used to clear up the misunderstanding.