
David Greene wrote:
testbed.cpp:33: error: operands to ?: have different types `boost::shared_ptr<Base>' and `boost::shared_ptr<A>'
Well, yes. Without BOOST_SP_NO_SP_CONVERTIBLE, the test does not generate that error. If the code used bare pointers the error would also not occur, so it's surprising to see it just by using a smart pointer.
The enable_if test disables the shared_ptr<Base> to shared_ptr<A> conversion, so there is no longer any ambiguity.
That's really bad. It effectively means one can't easily tell when one might need the full definition of a type. I ran into this because I wanted to decouple some code defining the body of one function that takes one type from the body of another that takes a different type. In terms of the example, I didn't want changes to A to cause recompilation of functions that take a Wrapper<B>.
I see how that might be a problem, but I don't see a solution. Either way, someone loses. I'd probably remove the typedef typename Tag::type type in this case, as it's the only thing requiring the definition of A.