From 23e280ffe465af4b2ce5677dc3e4ed29c7d9131a Mon Sep 17 00:00:00 2001
From: John Maddock
Date: Sun, 25 Mar 2001 10:31:16 +0000
Subject: [PATCH] Type_traits: Added add_const/add_volatile/is_fucntion tests.
Updated docs for new templates. Updated test
programs to test abstract base classes.
[SVN r9638]
---
examples/iter_swap_example.cpp | 3 +-
index.htm | 50 ++++++++++++
tests/alignment_test.cpp | 2 +-
tests/arithmetic_traits_test.cpp | 5 ++
tests/composite_traits_test.cpp | 17 ++++-
tests/cv_traits_test.cpp | 18 ++++-
tests/is_convertible_test.cpp | 1 +
tests/is_function_test.cpp | 72 ++++++++++++++++++
tests/is_same_test.cpp | 4 +
tests/object_type_traits_test.cpp | 28 +++++++
tests/transform_traits_test.cpp | 97 +++++++++++++++++++++++-
tools/specialisations.cpp | 121 ++++++++++++++++++++++++++++++
12 files changed, 410 insertions(+), 8 deletions(-)
create mode 100644 tests/is_function_test.cpp
create mode 100644 tools/specialisations.cpp
diff --git a/examples/iter_swap_example.cpp b/examples/iter_swap_example.cpp
index 898d0bd..b1e5e65 100644
--- a/examples/iter_swap_example.cpp
+++ b/examples/iter_swap_example.cpp
@@ -103,8 +103,7 @@ int main()
opt::iter_swap(v1.begin(), v1.begin()+1);
opt::iter_swap(v2.begin(), v2.begin()+1);
- cout << "Press any key to exit...";
- cin.get();
+ return 0;
}
diff --git a/index.htm b/index.htm
index 32cea14..4256baa 100644
--- a/index.htm
+++ b/index.htm
@@ -196,6 +196,20 @@ template instead.
that is_enum is currently broken under Borland C++).
|
+
+ |
+ ::boost::is_function<T>::value |
+ Evaluates to true only
+ if T is a function type (note not a reference or pointer
+ to function). |
+ 3.9.2p1
+ 8.3.5
+ |
+ Without partial
+ specialisation support, this template does not compile
+ for reference types. |
+ |
+
@@ -604,6 +618,24 @@ transformation to the template argument T:
|
+
+ |
+ ::boost::add_const<T>::type |
+ The same as "T
+ const" for all T. |
+ 3.9.3 |
+ |
+ |
+
+
+ |
+ ::boost::add_volatile<T>::type |
+ The same as "T
+ volatile" for all T. |
+ 3.9.3 |
+ |
+ |
+
As the table above indicates, support for partial
@@ -744,6 +776,12 @@ template.
Header |
|
+
+ |
+ add_const |
+ <boost/type_traits/transform_traits.hpp> |
+ |
+
|
add_pointer |
@@ -756,6 +794,12 @@ template.
<boost/type_traits/transform_traits.hpp> |
|
+
+ |
+ add_volatile |
+ <boost/type_traits/transform_traits.hpp> |
+ |
+
|
alignment_of |
@@ -841,6 +885,12 @@ template.
<boost/type_traits/arithmetic_traits.hpp> |
|
+
+ |
+ is_function |
+ <boost/type_traits/function_traits.hpp> |
+ |
+
|
is_fundamental |
diff --git a/tests/alignment_test.cpp b/tests/alignment_test.cpp
index e91855b..65dfef0 100644
--- a/tests/alignment_test.cpp
+++ b/tests/alignment_test.cpp
@@ -34,7 +34,7 @@ int main(int argc, char* argv[])
align_test(VB);
align_test(VD);
value_test(0, ::boost::alignment_of::value);
-
+
return check_result(argc, argv);
}
diff --git a/tests/arithmetic_traits_test.cpp b/tests/arithmetic_traits_test.cpp
index 87d2d31..1e02239 100644
--- a/tests/arithmetic_traits_test.cpp
+++ b/tests/arithmetic_traits_test.cpp
@@ -36,6 +36,7 @@ int main(int argc, char* argv[])
value_test(true, boost::is_void::value)
value_test(true, boost::is_void::value)
value_test(false, boost::is_void::value)
+ value_test(false, boost::is_void::value)
value_test(false, boost::is_integral::value)
value_test(false, boost::is_integral::value)
@@ -121,6 +122,7 @@ int main(int argc, char* argv[])
value_test(true, boost::is_integral::value)
value_test(true, boost::is_integral::value)
#endif
+ value_test(false, boost::is_integral::value)
value_test(true, boost::is_float::value)
value_test(true, boost::is_float::value)
value_test(true, boost::is_float::value)
@@ -136,6 +138,7 @@ int main(int argc, char* argv[])
value_test(false, boost::is_float::value)
value_test(false, boost::is_float::value)
value_test(false, boost::is_float::value)
+ value_test(false, boost::is_float::value)
value_test(false, boost::is_arithmetic::value)
@@ -162,8 +165,10 @@ int main(int argc, char* argv[])
value_test(true, boost::is_arithmetic<__int64>::value)
value_test(true, boost::is_arithmetic::value)
#endif
+ value_test(false, boost::is_arithmetic::value)
value_test(false, boost::is_fundamental::value)
+ value_test(false, boost::is_fundamental::value)
value_test(true, boost::is_fundamental::value)
value_test(true, boost::is_fundamental::value)
value_test(true, boost::is_fundamental::value)
diff --git a/tests/composite_traits_test.cpp b/tests/composite_traits_test.cpp
index 0ceed2f..45161e6 100644
--- a/tests/composite_traits_test.cpp
+++ b/tests/composite_traits_test.cpp
@@ -44,6 +44,9 @@ int main(int argc, char* argv[])
value_test(false, boost::is_array::value)
value_test(false, boost::is_array::value)
value_test(false, boost::is_array::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, boost::is_array::value)
+#endif
value_test(false, boost::is_pointer::value)
value_test(false, boost::is_pointer::value)
@@ -71,6 +74,9 @@ int main(int argc, char* argv[])
value_test(false, boost::is_pointer::value)
value_test(false, boost::is_pointer::value)
value_test(false, boost::is_pointer::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, boost::is_pointer::value)
+#endif
value_test(false, boost::is_reference::value)
value_test(true, boost::is_reference::value)
@@ -81,6 +87,9 @@ int main(int argc, char* argv[])
value_test(true, boost::is_reference::value)
value_test(true, boost::is_reference::value)
value_test(false, boost::is_reference::value)
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC)
+ value_test(false, boost::is_reference::value)
+#endif
value_test(false, boost::is_member_pointer::value)
value_test(false, boost::is_member_pointer::value)
@@ -91,12 +100,18 @@ int main(int argc, char* argv[])
value_test(true, boost::is_member_pointer::value)
value_test(true, boost::is_member_pointer::value)
value_test(false, boost::is_member_pointer::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, boost::is_member_pointer::value)
+#endif
value_test(false, boost::is_enum::value)
value_test(true, boost::is_enum::value)
value_test(false, boost::is_enum::value)
- value_test(false, boost::is_enum::value)
+ //value_test(false, boost::is_enum::value)
value_test(false, boost::is_enum::value)
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC)
+ value_test(false, boost::is_enum::value)
+#endif
return check_result(argc, argv);
}
diff --git a/tests/cv_traits_test.cpp b/tests/cv_traits_test.cpp
index 41d8c6a..98e150a 100644
--- a/tests/cv_traits_test.cpp
+++ b/tests/cv_traits_test.cpp
@@ -26,12 +26,28 @@ int main(int argc, char* argv[])
value_test(false, boost::is_const::value)
value_test(true, boost::is_const::value)
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC)
+ value_test(false, boost::is_const::value)
+ value_test(true, boost::is_const::value)
+#endif
value_test(false, boost::is_const::value)
value_test(true, boost::is_const::value)
value_test(true, boost::is_const::value)
value_test(true, boost::is_const::value)
+ value_test(false, boost::is_const::value)
+#ifndef __GNUC__
+ value_test(false, boost::is_const::value)
+#else
+ value_fail(false, boost::is_const::value)
+#endif
+
+
value_test(false, boost::is_volatile::value)
value_test(true, boost::is_volatile::value)
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC)
+ value_test(false, boost::is_volatile::value)
+ value_test(true, boost::is_volatile::value)
+#endif
value_test(false, boost::is_volatile::value)
value_test(true, boost::is_volatile::value)
value_test(true, boost::is_volatile::value)
@@ -43,7 +59,7 @@ int main(int argc, char* argv[])
//
// define the number of failures expected for given compilers:
#ifdef BOOST_MSVC
-unsigned int expected_failures = 2;
+unsigned int expected_failures = 3;
#else
unsigned int expected_failures = 0;
#endif
diff --git a/tests/is_convertible_test.cpp b/tests/is_convertible_test.cpp
index da375b2..b02f427 100644
--- a/tests/is_convertible_test.cpp
+++ b/tests/is_convertible_test.cpp
@@ -52,6 +52,7 @@ int main(int argc, char* argv[])
value_test(true, (boost::is_convertible::value));
value_test(true, (boost::is_convertible::value));
value_test(true, (boost::is_convertible::value));
+ value_test(false, (boost::is_convertible::value));
return check_result(argc, argv);
}
diff --git a/tests/is_function_test.cpp b/tests/is_function_test.cpp
new file mode 100644
index 0000000..a5d7af9
--- /dev/null
+++ b/tests/is_function_test.cpp
@@ -0,0 +1,72 @@
+
+// (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 "boost/type_traits/type_traits_test.hpp"
+
+template
+void is_function_test(const T& foo)
+{
+ value_test(true, ::boost::is_function::value);
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, ::boost::is_void::value);
+ value_test(false, ::boost::is_integral::value);
+ value_test(false, ::boost::is_float::value);
+ value_test(false, ::boost::is_arithmetic::value);
+ value_test(false, ::boost::is_fundamental::value);
+ value_test(false, ::boost::is_pointer::value);
+ value_test(false, ::boost::is_reference::value);
+ value_test(false, ::boost::is_member_pointer::value);
+ value_test(false, ::boost::is_enum::value);
+ value_test(false, ::boost::is_union::value);
+ value_test(false, ::boost::is_object::value);
+ value_test(false, ::boost::is_scalar::value);
+ value_test(false, ::boost::is_class::value);
+ value_test(false, ::boost::is_compound::value);
+ value_test(false, ::boost::is_POD::value);
+ value_test(false, ::boost::has_trivial_constructor::value);
+ value_test(false, ::boost::has_trivial_copy::value);
+ value_test(false, ::boost::has_trivial_assign::value);
+ value_test(false, ::boost::has_trivial_destructor::value);
+ value_test(false, ::boost::is_empty::value);
+#endif
+}
+
+void foo0(){};
+void foo1(int){};
+void foo2(int&, double){};
+void foo3(int&, bool, int, int){};
+void foo4(int, bool, int*, int[], int, int, int, int, int){};
+
+
+int main(int argc, char* argv[])
+{
+ is_function_test(foo0);
+ is_function_test(foo1);
+ is_function_test(foo2);
+ is_function_test(foo3);
+ is_function_test(foo4);
+
+ value_test(false, ::boost::is_function::value);
+ value_test(false, ::boost::is_function::value);
+ value_test(false, ::boost::is_function::value);
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, ::boost::is_function::value);
+ value_test(false, ::boost::is_function::value);
+#endif
+ value_test(false, ::boost::is_function::value);
+ value_test(false, ::boost::is_function::value);
+ value_test(false, ::boost::is_function::value);
+
+ return check_result(argc, argv);
+}
+
+//
+// define the number of failures expected for given compilers:
+unsigned int expected_failures = 0;
+
+
+
diff --git a/tests/is_same_test.cpp b/tests/is_same_test.cpp
index 0803d3c..bbb3ce1 100644
--- a/tests/is_same_test.cpp
+++ b/tests/is_same_test.cpp
@@ -27,6 +27,10 @@ int main(int argc, char* argv[])
value_test(false, (::boost::is_same::value))
value_test(true, (::boost::is_same::value))
value_test(false, (::boost::is_same::value))
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_MSVC)
+ value_test(true, (::boost::is_same::value))
+ value_test(false, (::boost::is_same::value))
+#endif
return check_result(argc, argv);
}
diff --git a/tests/object_type_traits_test.cpp b/tests/object_type_traits_test.cpp
index 18200f4..3005522 100644
--- a/tests/object_type_traits_test.cpp
+++ b/tests/object_type_traits_test.cpp
@@ -44,6 +44,10 @@ int main(int argc, char* argv[])
value_test(false, boost::is_class::value)
value_test(true, boost::is_class::value)
value_test(true, boost::is_class::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(true, boost::is_class::value)
+ value_test(true, boost::is_class::value)
+#endif
value_test(true, boost::is_class::value)
value_test(true, boost::is_class::value)
value_test(true, boost::is_class::value)
@@ -54,6 +58,9 @@ int main(int argc, char* argv[])
value_test(true, boost::is_object::value)
value_test(true, boost::is_object::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(true, boost::is_object::value)
+#endif
value_test(false, boost::is_object::value)
value_test(false, boost::is_object::value)
@@ -61,12 +68,18 @@ int main(int argc, char* argv[])
value_test(true, boost::is_scalar::value)
value_test(false, boost::is_scalar::value)
value_test(false, boost::is_scalar::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, boost::is_scalar::value)
+#endif
value_test(false, boost::is_scalar::value)
value_test(true, boost::is_compound::value)
value_test(true, boost::is_compound::value)
value_test(false, boost::is_compound::value)
value_test(false, boost::is_compound::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(true, boost::is_compound::value)
+#endif
value_test(true, boost::is_POD::value)
value_test(true, boost::is_POD::value)
@@ -84,6 +97,9 @@ int main(int argc, char* argv[])
value_test(false, boost::is_POD::value)
value_test(true, boost::is_POD::value)
value_test(true, boost::is_POD::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, boost::is_POD::value)
+#endif
value_test(true, boost::has_trivial_constructor::value)
value_test(true, boost::has_trivial_constructor::value)
@@ -99,6 +115,9 @@ int main(int argc, char* argv[])
value_test(true, boost::has_trivial_constructor::value)
value_test(true, boost::has_trivial_constructor::value)
value_test(true, boost::has_trivial_constructor::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, boost::has_trivial_constructor::value)
+#endif
value_test(true, boost::has_trivial_copy::value)
value_test(true, boost::has_trivial_copy::value)
@@ -115,6 +134,9 @@ int main(int argc, char* argv[])
value_test(true, boost::has_trivial_copy::value)
value_test(true, boost::has_trivial_copy::value)
value_test(true, boost::has_trivial_copy::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, boost::has_trivial_copy::value)
+#endif
value_test(true, boost::has_trivial_assign::value)
value_test(true, boost::has_trivial_assign::value)
@@ -131,6 +153,9 @@ int main(int argc, char* argv[])
value_test(true, boost::has_trivial_assign::value)
value_test(true, boost::has_trivial_assign::value)
value_test(true, boost::has_trivial_assign::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, boost::has_trivial_assign::value)
+#endif
value_test(true, boost::has_trivial_destructor::value)
value_test(true, boost::has_trivial_destructor::value)
@@ -146,6 +171,9 @@ int main(int argc, char* argv[])
value_test(false, boost::has_trivial_destructor::value)
value_test(true, boost::has_trivial_destructor::value)
value_test(true, boost::has_trivial_destructor::value)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ value_test(false, boost::has_trivial_destructor::value)
+#endif
soft_value_test(false, boost::is_empty::value)
soft_value_test(false, boost::is_empty::value)
diff --git a/tests/transform_traits_test.cpp b/tests/transform_traits_test.cpp
index 75f609c..58cb1f7 100644
--- a/tests/transform_traits_test.cpp
+++ b/tests/transform_traits_test.cpp
@@ -290,7 +290,7 @@ BOOST_DECL_TRANSFORM_TEST(add_reference_test_8, ::boost::add_reference, const [2
BOOST_DECL_TRANSFORM_TEST(add_reference_test_9, ::boost::add_reference, const &, const&)
BOOST_DECL_TRANSFORM_TEST(add_reference_test_10, ::boost::add_reference, const*, const*&)
BOOST_DECL_TRANSFORM_TEST(add_reference_test_11, ::boost::add_reference, volatile*, volatile*&)
-BOOST_DECL_TRANSFORM_TEST(add_reference_test_12, ::boost::add_reference, const[2][3], const (&)[2][3])
+//BOOST_DECL_TRANSFORM_TEST(add_reference_test_12, ::boost::add_reference, const[2][3], const (&)[2][3])
BOOST_DECL_TRANSFORM_TEST(add_reference_test_13, ::boost::add_reference, (&)[2], (&)[2])
void check_add_reference()
@@ -306,7 +306,7 @@ void check_add_reference()
add_reference_test_9();
add_reference_test_10();
add_reference_test_11();
- add_reference_test_12();
+ //add_reference_test_12();
add_reference_test_13();
}
@@ -351,6 +351,88 @@ void check_add_pointer()
#endif
}
+/***********************************************************************
+ *
+ * tests for add_const:
+ *
+ **********************************************************************/
+
+BOOST_DECL_TRANSFORM_TEST(add_const_test_1, ::boost::add_const, const, const)
+BOOST_DECL_TRANSFORM_TEST(add_const_test_2, ::boost::add_const, volatile, volatile const)
+BOOST_DECL_TRANSFORM_TEST(add_const_test_3, ::boost::add_const, *, *const)
+//BOOST_DECL_TRANSFORM_TEST2(add_const_test_4, ::boost::add_const)
+BOOST_DECL_TRANSFORM_TEST(add_const_test_7, ::boost::add_const, *volatile, *volatile const)
+BOOST_DECL_TRANSFORM_TEST(add_const_test_10, ::boost::add_const, const*, const*const)
+BOOST_DECL_TRANSFORM_TEST(add_const_test_11, ::boost::add_const, volatile*, volatile*const)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+BOOST_DECL_TRANSFORM_TEST(add_const_test_5, ::boost::add_const, const &, const&)
+BOOST_DECL_TRANSFORM_TEST(add_const_test_6, ::boost::add_const, &, &)
+BOOST_DECL_TRANSFORM_TEST(add_const_test_8, ::boost::add_const, const [2], const [2])
+BOOST_DECL_TRANSFORM_TEST(add_const_test_9, ::boost::add_const, volatile &, volatile&)
+BOOST_DECL_TRANSFORM_TEST(add_const_test_12, ::boost::add_const, [2][3], const[2][3])
+BOOST_DECL_TRANSFORM_TEST(add_const_test_13, ::boost::add_const, (&)[2], (&)[2])
+#endif
+
+void check_add_const()
+{
+ add_const_test_1();
+ add_const_test_2();
+ add_const_test_3();
+ //add_const_test_4();
+ add_const_test_7();
+ add_const_test_10();
+ add_const_test_11();
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ add_const_test_5();
+ add_const_test_6();
+ add_const_test_8();
+ add_const_test_9();
+ add_const_test_12();
+ add_const_test_13();
+#endif
+}
+
+/***********************************************************************
+ *
+ * tests for add_volatile:
+ *
+ **********************************************************************/
+
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_1, ::boost::add_volatile, const, const volatile)
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_2, ::boost::add_volatile, volatile, volatile)
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_3, ::boost::add_volatile, *, *volatile)
+//BOOST_DECL_TRANSFORM_TEST2(add_volatile_test_4, ::boost::add_volatile)
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_7, ::boost::add_volatile, *volatile, *volatile)
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_10, ::boost::add_volatile, const*, const*volatile)
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_11, ::boost::add_volatile, volatile*, volatile*volatile)
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_5, ::boost::add_volatile, const &, const&)
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_6, ::boost::add_volatile, &, &)
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_8, ::boost::add_volatile, const [2], const volatile [2])
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_9, ::boost::add_volatile, volatile &, volatile&)
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_12, ::boost::add_volatile, [2][3], volatile[2][3])
+BOOST_DECL_TRANSFORM_TEST(add_volatile_test_13, ::boost::add_volatile, (&)[2], (&)[2])
+#endif
+
+void check_add_volatile()
+{
+ add_volatile_test_1();
+ add_volatile_test_2();
+ add_volatile_test_3();
+ //add_volatile_test_4();
+ add_volatile_test_7();
+ add_volatile_test_10();
+ add_volatile_test_11();
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ add_volatile_test_5();
+ add_volatile_test_6();
+ add_volatile_test_8();
+ add_volatile_test_9();
+ add_volatile_test_12();
+ add_volatile_test_13();
+#endif
+}
+
int main(int argc, char* argv[])
{
@@ -362,6 +444,8 @@ int main(int argc, char* argv[])
check_remove_pointer();
check_add_reference();
check_add_pointer();
+ check_add_const();
+ check_add_volatile();
type_test(void, boost::remove_const::type)
type_test(void, boost::remove_volatile::type)
@@ -382,8 +466,10 @@ int main(int argc, char* argv[])
#ifdef SHORT_TRANSFORM_TEST
unsigned int expected_failures = 97; // cv-qualifiers
#else
-unsigned int expected_failures = 422; // cv-qualifiers
+unsigned int expected_failures = 474; // cv-qualifiers
#endif
+#elif defined(BOOST_MSVC)
+unsigned int expected_failures = 84; // partial specialisation (fails for UDT's)
#elif defined(__GNUC__)
unsigned int expected_failures = 1; // cv-qualified references
#else
@@ -393,3 +479,8 @@ unsigned int expected_failures = 0;
+
+
+
+
+
diff --git a/tools/specialisations.cpp b/tools/specialisations.cpp
new file mode 100644
index 0000000..b4f76b5
--- /dev/null
+++ b/tools/specialisations.cpp
@@ -0,0 +1,121 @@
+
+// (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.
+
+//
+// Simple program to output some template specialisations for the type_traits library.
+//
+
+#include
+
+using namespace std;
+
+unsigned count = 30;
+
+int main()
+{
+ unsigned i, j;
+ ofstream os("specialisations");
+
+ //
+ // generate is_function tester prototypes:
+ for(i = 0; i <= count; ++i)
+ {
+ os << "template \n::boost::type_traits::yes_type is_function_tester(R (*)(";
+ if(i == 0)
+ os << "void";
+ else
+ {
+ for(j = 0; j < i; ++j)
+ {
+ if(j) os << ", ";
+ os << "A" << j;
+ }
+ }
+ os << "));" << endl;
+ }
+ os << endl << endl;
+ //
+ // generate is_function_helper partial specialisations:
+ //
+ for(i = 0; i < count; ++i)
+ {
+ os << "template \nstruct is_function_helper_base{ BOOST_STATIC_CONSTANT(bool, value = true); };" << endl;
+ }
+ os << endl << endl;
+
+
+ //
+ // generate is_member_pointer_helper tester prototypes:
+ for(i = 0; i <= count; ++i)
+ {
+ os << "template \n::boost::type_traits::yes_type is_member_pointer_helper(R (T::*)(";
+ if(i == 0)
+ os << "void";
+ else
+ {
+ for(j = 0; j < i; ++j)
+ {
+ if(j) os << ", ";
+ os << "A" << j;
+ }
+ }
+ os << "));" << endl;
+ }
+ os << endl << endl;
+ //
+ // generate is_member_pointer partial specialisations:
+ //
+ for(i = 0; i < count; ++i)
+ {
+ os << "template \nstruct is_member_pointer{ BOOST_STATIC_CONSTANT(bool, value = true); };" << endl;
+ }
+ os << endl << endl;
+
+
+ return 0;
+}
\ No newline at end of file