Skip to content

Commit 22b6eb6

Browse files
committed
Add methods to check if sharing node is non-empty and of a certain type
1 parent 21476dd commit 22b6eb6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/util/sharing_map.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,8 @@ SHARING_MAPT2(, innert *)::get_container_node(const key_type &k)
894894
key >>= chunk;
895895
}
896896

897+
SM_ASSERT(ip->is_container());
898+
897899
return ip;
898900
}
899901

@@ -916,6 +918,8 @@ SHARING_MAPT2(const, innert *)::get_container_node(const key_type &k) const
916918
key >>= chunk;
917919
}
918920

921+
SM_ASSERT(ip->is_defined_container());
922+
919923
return ip;
920924
}
921925

src/util/sharing_node.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@ SN_TYPE_PAR_DEF class sharing_node_innert : public sharing_node_baset
163163
return data.is_derived_v();
164164
}
165165

166+
bool is_defined_internal() const
167+
{
168+
return !empty() && is_internal();
169+
}
170+
171+
bool is_defined_container() const
172+
{
173+
return !empty() && is_container();
174+
}
175+
166176
const d_it &read_internal() const
167177
{
168178
SN_ASSERT(!empty());

0 commit comments

Comments
 (0)