Alwin Arrasyid
Jul 29, 2024

--

Writing copy assignment operator and copy constructor is as much of a hassle as writing move assignment operator and move constructor.

Quoting this subheading here, then copy semantics also messed RAII up. You can't copy an object of a class that manages a raw pointer without writing a copy assignment operator and copy constructor fist. Unless you want a double free.

Using the right kind of smart pointer for your use-cases frees you from writing both move and copy assignment operators and constructors.

--

--

Alwin Arrasyid
Alwin Arrasyid

Written by Alwin Arrasyid

Principal Engineer, working on better IoT solutions and enabling AI on the edge.

No responses yet