On 10/10/2017 10:02, Hans Dembinski via Boost wrote:
Hi Ion,
On 10. Oct 2017, at 00:17, Ion Gaztañaga via Boost
wrote: There is a related (not a replacement) utility in Boost.Intrusive, used to store additional bits in red-black and AVL trees:
http://www.boost.org/doc/libs/1_65_1/boost/intrusive/pointer_plus_bits.hpp http://www.boost.org/doc/libs/1_65_1/boost/intrusive/pointer_plus_bits.hpp
It assumes the conversion between pointers and integers preserves the alignment in the lower bits of the integer. There are some esoteric platforms where this might not be true, but Boost.Intrusive does not support them.
ah, thanks, I didn't know that one. I thought Boost.Intrusive was about containers only, so I would never have looked there. Seeing how pointer_plus_bits is used in Boost.Intrusive, it seems that it is not really intended for users, and serves more as an utility for the library. It is not advertised in the documentation either.
Right now it's used internally and shared with Boost.Interprocess. But obviously we could make them public. The main point is that an utility to embed bits in pointers could consider also fancy pointers. Best, Ion