On 08/05/2015 22:13, Jean-Marc Lasgouttes wrote:
With C++11, auto_ptr is deprecated and we get warnings.
I am trying to see how we can get rid of it. unique_ptr is new to
C++11, so I'd rather avoid that.
Why that?
unique_ptr is supported since gcc 4.4 released in 2009:
https://gcc.gnu.org/gcc-4.4/changes.html
I guess this is old enough...
But quite frankly C++11 is very nice and moving to gcc 4.7 would enable
almost full C++11...; "auto" for example would improve the readability
of the code significantly. C++11 thread are quite nice as well if you
want to get rid of Qt thread in the core.
I have many places like in the patch below. Is there a reason why I
should keep the auto_ptr instead of a naked pointer?
In this particular example no real advantage IMO.
What is it good for?
Mainly avoid memory leak for incautious programmers :-)
Abdel.