
Hello, The attached patch contains some modifications to common_factor_test.cpp that make this file compile under MSVC 6.5 (and also possibly under MSVC 7.0 and CW 9.4, all of which are failing now): 1. Static constants haven been redeclared using BOOST_STATIC_CONSTANT. 2. my_wrapped_integer contains member template friend declarations, which older compilers do not support: replaced with non-template declarations that serve the same practical purposes. 3. MSVC++ 6.5/7.0 seem to have problems with Barton-Nackman injected operators when the associated type is instantiated only inside template code. The problem is solved by forcing instantiations of the offending types outside of the template code. This problem has already been reported elsewhere: http://lists.boost.org/Archives/boost/2006/10/111935.php 4. MSVC 6.5 does not have operator<<(ostream,__int64) nor operator<<(ostream, unsigned __int64), as reported in http://support.microsoft.com/default.aspx?scid=kb;en-us;168440 Solved by adding appropriate overloads inside namespace std. Any objections to this being commited to HEAD and RC_1_34_0? Thank you, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo 10a11
// 01 Dec 2006 Various fixes for old compilers (Joaquín M López Muñoz) 19a21 #include <boost/detail/workaround.hpp> 53c55 < static int const id = ID;
BOOST_STATIC_CONSTANT(int,id = ID);
87,89c89 < template < typename Ch, class Tr > < friend std::basic_istream<Ch, Tr> & < operator >>( std::basic_istream<Ch, Tr> &i, self_type &x ) ---
friend std::istream & operator >>( std::istream &i, self_type &x )
92,94c92 < template < typename Ch, class Tr > < friend std::basic_ostream<Ch, Tr> & < operator <<( std::basic_ostream<Ch, Tr> &o, self_type const &x ) ---
friend std::ostream & operator <<( std::ostream &o, self_type const &x )
107a106,112
// Without these explicit instantiations, MSVC++ 6.5/7.0 does not find // some friend operators in certain contexts. MyInt1 dummy1; MyUnsigned1 dummy2; MyInt2 dummy3; MyUnsigned2 dummy4;
139c144 < static const bool is_specialized = limits_type::is_specialized; ---
BOOST_STATIC_CONSTANT(bool, is_specialized = limits_type::is_specialized);
144,149c149,154 < static const int digits = limits_type::digits; < static const int digits10 = limits_type::digits10; < static const bool is_signed = limits_type::is_signed; < static const bool is_integer = limits_type::is_integer; < static const bool is_exact = limits_type::is_exact; < static const int radix = limits_type::radix; ---
BOOST_STATIC_CONSTANT(int, digits = limits_type::digits); BOOST_STATIC_CONSTANT(int, digits10 = limits_type::digits10); BOOST_STATIC_CONSTANT(bool, is_signed = limits_type::is_signed); BOOST_STATIC_CONSTANT(bool, is_integer = limits_type::is_integer); BOOST_STATIC_CONSTANT(bool, is_exact = limits_type::is_exact); BOOST_STATIC_CONSTANT(int, radix = limits_type::radix);
153,162c158,167 < static const int min_exponent = limits_type::min_exponent; < static const int min_exponent10 = limits_type::min_exponent10; < static const int max_exponent = limits_type::max_exponent; < static const int max_exponent10 = limits_type::max_exponent10; < < static const bool has_infinity = limits_type::has_infinity; < static const bool has_quiet_NaN = limits_type::has_quiet_NaN; < static const bool has_signaling_NaN = limits_type::has_signaling_NaN; < static const float_denorm_style has_denorm = limits_type::has_denorm; < static const bool has_denorm_loss = limits_type::has_denorm_loss; ---
BOOST_STATIC_CONSTANT(int, min_exponent = limits_type::min_exponent); BOOST_STATIC_CONSTANT(int, min_exponent10 = limits_type::min_exponent10); BOOST_STATIC_CONSTANT(int, max_exponent = limits_type::max_exponent); BOOST_STATIC_CONSTANT(int, max_exponent10 = limits_type::max_exponent10);
BOOST_STATIC_CONSTANT(bool, has_infinity = limits_type::has_infinity); BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = limits_type::has_quiet_NaN); BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = limits_type::has_signaling_NaN); BOOST_STATIC_CONSTANT(float_denorm_style, has_denorm = limits_type::has_denorm); BOOST_STATIC_CONSTANT(bool, has_denorm_loss = limits_type::has_denorm_loss);
169,175c174,180 < static const bool is_iec559 = limits_type::is_iec559; < static const bool is_bounded = limits_type::is_bounded; < static const bool is_modulo = limits_type::is_modulo; < < static const bool traps = limits_type::traps; < static const bool tinyness_before = limits_type::tinyness_before; < static const float_round_style round_style = limits_type::round_style; ---
BOOST_STATIC_CONSTANT(bool, is_iec559 = limits_type::is_iec559); BOOST_STATIC_CONSTANT(bool, is_bounded = limits_type::is_bounded); BOOST_STATIC_CONSTANT(bool, is_modulo = limits_type::is_modulo);
BOOST_STATIC_CONSTANT(bool, traps = limits_type::traps); BOOST_STATIC_CONSTANT(bool, tinyness_before = limits_type::tinyness_before); BOOST_STATIC_CONSTANT(float_round_style, round_style = limits_type::round_style);
186c191 < static const bool is_specialized = limits_type::is_specialized; ---
BOOST_STATIC_CONSTANT(bool, is_specialized = limits_type::is_specialized);
191,196c196,201 < static const int digits = limits_type::digits; < static const int digits10 = limits_type::digits10; < static const bool is_signed = limits_type::is_signed; < static const bool is_integer = limits_type::is_integer; < static const bool is_exact = limits_type::is_exact; < static const int radix = limits_type::radix; ---
BOOST_STATIC_CONSTANT(int, digits = limits_type::digits); BOOST_STATIC_CONSTANT(int, digits10 = limits_type::digits10); BOOST_STATIC_CONSTANT(bool, is_signed = limits_type::is_signed); BOOST_STATIC_CONSTANT(bool, is_integer = limits_type::is_integer); BOOST_STATIC_CONSTANT(bool, is_exact = limits_type::is_exact); BOOST_STATIC_CONSTANT(int, radix = limits_type::radix);
200,209c205,214 < static const int min_exponent = limits_type::min_exponent; < static const int min_exponent10 = limits_type::min_exponent10; < static const int max_exponent = limits_type::max_exponent; < static const int max_exponent10 = limits_type::max_exponent10; < < static const bool has_infinity = limits_type::has_infinity; < static const bool has_quiet_NaN = limits_type::has_quiet_NaN; < static const bool has_signaling_NaN = limits_type::has_signaling_NaN; < static const float_denorm_style has_denorm = limits_type::has_denorm; < static const bool has_denorm_loss = limits_type::has_denorm_loss; ---
BOOST_STATIC_CONSTANT(int, min_exponent = limits_type::min_exponent); BOOST_STATIC_CONSTANT(int, min_exponent10 = limits_type::min_exponent10); BOOST_STATIC_CONSTANT(int, max_exponent = limits_type::max_exponent); BOOST_STATIC_CONSTANT(int, max_exponent10 = limits_type::max_exponent10);
BOOST_STATIC_CONSTANT(bool, has_infinity = limits_type::has_infinity); BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = limits_type::has_quiet_NaN); BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = limits_type::has_signaling_NaN); BOOST_STATIC_CONSTANT(float_denorm_style, has_denorm = limits_type::has_denorm); BOOST_STATIC_CONSTANT(bool, has_denorm_loss = limits_type::has_denorm_loss);
217,223c222,228 < static const bool is_iec559 = limits_type::is_iec559; < static const bool is_bounded = limits_type::is_bounded; < static const bool is_modulo = limits_type::is_modulo; < < static const bool traps = limits_type::traps; < static const bool tinyness_before = limits_type::tinyness_before; < static const float_round_style round_style = limits_type::round_style; ---
BOOST_STATIC_CONSTANT(bool, is_iec559 = limits_type::is_iec559); BOOST_STATIC_CONSTANT(bool, is_bounded = limits_type::is_bounded); BOOST_STATIC_CONSTANT(bool, is_modulo = limits_type::is_modulo);
BOOST_STATIC_CONSTANT(bool, traps = limits_type::traps); BOOST_STATIC_CONSTANT(bool, tinyness_before = limits_type::tinyness_before); BOOST_STATIC_CONSTANT(float_round_style, round_style = limits_type::round_style);
227c232,242 < } // namespace std ---
#if BOOST_WORKAROUND(BOOST_MSVC,<1300) // MSVC 6.0 lacks operator<< for __int64, see // http://support.microsoft.com/default.aspx?scid=kb;en-us;168440
inline ostream& operator<<(ostream& os, __int64 i) { char buf[20]; sprintf(buf,"%I64d", i); os << buf; return os; } 228a244,253 inline ostream& operator<<(ostream& os, unsigned __int64 i) { char buf[20]; sprintf(buf,"%I64u", i); os << buf; return os; } #endif
} // namespace std