"David Abrahams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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 > codebase.
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 something like python::detail::member_function_cast<Target>::stage1(f).stage2(f) 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::*) ()) { return cast_helper<S,T>(); } Then cast_helper<S,T> derives from mpl::if_c<is_base_and_derived<S,T>::value,...,...> 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); to typedef int (Y::*mpf1)() const; assert_mf_cast<mpf1, Y>(&X::f); I'm not sure if you'd like to have this in the codebase! Chris _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost