Why no "w != NULL" assertion before boost/intrusive/rbtree_algorithms.hpp:511 like before the line 476?

Andrew via Boost-users <[email protected]> Tue, 05 Aug 2025 08:05:14 -0000
Newsgroups gmane.comp.lib.boost.user
Message-ID <[email protected]>
Boost version: latest release

file: boost/intrusive/rbtree_algorithms.hpp

function: rebalance_after_erasure_restore_invariants

in this if-branch

```
if(x == x_parent_left){ //x is left child
```

there is "w != NULL" assertion before variable 'w' access:

```
BOOST_INTRUSIVE_INVARIANT_ASSERT(w);
if(NodeTraits::get_color(w) == NodeTraits::red()){
```

but in else-branch there is no same assertion before variable 'w' access:

```
if(NodeTraits::get_color(w) == NodeTraits::red()){
```

Why? Are there no assertion in else-branch intentionally due to the rbtree structure itself? 

Thanks.
_______________________________________________
Boost-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.boost.org/mailman3/lists/boost-users.lists.boost.org/
Archived at: https://lists.boost.org/archives/list/[email protected]/message/QEMYKNTWLOBDRTDUC2ATC5FMZPDBEMQP/