Help with deficient compilers?

I need help with fixing code in BOOST_ROOT/libs/integer/test/ integer_test.cpp. It works fine on my computer, but other ones are giving errors. I have some guesses on what's wrong, but I need suggestions on what the fixes should be. 1. I have a custom meta-function like: //========================= typedef boost::mpl::vector<unsigned char, unsigned short, unsigned int, unsigned long long> distinct_unsigned_types; typedef boost::mpl::transform< distinct_unsigned_types, boost::make_signed< boost::mpl::_1 >
::type distinct_signed_types;
// List the digit counts for each integral type template < typename T > struct digits_of : boost::mpl::int_< std::numeric_limits<T>::digits > { }; typedef boost::mpl::transform< distinct_unsigned_types, digits_of< boost::mpl::_1 >
::type distinct_integral_bit_counts; //=========================
I noticed that supplied meta-functions, like boost.make_unsigned, use macros in their implementations, instead of the straight implementation I use in digits_of. Now MPL says that its machinery will make sure that straight implementations work. However, I don't think it's successful on deficient compilers. Maybe I should structure digits_of with all the work-around macros. How? (I don't want to just look at the headers and guess how they work.) 2. I don't think I have SFINAE selection correct: //========================= #ifndef BOOST_NO_SFINAE template < typename ValueT, template<ValueT> class Tmpl, ValueT Value > bool print_out_template( Tmpl<Value> const &, ValueT setting, char const *template_pre_name, char const *template_post_name, typename Tmpl<Value>::type *unused = 0 ) { // Too bad the type-id expression couldn't use the compact form "*unused", // but type-ids of dereferenced null pointers throw by order of C ++ 2003, // sect. 5.2.8, para. 2 (although the result is not conceptually needed). PRIVATE_SHOW_MESSAGE( "This is " << template_pre_name << setting << template_post_name << " specialization, with type '" << typeid(typename Tmpl<Value>::type).name() << "'." ); return true; } template < typename ValueT, typename T > bool print_out_template( T const &, ValueT setting, char const *template_pre_name, char const *template_post_name ) { PRIVATE_SHOW_MESSAGE( "Looking for " << template_pre_name << setting << template_post_name << " specialization? It doesn't exist." ); return false; } #else #error "These tests cannot work without Substitution-Failure-Is-Not- An-Error" #endif //========================= The BOOST_NO_SFINAE guards didn't help, compilers still choked on this code. (I guess I'll remove those guards later.) I think that any type that doesn't have an inner "type" will only choose the false- return case. On my computer, types with an inner "type" will choose the true return case, with that case being given priority. The reports are giving errors where, when given a type with an inner "type", the two cases are considered equal, leading to an ambiguity error. How do I restructure this code? -- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT hotmail DOT com
participants (1)
-
Daryle Walker