From: Chris Trengove (trengove_at_[hidden])
Date: 2003-04-01 04:29:32
"David Abrahams" <dave_at_[hidden]> wrote in message
> Please see if you can come up with a simpler non-specific approach
> which might break cwpro7. That's what I'd like to have in the
I think I have come across an approach which works with BCC, but I'm afraid
it can hardly be called "non-specific". Not being able to use template
syntax with member function pointers is quite a handicap. We end up with
where stage1() is a set of overloaded member functions which merely extract
the class (S) from the member function pointer; eg.
template <class S,class R>
static cast_helper<S,T> stage1(R (S::*) ())
Then cast_helper<S,T> derives from
to choose between the two types of cast, which is performed by the stage2()
member function. However, for the base/derived case, we need an additional
full set of overloaded member functions to perform the cast. So the net
effect of this particular compiler bug is that we need to double the work of
Boost.Preprocessor in generating all these overloads!
To add insult to injury, we also have to re-write the test file as well,
using typedefs everywhere. For example, change
assert_mf_cast<int (Y::*)() const, Y>(&X::f);
typedef int (Y::*mpf1)() const;
I'm not sure if you'd like to have this in the codebase!
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk