$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Hadriel Kaplan (hadrielk_at_[hidden])
Date: 2020-09-21 00:57:22
> On Sep 20, 2020, at 6:52 PM, Maximilian Riemensberger via Boost <boost_at_[hidden]> 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