
Brian Bartman <bbartmanboost <at> gmail.com> writes:
Would it be better to make the pointer_plus_bits convertible to a boolean based on the value of the pointer being stored? This would allow it to be more like to a pointer being that you could, as many people do, put it inside of an if statement to check to see if its null.
Converting to bool can be problematic, as throughly explained at http://www.informit.com/articles/article.aspx?p=31529&seqNum=8 The optimum way to do this is to convert to a pointer of a private type which is null if and only if the stored pointer is null. This is explained also at the reference above and it's the way boost::shared_ptr implements "conversion to bool semantics" (take a look at the source for inspiration). Joaquín M López Muñoz Telefónica, Investigación y Desarrollo