cornelius / libkode

C++ code generation library
8 stars 11 forks source link

Port all schema (XSD::) classes to unique_ptr and add move operations #42

Closed dfaure-kdab closed 3 years ago

dfaure-kdab commented 3 years ago

This partially reverts the previous commit in XmlElement to choose a more optimal solution. The copy constructor is as before (instead of calling a too-generic std::swap that will create more temporaries). The move constructor was allocating needlessly, we just need to grab the pointer of the other instance. So instead this now uses unique_ptr to simplify the destructor and because it gives us the move operations automatically.

Independently from move operations, this code review also spotted a number of missing calls to base classes in the existing operator=. Proved by unittests, and fixed.

dfaure-kdab commented 3 years ago

Urgh, nasty regression in clang-format 10.0 which outputs { } instead of {} for empty bodies. All I can find about it is https://reviews.llvm.org/D37979

I'll fix it by hand... (well, with a perl one-liner) :)

dfaure-kdab commented 3 years ago

@martonmiklos this is ready for review now