Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-04-19 08:20:56

Loïc Joly wrote:
> Hello everybody,
> In boost::shared_ptr, there is a trick to get a type convertible to
> bool that is not a bool... unspecified_bool_type is a function
> pointer.
> However, with MSVC8.0, and at least when I compile with /clr, I seem
> to have some problem with it : The null fct ptr seems to be coded
> 0xffffffff. That is just fine in non /clr compilation, where it gets
> evaluated as false when converted in boolean. But in /clr mode, it is
> converted to true.

I can't reproduce this problem with the following code:

#include <boost/shared_ptr.hpp>
#include <iostream>

int main()
    boost::shared_ptr<int> px;
    std::cout << ( px? true: false ) << std::endl;

compiled as /clr. The compiler does seem to encode a NULL member pointer
as -1, but the example prints 0, as it should.

Boost list run by bdawes at, gregod at, cpdaniel at, john at