mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 02:44:10 +00:00
minor compiler compatability fixes
[SVN r7661]
This commit is contained in:
parent
767b61a254
commit
e52916acf2
@ -295,37 +295,47 @@ int main()
|
||||
template <typename T, bool isarray = false>
|
||||
struct call_traits_test
|
||||
{
|
||||
static void assert_construct(boost::call_traits<T>::param_type val);
|
||||
typedef ::boost::call_traits<T> 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 <typename T, bool isarray>
|
||||
void call_traits_test<T, isarray>::assert_construct(boost::call_traits<T>::param_type val)
|
||||
void call_traits_test<T, isarray>::assert_construct(typename call_traits_test<T, isarray>::param_type val)
|
||||
{
|
||||
//
|
||||
// this is to check that the call_traits assertions are valid:
|
||||
T t(val);
|
||||
boost::call_traits<T>::value_type v(t);
|
||||
boost::call_traits<T>::reference r(t);
|
||||
boost::call_traits<T>::const_reference cr(t);
|
||||
boost::call_traits<T>::param_type p(t);
|
||||
boost::call_traits<T>::value_type v2(v);
|
||||
boost::call_traits<T>::value_type v3(r);
|
||||
boost::call_traits<T>::value_type v4(p);
|
||||
boost::call_traits<T>::reference r2(v);
|
||||
boost::call_traits<T>::reference r3(r);
|
||||
boost::call_traits<T>::const_reference cr2(v);
|
||||
boost::call_traits<T>::const_reference cr3(r);
|
||||
boost::call_traits<T>::const_reference cr4(cr);
|
||||
boost::call_traits<T>::const_reference cr5(p);
|
||||
boost::call_traits<T>::param_type p2(v);
|
||||
boost::call_traits<T>::param_type p3(r);
|
||||
boost::call_traits<T>::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 <typename T>
|
||||
struct call_traits_test<T, true>
|
||||
{
|
||||
static void assert_construct(boost::call_traits<T>::param_type val);
|
||||
typedef ::boost::call_traits<T> 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 <typename T>
|
||||
@ -334,23 +344,23 @@ void call_traits_test<T, true>::assert_construct(boost::call_traits<T>::param_ty
|
||||
//
|
||||
// this is to check that the call_traits assertions are valid:
|
||||
T t;
|
||||
boost::call_traits<T>::value_type v(t);
|
||||
boost::call_traits<T>::value_type v5(val);
|
||||
boost::call_traits<T>::reference r = t;
|
||||
boost::call_traits<T>::const_reference cr = t;
|
||||
boost::call_traits<T>::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<T>::const_reference cr2 = r;
|
||||
const_reference cr2 = r;
|
||||
#endif
|
||||
boost::call_traits<T>::param_type p(t);
|
||||
boost::call_traits<T>::value_type v2(v);
|
||||
boost::call_traits<T>::const_reference cr3 = cr;
|
||||
boost::call_traits<T>::value_type v3(r);
|
||||
boost::call_traits<T>::value_type v4(p);
|
||||
boost::call_traits<T>::param_type p2(v);
|
||||
boost::call_traits<T>::param_type p3(r);
|
||||
boost::call_traits<T>::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
|
||||
|
||||
|
@ -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 <iostream>
|
||||
#include <typeinfo>
|
||||
@ -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<int, double>;
|
||||
template class compressed_pair<int, int>;
|
||||
template class compressed_pair<empty_UDT, int>;
|
||||
template class compressed_pair<int, empty_UDT>;
|
||||
template class compressed_pair<empty_UDT, empty_UDT>;
|
||||
template class compressed_pair<empty_UDT, empty_POD_UDT>;
|
||||
#else
|
||||
template class boost::compressed_pair<int, double>;
|
||||
template class boost::compressed_pair<int, int>;
|
||||
template class boost::compressed_pair<empty_UDT, int>;
|
||||
template class boost::compressed_pair<int, empty_UDT>;
|
||||
template class boost::compressed_pair<empty_UDT, empty_UDT>;
|
||||
template class boost::compressed_pair<empty_UDT, empty_POD_UDT>;
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
//
|
||||
@ -127,12 +131,14 @@ template compressed_pair<double, int&>::compressed_pair(int&);
|
||||
template compressed_pair<double, int&>::compressed_pair(call_traits<double>::param_type,int&);
|
||||
//
|
||||
// and then arrays:
|
||||
#ifndef __MWERKS__
|
||||
#ifndef __BORLANDC__
|
||||
template call_traits<int[2]>::reference compressed_pair<double, int[2]>::second();
|
||||
#endif
|
||||
template call_traits<double>::reference compressed_pair<double, int[2]>::first();
|
||||
template compressed_pair<double, int[2]>::compressed_pair(const double&);
|
||||
template compressed_pair<double, int[2]>::compressed_pair();
|
||||
#endif // __MWERKS__
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
|
||||
|
@ -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<v, x>::value == false){\
|
||||
@ -438,7 +439,12 @@ int main()
|
||||
value_test(false, is_empty<int>::value)
|
||||
value_test(false, is_empty<int*>::value)
|
||||
value_test(false, is_empty<int&>::value)
|
||||
#ifdef __MWERKS__
|
||||
// apparent compiler bug causes this to fail to compile:
|
||||
value_fail(false, is_empty<int[2]>::value)
|
||||
#else
|
||||
value_test(false, is_empty<int[2]>::value)
|
||||
#endif
|
||||
value_test(false, is_empty<f1>::value)
|
||||
value_test(false, is_empty<mf1>::value)
|
||||
value_test(false, is_empty<UDT>::value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user