cpp_weekly
cpp_weekly copied to clipboard
move constructor or use smart pointer
I have some question. Here is my code, it has question I want to ask everyone.
https://godbolt.org/z/3d3YzoW3h
My English is a bit poor, so if people have difficulty understanding what I write, I hope people can ignore it.
Moves are usually pretty cheap/fast. With a container like std::vector it usually just has to swap a couple pointers and sizes regardless of how many elements are contained. Just do what makes the code simpler for now. If you encounter performance issues, you can use a profiler to identify the actual bottlenecks.