
Pedro, Thanks, I see it now in [lib.util.smartptr.shared.obs]. Thanks to you all for pointing me to this and solving my bool conversion problem. So if( x ) should be possible for integer x, and I will include this in my document, and test it for a few compilers. Regards, Maarten. "Pedro LamarĂ£o" <pedro.lamarao@intersix.com.br> wrote in message news:e54msp$24k$1@sea.gmane.org... Maarten Kronenburg escreveu:
Thanks for your comments. The integer is not a drop-in replacement for any base type; because it accesses its data through a pointer, and has to check on certain conditions and carries etc, it is much slower than the base types.
He meant by "drop-in replacement" that an integer object should behave exactly like an int object, so that we could just replace int i; by integer i; and everything just work like magic. That would be highly desirable.
A conversion operator will generate ambiguities in expressions, even a bool conversion operator, because bool can be implicitly converted to int.
That can be avoided with the trick mentioned by the parent:
First, an operator unspecified_bool_type(), like the one found in shared_ptr.
The trick involves a pointer-to-member; those are not implicitly convertible to int, but are "testable for nullness". The unique_ptr proposal also uses this trick. -- Pedro LamarĂ£o _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost