[minmax] fixes to support MSVC

The following patches make the two tests of Boost.Minmax pass for MSVC 6.5: 1. minmax.hpp: 28a29
#include <boost/ref.hpp>
There were some usages of boost::ref without including its header. I think this patch is necessary for every copmiler, not only MSVC. 2. minmax_test.hpp: 52,53c52,53 < BOOST_CHECK_EQUAL( result1.get<0>(), zero ); < BOOST_CHECK_EQUAL( result1.get<1>(), one ); ---
BOOST_CHECK_EQUAL( get<0>(result1), zero ); BOOST_CHECK_EQUAL( get<1>(result1), one ); 56,57c56,57 < BOOST_CHECK_EQUAL( result2.get<0>(), zero ); < BOOST_CHECK_EQUAL( result2.get<1>(), one );
BOOST_CHECK_EQUAL( get<0>(result2), zero ); BOOST_CHECK_EQUAL( get<1>(result2), one ); 62,63c62,63 < BOOST_CHECK_EQUAL( result3.get<0>(), zero ); < BOOST_CHECK_EQUAL( result3.get<1>(), one );
BOOST_CHECK_EQUAL( get<0>(result3), zero ); BOOST_CHECK_EQUAL( get<1>(result3), one ); 68,69c68,69 < BOOST_CHECK_EQUAL( result4.get<0>(), zero ); < BOOST_CHECK_EQUAL( result4.get<1>(), one );
BOOST_CHECK_EQUAL( get<0>(result4), zero ); BOOST_CHECK_EQUAL( get<1>(result4), one );
In MSVC 6.0 and later Boost.Tuple does not provide the get<>() member function, so we have to resort to the global get function. I don't think this does any harm to any other compiler. 3. minmax_element_test.hpp 0a1
#include <boost/config.hpp> /* prevents some nasty warns in MSVC */ 35a37,38
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(custom)
The first include activates pragmas in MSVC that help avoid some nasty and harmless warnings. As for the second change, the error messages clearly indicate that this macro be used. This is what I've done, and the now test compiles and runs like breeze. With these three changes, all failures for MSVC 6.5 are solved. OK to commit? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo 28a29
#include <boost/ref.hpp>
52,53c52,53 < BOOST_CHECK_EQUAL( result1.get<0>(), zero ); < BOOST_CHECK_EQUAL( result1.get<1>(), one ); ---
BOOST_CHECK_EQUAL( get<0>(result1), zero ); BOOST_CHECK_EQUAL( get<1>(result1), one ); 56,57c56,57 < BOOST_CHECK_EQUAL( result2.get<0>(), zero ); < BOOST_CHECK_EQUAL( result2.get<1>(), one );
BOOST_CHECK_EQUAL( get<0>(result2), zero ); BOOST_CHECK_EQUAL( get<1>(result2), one ); 62,63c62,63 < BOOST_CHECK_EQUAL( result3.get<0>(), zero ); < BOOST_CHECK_EQUAL( result3.get<1>(), one );
BOOST_CHECK_EQUAL( get<0>(result3), zero ); BOOST_CHECK_EQUAL( get<1>(result3), one ); 68,69c68,69 < BOOST_CHECK_EQUAL( result4.get<0>(), zero ); < BOOST_CHECK_EQUAL( result4.get<1>(), one );
BOOST_CHECK_EQUAL( get<0>(result4), zero ); BOOST_CHECK_EQUAL( get<1>(result4), one );
0a1
#include <boost/config.hpp> /* prevents some nasty warns in MSVC */ 35a37,38
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(custom)

On Jul 22, 2004, at 6:40 AM, Joaquín Mª López Muñoz wrote:
The following patches make the two tests of Boost.Minmax pass for MSVC 6.5:
1. minmax.hpp: 28a29
#include <boost/ref.hpp>
I thought this was included by tuple, but maybe it is undocumented, and in any case, since the use is explicit, better include the header. Thanks!
2. minmax_test.hpp: In MSVC 6.0 and later Boost.Tuple does not provide the get<>() member function, so we have to resort to the global get function. I don't think this does any harm to any other compiler.
That's fine with me. I'm not used to the latter idiom, but if it please MSVC... It's also a bit more generic, so I really don't mind ;-)
With these three changes, all failures for MSVC 6.5 are solved. OK to commit?
Absolutely, go ahead and thank you very much, Joaquin! -- Herve'
participants (2)
-
Hervé Brönnimann
-
Joaquín Mª López Muñoz