
Hi Stephan, ----- Original Message ----- From: "Stefan Strasser" <strasser@uni-bremen.de> To: <boost@lists.boost.org> Sent: Monday, September 07, 2009 10:32 PM Subject: Re: [boost] Interest request for pointer+bit compressionoptimization
Am Monday 07 September 2009 19:00:14 schrieb vicente.botet:
Hi,
I have recently found in the blog of Joaquin the following optimization consisting in embed a bit into the representation of a pointer. Please read it, it is not too long (http://bannalia.blogspot.com/2008/11/optimizing-red-black-tree-color-bits. html)
I was wondering if it would be interesting to provide some generic template classes making easier this kind of optimization.
I know that boost.intrusive's rb-tree implements that, and below I quoted its way to decide if the pointer is aligned in a way to use the lower bits of the pointer.
Thanks for the pointer. So there is already an example of a potential Boost user.
if you wanted to implement that as a generic template I guess the best way is to hide it behind a class that models the concept of a std::pair, or a boost::tuple.
e.g. optimized_pair<void *,bool> p(0,false); assert(sizeof(p) == sizeof(void *));
Yes, this could be a valid alternative. I would try to implement it. Thanks, Vicente