Join GitHub today
include/denc: remove nullptr runtime magic boundedness check #13889
We were passing (const T)nullptr to bound_encode so that we
So drop these checks and rely on the developer to implement a
Signed-off-by: Sage Weil firstname.lastname@example.org
Here is a fix!
You may ask "@adamemerson! What the heck is the point of that cast?"
If you do ask this, I shall tell you that maps, sets, multimaps, multisets, unordered_maps, unordered_sets, and associative containers generally don't have the value type you would expect. Iterators into maps do not return std::pair<key, value>& but instead std::pair<const key, value>&. This is why we define T explicitly in the container traits. For most containers it's just value_type, but for map it's explicitly std::pair<key, value>.
Without this the calls to denc fail, because there is no denc_traits for, for example, const int. Sticking the cast in just ensures we call denc on a reference of the appropriate type.