BDE 4.19.0 Release
Schedule
The BDE team announces that the BDE 4.19.0 production release was completed on Monday, Jan 27th, 2025.
BDE 4.19.0 Release Highlights
New Transparent Hasher Tailored for Strings: bdlb::TransparentStringHash
This release introduces the component bdlb::TransparentStringHash that
provides a transparent hash function that is specifically tailored to be used
with bsl::string keys.
A transparent hash function combined with using a transparent comparator allows
one to avoid unnecessary conversions when looking up a key in unordered
containers. The most common use case is to avoid constructing a
bsl::string when looking up a string key represented by a const char *
or bsl::string_view. Without transparent hash and comparator, looking up a
const char * in a bsl::unordered_set<bsl::string> would incur a
conversion to bsl::string and possibly an unnecessary allocation.
Furthermore, attempting to look up a bsl::string_view fails to compile
since there is no implicit conversion from bsl::string_view to
bsl::string:
bsl::unordered_set<bsl::string> set{"hello", "goodbye"};
assert(set.contains("hello")); // Passes, but creates a temporary ``bsl::string``!
assert(set.contains(bsl::string_view("hello"))); // Does not compile - no implicit conversion!
Although using bdlb::TransparentHash and bdlb::TransparentEqualTo
allows one to look up a bsl::string_view and removes the unnecessary
conversion, it comes with a surprising result where strings seemingly having
the same value are no longer found in the set:
bsl::unordered_set<bsl::string,
bdlb::TransparentHash,
bdlb::TransparentEqualTo> set{"hello", "goodbye"};
assert(set.contains("hello")); // No allocation, assertion FAILS!
assert(set.contains(bsl::string_view("hello"))); // No allocation, assertion PASSES.
This behavior is due to the default hasher, to which bdlb::TransparentHash
delegates, not treating const char * as a string, but rather as a raw
pointer, hashing the pointer value itself. With
bdlb::TransparentStringHash, however, const char * is treated as a
C-style string and is hashed accordingly, producing the expected result:
bsl::unordered_set<bsl::string,
bdlb::TransparentStringHash,
bdlb::TransparentEqualTo> set{"hello", "goodbye"};
assert(set.contains("hello")); // No allocation, assertion PASSES.
assert(set.contains(bsl::string_view("hello"))); // No allocation, assertion PASSES.
Fixed DRQSs:
Summary |
|---|
Add real bdlat package documentation |
FlatHashSet/FlatHashMap: support transparent Hash/Equal |
sim_cpp11_features.pl add format tool suppression to generated code |
please correct balcl_commandline.t.cpp compile warning |
please address baea_commandline.t.cpp compile warning |
please correct/reduce balcl_commandline case 28 intermittent issue |
Add transparent ‘at’ and ‘operator[]’ to maps. |
Implement transparent ‘insert_or_assign’ |
Add std:: overloads for bdlb::TransparentStringHash |
bsl-internal fails to build with C++23 and requires updates. |
bsl::hardware_destructive_interference_size |
please correct unix-linux---clang-15 bsl test driver compile warnings |
Delete dangling reference to baet in baetzo.dep |
Clean up the transparent tests in the unordered containers |
bdlb_nullablevalue TD fails in c++23. |
sim_cpp11_features modifying Generated on with no other changes |
reduce bde repo NB warnings |
clean bal opt_dbg_64_safe_ubsan_cpp20 warnings |
Docs rendering missing paragraph breaks |