@@ -194,11 +194,10 @@ class sharing_mapt
194
194
typedef std::vector<key_type> keyst;
195
195
196
196
protected:
197
- typedef sharing_nodet<key_type, mapped_type> innert;
198
- typedef sharing_nodet<key_type, mapped_type> leaft;
197
+ typedef sharing_nodet<key_type, mapped_type> nodet;
199
198
200
- typedef typename innert ::to_mapt to_mapt;
201
- typedef typename innert ::leaf_listt leaf_listt;
199
+ typedef typename nodet ::to_mapt to_mapt;
200
+ typedef typename nodet ::leaf_listt leaf_listt;
202
201
203
202
struct falset
204
203
{
@@ -519,8 +518,8 @@ class sharing_mapt
519
518
protected:
520
519
// helpers
521
520
522
- leaft &get_leaf_node (const key_type &k);
523
- const leaft *get_leaf_node (const key_type &k) const ;
521
+ nodet &get_leaf_node (const key_type &k);
522
+ const nodet *get_leaf_node (const key_type &k) const ;
524
523
525
524
// / Move a container node (containing a single leaf) further down the tree
526
525
// / such as to resolve a collision with another key-value pair. This method is
@@ -545,12 +544,12 @@ class sharing_mapt
545
544
const std::size_t starting_level,
546
545
const std::size_t key_suffix,
547
546
const std::size_t bit_last,
548
- innert &inner,
547
+ nodet &inner,
549
548
const key_type &k,
550
549
valueU &&m);
551
550
552
551
void iterate(
553
- const innert &n,
552
+ const nodet &n,
554
553
std::function<void (const key_type &k, const mapped_type &m)> f) const ;
555
554
556
555
// / Add a delta item to the delta view if the value in the \p container (which
@@ -568,13 +567,13 @@ class sharing_mapt
568
567
// / \param only_common: flag indicating if only items are added to the delta
569
568
// / view for which the keys are in both maps
570
569
void add_item_if_not_shared (
571
- const leaft &leaf,
572
- const innert &inner,
570
+ const nodet &leaf,
571
+ const nodet &inner,
573
572
const std::size_t level,
574
573
delta_viewt &delta_view,
575
574
const bool only_common) const ;
576
575
577
- void gather_all (const innert &n, delta_viewt &delta_view) const ;
576
+ void gather_all (const nodet &n, delta_viewt &delta_view) const ;
578
577
579
578
std::size_t count_unmarked_nodes (
580
579
bool leafs_only,
@@ -592,25 +591,25 @@ class sharing_mapt
592
591
static const std::size_t levels;
593
592
594
593
// key-value map
595
- innert map;
594
+ nodet map;
596
595
597
596
// number of elements in the map
598
597
size_type num = 0 ;
599
598
};
600
599
601
600
SHARING_MAPT (void )
602
601
::iterate(
603
- const innert &n,
602
+ const nodet &n,
604
603
std::function<void (const key_type &k, const mapped_type &m)> f) const
605
604
{
606
605
SM_ASSERT (!n.empty ());
607
606
608
- std::stack<const innert *> stack;
607
+ std::stack<const nodet *> stack;
609
608
stack.push (&n);
610
609
611
610
do
612
611
{
613
- const innert *ip = stack.top ();
612
+ const nodet *ip = stack.top ();
614
613
stack.pop ();
615
614
616
615
SM_ASSERT (!ip->empty ());
@@ -656,12 +655,12 @@ ::count_unmarked_nodes(
656
655
657
656
unsigned count = 0 ;
658
657
659
- std::stack<const innert *> stack;
658
+ std::stack<const nodet *> stack;
660
659
stack.push (&map);
661
660
662
661
do
663
662
{
664
- const innert *ip = stack.top ();
663
+ const nodet *ip = stack.top ();
665
664
SM_ASSERT (!ip->empty ());
666
665
stack.pop ();
667
666
@@ -795,7 +794,7 @@ SHARING_MAPT(void)::get_view(viewt &view) const
795
794
}
796
795
797
796
SHARING_MAPT (void )
798
- ::gather_all(const innert &n, delta_viewt &delta_view) const
797
+ ::gather_all(const nodet &n, delta_viewt &delta_view) const
799
798
{
800
799
auto f = [&delta_view](const key_type &k, const mapped_type &m) {
801
800
delta_view.push_back (delta_view_itemt (k, m));
@@ -805,8 +804,8 @@ ::gather_all(const innert &n, delta_viewt &delta_view) const
805
804
}
806
805
807
806
SHARING_MAPT (void )::add_item_if_not_shared(
808
- const leaft &leaf,
809
- const innert &inner,
807
+ const nodet &leaf,
808
+ const nodet &inner,
810
809
const std::size_t level,
811
810
delta_viewt &delta_view,
812
811
const bool only_common) const
@@ -816,7 +815,7 @@ SHARING_MAPT(void)::add_item_if_not_shared(
816
815
817
816
key >>= level * chunk;
818
817
819
- const innert *ip = &inner;
818
+ const nodet *ip = &inner;
820
819
SM_ASSERT (ip->is_defined_internal ());
821
820
822
821
while (true )
@@ -899,7 +898,7 @@ ::get_delta_view(
899
898
return ;
900
899
}
901
900
902
- typedef std::pair<const innert *, const innert *> stack_itemt;
901
+ typedef std::pair<const nodet *, const nodet *> stack_itemt;
903
902
std::stack<stack_itemt> stack;
904
903
905
904
std::stack<std::size_t > level_stack;
@@ -921,8 +920,8 @@ ::get_delta_view(
921
920
{
922
921
const stack_itemt &si = stack.top ();
923
922
924
- const innert *ip1 = si.first ;
925
- const innert *ip2 = si.second ;
923
+ const nodet *ip1 = si.first ;
924
+ const nodet *ip2 = si.second ;
926
925
927
926
SM_ASSERT (!ip1->shares_with (*ip2));
928
927
@@ -942,9 +941,9 @@ ::get_delta_view(
942
941
{
943
942
for (const auto &item : ip1->get_to_map ())
944
943
{
945
- const innert &child = item.second ;
944
+ const nodet &child = item.second ;
946
945
947
- const innert *p;
946
+ const nodet *p;
948
947
p = ip2->find_child (item.first );
949
948
950
949
if (p == nullptr )
@@ -967,7 +966,7 @@ ::get_delta_view(
967
966
968
967
for (const auto &item : ip1->get_to_map ())
969
968
{
970
- const innert &child = item.second ;
969
+ const nodet &child = item.second ;
971
970
972
971
if (!child.shares_with (*ip2))
973
972
{
@@ -1039,7 +1038,7 @@ ::get_delta_view(
1039
1038
for (const auto &l1 : ip1->get_container ())
1040
1039
{
1041
1040
const key_type &k1 = l1.get_key ();
1042
- const leaft *p;
1041
+ const nodet *p;
1043
1042
1044
1043
p = ip2->find_leaf (k1);
1045
1044
@@ -1063,12 +1062,12 @@ ::get_delta_view(
1063
1062
while (!stack.empty ());
1064
1063
}
1065
1064
1066
- SHARING_MAPT2 (, leaft &)::get_leaf_node(const key_type &k)
1065
+ SHARING_MAPT2 (, nodet &)::get_leaf_node(const key_type &k)
1067
1066
{
1068
1067
SM_ASSERT (has_key (k));
1069
1068
1070
1069
std::size_t key = hash ()(k);
1071
- innert *ip = ↦
1070
+ nodet *ip = ↦
1072
1071
SM_ASSERT (ip->is_defined_internal ());
1073
1072
1074
1073
while (true )
@@ -1096,13 +1095,13 @@ SHARING_MAPT2(, leaft &)::get_leaf_node(const key_type &k)
1096
1095
}
1097
1096
}
1098
1097
1099
- SHARING_MAPT2 (const , leaft *)::get_leaf_node(const key_type &k) const
1098
+ SHARING_MAPT2 (const , nodet *)::get_leaf_node(const key_type &k) const
1100
1099
{
1101
1100
if (empty ())
1102
1101
return nullptr ;
1103
1102
1104
1103
std::size_t key = hash ()(k);
1105
- const innert *ip = ↦
1104
+ const nodet *ip = ↦
1106
1105
SM_ASSERT (ip->is_defined_internal ());
1107
1106
1108
1107
while (true )
@@ -1141,11 +1140,11 @@ SHARING_MAPT(void)::erase(const key_type &k)
1141
1140
{
1142
1141
SM_ASSERT (has_key (k));
1143
1142
1144
- innert *del = nullptr ;
1143
+ nodet *del = nullptr ;
1145
1144
std::size_t del_bit = 0 ;
1146
1145
1147
1146
std::size_t key = hash ()(k);
1148
- innert *ip = ↦
1147
+ nodet *ip = ↦
1149
1148
1150
1149
while (true )
1151
1150
{
@@ -1210,23 +1209,23 @@ ::migrate(
1210
1209
const std::size_t starting_level,
1211
1210
const std::size_t key_suffix,
1212
1211
const std::size_t bit_last,
1213
- innert &inner,
1212
+ nodet &inner,
1214
1213
const key_type &k,
1215
1214
valueU &&m)
1216
1215
{
1217
1216
SM_ASSERT (starting_level < levels - 1 );
1218
1217
SM_ASSERT (inner.is_defined_internal ());
1219
1218
1220
- leaft &leaf = inner.add_child (bit_last);
1219
+ nodet &leaf = inner.add_child (bit_last);
1221
1220
SM_ASSERT (leaf.is_defined_leaf ());
1222
1221
1223
1222
std::size_t key_existing = hash ()(leaf.get_key ());
1224
1223
key_existing >>= chunk * starting_level;
1225
1224
1226
- leaft leaf_kept;
1225
+ nodet leaf_kept;
1227
1226
leaf_kept.swap (leaf);
1228
1227
1229
- innert *ip = &leaf;
1228
+ nodet *ip = &leaf;
1230
1229
SM_ASSERT (ip->empty ());
1231
1230
1232
1231
// Find place for both elements
@@ -1250,11 +1249,11 @@ ::migrate(
1250
1249
{
1251
1250
// Place found
1252
1251
1253
- innert &l1 = ip->add_child (bit_existing);
1252
+ nodet &l1 = ip->add_child (bit_existing);
1254
1253
SM_ASSERT (l1.empty ());
1255
1254
l1.swap (leaf_kept);
1256
1255
1257
- innert &l2 = ip->add_child (bit);
1256
+ nodet &l2 = ip->add_child (bit);
1258
1257
SM_ASSERT (l2.empty ());
1259
1258
l2.make_leaf (k, std::forward<valueU>(m));
1260
1259
@@ -1289,7 +1288,7 @@ ::insert(const key_type &k, valueU &&m)
1289
1288
SM_ASSERT (!has_key (k));
1290
1289
1291
1290
std::size_t key = hash ()(k);
1292
- innert *ip = ↦
1291
+ nodet *ip = ↦
1293
1292
1294
1293
// The root must be an internal node
1295
1294
SM_ASSERT (ip->is_internal ());
@@ -1304,7 +1303,7 @@ ::insert(const key_type &k, valueU &&m)
1304
1303
SM_ASSERT (ip->is_internal ());
1305
1304
SM_ASSERT (level == 0 || !ip->empty ());
1306
1305
1307
- innert &child = ip->add_child (bit);
1306
+ nodet &child = ip->add_child (bit);
1308
1307
1309
1308
// Place is unoccupied
1310
1309
if (child.empty ())
@@ -1365,7 +1364,7 @@ ::insert(const key_type &k, valueU &&m)
1365
1364
SHARING_MAPT4 (valueU, void )
1366
1365
::replace(const key_type &k, valueU &&m)
1367
1366
{
1368
- leaft &lp = get_leaf_node (k);
1367
+ nodet &lp = get_leaf_node (k);
1369
1368
1370
1369
INVARIANT (
1371
1370
!value_equalt ()(as_const (lp).get_value (), m),
@@ -1377,7 +1376,7 @@ ::replace(const key_type &k, valueU &&m)
1377
1376
SHARING_MAPT (void )
1378
1377
::update(const key_type &k, std::function<void (mapped_type &)> mutator)
1379
1378
{
1380
- leaft &lp = get_leaf_node (k);
1379
+ nodet &lp = get_leaf_node (k);
1381
1380
1382
1381
value_comparatort comparator (as_const (lp).get_value ());
1383
1382
@@ -1392,7 +1391,7 @@ ::update(const key_type &k, std::function<void(mapped_type &)> mutator)
1392
1391
SHARING_MAPT2 (optionalt<std::reference_wrapper<const , mapped_type>>)::find(
1393
1392
const key_type &k) const
1394
1393
{
1395
- const leaft *lp = get_leaf_node (k);
1394
+ const nodet *lp = get_leaf_node (k);
1396
1395
1397
1396
if (lp == nullptr )
1398
1397
return {};
0 commit comments