@Yankes
>this is wrong signature for move constructor.
Well, I made them const so that I could more easily determine what was being copied, and what was being moved. That allowed me to find a few places in code which I fixed. But yeah, move constructor with const doesn't make sense.
>your version had three problems:
Nice catch. I should mention that, if a sav file is missing ---, it's corrupted, because the header contains critical data.
>I had helper class `class RawData`
I should probably have made readFileRaw and getYamlSaveHeaderRaw return RawData instead of char*.
YamlRootNodeReader currently copies that data to ryml::Tree's buffer (arena), so there's no need to keep that data.
I could make a version that would use parse_in_place instead of parse_in_arena, but then data would have to outlive YamlRootNodeReader instance, which means it would have to keep the data. It's not worth the effort, because it only makes parsing maybe 1% faster (skips 1 memory allocation + copy).
Anyway, yeah, unique_ptr with RawData would probably be a better solution instead of YamlRootNodeReader calling free itself. Probably also safer, because if there's an exception, the free doesn't get called.
Should I change stuff to use unique_ptr + RawData?
> and what was being moved
is this constructor even called? I recall that overload resolution always avoid this signature and `const&` is always preferred over `const&&`.
> Should I change stuff to use unique_ptr + RawData?
Yes, but RawData is unique_ptr + size. This means when you use one, you use both. For now we can replace `char*, size_t` args by `RawData`.
> because it only makes parsing maybe 1% faster
Ok, if we remove other allocations then it would rise to araund 4%? Probably too much changes for small profit. For now we can keep as is, maybe in future after we stabilize codebase we can improve things here (like script too).