From e52916acf2338c4d9d18de2ace90b1a7a5cdb9f0 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 29 Jul 2000 11:39:42 +0000 Subject: [PATCH] minor compiler compatability fixes [SVN r7661] --- call_traits_test.cpp | 76 +++++++++++++++++++++++----------------- compressed_pair_test.cpp | 18 ++++++---- type_traits_test.cpp | 6 ++++ 3 files changed, 61 insertions(+), 39 deletions(-) diff --git a/call_traits_test.cpp b/call_traits_test.cpp index c89169f..d0db895 100644 --- a/call_traits_test.cpp +++ b/call_traits_test.cpp @@ -295,37 +295,47 @@ int main() template struct call_traits_test { - static void assert_construct(boost::call_traits::param_type val); + typedef ::boost::call_traits ct; + typedef typename ct::param_type param_type; + typedef typename ct::reference reference; + typedef typename ct::const_reference const_reference; + typedef typename ct::value_type value_type; + static void assert_construct(param_type val); }; template -void call_traits_test::assert_construct(boost::call_traits::param_type val) +void call_traits_test::assert_construct(typename call_traits_test::param_type val) { // // this is to check that the call_traits assertions are valid: T t(val); - boost::call_traits::value_type v(t); - boost::call_traits::reference r(t); - boost::call_traits::const_reference cr(t); - boost::call_traits::param_type p(t); - boost::call_traits::value_type v2(v); - boost::call_traits::value_type v3(r); - boost::call_traits::value_type v4(p); - boost::call_traits::reference r2(v); - boost::call_traits::reference r3(r); - boost::call_traits::const_reference cr2(v); - boost::call_traits::const_reference cr3(r); - boost::call_traits::const_reference cr4(cr); - boost::call_traits::const_reference cr5(p); - boost::call_traits::param_type p2(v); - boost::call_traits::param_type p3(r); - boost::call_traits::param_type p4(p); + value_type v(t); + reference r(t); + const_reference cr(t); + param_type p(t); + value_type v2(v); + value_type v3(r); + value_type v4(p); + reference r2(v); + reference r3(r); + const_reference cr2(v); + const_reference cr3(r); + const_reference cr4(cr); + const_reference cr5(p); + param_type p2(v); + param_type p3(r); + param_type p4(p); } #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template struct call_traits_test { - static void assert_construct(boost::call_traits::param_type val); + typedef ::boost::call_traits ct; + typedef typename ct::param_type param_type; + typedef typename ct::reference reference; + typedef typename ct::const_reference const_reference; + typedef typename ct::value_type value_type; + static void assert_construct(param_type val); }; template @@ -334,23 +344,23 @@ void call_traits_test::assert_construct(boost::call_traits::param_ty // // this is to check that the call_traits assertions are valid: T t; - boost::call_traits::value_type v(t); - boost::call_traits::value_type v5(val); - boost::call_traits::reference r = t; - boost::call_traits::const_reference cr = t; - boost::call_traits::reference r2 = r; + value_type v(t); + value_type v5(val); + reference r = t; + const_reference cr = t; + reference r2 = r; #ifndef __BORLANDC__ // C++ Builder buglet: - boost::call_traits::const_reference cr2 = r; + const_reference cr2 = r; #endif - boost::call_traits::param_type p(t); - boost::call_traits::value_type v2(v); - boost::call_traits::const_reference cr3 = cr; - boost::call_traits::value_type v3(r); - boost::call_traits::value_type v4(p); - boost::call_traits::param_type p2(v); - boost::call_traits::param_type p3(r); - boost::call_traits::param_type p4(p); + param_type p(t); + value_type v2(v); + const_reference cr3 = cr; + value_type v3(r); + value_type v4(p); + param_type p2(v); + param_type p3(r); + param_type p4(p); } #endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/compressed_pair_test.cpp b/compressed_pair_test.cpp index ebbaa78..c8ab32f 100644 --- a/compressed_pair_test.cpp +++ b/compressed_pair_test.cpp @@ -1,9 +1,3 @@ -// boost::compressed_pair test program - -// (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and -// distribute this software is granted provided this copyright notice appears -// in all copies. This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. #include #include @@ -24,6 +18,7 @@ unsigned test_count = 0; #define value_test(v, x) ++test_count;\ if(v != x){++failures; std::cout << "checking value of " << #x << "...failed" << std::endl;} +#define value_fail(v, x) ++test_count; ++failures; std::cout << "checking value of " << #x << "...failed" << std::endl; #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #define type_test(v, x) ++test_count;\ @@ -110,12 +105,21 @@ int main() // // instanciate some compressed pairs: +#ifdef __MWERKS__ +template class compressed_pair; +template class compressed_pair; +template class compressed_pair; +template class compressed_pair; +template class compressed_pair; +template class compressed_pair; +#else template class boost::compressed_pair; template class boost::compressed_pair; template class boost::compressed_pair; template class boost::compressed_pair; template class boost::compressed_pair; template class boost::compressed_pair; +#endif #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // @@ -127,12 +131,14 @@ template compressed_pair::compressed_pair(int&); template compressed_pair::compressed_pair(call_traits::param_type,int&); // // and then arrays: +#ifndef __MWERKS__ #ifndef __BORLANDC__ template call_traits::reference compressed_pair::second(); #endif template call_traits::reference compressed_pair::first(); template compressed_pair::compressed_pair(const double&); template compressed_pair::compressed_pair(); +#endif // __MWERKS__ #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/type_traits_test.cpp b/type_traits_test.cpp index b50892a..8c0e460 100644 --- a/type_traits_test.cpp +++ b/type_traits_test.cpp @@ -30,6 +30,7 @@ unsigned test_count = 0; #define value_test(v, x) ++test_count;\ if(v != x){++failures; std::cout << "checking value of " << #x << "...failed" << std::endl;} +#define value_fail(v, x) ++test_count; ++failures; std::cout << "checking value of " << #x << "...failed" << std::endl; #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #define type_test(v, x) ++test_count;\ if(is_same::value == false){\ @@ -438,7 +439,12 @@ int main() value_test(false, is_empty::value) value_test(false, is_empty::value) value_test(false, is_empty::value) +#ifdef __MWERKS__ + // apparent compiler bug causes this to fail to compile: + value_fail(false, is_empty::value) +#else value_test(false, is_empty::value) +#endif value_test(false, is_empty::value) value_test(false, is_empty::value) value_test(false, is_empty::value)