On Sep 20, 2020, at 6:52 PM, Maximilian Riemensberger via Boost
wrote: - The library is inconsistent about `shrink_to_fit`. `object does not have it, `array` has it. Also the documentation does not state what `shrink_to_fit` does, basically repeating the errors of `std::vector`. I firmly believe that the function should either be removed or clear and precise semantics should be documented. In it's current state the following question comes to mind: Why would I ever want to call it?
Personally I prefer it keep it. In my day job I deal with very large json structures (sometimes over 1GB), and they get copied around. Boost.JSON is already more efficient than what we currently use, but I’m greedy. :) As an example, Boost.JSON's serializer allocates a lot more memory in the returned string than is actually used, in my testing. Using std::string::shrink_to_fit() it dropped about 50% of the memory usage. If std::string didn’t have such a function, I wouldn’t get that benefit. But I agree it should be clear what it does in the docs. -hadriel