11#ifndef INCLUDED_BDLC_FLATHASHTABLE_CPP03
12#define INCLUDED_BDLC_FLATHASHTABLE_CPP03
63#ifdef COMPILING_BDLC_FLATHASHTABLE_H
69struct FlatHashTable_ImplUtil;
72class FlatHashTable_IteratorImp;
75bool operator==(
const class FlatHashTable_IteratorImp<ENTRY>&,
76 const class FlatHashTable_IteratorImp<ENTRY>&);
87class FlatHashTable_IteratorImp
90 typedef FlatHashTable_GroupControl GroupControl;
94 const bsl::uint8_t *d_controls_p;
95 bsl::size_t d_additionalLength;
116 const bsl::uint8_t *controls,
117 bsl::size_t additionalLength);
157template <
class ENTRY>
158bool operator==(
const FlatHashTable_IteratorImp<ENTRY>& a,
159 const FlatHashTable_IteratorImp<ENTRY>& b);
167template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
171 typedef FlatHashTable_GroupControl GroupControl;
172 typedef FlatHashTable_ImplUtil ImplUtil;
173 typedef FlatHashTable_IteratorImp<ENTRY> IteratorImp;
191 bsl::uint8_t *d_controls_p;
193 bsl::size_t d_capacity;
194 int d_groupControlShift;
207 static bsl::size_t findAvailable(bsl::uint8_t *
controls,
224 bsl::size_t indexOfKey(
bool *notFound,
226 bsl::size_t hashValue);
239 template <
class LOOKUP_KEY>
241 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
242 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
244 indexOfKeyTransparent(
bool *notFound,
245 const LOOKUP_KEY& key,
246 bsl::size_t hashValue)
250 bsl::size_t index = findTransparentKey(key, hashValue);
252 if (index == d_capacity) {
261 index = findAvailable(d_controls_p, index, d_capacity);
276 void rehashRaw(bsl::size_t newCapacity);
285 bsl::size_t findKey(
const KEY& key, bsl::size_t hashValue)
const;
292 template <
class LOOKUP_KEY>
294 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
295 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
297 findTransparentKey(
const LOOKUP_KEY& key, bsl::size_t hashValue)
const
303 bsl::size_t index = (hashValue >> d_groupControlShift)
305 bsl::uint8_t hashlet =
static_cast<bsl::uint8_t
>(
309 bsl::uint8_t *controlStart = d_controls_p + index;
310 ENTRY *entryStart = d_entries_p + index;
312 GroupControl groupControl(controlStart);
313 bsl::uint32_t candidates = groupControl.match(hashlet);
317 ENTRY *entry = entryStart + offset;
320 d_equal(ENTRY_UTIL::key(*entry), key))) {
321 return index + offset;
338 bsl::size_t minimumCompliantCapacity(bsl::size_t minimumCapacity)
const;
381 FlatHashTable(
const FlatHashTable& original,
418 FlatHashTable&
operator=(
const FlatHashTable& rhs);
435 template <
class KEY_TYPE>
464 template <
class LOOKUP_KEY>
466 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
467 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
478 return bsl::make_pair(it1, it2);
481#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
484#ifndef BDLC_FLATHASHTABLE_VARIADIC_LIMIT
485#define BDLC_FLATHASHTABLE_VARIADIC_LIMIT 10
487#ifndef BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A
488#define BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A BDLC_FLATHASHTABLE_VARIADIC_LIMIT
490#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 0
495#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 1
496 template<
class ARGS_01>
501#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 2
502 template<
class ARGS_01,
509#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 3
510 template<
class ARGS_01,
519#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 4
520 template<
class ARGS_01,
531#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 5
532 template<
class ARGS_01,
545#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 6
546 template<
class ARGS_01,
561#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 7
562 template<
class ARGS_01,
579#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 8
580 template<
class ARGS_01,
599#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 9
600 template<
class ARGS_01,
621#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_A >= 10
622 template<
class ARGS_01,
648 template<
class... ARGS>
658 bsl::size_t
erase(
const KEY& key);
663 template <
class LOOKUP_KEY>
665 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
666 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
709 template <
class LOOKUP_KEY>
711 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
712 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
714 find(
const LOOKUP_KEY& key)
718 bsl::size_t index = findTransparentKey(key, d_hasher(key));
719 if (index < d_capacity) {
720 return iterator(IteratorImp(d_entries_p + index,
721 d_controls_p + index,
722 d_capacity - index - 1));
743 template <
class LOOKUP_KEY>
745 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
746 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
752 bsl::size_t hashValue = d_hasher(key);
753 bsl::size_t index = indexOfKeyTransparent(¬Found,
758 ENTRY_UTIL::construct(
763 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
770 d_controls_p + index,
771 d_capacity - index - 1),
787 template <
class INPUT_ITERATOR>
788 void insert(INPUT_ITERATOR first, INPUT_ITERATOR last);
797 void rehash(bsl::size_t minimumCapacity);
811 void reserve(bsl::size_t numEntries);
817#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
820#ifndef BDLC_FLATHASHTABLE_VARIADIC_LIMIT
821#define BDLC_FLATHASHTABLE_VARIADIC_LIMIT 10
823#ifndef BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D
824#define BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D BDLC_FLATHASHTABLE_VARIADIC_LIMIT
826#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 0
830#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 1
831 template<
class ARGS_01>
836#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 2
837 template<
class ARGS_01,
844#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 3
845 template<
class ARGS_01,
854#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 4
855 template<
class ARGS_01,
866#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 5
867 template<
class ARGS_01,
880#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 6
881 template<
class ARGS_01,
896#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 7
897 template<
class ARGS_01,
914#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 8
915 template<
class ARGS_01,
934#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 9
935 template<
class ARGS_01,
956#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 10
957 template<
class ARGS_01,
981#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 0
983 BloombergLP::bslmf::MovableRef<KEY> key);
986#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 1
987 template <
class ARGS_01>
989 BloombergLP::bslmf::MovableRef<KEY> key,
993#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 2
994 template <
class ARGS_01,
997 BloombergLP::bslmf::MovableRef<KEY> key,
1002#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 3
1003 template <
class ARGS_01,
1007 BloombergLP::bslmf::MovableRef<KEY> key,
1013#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 4
1014 template <
class ARGS_01,
1019 BloombergLP::bslmf::MovableRef<KEY> key,
1026#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 5
1027 template <
class ARGS_01,
1033 BloombergLP::bslmf::MovableRef<KEY> key,
1041#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 6
1042 template <
class ARGS_01,
1049 BloombergLP::bslmf::MovableRef<KEY> key,
1058#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 7
1059 template <
class ARGS_01,
1067 BloombergLP::bslmf::MovableRef<KEY> key,
1077#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 8
1078 template <
class ARGS_01,
1087 BloombergLP::bslmf::MovableRef<KEY> key,
1098#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 9
1099 template <
class ARGS_01,
1109 BloombergLP::bslmf::MovableRef<KEY> key,
1121#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 10
1122 template <
class ARGS_01,
1133 BloombergLP::bslmf::MovableRef<KEY> key,
1147#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 0
1148 template <
class LOOKUP_KEY>
1150 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1151 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1156 bsl::size_t hashValue = d_hasher(key);
1157 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1160 ENTRY_UTIL::construct(d_entries_p + index,
1163 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1169 d_controls_p + index,
1170 d_capacity - index - 1),
1175#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 1
1176 template <
class LOOKUP_KEY,
class ARGS_01>
1178 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1179 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1185 bsl::size_t hashValue = d_hasher(key);
1186 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1189 ENTRY_UTIL::construct(d_entries_p + index,
1193 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1199 d_controls_p + index,
1200 d_capacity - index - 1),
1205#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 2
1206 template <
class LOOKUP_KEY,
class ARGS_01,
1209 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1210 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1217 bsl::size_t hashValue = d_hasher(key);
1218 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1221 ENTRY_UTIL::construct(d_entries_p + index,
1226 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1232 d_controls_p + index,
1233 d_capacity - index - 1),
1238#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 3
1239 template <
class LOOKUP_KEY,
class ARGS_01,
1243 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1244 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1252 bsl::size_t hashValue = d_hasher(key);
1253 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1256 ENTRY_UTIL::construct(d_entries_p + index,
1262 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1268 d_controls_p + index,
1269 d_capacity - index - 1),
1274#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 4
1275 template <
class LOOKUP_KEY,
class ARGS_01,
1280 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1281 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1290 bsl::size_t hashValue = d_hasher(key);
1291 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1294 ENTRY_UTIL::construct(d_entries_p + index,
1301 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1307 d_controls_p + index,
1308 d_capacity - index - 1),
1313#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 5
1314 template <
class LOOKUP_KEY,
class ARGS_01,
1320 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1321 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1331 bsl::size_t hashValue = d_hasher(key);
1332 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1335 ENTRY_UTIL::construct(d_entries_p + index,
1343 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1349 d_controls_p + index,
1350 d_capacity - index - 1),
1355#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 6
1356 template <
class LOOKUP_KEY,
class ARGS_01,
1363 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1364 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1375 bsl::size_t hashValue = d_hasher(key);
1376 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1379 ENTRY_UTIL::construct(d_entries_p + index,
1388 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1394 d_controls_p + index,
1395 d_capacity - index - 1),
1400#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 7
1401 template <
class LOOKUP_KEY,
class ARGS_01,
1409 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1410 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1422 bsl::size_t hashValue = d_hasher(key);
1423 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1426 ENTRY_UTIL::construct(d_entries_p + index,
1436 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1442 d_controls_p + index,
1443 d_capacity - index - 1),
1448#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 8
1449 template <
class LOOKUP_KEY,
class ARGS_01,
1458 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1459 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1472 bsl::size_t hashValue = d_hasher(key);
1473 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1476 ENTRY_UTIL::construct(d_entries_p + index,
1487 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1493 d_controls_p + index,
1494 d_capacity - index - 1),
1499#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 9
1500 template <
class LOOKUP_KEY,
class ARGS_01,
1510 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1511 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1525 bsl::size_t hashValue = d_hasher(key);
1526 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1529 ENTRY_UTIL::construct(d_entries_p + index,
1541 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1547 d_controls_p + index,
1548 d_capacity - index - 1),
1553#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_D >= 10
1554 template <
class LOOKUP_KEY,
class ARGS_01,
1565 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1566 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1581 bsl::size_t hashValue = d_hasher(key);
1582 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1585 ENTRY_UTIL::construct(d_entries_p + index,
1598 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1604 d_controls_p + index,
1605 d_capacity - index - 1),
1613 template<
class... ARGS>
1617 template <
class... ARGS>
1619 BloombergLP::bslmf::MovableRef<KEY> key,
1622 template <
class LOOKUP_KEY,
class... ARGS>
1624 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1625 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1631 bsl::size_t hashValue = d_hasher(key);
1632 bsl::size_t index = indexOfKeyTransparent(¬Found, key, hashValue);
1635 ENTRY_UTIL::construct(d_entries_p + index,
1639 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
1645 d_controls_p + index,
1646 d_capacity - index - 1),
1670 void swap(FlatHashTable& other);
1680 bool contains(
const KEY& key)
const;
1688 const bsl::uint8_t *
controls()
const;
1694 bsl::size_t
count(
const KEY& key)
const;
1718 const KEY& key)
const;
1729 template <
class LOOKUP_KEY>
1731 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1732 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1740 if (cit1 !=
end()) {
1743 return bsl::make_pair(cit1, cit2);
1754 template <
class LOOKUP_KEY>
1756 BloombergLP::bslmf::IsTransparentPredicate<HASH, LOOKUP_KEY>::value
1757 && BloombergLP::bslmf::IsTransparentPredicate<EQUAL,LOOKUP_KEY>::value
1759 find(
const LOOKUP_KEY& key)
const
1763 bsl::size_t index = findTransparentKey(key, d_hasher(key));
1764 if (index < d_capacity) {
1766 d_controls_p + index,
1767 d_capacity - index - 1));
1797 bsl::size_t
size()
const;
1828template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
1829bool operator==(
const FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>& lhs,
1830 const FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>& rhs);
1839template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
1840bool operator!=(
const FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>& lhs,
1841 const FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>& rhs);
1848template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
1849void swap(FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>& a,
1850 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>& b);
1861struct FlatHashTable_ImplUtil {
1865 typedef FlatHashTable_GroupControl GroupControl;
1872 template <
class ENTRY_TYPE>
1873 class DestroyEntryArrayProctor;
1908 template <
class ENTRY_TYPE>
1909 static void copyEntryAndControlArrays(
1910 ENTRY_TYPE *firstDestinationEntry,
1911 bsl::uint8_t *firstDestinationControl,
1912 const ENTRY_TYPE *firstSourceEntry,
1913 const ENTRY_TYPE *lastSourceEntry,
1914 const bsl::uint8_t *firstSourceControl,
1915 const bsl::uint8_t *lastSourceControl,
1918 template <
class ENTRY_TYPE>
1919 static void copyEntryAndControlArrays(
1920 ENTRY_TYPE *firstDestinationEntry,
1921 bsl::uint8_t *firstDestinationControl,
1922 const ENTRY_TYPE *firstSourceEntry,
1923 const ENTRY_TYPE *lastSourceEntry,
1924 const bsl::uint8_t *firstSourceControl,
1925 const bsl::uint8_t *lastSourceControl,
1947 template <
class ENTRY_TYPE>
1948 static void destroyEntryArray(ENTRY_TYPE *firstEntry,
1949 ENTRY_TYPE *lastEntry,
1950 const bsl::uint8_t *firstControl,
1951 const bsl::uint8_t *lastControl,
1953 template <
class ENTRY_TYPE>
1954 static void destroyEntryArray(ENTRY_TYPE *firstEntry,
1955 ENTRY_TYPE *lastEntry,
1956 const bsl::uint8_t *firstControl,
1957 const bsl::uint8_t *lastControl,
1991 template <
class ENTRY_TYPE>
1993 copyEntryAndControlArrays(ENTRY_TYPE *firstDestinationEntry,
1994 bsl::uint8_t *firstDestinationControl,
1995 const ENTRY_TYPE *firstSourceEntry,
1996 const ENTRY_TYPE *lastSourceEntry,
1997 const bsl::uint8_t *firstSourceControl,
1998 const bsl::uint8_t *lastSourceControl,
2016 template <
class ENTRY_TYPE>
2017 static void destroyEntryArray(ENTRY_TYPE *firstEntry,
2018 ENTRY_TYPE *lastEntry,
2019 const bsl::uint8_t *firstControl,
2020 const bsl::uint8_t *lastControl);
2032template <
class ENTRY_TYPE>
2033class FlatHashTable_ImplUtil::DestroyEntryArrayProctor {
2036 typedef FlatHashTable_GroupControl GroupControl;
2037 typedef FlatHashTable_ImplUtil ImplUtil;
2042 ENTRY_TYPE *d_firstEntry_p;
2045 ENTRY_TYPE *d_lastEntry_p;
2048 const bsl::uint8_t *d_firstControl_p;
2051 const bsl::uint8_t *d_lastControl_p;
2055 DestroyEntryArrayProctor(
const DestroyEntryArrayProctor&);
2056 DestroyEntryArrayProctor& operator=(
const DestroyEntryArrayProctor&);
2071 DestroyEntryArrayProctor(ENTRY_TYPE *firstEntry,
2072 ENTRY_TYPE *lastEntry,
2073 const bsl::uint8_t *firstControl,
2074 const bsl::uint8_t *lastControl);
2079 ~DestroyEntryArrayProctor();
2085 void moveEnd(bsl::ptrdiff_t offset);
2104template <
class ENTRY>
2109, d_additionalLength(0)
2113template <
class ENTRY>
2115FlatHashTable_IteratorImp<ENTRY>::FlatHashTable_IteratorImp(
2117 const bsl::uint8_t *controls,
2118 bsl::size_t additionalLength)
2119: d_entries_p(entries)
2120, d_controls_p(controls)
2121, d_additionalLength(additionalLength)
2125template <
class ENTRY>
2127FlatHashTable_IteratorImp<ENTRY>::FlatHashTable_IteratorImp(
2128 const FlatHashTable_IteratorImp& original)
2129: d_entries_p(original.d_entries_p)
2130, d_controls_p(original.d_controls_p)
2131, d_additionalLength(original.d_additionalLength)
2136template <
class ENTRY>
2138FlatHashTable_IteratorImp<ENTRY>& FlatHashTable_IteratorImp<ENTRY>::operator=(
2139 const FlatHashTable_IteratorImp& rhs)
2141 d_entries_p =
rhs.d_entries_p;
2142 d_controls_p =
rhs.d_controls_p;
2143 d_additionalLength =
rhs.d_additionalLength;
2148template <
class ENTRY>
2150void FlatHashTable_IteratorImp<ENTRY>::operator++()
2155 while (d_additionalLength) {
2158 --d_additionalLength;
2159 if (0 == (*d_controls_p & 0x80)) {
2169template <
class ENTRY>
2171ENTRY& FlatHashTable_IteratorImp<ENTRY>::operator*()
const
2176 return *d_entries_p;
2182template <
class ENTRY>
2185 const FlatHashTable_IteratorImp<ENTRY>& b)
2187 return a.d_entries_p == b.d_entries_p
2188 && a.d_controls_p == b.d_controls_p
2189 && a.d_additionalLength == b.d_additionalLength;
2199template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2200bsl::size_t FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::findAvailable(
2201 bsl::uint8_t *controls,
2203 bsl::size_t capacity)
2207 for (bsl::size_t i = 0; i < capacity; i += GroupControl::k_SIZE) {
2208 bsl::uint8_t *controlStart = controls + index;
2210 GroupControl groupControl(controlStart);
2211 bsl::uint32_t candidates = groupControl.available();
2218 index = (index + GroupControl::k_SIZE) & (capacity - 1);
2222 " even though it should have found one");
2227template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2228bsl::size_t FlatHashTable<KEY,
2232 EQUAL>::indexOfKey(
bool *notFound,
2234 bsl::size_t hashValue)
2238 bsl::size_t index = findKey(key, hashValue);
2240 if (index == d_capacity) {
2243 if (d_size >= k_MAX_LOAD_FACTOR_NUMERATOR
2244 * (d_capacity / k_MAX_LOAD_FACTOR_DENOMINATOR)) {
2245 rehashRaw(d_capacity > 0 ? 2 * d_capacity : k_MIN_CAPACITY);
2248 index = (hashValue >> d_groupControlShift) * GroupControl::k_SIZE;
2249 index = findAvailable(d_controls_p, index, d_capacity);
2258template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2259void FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::rehashRaw(
2260 bsl::size_t newCapacity)
2265 FlatHashTable tmp(newCapacity,
2270 for (bsl::size_t i = 0; i < d_capacity; i += GroupControl::k_SIZE) {
2271 bsl::uint8_t *controlStart = d_controls_p + i;
2272 ENTRY *entryStart = d_entries_p + i;
2274 GroupControl groupControl(controlStart);
2275 bsl::uint32_t candidates = groupControl.inUse();
2276 while (candidates) {
2278 ENTRY *entry = entryStart + offset;
2284 *(controlStart + offset) = GroupControl::k_ERASED;
2288 bsl::size_t hashValue = tmp.d_hasher(ENTRY_UTIL::key(*entry));
2289 bsl::size_t index = (hashValue >> tmp.d_groupControlShift)
2290 * GroupControl::k_SIZE;
2292 index = findAvailable(tmp.d_controls_p, index, tmp.d_capacity);
2301 tmp.d_controls_p[index] =
static_cast<bsl::uint8_t
>(
2302 hashValue & k_HASHLET_MASK);
2316 d_groupControlShift = 0;
2326template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2327bsl::size_t FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::findKey(
2329 bsl::size_t hashValue)
const
2333 bsl::size_t index = (hashValue >> d_groupControlShift)
2334 * GroupControl::k_SIZE;
2335 bsl::uint8_t hashlet =
static_cast<bsl::uint8_t
>(
2336 hashValue & k_HASHLET_MASK);
2338 for (bsl::size_t i = 0; i < d_capacity; i += GroupControl::k_SIZE) {
2339 bsl::uint8_t *controlStart = d_controls_p + index;
2340 ENTRY *entryStart = d_entries_p + index;
2342 GroupControl groupControl(controlStart);
2343 bsl::uint32_t candidates = groupControl.match(hashlet);
2344 while (candidates) {
2347 ENTRY *entry = entryStart + offset;
2350 d_equal(ENTRY_UTIL::key(*entry), key))) {
2351 return index + offset;
2359 index = (index + GroupControl::k_SIZE) & (d_capacity - 1);
2365template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2366bsl::size_t FlatHashTable<KEY,
2370 EQUAL>::minimumCompliantCapacity(
2371 bsl::size_t minimumCapacity)
const
2373 bsl::size_t minForEntries = ((d_size + k_MAX_LOAD_FACTOR_NUMERATOR - 1)
2374 / k_MAX_LOAD_FACTOR_NUMERATOR)
2375 * k_MAX_LOAD_FACTOR_DENOMINATOR;
2377 bsl::size_t capacity = minimumCapacity >= minForEntries
2382 capacity = capacity > k_MIN_CAPACITY
2384 static_cast<bsl::uint64_t
>(capacity)))
2392template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2394FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::FlatHashTable(
2395 bsl::size_t capacity,
2403, d_groupControlShift(0)
2406, d_allocator_p(
bslma::Default::allocator(basicAllocator))
2409 d_capacity = capacity > k_MIN_CAPACITY
2411 static_cast<bsl::uint64_t
>(capacity)))
2414 d_groupControlShift =
static_cast<int>(
2415 sizeof(bsl::size_t) * 8
2418 / GroupControl::k_SIZE)));
2420 ENTRY *entries =
static_cast<ENTRY *
>(
2421 d_allocator_p->
allocate(d_capacity *
sizeof(ENTRY)));
2426 d_controls_p =
static_cast<bsl::uint8_t *
>(
2427 d_allocator_p->
allocate(d_capacity));
2428 bsl::memset(d_controls_p, GroupControl::k_EMPTY, d_capacity);
2431 d_entries_p = entries;
2435template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2437FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::FlatHashTable(
2438 const FlatHashTable& original,
2444, d_groupControlShift(0)
2445, d_hasher(original.hash_function())
2446, d_equal(original.key_eq())
2447, d_allocator_p(
bslma::Default::allocator(basicAllocator))
2449 if (0 != original.d_capacity) {
2450 bsl::uint8_t *
const controls =
static_cast<bsl::uint8_t *
>(
2451 d_allocator_p->
allocate(original.d_capacity));
2456 ENTRY *
const entries =
static_cast<ENTRY *
>(
2457 d_allocator_p->
allocate(original.d_capacity *
sizeof(ENTRY)));
2462 ImplUtil::copyEntryAndControlArrays(
2465 original.d_entries_p,
2466 original.d_entries_p + original.d_capacity,
2467 original.d_controls_p,
2468 original.d_controls_p + original.d_capacity,
2471 entriesProctor.release();
2472 controlsProctor.release();
2474 d_entries_p = entries;
2475 d_controls_p = controls;
2476 d_size = original.d_size;
2477 d_capacity = original.d_capacity;
2478 d_groupControlShift = original.d_groupControlShift;
2482template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2484FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::FlatHashTable(
2486: d_entries_p(
bslmf::MovableRefUtil::access(original).d_entries_p)
2487, d_controls_p(
bslmf::MovableRefUtil::access(original).d_controls_p)
2488, d_size(
bslmf::MovableRefUtil::access(original).d_size)
2489, d_capacity(
bslmf::MovableRefUtil::access(original).d_capacity)
2490, d_groupControlShift(
2491 bslmf::MovableRefUtil::access(original).d_groupControlShift)
2492, d_hasher(
bslmf::MovableRefUtil::access(original).d_hasher)
2493, d_equal(
bslmf::MovableRefUtil::access(original).d_equal)
2494, d_allocator_p(
bslmf::MovableRefUtil::access(original).d_allocator_p)
2496 FlatHashTable& reference = original;
2498 reference.d_entries_p = 0;
2499 reference.d_controls_p = 0;
2500 reference.d_size = 0;
2501 reference.d_capacity = 0;
2502 reference.d_groupControlShift = 0;
2505template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2506FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::FlatHashTable(
2513, d_groupControlShift(0)
2514, d_hasher(
bslmf::MovableRefUtil::access(original).d_hasher)
2515, d_equal(
bslmf::MovableRefUtil::access(original).d_equal)
2516, d_allocator_p(
bslma::Default::allocator(basicAllocator))
2518 FlatHashTable& reference = original;
2519 if (d_allocator_p == reference.d_allocator_p) {
2525 &reference.d_groupControlShift);
2527 else if (reference.d_capacity) {
2528 bsl::uint8_t *
const controls =
static_cast<bsl::uint8_t *
>(
2529 d_allocator_p->
allocate(reference.d_capacity));
2534 ENTRY *
const entries =
static_cast<ENTRY *
>(
2535 d_allocator_p->
allocate(reference.d_capacity *
sizeof(ENTRY)));
2540 ImplUtil::copyEntryAndControlArrays(
2543 reference.d_entries_p,
2544 reference.d_entries_p + reference.d_capacity,
2545 reference.d_controls_p,
2546 reference.d_controls_p + reference.d_capacity,
2549 entriesProctor.release();
2550 controlsProctor.release();
2552 d_entries_p = entries;
2553 d_controls_p = controls;
2554 d_size = reference.d_size;
2555 d_capacity = reference.d_capacity;
2556 d_groupControlShift = reference.d_groupControlShift;
2560template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2562FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::~FlatHashTable()
2565 (d_capacity == 0 && d_groupControlShift == 0) ||
2566 (d_groupControlShift ==
2567 static_cast<int>(
sizeof(bsl::size_t) * 8 -
2569 d_capacity / GroupControl::k_SIZE)))));
2571 if (0 != d_entries_p) {
2572 ImplUtil::destroyEntryArray(d_entries_p,
2573 d_entries_p + d_capacity,
2575 d_controls_p + d_capacity);
2583template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2585FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>&
2586FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::operator=(
2587 const FlatHashTable& rhs)
2590 FlatHashTable tmp(rhs, d_allocator_p);
2596template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2598FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>&
2599FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::operator=(
2602 FlatHashTable& reference =
rhs;
2603 if (
this != &reference) {
2611template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2612template <
class KEY_TYPE>
2614ENTRY& FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::operator[](
2618 bsl::size_t hashValue = d_hasher(key);
2619 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
2622 ENTRY_UTIL::constructFromKey(d_entries_p + index,
2626 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
2627 hashValue & k_HASHLET_MASK);
2632 return d_entries_p[index];
2635template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2637void FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::clear()
2639 ImplUtil::destroyEntryArray(d_entries_p,
2640 d_entries_p + d_capacity,
2642 d_controls_p + d_capacity);
2645 bsl::memset(d_controls_p, GroupControl::k_EMPTY, d_capacity);
2651template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2654 typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2655 typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator>
2656FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::equal_range(
const KEY& key)
2658 iterator it1 = find(key);
2660 return bsl::make_pair(it1, it1);
2664 return bsl::make_pair(it1, it2);
2667#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
2670#ifndef BDLC_FLATHASHTABLE_VARIADIC_LIMIT
2671#define BDLC_FLATHASHTABLE_VARIADIC_LIMIT 10
2673#ifndef BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E
2674#define BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E BDLC_FLATHASHTABLE_VARIADIC_LIMIT
2676#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 0
2677template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2680 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2682FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2686 ENTRY_UTIL::construct(value.
address(),
2694#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 1
2695template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2696template<
class ARGS_01>
2699 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2701FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2705 ENTRY_UTIL::construct(value.
address(),
2714#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 2
2715template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2716template<
class ARGS_01,
2720 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2722FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2727 ENTRY_UTIL::construct(value.
address(),
2737#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 3
2738template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2739template<
class ARGS_01,
2744 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2746FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2752 ENTRY_UTIL::construct(value.
address(),
2763#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 4
2764template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2765template<
class ARGS_01,
2771 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2773FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2780 ENTRY_UTIL::construct(value.
address(),
2792#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 5
2793template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2794template<
class ARGS_01,
2801 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2803FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2811 ENTRY_UTIL::construct(value.
address(),
2824#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 6
2825template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2826template<
class ARGS_01,
2834 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2836FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2845 ENTRY_UTIL::construct(value.
address(),
2859#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 7
2860template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2861template<
class ARGS_01,
2870 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2872FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2882 ENTRY_UTIL::construct(value.
address(),
2897#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 8
2898template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2899template<
class ARGS_01,
2909 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2911FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2922 ENTRY_UTIL::construct(value.
address(),
2938#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 9
2939template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2940template<
class ARGS_01,
2951 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2953FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
2965 ENTRY_UTIL::construct(value.
address(),
2982#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_E >= 10
2983template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
2984template<
class ARGS_01,
2996 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
2998FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
3011 ENTRY_UTIL::construct(value.
address(),
3032template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3033template<
class... ARGS>
3036 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3038FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::emplace(
3042 ENTRY_UTIL::construct(value.
address(),
3053template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3055bsl::size_t FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::erase(
3058 iterator it = find(key);
3066template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3068typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator
3069FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::erase(
3070 typename FlatHashTable<KEY,
3074 EQUAL>::const_iterator position)
3078 bsl::size_t index = &*position - d_entries_p;
3079 bslma::DestructionUtil::destroy(d_entries_p + index);
3080 d_controls_p[index] = GroupControl::k_ERASED;
3084 for (bsl::size_t i = index + 1; i < d_capacity; ++i) {
3085 if (0 == (d_controls_p[i] & GroupControl::k_EMPTY)) {
3086 return iterator(IteratorImp(d_entries_p + i,
3088 d_capacity - i - 1));
3095template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3097typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator
3098FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::erase(
3099 typename FlatHashTable<KEY,
3103 EQUAL>::iterator position)
3110 bsl::size_t index = &*position - d_entries_p;
3111 bslma::DestructionUtil::destroy(d_entries_p + index);
3112 d_controls_p[index] = GroupControl::k_ERASED;
3116 for (bsl::size_t i = index + 1; i < d_capacity; ++i) {
3117 if (0 == (d_controls_p[i] & GroupControl::k_EMPTY)) {
3118 return iterator(IteratorImp(d_entries_p + i,
3120 d_capacity - i - 1));
3127template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3128typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator
3129FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::erase(
3130 typename FlatHashTable<KEY,
3134 EQUAL>::const_iterator first,
3135 typename FlatHashTable<KEY,
3139 EQUAL>::const_iterator last)
3143 if (last !=
end()) {
3144 bsl::size_t index = &*last - d_entries_p;
3145 rv = iterator(IteratorImp(d_entries_p + index,
3146 d_controls_p + index,
3147 d_capacity - index - 1));
3154 for (; first != last; ++first) {
3161template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3163typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator
3164FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::find(
const KEY& key)
3166 bsl::size_t index = findKey(key, d_hasher(key));
3167 if (index < d_capacity) {
3168 return iterator(IteratorImp(d_entries_p + index,
3169 d_controls_p + index,
3170 d_capacity - index - 1));
3175template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3178FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::insert(
const ENTRY& entry)
3181 bsl::size_t hashValue = d_hasher(ENTRY_UTIL::key(entry));
3182 bsl::size_t index = indexOfKey(¬Found,
3183 ENTRY_UTIL::key(entry),
3187 ENTRY_UTIL::construct(d_entries_p + index, d_allocator_p, entry);
3188 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3189 hashValue & k_HASHLET_MASK);
3194 d_controls_p + index,
3195 d_capacity - index - 1),
3199template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3202FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::insert(
3206 bsl::size_t hashValue = d_hasher(ENTRY_UTIL::key(entry));
3207 bsl::size_t index = indexOfKey(¬Found,
3208 ENTRY_UTIL::key(entry),
3212 ENTRY_UTIL::construct(d_entries_p + index,
3216 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3217 hashValue & k_HASHLET_MASK);
3223 d_controls_p + index,
3224 d_capacity - index - 1),
3228template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3229template <
class INPUT_ITERATOR>
3231void FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::insert(
3232 INPUT_ITERATOR first,
3233 INPUT_ITERATOR last)
3235 for (; first != last; ++first) {
3240template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3242void FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::rehash(
3243 bsl::size_t minimumCapacity)
3245 minimumCapacity = minimumCompliantCapacity(minimumCapacity);
3247 if (0 < minimumCapacity) {
3248 rehashRaw(minimumCapacity);
3257 d_groupControlShift = 0;
3261template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3263void FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::reserve(
3264 bsl::size_t numEntries)
3266 if (0 == d_capacity && 0 == numEntries) {
3273 bsl::size_t minForEntries = ((numEntries + k_MAX_LOAD_FACTOR_NUMERATOR - 1)
3274 / k_MAX_LOAD_FACTOR_NUMERATOR)
3275 * k_MAX_LOAD_FACTOR_DENOMINATOR;
3277 rehash(minForEntries);
3280template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3282void FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::reset()
3284 if (0 != d_entries_p) {
3285 ImplUtil::destroyEntryArray(d_entries_p,
3286 d_entries_p + d_capacity,
3288 d_controls_p + d_capacity);
3297 d_groupControlShift = 0;
3301#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
3304#ifndef BDLC_FLATHASHTABLE_VARIADIC_LIMIT
3305#define BDLC_FLATHASHTABLE_VARIADIC_LIMIT 10
3307#ifndef BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F
3308#define BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F BDLC_FLATHASHTABLE_VARIADIC_LIMIT
3310#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 0
3311template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3313 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3315FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3319 bsl::size_t hashValue = d_hasher(key);
3320 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3323 ENTRY_UTIL::construct(d_entries_p + index,
3326 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3327 hashValue & k_HASHLET_MASK);
3332 d_controls_p + index,
3333 d_capacity - index - 1),
3338#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 1
3339template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3340template<
class ARGS_01>
3342 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3344FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3349 bsl::size_t hashValue = d_hasher(key);
3350 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3353 ENTRY_UTIL::construct(d_entries_p + index,
3357 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3358 hashValue & k_HASHLET_MASK);
3363 d_controls_p + index,
3364 d_capacity - index - 1),
3369#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 2
3370template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3371template<
class ARGS_01,
3374 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3376FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3382 bsl::size_t hashValue = d_hasher(key);
3383 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3386 ENTRY_UTIL::construct(d_entries_p + index,
3391 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3392 hashValue & k_HASHLET_MASK);
3397 d_controls_p + index,
3398 d_capacity - index - 1),
3403#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 3
3404template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3405template<
class ARGS_01,
3409 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3411FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3418 bsl::size_t hashValue = d_hasher(key);
3419 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3422 ENTRY_UTIL::construct(d_entries_p + index,
3428 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3429 hashValue & k_HASHLET_MASK);
3434 d_controls_p + index,
3435 d_capacity - index - 1),
3440#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 4
3441template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3442template<
class ARGS_01,
3447 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3449FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3457 bsl::size_t hashValue = d_hasher(key);
3458 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3461 ENTRY_UTIL::construct(d_entries_p + index,
3468 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3469 hashValue & k_HASHLET_MASK);
3474 d_controls_p + index,
3475 d_capacity - index - 1),
3480#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 5
3481template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3482template<
class ARGS_01,
3488 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3490FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3499 bsl::size_t hashValue = d_hasher(key);
3500 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3503 ENTRY_UTIL::construct(d_entries_p + index,
3511 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3512 hashValue & k_HASHLET_MASK);
3517 d_controls_p + index,
3518 d_capacity - index - 1),
3523#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 6
3524template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3525template<
class ARGS_01,
3532 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3534FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3544 bsl::size_t hashValue = d_hasher(key);
3545 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3548 ENTRY_UTIL::construct(d_entries_p + index,
3557 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3558 hashValue & k_HASHLET_MASK);
3563 d_controls_p + index,
3564 d_capacity - index - 1),
3569#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 7
3570template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3571template<
class ARGS_01,
3579 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3581FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3592 bsl::size_t hashValue = d_hasher(key);
3593 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3596 ENTRY_UTIL::construct(d_entries_p + index,
3606 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3607 hashValue & k_HASHLET_MASK);
3612 d_controls_p + index,
3613 d_capacity - index - 1),
3618#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 8
3619template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3620template<
class ARGS_01,
3629 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3631FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3643 bsl::size_t hashValue = d_hasher(key);
3644 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3647 ENTRY_UTIL::construct(d_entries_p + index,
3658 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3659 hashValue & k_HASHLET_MASK);
3664 d_controls_p + index,
3665 d_capacity - index - 1),
3670#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 9
3671template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3672template<
class ARGS_01,
3682 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3684FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3697 bsl::size_t hashValue = d_hasher(key);
3698 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3701 ENTRY_UTIL::construct(d_entries_p + index,
3713 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3714 hashValue & k_HASHLET_MASK);
3719 d_controls_p + index,
3720 d_capacity - index - 1),
3725#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 10
3726template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3727template<
class ARGS_01,
3738 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3740FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3754 bsl::size_t hashValue = d_hasher(key);
3755 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
3758 ENTRY_UTIL::construct(d_entries_p + index,
3771 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3772 hashValue & k_HASHLET_MASK);
3777 d_controls_p + index,
3778 d_capacity - index - 1),
3784#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 0
3785template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3787 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3789FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3790 BloombergLP::bslmf::MovableRef<KEY> key)
3794 bsl::size_t hashValue = d_hasher(k);
3795 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
3798 ENTRY_UTIL::construct(d_entries_p + index,
3801 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3802 hashValue & k_HASHLET_MASK);
3806 d_controls_p + index,
3807 d_capacity - index - 1),
3812#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 1
3813template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3814template<
class ARGS_01>
3816 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3818FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3819 BloombergLP::bslmf::MovableRef<KEY> key,
3824 bsl::size_t hashValue = d_hasher(k);
3825 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
3828 ENTRY_UTIL::construct(d_entries_p + index,
3832 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3833 hashValue & k_HASHLET_MASK);
3837 d_controls_p + index,
3838 d_capacity - index - 1),
3843#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 2
3844template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3845template<
class ARGS_01,
3848 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3850FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3851 BloombergLP::bslmf::MovableRef<KEY> key,
3857 bsl::size_t hashValue = d_hasher(k);
3858 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
3861 ENTRY_UTIL::construct(d_entries_p + index,
3866 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3867 hashValue & k_HASHLET_MASK);
3871 d_controls_p + index,
3872 d_capacity - index - 1),
3877#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 3
3878template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3879template<
class ARGS_01,
3883 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3885FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3886 BloombergLP::bslmf::MovableRef<KEY> key,
3893 bsl::size_t hashValue = d_hasher(k);
3894 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
3897 ENTRY_UTIL::construct(d_entries_p + index,
3903 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3904 hashValue & k_HASHLET_MASK);
3908 d_controls_p + index,
3909 d_capacity - index - 1),
3914#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 4
3915template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3916template<
class ARGS_01,
3921 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3923FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3924 BloombergLP::bslmf::MovableRef<KEY> key,
3932 bsl::size_t hashValue = d_hasher(k);
3933 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
3936 ENTRY_UTIL::construct(d_entries_p + index,
3943 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3944 hashValue & k_HASHLET_MASK);
3948 d_controls_p + index,
3949 d_capacity - index - 1),
3954#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 5
3955template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3956template<
class ARGS_01,
3962 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
3964FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
3965 BloombergLP::bslmf::MovableRef<KEY> key,
3974 bsl::size_t hashValue = d_hasher(k);
3975 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
3978 ENTRY_UTIL::construct(d_entries_p + index,
3986 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
3987 hashValue & k_HASHLET_MASK);
3991 d_controls_p + index,
3992 d_capacity - index - 1),
3997#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 6
3998template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
3999template<
class ARGS_01,
4006 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
4008FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
4009 BloombergLP::bslmf::MovableRef<KEY> key,
4019 bsl::size_t hashValue = d_hasher(k);
4020 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
4023 ENTRY_UTIL::construct(d_entries_p + index,
4032 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
4033 hashValue & k_HASHLET_MASK);
4037 d_controls_p + index,
4038 d_capacity - index - 1),
4043#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 7
4044template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4045template<
class ARGS_01,
4053 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
4055FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
4056 BloombergLP::bslmf::MovableRef<KEY> key,
4067 bsl::size_t hashValue = d_hasher(k);
4068 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
4071 ENTRY_UTIL::construct(d_entries_p + index,
4081 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
4082 hashValue & k_HASHLET_MASK);
4086 d_controls_p + index,
4087 d_capacity - index - 1),
4092#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 8
4093template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4094template<
class ARGS_01,
4103 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
4105FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
4106 BloombergLP::bslmf::MovableRef<KEY> key,
4118 bsl::size_t hashValue = d_hasher(k);
4119 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
4122 ENTRY_UTIL::construct(d_entries_p + index,
4133 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
4134 hashValue & k_HASHLET_MASK);
4138 d_controls_p + index,
4139 d_capacity - index - 1),
4144#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 9
4145template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4146template<
class ARGS_01,
4156 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
4158FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
4159 BloombergLP::bslmf::MovableRef<KEY> key,
4172 bsl::size_t hashValue = d_hasher(k);
4173 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
4176 ENTRY_UTIL::construct(d_entries_p + index,
4188 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
4189 hashValue & k_HASHLET_MASK);
4193 d_controls_p + index,
4194 d_capacity - index - 1),
4199#if BDLC_FLATHASHTABLE_VARIADIC_LIMIT_F >= 10
4200template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4201template<
class ARGS_01,
4212 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
4214FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
4215 BloombergLP::bslmf::MovableRef<KEY> key,
4229 bsl::size_t hashValue = d_hasher(k);
4230 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
4233 ENTRY_UTIL::construct(d_entries_p + index,
4246 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
4247 hashValue & k_HASHLET_MASK);
4251 d_controls_p + index,
4252 d_capacity - index - 1),
4260template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4261template<
class... ARGS>
4263 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
4265FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
4270 bsl::size_t hashValue = d_hasher(key);
4271 bsl::size_t index = indexOfKey(¬Found, key, hashValue);
4274 ENTRY_UTIL::construct(d_entries_p + index,
4278 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
4279 hashValue & k_HASHLET_MASK);
4284 d_controls_p + index,
4285 d_capacity - index - 1),
4289template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4290template<
class... ARGS>
4292 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator,
4294FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::try_emplace(
4295 BloombergLP::bslmf::MovableRef<KEY> key,
4300 bsl::size_t hashValue = d_hasher(k);
4301 bsl::size_t index = indexOfKey(¬Found, k, hashValue);
4304 ENTRY_UTIL::construct(d_entries_p + index,
4308 d_controls_p[index] =
static_cast<bsl::uint8_t
>(
4309 hashValue & k_HASHLET_MASK);
4313 d_controls_p + index,
4314 d_capacity - index - 1),
4322template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4324typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator
4325FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::begin()
4328 for (bsl::size_t i = 0; i < d_capacity; ++i) {
4329 if (0 == (d_controls_p[i] & GroupControl::k_EMPTY)) {
4330 return iterator(IteratorImp(d_entries_p + i,
4332 d_capacity - i - 1));
4339template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4341typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::iterator
4342FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::end()
4349template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4351void FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::swap(
4352 FlatHashTable& other)
4366template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4368bsl::size_t FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::
4374template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4376bool FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::contains(
4377 const KEY& key)
const
4379 return find(key) !=
end();
4382template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4384const bsl::uint8_t *FlatHashTable<KEY,
4388 EQUAL>::controls()
const
4390 return d_controls_p;
4393template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4395bsl::size_t FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::count(
4396 const KEY& key)
const
4398 return contains(key) ? 1 : 0;
4401template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4403bool FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::empty()
const
4408template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4410const ENTRY *FlatHashTable<KEY,
4414 EQUAL>::entries()
const
4419template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4425 EQUAL>::const_iterator,
4426 typename FlatHashTable<KEY,
4430 EQUAL>::const_iterator>
4431FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::equal_range(
4432 const KEY& key)
const
4434 const_iterator cit1 = find(key);
4435 const_iterator cit2 = cit1;
4436 if (cit1 !=
end()) {
4439 return bsl::make_pair(cit1, cit2);
4442template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4444typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::const_iterator
4445FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::find(
const KEY& key)
const
4447 bsl::size_t index = findKey(key, d_hasher(key));
4448 if (index < d_capacity) {
4449 return const_iterator(IteratorImp(d_entries_p + index,
4450 d_controls_p + index,
4451 d_capacity - index - 1));
4456template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4458HASH FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::hash_function()
const
4463template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4465EQUAL FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::key_eq()
const
4470template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4476 EQUAL>::load_factor()
const
4478 return d_capacity > 0
4479 ?
static_cast<float>(d_size) /
static_cast<float>(d_capacity)
4483template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4489 EQUAL>::max_load_factor()
const
4491 return static_cast<float>(k_MAX_LOAD_FACTOR_NUMERATOR)
4492 /
static_cast<float>(k_MAX_LOAD_FACTOR_DENOMINATOR);
4495template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4497bsl::size_t FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::size()
const
4504template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4506typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::const_iterator
4507FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::begin()
const
4510 for (bsl::size_t i = 0; i < d_capacity; ++i) {
4511 if (0 == (d_controls_p[i] & GroupControl::k_EMPTY)) {
4512 return const_iterator(
4513 IteratorImp(d_entries_p + i,
4515 d_capacity - i - 1));
4519 return const_iterator();
4522template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4524typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::const_iterator
4525FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::cbegin()
const
4530template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4532typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::const_iterator
4533FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::cend()
const
4538template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4540typename FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::const_iterator
4541FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>::end()
const
4543 return const_iterator();
4548template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4553 return d_allocator_p;
4559template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4565 const FlatHashTable<KEY,
4571 typedef typename FlatHashTable<KEY,
4575 EQUAL>::const_iterator ConstIterator;
4577 if (
lhs.size() ==
rhs.size()) {
4578 ConstIterator lhsEnd =
lhs.end();
4579 ConstIterator rhsEnd =
rhs.end();
4581 if (
lhs.capacity() <=
rhs.capacity()) {
4582 for (ConstIterator it =
lhs.begin(); it != lhsEnd; ++it) {
4583 ConstIterator i =
rhs.find(ENTRY_UTIL::key(*it));
4584 if (i == rhsEnd || *i != *it) {
4591 for (ConstIterator it =
rhs.begin(); it != rhsEnd; ++it) {
4592 ConstIterator i =
lhs.find(ENTRY_UTIL::key(*it));
4593 if (i == lhsEnd || *i != *it) {
4603template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4609 const FlatHashTable<KEY,
4619template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4621void bdlc::swap(FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>& a,
4622 FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL>& b)
4624 if (a.allocator() == b.allocator()) {
4630 typedef FlatHashTable<KEY, ENTRY, ENTRY_UTIL, HASH, EQUAL> Table;
4632 Table futureA(b, a.allocator());
4633 Table futureB(a, b.allocator());
4641template <
class KEY,
class ENTRY,
class ENTRY_UTIL,
class HASH,
class EQUAL>
4642struct UsesBslmaAllocator<
bdlc::FlatHashTable<KEY,
4658template <
class ENTRY_TYPE>
4660void FlatHashTable_ImplUtil::copyEntryAndControlArrays(
4661 ENTRY_TYPE *firstDestinationEntry,
4662 bsl::uint8_t *firstDestinationControl,
4663 const ENTRY_TYPE *firstSourceEntry,
4664 const ENTRY_TYPE *lastSourceEntry,
4665 const bsl::uint8_t *firstSourceControl,
4666 const bsl::uint8_t *lastSourceControl,
4670 (void) isBitwiseCopyable;
4674 bsl::memcpy(firstDestinationControl,
4676 bsl::distance(firstSourceControl, lastSourceControl) *
4677 sizeof(bsl::uint8_t));
4679 const bsl::size_t numEntries =
static_cast<bsl::size_t
>(
4680 bsl::distance(firstSourceEntry, lastSourceEntry));
4682 DestroyEntryArrayProctor<ENTRY_TYPE> destroyEntriesProctor(
4683 firstDestinationEntry,
4684 firstDestinationEntry,
4685 firstDestinationControl,
4686 firstDestinationControl);
4688 for (bsl::size_t idx = 0; idx != numEntries; ++idx) {
4689 ENTRY_TYPE& destinationEntry = *(firstDestinationEntry + idx);
4690 const bsl::uint8_t& sourceControl = *(firstSourceControl + idx);
4691 const ENTRY_TYPE& sourceEntry = *(firstSourceEntry + idx);
4695 &destinationEntry, entryAllocator, sourceEntry);
4698 destroyEntriesProctor.moveEnd(1);
4701 destroyEntriesProctor.release();
4704template <
class ENTRY_TYPE>
4706void FlatHashTable_ImplUtil::copyEntryAndControlArrays(
4707 ENTRY_TYPE *firstDestinationEntry,
4708 bsl::uint8_t *firstDestinationControl,
4709 const ENTRY_TYPE *firstSourceEntry,
4710 const ENTRY_TYPE *lastSourceEntry,
4711 const bsl::uint8_t *firstSourceControl,
4712 const bsl::uint8_t *lastSourceControl,
4716 (void) isBitwiseCopyable;
4720 bsl::memcpy(firstDestinationControl,
4722 bsl::distance(firstSourceControl, lastSourceControl) *
4723 sizeof(bsl::uint8_t));
4725#if defined(BSLS_PLATFORM_CMP_GNU) && BSLS_PLATFORM_CMP_VERSION >= 80000
4726#pragma GCC diagnostic push
4727#pragma GCC diagnostic ignored "-Wclass-memaccess"
4730 bsl::memcpy(firstDestinationEntry,
4732 bsl::distance(firstSourceEntry, lastSourceEntry) *
4733 sizeof(ENTRY_TYPE));
4735#if defined(BSLS_PLATFORM_CMP_GNU) && BSLS_PLATFORM_CMP_VERSION >= 80000
4736#pragma GCC diagnostic pop
4740template <
class ENTRY_TYPE>
4742void FlatHashTable_ImplUtil::destroyEntryArray(
4743 ENTRY_TYPE *firstEntry,
4744 ENTRY_TYPE *lastEntry,
4745 const bsl::uint8_t *firstControl,
4746 const bsl::uint8_t *lastControl,
4749 (void) triviallyDestructible;
4769 static_cast<void>(lastControl);
4771 const bsl::size_t numEntries =
4772 static_cast<bsl::size_t
>(bsl::distance(firstEntry, lastEntry));
4773 const bsl::size_t numGroupedEntries =
4776 for (bsl::size_t idx = 0;
4777 idx != numGroupedEntries;
4779 GroupControl groupControl(firstControl + idx);
4780 bsl::uint32_t candidates = groupControl.inUse();
4781 while (candidates) {
4783 bslma::DestructionUtil::destroy(firstEntry + idx + offset);
4788 for (bsl::size_t idx = numGroupedEntries; idx != numEntries; ++idx) {
4789 ENTRY_TYPE& entry = *(firstEntry + idx);
4790 const bsl::uint8_t& control = *(firstControl + idx);
4793 bslma::DestructionUtil::destroy(&entry);
4798template <
class ENTRY_TYPE>
4800void FlatHashTable_ImplUtil::destroyEntryArray(
4803 const bsl::uint8_t *,
4804 const bsl::uint8_t *,
4807 (void) triviallyDestructible;
4813template <
class ENTRY_TYPE>
4815void FlatHashTable_ImplUtil::copyEntryAndControlArrays(
4816 ENTRY_TYPE *firstDestinationEntry,
4817 bsl::uint8_t *firstDestinationControl,
4818 const ENTRY_TYPE *firstSourceEntry,
4819 const ENTRY_TYPE *lastSourceEntry,
4820 const bsl::uint8_t *firstSourceControl,
4821 const bsl::uint8_t *lastSourceControl,
4825 bsl::distance(firstSourceControl, lastSourceControl));
4827 FlatHashTable_ImplUtil::copyEntryAndControlArrays(
4828 firstDestinationEntry,
4829 firstDestinationControl,
4838template <
class ENTRY_TYPE>
4840void FlatHashTable_ImplUtil::destroyEntryArray(
4841 ENTRY_TYPE *firstEntry,
4842 ENTRY_TYPE *lastEntry,
4843 const bsl::uint8_t *firstControl,
4844 const bsl::uint8_t *lastControl)
4847 bsl::distance(firstControl, lastControl));
4860 IsEntryTypeTriviallyDestructible;
4862 FlatHashTable_ImplUtil::destroyEntryArray(
4867 IsEntryTypeTriviallyDestructible());
4875template <
class ENTRY_TYPE>
4877FlatHashTable_ImplUtil::DestroyEntryArrayProctor<
4878 ENTRY_TYPE>::DestroyEntryArrayProctor(ENTRY_TYPE *firstEntry,
4879 ENTRY_TYPE *lastEntry,
4880 const bsl::uint8_t *firstControl,
4881 const bsl::uint8_t *lastControl)
4882: d_firstEntry_p(firstEntry)
4883, d_lastEntry_p(lastEntry)
4884, d_firstControl_p(firstControl)
4885, d_lastControl_p(lastControl)
4889template <
class ENTRY_TYPE>
4891FlatHashTable_ImplUtil::DestroyEntryArrayProctor<
4892 ENTRY_TYPE>::~DestroyEntryArrayProctor()
4894 ImplUtil::destroyEntryArray(d_firstEntry_p,
4901template <
class ENTRY_TYPE>
4903void FlatHashTable_ImplUtil::DestroyEntryArrayProctor<ENTRY_TYPE>::moveEnd(
4904 bsl::ptrdiff_t offset)
4906 d_lastEntry_p += offset;
4907 d_lastControl_p += offset;
4910template <
class ENTRY_TYPE>
4912void FlatHashTable_ImplUtil::DestroyEntryArrayProctor<ENTRY_TYPE>::release()
4916 d_firstControl_p = 0;
4917 d_lastControl_p = 0;
4924# error Not valid except when included from bdlc_flathashtable.h
static const bsl::uint8_t k_EMPTY
Definition bdlc_flathashtable_groupcontrol.h:125
static const bsl::size_t k_SIZE
Definition bdlc_flathashtable_groupcontrol.h:127
FlatHashTable_IteratorImp & operator=(const FlatHashTable_IteratorImp &rhs)
Definition bdlc_flathashtable.h:1376
~FlatHashTable_IteratorImp()=default
FlatHashTable_IteratorImp()
Definition bdlc_flathashtable.h:1344
void operator++()
Definition bdlc_flathashtable.h:1388
ENTRY & operator*() const
Definition bdlc_flathashtable.h:1409
Definition bdlc_flathashtable.h:326
void clear()
Definition bdlc_flathashtable.h:1875
bsl::size_t erase(const KEY &key)
Definition bdlc_flathashtable.h:1927
const ENTRY * entries() const
Definition bdlc_flathashtable.h:2329
static const bsl::size_t k_MIN_CAPACITY
Definition bdlc_flathashtable.h:503
float max_load_factor() const
Definition bdlc_flathashtable.h:2404
const_iterator cbegin() const
Definition bdlc_flathashtable.h:2440
void swap(FlatHashTable &other)
Definition bdlc_flathashtable.h:2266
HASH hash_type
Definition bdlc_flathashtable.h:337
bsl::pair< iterator, bool > insert(const ENTRY &entry)
Definition bdlc_flathashtable.h:2050
EQUAL key_equal_type
Definition bdlc_flathashtable.h:338
static const bsl::size_t k_MAX_LOAD_FACTOR_NUMERATOR
Definition bdlc_flathashtable.h:508
void reset()
Definition bdlc_flathashtable.h:2154
bsl::pair< iterator, bool > emplace(ARGS &&... args)
iterator find(const KEY &key)
Definition bdlc_flathashtable.h:2036
iterator end()
Definition bdlc_flathashtable.h:2257
bool empty() const
Definition bdlc_flathashtable.h:2318
bsl::pair< iterator, bool > try_emplace(const KEY &key, ARGS &&... args)
static const bsl::size_t k_MAX_LOAD_FACTOR_DENOMINATOR
Definition bdlc_flathashtable.h:513
ENTRY_UTIL entry_util_type
Definition bdlc_flathashtable.h:336
static const bsl::int8_t k_HASHLET_MASK
Definition bdlc_flathashtable.h:506
bslma::Allocator * allocator() const
Return the allocator used by this hash table to supply memory.
Definition bdlc_flathashtable.h:2466
bsl::size_t capacity() const
Definition bdlc_flathashtable.h:2284
bslstl::ForwardIterator< const ENTRY, IteratorImp > const_iterator
Definition bdlc_flathashtable.h:343
bslstl::ForwardIterator< ENTRY, IteratorImp > iterator
Definition bdlc_flathashtable.h:341
const bsl::uint8_t * controls() const
Definition bdlc_flathashtable.h:2303
ENTRY entry_type
Definition bdlc_flathashtable.h:335
ENTRY & operator[](BSLS_COMPILERFEATURES_FORWARD_REF(KEY_TYPE) key)
Definition bdlc_flathashtable.h:1852
KEY key_type
Definition bdlc_flathashtable.h:334
EQUAL key_eq() const
Definition bdlc_flathashtable.h:2380
bool contains(const KEY &key) const
Definition bdlc_flathashtable.h:2291
iterator begin()
Definition bdlc_flathashtable.h:2240
void reserve(bsl::size_t numEntries)
Definition bdlc_flathashtable.h:2135
bsl::enable_if< BloombergLP::bslmf::IsTransparentPredicate< HASH, LOOKUP_KEY >::value &&BloombergLP::bslmf::IsTransparentPredicate< EQUAL, LOOKUP_KEY >::value, bsl::pair< iterator, bool > >::type insertTransparent(LOOKUP_KEY &&key)
Definition bdlc_flathashtable.h:754
const_iterator cend() const
Definition bdlc_flathashtable.h:2448
bsl::size_t size() const
Return the number of entries in this table.
Definition bdlc_flathashtable.h:2412
bsl::size_t count(const KEY &key) const
Definition bdlc_flathashtable.h:2310
FlatHashTable & operator=(const FlatHashTable &rhs)
Definition bdlc_flathashtable.h:1824
~FlatHashTable()
Destroy this object and each of its entries.
Definition bdlc_flathashtable.h:1800
HASH hash_function() const
Definition bdlc_flathashtable.h:2373
float load_factor() const
Definition bdlc_flathashtable.h:2391
void rehash(bsl::size_t minimumCapacity)
Definition bdlc_flathashtable.h:2114
bsl::pair< iterator, iterator > equal_range(const KEY &key)
Definition bdlc_flathashtable.h:1894
Definition bslstl_pair.h:1280
static void swap(T *a, T *b)
Definition bslalg_swaputil.h:182
Definition bslma_allocator.h:545
virtual void deallocate(void *address)=0
virtual void * allocate(size_type size)=0
Definition bslma_deallocatorproctor.h:312
Definition bslma_destructorguard.h:132
Definition bslma_destructorproctor.h:259
Definition bslmf_movableref.h:752
Definition bslstl_forwarditerator.h:171
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:231
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_ASSERT_OPT_UNREACHABLE(X)
Definition bsls_assert.h:2065
#define BSLS_COMPILERFEATURES_FORWARD_REF(T)
Definition bsls_compilerfeatures.h:2343
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2349
bool operator!=(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
bool operator==(const FileCleanerConfiguration &lhs, const FileCleanerConfiguration &rhs)
void swap(OptionValue &a, OptionValue &b)
Definition bdlc_bitarray.h:506
void swap(BitArray &a, BitArray &b)
bool operator==(const BitArray &lhs, const BitArray &rhs)
bool operator!=(const BitArray &lhs, const BitArray &rhs)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
deque< VALUE_TYPE, ALLOCATOR >::size_type erase(deque< VALUE_TYPE, ALLOCATOR > &deq, const BDE_OTHER_TYPE &value)
Definition bslstl_deque.h:4424
T::iterator begin(T &container)
Definition bslstl_iterator.h:1593
ALLOCATOR & lhs
Definition bslstl_string.h:3917
T::iterator end(T &container)
Definition bslstl_iterator.h:1621
Definition baljsn_encoder_testtypes.h:76
Definition bdlbb_blob.h:579
static int numTrailingUnsetBits(unsigned int value)
Definition bdlb_bitutil.h:456
static unsigned int withBitCleared(unsigned int value, int index)
Definition bdlb_bitutil.h:571
static int log2(unsigned int value)
Definition bdlb_bitutil.h:340
static unsigned int roundUpToBinaryPower(unsigned int value)
Definition bdlb_bitutil.h:540
Definition bslmf_enableif.h:530
Definition bslmf_integralconstant.h:261
static void construct(TARGET_TYPE *address, const ALLOCATOR &allocator)
Definition bslma_constructionutil.h:1244
static void destructiveMove(TARGET_TYPE *address, const ALLOCATOR &allocator, TARGET_TYPE *original)
Definition bslma_constructionutil.h:1296
Definition bslmf_isbitwisecopyable.h:298
static MovableRef< t_TYPE > move(t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1067
Definition bsls_objectbuffer.h:277
TYPE * address()
Definition bsls_objectbuffer.h:335
TYPE & object()
Definition bsls_objectbuffer.h:352