From 03f77589ce707ad921a184fc6e0752de1c6278fd Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 2 Jan 2001 12:40:29 +0000 Subject: [PATCH] This commit was generated by cvs2svn to compensate for changes in r889, which included commits to RCS files with non-trunk default branches. [SVN r8506] --- development/alignment_test.cpp | 43 + development/arithmetic_traits_test.cpp | 197 ++++ development/composite_traits_test.cpp | 111 +++ development/copy_example.cpp | 240 +++++ development/cs-win32.html | 118 +++ development/cv_traits_test.cpp | 50 + development/fill_example.cpp | 191 ++++ development/include/boost/call_traits.hpp | 23 + development/include/boost/config.hpp | 427 +++++++++ .../include/boost/detail/call_traits.hpp | 138 +++ .../include/boost/detail/ob_call_traits.hpp | 125 +++ development/include/boost/smart_ptr.hpp | 379 ++++++++ development/include/boost/timer.hpp | 57 ++ development/include/boost/type_traits.hpp | 42 + .../boost/type_traits/alignment_traits.hpp | 66 ++ .../boost/type_traits/arithmetic_traits.hpp | 262 ++++++ .../boost/type_traits/composite_traits.hpp | 357 +++++++ .../boost/type_traits/conversion_traits.hpp | 220 +++++ .../include/boost/type_traits/cv_traits.hpp | 214 +++++ development/include/boost/type_traits/fwd.hpp | 138 +++ development/include/boost/type_traits/ice.hpp | 75 ++ .../boost/type_traits/object_traits.hpp | 313 +++++++ .../include/boost/type_traits/same_traits.hpp | 89 ++ .../boost/type_traits/transform_traits.hpp | 152 +++ .../boost/type_traits/type_traits_test.hpp | 324 +++++++ development/include/boost/utility.hpp | 96 ++ development/is_convertible_test.cpp | 72 ++ development/is_same_test.cpp | 34 + development/iter_swap_example.cpp | 110 +++ development/object_type_traits_test.cpp | 184 ++++ development/regress.cfg | 14 + development/regression.out.txt | 879 ++++++++++++++++++ development/transform_traits_test.cpp | 78 ++ development/trivial_destructor_example.cpp | 165 ++++ 34 files changed, 5983 insertions(+) create mode 100644 development/alignment_test.cpp create mode 100644 development/arithmetic_traits_test.cpp create mode 100644 development/composite_traits_test.cpp create mode 100644 development/copy_example.cpp create mode 100644 development/cs-win32.html create mode 100644 development/cv_traits_test.cpp create mode 100644 development/fill_example.cpp create mode 100644 development/include/boost/call_traits.hpp create mode 100644 development/include/boost/config.hpp create mode 100644 development/include/boost/detail/call_traits.hpp create mode 100644 development/include/boost/detail/ob_call_traits.hpp create mode 100644 development/include/boost/smart_ptr.hpp create mode 100644 development/include/boost/timer.hpp create mode 100644 development/include/boost/type_traits.hpp create mode 100644 development/include/boost/type_traits/alignment_traits.hpp create mode 100644 development/include/boost/type_traits/arithmetic_traits.hpp create mode 100644 development/include/boost/type_traits/composite_traits.hpp create mode 100644 development/include/boost/type_traits/conversion_traits.hpp create mode 100644 development/include/boost/type_traits/cv_traits.hpp create mode 100644 development/include/boost/type_traits/fwd.hpp create mode 100644 development/include/boost/type_traits/ice.hpp create mode 100644 development/include/boost/type_traits/object_traits.hpp create mode 100644 development/include/boost/type_traits/same_traits.hpp create mode 100644 development/include/boost/type_traits/transform_traits.hpp create mode 100644 development/include/boost/type_traits/type_traits_test.hpp create mode 100644 development/include/boost/utility.hpp create mode 100644 development/is_convertible_test.cpp create mode 100644 development/is_same_test.cpp create mode 100644 development/iter_swap_example.cpp create mode 100644 development/object_type_traits_test.cpp create mode 100644 development/regress.cfg create mode 100644 development/regression.out.txt create mode 100644 development/transform_traits_test.cpp create mode 100644 development/trivial_destructor_example.cpp diff --git a/development/alignment_test.cpp b/development/alignment_test.cpp new file mode 100644 index 0000000..44f50ce --- /dev/null +++ b/development/alignment_test.cpp @@ -0,0 +1,43 @@ + +// (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 + +#ifdef __BORLANDC__ +#pragma hrdstop +#endif +#include "boost/type_traits/type_traits_test.hpp" + +NESTED_DECL(alignment_of) + +int main(int argc, char* argv[]) +{ + NESTED_TEST(alignment_of, int) + NESTED_TEST(alignment_of, int_constructible) + + align_test(int); + align_test(char); + align_test(double); + align_test(int[4]); + align_test(int(*)(int)); +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + align_test(char&); + align_test(char (&)(int)); + align_test(char(&)[4]); +#endif + align_test(int*); + //align_test(const int); + align_test(VB); + align_test(VD); + + return check_result(argc, argv); +} + +// +// define the number of failures expected for given compilers: +unsigned int expected_failures = 0; + diff --git a/development/arithmetic_traits_test.cpp b/development/arithmetic_traits_test.cpp new file mode 100644 index 0000000..87d2d31 --- /dev/null +++ b/development/arithmetic_traits_test.cpp @@ -0,0 +1,197 @@ + +// (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 + +#ifdef __BORLANDC__ +#pragma hrdstop +#endif +#include "boost/type_traits/type_traits_test.hpp" + +NESTED_DECL(is_void) +NESTED_DECL(is_integral) +NESTED_DECL(is_float) +NESTED_DECL(is_arithmetic) +NESTED_DECL(is_fundamental) + +int main(int argc, char* argv[]) +{ + NESTED_TEST(is_void, void) + NESTED_TEST(is_void, int) + NESTED_TEST(is_integral, int) + NESTED_TEST(is_integral, float) + NESTED_TEST(is_float, void) + NESTED_TEST(is_float, double) + NESTED_TEST(is_arithmetic, void) + NESTED_TEST(is_arithmetic, int) + NESTED_TEST(is_fundamental, UDT) + NESTED_TEST(is_fundamental, int) + + value_test(true, boost::is_void::value) + value_test(true, boost::is_void::value) + 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_integral::value) + value_test(false, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(false, boost::is_integral::value) + value_test(false, boost::is_integral::value) + value_test(false, boost::is_integral::value) + #ifdef ULLONG_MAX + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #endif + #if defined(__BORLANDC__) || defined(_MSC_VER) + value_test(true, boost::is_integral<__int64>::value) + value_test(true, boost::is_integral::value) + #endif + //const qualified ints: + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #ifdef ULLONG_MAX + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #endif + #if defined(__BORLANDC__) || defined(_MSC_VER) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #endif + // volatile qualified ints: + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #ifdef ULLONG_MAX + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #endif + #if defined(__BORLANDC__) || defined(_MSC_VER) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #endif + //const qualified ints: + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #ifdef ULLONG_MAX + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #endif + #if defined(__BORLANDC__) || defined(_MSC_VER) + value_test(true, boost::is_integral::value) + value_test(true, boost::is_integral::value) + #endif + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, boost::is_float::value) + value_test(true, 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) + value_test(false, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + #ifdef ULLONG_MAX + value_test(true, boost::is_arithmetic::value) + value_test(true, boost::is_arithmetic::value) + #endif + #if defined(__BORLANDC__) || defined(_MSC_VER) + value_test(true, boost::is_arithmetic<__int64>::value) + value_test(true, boost::is_arithmetic::value) + #endif + + 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) + value_test(true, 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) + value_test(true, 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) + value_test(true, 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) + #ifdef ULLONG_MAX + value_test(true, boost::is_fundamental::value) + value_test(true, boost::is_fundamental::value) + #endif + #if defined(__BORLANDC__) || defined(_MSC_VER) + value_test(true, boost::is_fundamental<__int64>::value) + value_test(true, boost::is_fundamental::value) + #endif + + return check_result(argc, argv); +} + +// +// define the number of failures expected for given compilers: +unsigned int expected_failures = 0; + diff --git a/development/composite_traits_test.cpp b/development/composite_traits_test.cpp new file mode 100644 index 0000000..7b496a5 --- /dev/null +++ b/development/composite_traits_test.cpp @@ -0,0 +1,111 @@ + +// (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 + +#ifdef __BORLANDC__ +#pragma hrdstop +#endif +#include "boost/type_traits/type_traits_test.hpp" + +NESTED_DECL(is_array) +NESTED_DECL(is_pointer) +NESTED_DECL(is_reference) + +int main(int argc, char* argv[]) +{ + NESTED_TEST(is_array, int) + NESTED_TEST(is_array, int[2]) + NESTED_TEST(is_array, int[3][4]) + NESTED_TEST(is_array, int const [5]) + NESTED_TEST(is_array, int(&)[2]) + NESTED_TEST(is_array, int (*)(double)) + NESTED_TEST(is_pointer, int) + NESTED_TEST(is_pointer, int*) + NESTED_TEST(is_reference, int) + NESTED_TEST(is_reference, int&) + + value_test(false, boost::is_array::value) + value_test(false, boost::is_array::value) + value_test(false, boost::is_array::value) + value_test(false, boost::is_array::value) + value_test(false, boost::is_array::value) + value_test(false, boost::is_array::value) + value_test(false, boost::is_array::value) + value_test(true, boost::is_array::value) + value_test(true, boost::is_array::value) + value_test(true, boost::is_array::value) + value_test(true, boost::is_array::value) + value_test(true, boost::is_array::value) + value_test(false, boost::is_array::value) + value_test(false, boost::is_array::value) + + value_test(false, boost::is_pointer::value) + value_test(false, boost::is_pointer::value) + value_test(true, boost::is_pointer::value) + value_test(true, boost::is_pointer::value) + value_test(true, boost::is_pointer::value) + value_test(true, boost::is_pointer::value) + // these were false in previous versions (JM 20 Dec 2000): + value_test(true, boost::is_pointer::value) + value_test(true, boost::is_pointer::value) + value_test(true, boost::is_pointer::value) + // JM 02 Oct 2000: + value_test(false, boost::is_pointer::value) + value_test(false, boost::is_pointer::value) + value_test(false, boost::is_pointer::value) + value_test(false, boost::is_pointer::value) + value_test(false, boost::is_pointer::value) + + value_test(true, boost::is_pointer::value) + value_test(true, boost::is_pointer::value) + value_test(true, boost::is_pointer::value) + // Steve: was 'true', should be 'false', via 3.9.2p3 + value_test(false, boost::is_pointer::value) + value_test(false, boost::is_pointer::value) + value_test(false, boost::is_pointer::value) + value_test(false, boost::is_pointer::value) + + value_test(false, boost::is_reference::value) + value_test(true, boost::is_reference::value) + value_test(true, boost::is_reference::value) + value_test(true, boost::is_reference::value) + value_test(true, boost::is_reference::value) + value_test(true, boost::is_reference::value) + value_test(true, boost::is_reference::value) + value_test(true, boost::is_reference::value) + + value_test(false, boost::is_member_pointer::value) + value_test(false, boost::is_member_pointer::value) + value_test(false, boost::is_member_pointer::value) + value_test(false, boost::is_member_pointer::value) + value_test(true, boost::is_member_pointer::value) + value_test(true, boost::is_member_pointer::value) + value_test(true, boost::is_member_pointer::value) + value_test(true, boost::is_member_pointer::value) + + 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) + + return check_result(argc, argv); +} + +// +// define the number of failures expected for given compilers: +#ifdef __BORLANDC__ +unsigned int expected_failures = 2; +#elif defined(__GNUC__) +unsigned int expected_failures = 1; // can't handle cv-qualified references +#elif defined(BOOST_MSVC) +unsigned int expected_failures = 1; +#else +unsigned int expected_failures = 0; +#endif + + diff --git a/development/copy_example.cpp b/development/copy_example.cpp new file mode 100644 index 0000000..c20e27a --- /dev/null +++ b/development/copy_example.cpp @@ -0,0 +1,240 @@ + +/* + * + * Copyright (c) 1999 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * This file provides some example of type_traits usage - + * by "optimising" various algorithms: + * + * opt::copy - optimised for trivial copy (cf std::copy) + * + */ + +#include +#include +#include +#include +#include + +#include +#include + +using std::cout; +using std::endl; +using std::cin; + +namespace opt{ + +// +// opt::copy +// same semantics as std::copy +// calls memcpy where appropiate. +// + +namespace detail{ + +template +I2 copy_imp(I1 first, I1 last, I2 out) +{ + while(first != last) + { + *out = *first; + ++out; + ++first; + } + return out; +} + +template +struct copier +{ + template + static I2 do_copy(I1 first, I1 last, I2 out) + { return copy_imp(first, last, out); } +}; + +template <> +struct copier +{ + template + static I2* do_copy(I1* first, I1* last, I2* out) + { + memcpy(out, first, (last-first)*sizeof(I2)); + return out+(last-first); + } +}; + + +} + +#ifndef BOOST_NO_STD_ITERATOR_TRAITS + +template +inline I2 copy(I1 first, I1 last, I2 out) +{ + typedef typename boost::remove_cv::value_type>::type v1_t; + typedef typename boost::remove_cv::value_type>::type v2_t; + return detail::copier< + ::boost::type_traits::ice_and< + ::boost::is_same::value, + ::boost::is_pointer::value, + ::boost::is_pointer::value, + ::boost::has_trivial_assign::value + >::value>::do_copy(first, last, out); +} + +#else // BOOST_NO_STD_ITERATOR_TRAITS + +// +// If there is no standard iterator_traits then we have to +// use overloading rather than iterator_traits to detect +// when we have T*'s to copy. Note that we cannot overload +// copy directly as that will cause some standard conforming +// code to fail to build: + +namespace detail{ + +template +inline I2 copy_(const I1& first, const I1& last, const I2& out) +{ + return detail::copier::do_copy(first, last, out); +} + +template +inline T* copy_(const T* first, const T* last, T* out) +{ + return detail::copier< + ::boost::has_trivial_assign::value + >::do_copy(first, last, out); +} + +} // namespace detail + +template +inline I2 copy(I1 first, I1 last, I2 out) +{ + return detail::copy_(first, last, out); +} + +#endif // BOOST_NO_STD_ITERATOR_TRAITS + +}; // namespace opt + +// +// define some global data: +// +const int array_size = 1000; +int i_array_[array_size] = {0,}; +const int ci_array_[array_size] = {0,}; +char c_array_[array_size] = {0,}; +const char cc_array_[array_size] = { 0,}; +// +// since arrays aren't iterators we define a set of pointer +// aliases into the arrays (otherwise the compiler is entitled +// to deduce the type passed to the template functions as +// T (&)[N] rather than T*). +int* i_array = i_array_; +const int* ci_array = ci_array_; +char* c_array = c_array_; +const char* cc_array = cc_array_; + +const int iter_count = 1000000; + +int main() +{ + boost::timer t; + double result; + int i; + cout << "Measuring times in micro-seconds per 1000 elements processed" << endl << endl; + cout << "testing copy...\n" + "[Some standard library versions may already perform this optimisation.]" << endl; + + // cache load: + opt::copy(ci_array, ci_array + array_size, i_array); + + // time optimised version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + opt::copy(ci_array, ci_array + array_size, i_array); + } + result = t.elapsed(); + cout << "opt::copy: " << result << endl; + + // cache load: + std::copy(ci_array, ci_array + array_size, i_array); + + // time standard version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + std::copy(ci_array, ci_array + array_size, i_array); + } + result = t.elapsed(); + cout << "std::copy: " << result << endl; + + // cache load: + opt::detail::copier::do_copy(ci_array, ci_array + array_size, i_array); + + // time unoptimised version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + opt::detail::copier::do_copy(ci_array, ci_array + array_size, i_array); + } + result = t.elapsed(); + cout << "standard \"unoptimised\" copy: " << result << endl << endl; + + // cache load: + opt::copy(cc_array, cc_array + array_size, c_array); + + // time optimised version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + opt::copy(cc_array, cc_array + array_size, c_array); + } + result = t.elapsed(); + cout << "opt::copy: " << result << endl; + + // cache load: + std::copy(cc_array, cc_array + array_size, c_array); + + // time standard version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + std::copy(cc_array, cc_array + array_size, c_array); + } + result = t.elapsed(); + cout << "std::copy: " << result << endl; + + // cache load: + opt::detail::copier::do_copy(cc_array, cc_array + array_size, c_array); + + // time unoptimised version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + opt::detail::copier::do_copy(cc_array, cc_array + array_size, c_array); + } + result = t.elapsed(); + cout << "standard \"unoptimised\" copy: " << result << endl << endl; + + return 0; +} + + + + + + diff --git a/development/cs-win32.html b/development/cs-win32.html new file mode 100644 index 0000000..991837f --- /dev/null +++ b/development/cs-win32.html @@ -0,0 +1,118 @@ + + + +Compiler Status: win32 + + + +

+

Compiler Status: win32

+

+

Run Date: 01 Jan 2001 12:44 GMT

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProgramTest
Type
GNU
GCC
2.95.2
Borland
BCC
5.5.1
Microsoft
VC++
6.0 SP4
Microsoft
VC++
6.0 SP4
STLport
4.0
libs/type_traits/alignment_test.cpprunPassPassPassPass
libs/type_traits/arithmetic_traits_test.cpprunPassPassPassPass
libs/type_traits/composite_traits_test.cpprunPassPassPassPass
libs/type_traits/cv_traits_test.cpprunPassPassPassPass
libs/type_traits/is_convertible_test.cpprunPassFailPassPass
libs/type_traits/is_same_test.cpprunPassPassPassPass
libs/type_traits/object_type_traits_test.cpprunPassPassPassPass
libs/type_traits/transform_traits_test.cpprunPassPassFailFail
libs/type_traits/trivial_destructor_example.cppcompilePassPassPassPass
libs/type_traits/copy_example.cppcompilePassPassPassPass
libs/type_traits/fill_example.cppcompilePassPassPassPass
libs/type_traits/iter_swap_example.cppcompilePassPassFailFail
diff --git a/development/cv_traits_test.cpp b/development/cv_traits_test.cpp new file mode 100644 index 0000000..41d8c6a --- /dev/null +++ b/development/cv_traits_test.cpp @@ -0,0 +1,50 @@ + +// (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 + +#ifdef __BORLANDC__ +#pragma hrdstop +#endif +#include "boost/type_traits/type_traits_test.hpp" + +NESTED_DECL(is_const) +NESTED_DECL(is_volatile) + +int main(int argc, char* argv[]) +{ + NESTED_TEST(is_const, int) + NESTED_TEST(is_const, const int) + NESTED_TEST(is_const, volatile int) + NESTED_TEST(is_volatile, int) + NESTED_TEST(is_volatile, const int) + NESTED_TEST(is_volatile, volatile int) + + value_test(false, boost::is_const::value) + value_test(true, boost::is_const::value) + 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_volatile::value) + value_test(true, boost::is_volatile::value) + value_test(false, boost::is_volatile::value) + value_test(true, boost::is_volatile::value) + value_test(true, boost::is_volatile::value) + value_test(true, boost::is_volatile::value) + + return check_result(argc, argv); +} + +// +// define the number of failures expected for given compilers: +#ifdef BOOST_MSVC +unsigned int expected_failures = 2; +#else +unsigned int expected_failures = 0; +#endif + diff --git a/development/fill_example.cpp b/development/fill_example.cpp new file mode 100644 index 0000000..ce5f03e --- /dev/null +++ b/development/fill_example.cpp @@ -0,0 +1,191 @@ + +/* + * + * Copyright (c) 1999 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * This file provides some example of type_traits usage - + * by "optimising" various algorithms: + * + * opt::fill - optimised for trivial copy/small types (cf std::fill) + * + */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#if defined(BOOST_NO_STDC_NAMESPACE) || (defined(std) && defined(__SGI_STL_PORT)) +namespace std{ using :: memset; } +#endif + +using std::cout; +using std::endl; +using std::cin; + +namespace opt{ +// +// fill +// same as std::fill, uses memset where appropriate, along with call_traits +// to "optimise" parameter passing. +// +namespace detail{ + +template +void do_fill_(I first, I last, typename boost::call_traits::param_type val) +{ + while(first != last) + { + *first = val; + ++first; + } +} + +template +struct filler +{ + template + struct rebind + { + static void do_fill(I first, I last, typename boost::call_traits::param_type val) + { do_fill_(first, last, val); } + }; +}; + +template <> +struct filler +{ + template + struct rebind + { + static void do_fill(I first, I last, T val) + { + std::memset(first, val, last-first); + } + }; +}; + +} + +template +inline void fill(I first, I last, const T& val) +{ + typedef detail::filler< + ::boost::type_traits::ice_and< + ::boost::is_pointer::value, + ::boost::is_arithmetic::value, + (sizeof(T) == 1) + >::value> filler_t; + typedef typename filler_t:: template rebind binder; + binder::do_fill(first, last, val); +} + +}; // namespace opt + +// +// define some global data: +// +const int array_size = 1000; +int i_array_[array_size] = {0,}; +const int ci_array_[array_size] = {0,}; +char c_array_[array_size] = {0,}; +const char cc_array_[array_size] = { 0,}; +// +// since arrays aren't iterators we define a set of pointer +// aliases into the arrays (otherwise the compiler is entitled +// to deduce the type passed to the template functions as +// T (&)[N] rather than T*). +int* i_array = i_array_; +const int* ci_array = ci_array_; +char* c_array = c_array_; +const char* cc_array = cc_array_; + +const int iter_count = 1000000; + +int main() +{ + boost::timer t; + double result; + int i; + // + // test destroy_array, + // compare destruction time of an array of ints + // with unoptimised form. + // + cout << "Measuring times in micro-seconds per 1000 elements processed" << endl << endl; + + cout << "testing fill(char)...\n" + "[Some standard library versions may already perform this optimisation.]" << endl; + + // cache load: + opt::fill(c_array, c_array + array_size, (char)3); + + // time optimised version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + opt::fill(c_array, c_array + array_size, (char)3); + } + result = t.elapsed(); + cout << "opt::fill: " << result << endl; + + // cache load: + std::fill(c_array, c_array + array_size, (char)3); + + // time standard version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + std::fill(c_array, c_array + array_size, (char)3); + } + result = t.elapsed(); + cout << "std::fill: " << result << endl << endl; + + cout << "testing fill(int)...\n" + "[Tests the effect of call_traits pass-by-value optimisation -\nthe value of this optimisation may depend upon hardware characteristics.]" << endl; + + // cache load: + opt::fill(i_array, i_array + array_size, 3); + + // timer optimised version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + opt::fill(i_array, i_array + array_size, 3); + } + result = t.elapsed(); + cout << "opt::fill: " << result << endl; + + // cache load: + std::fill(i_array, i_array + array_size, 3); + + // time standard version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + std::fill(i_array, i_array + array_size, 3); + } + result = t.elapsed(); + cout << "std::fill: " << result << endl << endl; + + return 0; +} + + + + + diff --git a/development/include/boost/call_traits.hpp b/development/include/boost/call_traits.hpp new file mode 100644 index 0000000..345a440 --- /dev/null +++ b/development/include/boost/call_traits.hpp @@ -0,0 +1,23 @@ +// (C) Copyright Boost.org 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. + +// See http://www.boost.org for most recent version including documentation. +// See boost/detail/call_traits.hpp and boost/detail/ob_call_traits.hpp +// for full copyright notices. + +#ifndef BOOST_CALL_TRAITS_HPP +#define BOOST_CALL_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include +#else +#include +#endif + +#endif // BOOST_CALL_TRAITS_HPP diff --git a/development/include/boost/config.hpp b/development/include/boost/config.hpp new file mode 100644 index 0000000..3e01dca --- /dev/null +++ b/development/include/boost/config.hpp @@ -0,0 +1,427 @@ +// Boost config.hpp configuration header file ------------------------------// + +// (C) Copyright Boost.org 1999. 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. + +// See http://www.boost.org for most recent version. + +// Boost config.hpp policy and rationale documentation has been moved to +// http://www.boost.org/libs/config + +// Revision History (excluding minor changes for specific compilers) +// 31 Dec 00 BOOST_NO_CV_SPECIALIZATIONS +// BOOST_NO_CV_VOID_SPECIALIZATIONS (John Maddock) +// 17 Nov 00 BOOST_NO_AUTO_PTR (John Maddock) +// 4 Oct 00 BOOST_NO_STD_MIN_MAX (Jeremy Siek) +// 29 Sep 00 BOOST_NO_INTEGRAL_INT64_T (Jens Maurer) +// 25 Sep 00 BOOST_NO_STD_ALLOCATOR (Jeremy Siek) +// 18 SEP 00 BOOST_NO_SLIST, BOOST_NO_HASH, +// BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +// BOOST_NO_LIMITS (Jeremy Siek) +// 1 Sep 00 BOOST_NO_PRIVATE_IN_AGGREGATE added. (Mark Rodgers) +// 23 Jul 00 Fixed spelling of BOOST_NO_INCLASS_MEMBER_INITIALIZATION in +// comment (Dave Abrahams). +// 10 Jul 00 BOOST_NO_POINTER_TO_MEMBER_CONST added (Mark Rodgers) +// 26 Jun 00 BOOST_NO_STD_ITERATOR, BOOST_MSVC_STD_ITERATOR, +// BOOST_NO_STD_ITERATOR_TRAITS, BOOST_NO_USING_TEMPLATE, +// added (Jeremy Siek) +// 20 Jun 00 BOOST_MSVC added (Aleksey Gurtovoy) +// 14 Jun 00 BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS (Jens M.) +// 22 Mar 00 BOOST_MSVC6_MEMBER_TEMPLATES added (Dave Abrahams) +// 18 Feb 00 BOOST_NO_INCLASS_MEMBER_INITIALIZATION added (Jens Maurer) +// 26 Jan 00 Borland compiler support added (John Maddock) +// 26 Jan 00 Sun compiler support added (Jörg Schaible) +// 30 Dec 99 BOOST_NMEMBER_TEMPLATES compatibility moved here from +// smart_ptr.hpp. (Dave Abrahams) +// 15 Nov 99 BOOST_NO_OPERATORS_IN_NAMESPACE, +// BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION added (Beman Dawes) +// 11 Oct 99 BOOST_NO_STDC_NAMESPACE refined; supplied +// 29 Sep 99 BOOST_NO_STDC_NAMESPACE added (Ed Brey) +// 24 Sep 99 BOOST_DECL added (Ed Brey) +// 10 Aug 99 Endedness flags added, GNU CC support added +// 22 Jul 99 Initial version + + +#ifndef BOOST_CONFIG_HPP +#define BOOST_CONFIG_HPP + +// Conformance Flag Macros -------------------------------------------------// +// +// Conformance flag macros should identify the absence of C++ Standard +// conformance rather than its presence. This ensures that standard conforming +// compilers do not require a lot of configuration flag macros. It places the +// burden where it should be, on non-conforming compilers. In the future, +// hopefully, less rather than more conformance flags will have to be defined. + +// BOOST_NO_CV_SPECIALIZATIONS: if template specialisations for cv-qualified types +// conflict with a specialistaion for unqualififed type. + +// BOOST_NO_CV_VOID_SPECIALIZATIONS: if template specialisations for cv-void types +// conflict with a specialistaion for void. + +// BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS: Template value +// parameters cannot have a dependent type, for example +// "template class X { ... };" + +// BOOST_NO_INCLASS_MEMBER_INITIALIZATION: Compiler violates std::9.4.2/4. + +// BOOST_NO_INT64_T: does not support 64-bit integer +// types. (Set by rather than ). + +// BOOST_NO_INTEGRAL_INT64_T: int64_t as defined by is +// not an integral type. + +// BOOST_NO_MEMBER_TEMPLATES: Member template functions not fully supported. +// Also see BOOST_MSVC6_MEMBER_TEMPLATES in the Compiler Control section below. + +// BOOST_NO_MEMBER_TEMPLATE_FRIENDS: Member template friend syntax +// ("template friend class frd;") described in the C++ Standard, +// 14.5.3, not supported. + +// BOOST_NO_OPERATORS_IN_NAMESPACE: Compiler requires inherited operator +// friend functions to be defined at namespace scope, then using'ed to boost. +// Probably GCC specific. See boost/operators.hpp for example. + +// BOOST_NO_POINTER_TO_MEMBER_CONST: The compiler does not correctly handle +// pointers to const member functions, preventing use of these in overloaded +// function templates. See boost/functional.hpp for example. + +// BOOST_NO_PRIVATE_IN_AGGREGATE: The compiler misreads 8.5.1, treating classes +// as non-aggregate if they contain private or protected member functions. + +// BOOST_NO_STD_ITERATOR: The C++ implementation fails to provide the +// std::iterator class. + +// BOOST_NO_STD_ITERATOR_TRAITS: The compiler does not provide a standard +// compliant implementation of std::iterator_traits. Note that +// the compiler may still have a non-standard implementation. + +// BOOST_NO_STDC_NAMESPACE: The contents of C++ standard headers for C library +// functions (the headers) have not been placed in namespace std. +// Because the use of std::size_t is so common, a specific workaround for +// (and thus std::size_t) is provided in this header (see below). +// For other headers, a workaround must be provided in the boost header: +// +// #include // for abs +// #ifdef BOOST_NO_STDC_NAMESPACE +// namespace std { using ::abs; } +// #endif + +// BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION. Class template partial +// specialization (14.5.4 [temp.class.spec]) not supported. + +// BOOST_NO_USING_TEMPLATE: The compiler will not accept a using declaration +// that imports a template from the global namespace into a named namespace. +// Probably Borland specific. + +// BOOST_NO_AUTO_PTR: If the compiler / library supplies non-standard or broken +// std::auto_ptr. + +// Compiler Control or Information Macros ----------------------------------// +// +// Compilers often supply features outside of the C++ Standard which need to be +// controlled or detected. As usual, reasonable default behavior should occur +// if any of these macros are not defined. + +// BOOST_DECL: Certain compilers for Microsoft operating systems require +// non-standard class and function decoration if dynamic load library linking +// is desired. BOOST_DECL supplies that decoration, defaulting to a nul string +// so that it is harmless when not required. Boost does not encourage the use +// of BOOST_DECL - it is non-standard and to be avoided if practical to do so. + +// BOOST_DECL_EXPORTS: User defined, BOOST_DECL_EXPORTS causes BOOST_DECL to +// be defined as __declspec(dllexport) rather than __declspec(dllimport). + +// BOOST_MSVC6_MEMBER_TEMPLATES: Microsoft Visual C++ 6.0 has enough member +// template idiosyncrasies (being polite) that BOOST_NO_MEMBER_TEMPLATES is +// defined for this compiler. BOOST_MSVC6_MEMBER_TEMPLATES is defined to allow +// compiler specific workarounds. + +// BOOST_MSVC: defined as _MSC_VER for the Microsoft compiler only. In general, +// boost headers should test for a specific conformance flag macro (for +// example, BOOST_NO_MEMBER_TEMPLATE_FRIENDS) rather than a specific compiler. +// VC++ is a special case, however, since many libraries try to support it yet +// it has so many conformance issues that sometimes it is just easier to test +// for it directly. On the other hand, the obvious way to do this doesn't work, +// as many non-Microsoft compilers define _MSC_VER. Thus BOOST_MSVC. + +// BOOST_MSVC_STD_ITERATOR: Microsoft's broken version of std::iterator +// is being used. + +// BOOST_SYSTEM_HAS_STDINT_H: There are no 1998 C++ Standard headers +// or , although the 1999 C Standard does include . +// If is present, can make good use of it, +// so a flag is supplied (signalling presence; thus the default is not +// present, conforming to the current C++ standard). + +// BOOST_NO_SLIST: The C++ implementation does not provide the slist class. + +// BOOST_NO_HASH: The C++ implementation does not provide the hash_set +// or hash_map classes. + +// BOOST_STD_EXTENSION_NAMESPACE: The name of the namespace in which the slist, +// hash_set and/or hash_map templates are defined in this implementation (if any). + +// BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS: The standard library does not provide +// templated iterator constructors for its containers. + +// BOOST_NO_LIMITS: The C++ implementation does not provide the header. + +// BOOST_NO_INTRINSIC_WCHAR_T: The C++ implementation does not provide wchar_t, +// or it is really a synonym for another integral type. Use this symbol to +// decide whether it is appropriate to explicitly specialize a template on +// wchar_t if there is already a specialization for other integer types. + +// BOOST_NO_STD_ALLOCATOR: The C++ standard library does not provide +// a standards conforming std::allocator. + +// BOOST_NO_STD_MIN_MAX: The C++ standard library does not provide +// the min() and max() template functions that should be in . + +// Compilers are listed in alphabetic order (except VC++ last - see below)---// + +// GNU CC (also known as GCC and G++) --------------------------------------// + +# if defined __GNUC__ +# if __GNUC__ == 2 && __GNUC_MINOR__ == 91 + // egcs 1.1 won't parse smart_ptr.hpp without this: +# define BOOST_NO_AUTO_PTR +# endif +# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95 +# include // not sure this is the right way to do this -JGS +# if !defined(_CXXRT_STD) && !defined(__SGI_STL) // need to ask Dietmar about this -JGS +# define BOOST_NO_STD_ITERATOR +# define BOOST_NO_LIMITS +# endif +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_OPERATORS_IN_NAMESPACE +# endif +# if __GNUC__ == 2 && __GNUC_MINOR__ <= 8 +# define BOOST_NO_MEMBER_TEMPLATES +# endif + +// Kai C++ ------------------------------------------------------------------// + +#elif defined __KCC +# define BOOST_NO_SLIST +# define BOOST_NO_HASH + +// Greenhills C++ -----------------------------------------------------------// + +#elif defined __ghs +# define BOOST_NO_SLIST +# define BOOST_NO_HASH + +// Borland ------------------------------------------------------------------// + +#elif defined __BORLANDC__ +# define BOOST_NO_SLIST +# define BOOST_NO_HASH +# if __BORLANDC__ <= 0x0551 +# define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_PRIVATE_IN_AGGREGATE +# endif +# if __BORLANDC__ <= 0x0550 +// Borland C++ Builder 4 and 5: +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_USING_TEMPLATE +# if __BORLANDC__ == 0x0550 +// Borland C++ Builder 5, command-line compiler 5.5: +# define BOOST_NO_OPERATORS_IN_NAMESPACE +# endif +# endif +# if defined BOOST_DECL_EXPORTS +# define BOOST_DECL __declspec(dllexport) +# else +# define BOOST_DECL __declspec(dllimport) +# endif +# define BOOST_NO_CV_SPECIALIZATIONS +# define BOOST_NO_CV_VOID_SPECIALIZATIONS + +// Intel -------------------------------------------------------------------// + +# elif defined __ICL +# include // not sure this is the right way to do this -JGS +# if __SGI_STL_PORT >= 0x400 || __SGI_STL_PORT >= 0x321 && defined(__STL_USE_NAMESPACES) + // a perfectly good implementation of std::iterator is supplied +# elif defined(__SGI_STL_ITERATOR) +# define BOOST_NO_STD_ITERATOR // No std::iterator in this case +# else // assume using dinkumware's STL that comes with VC++ 6.0 +# define BOOST_MSVC_STD_ITERATOR +# define BOOST_NO_STD_ITERATOR_TRAITS +# define BOOST_NO_STDC_NAMESPACE +# define BOOST_NO_SLIST +# define BOOST_NO_HASH +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# define BOOST_NO_STD_ALLOCATOR +# define BOOST_NO_STD_MIN_MAX +# endif + + +// Metrowerks CodeWarrior --------------------------------------------------// + +# elif defined __MWERKS__ +# if __MWERKS__ <= 0x4000 +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# endif +# if __MWERKS__ <= 0x2301 +# define BOOST_NO_POINTER_TO_MEMBER_CONST +# endif +# if __MWERKS__ >= 0x2300 +# define BOOST_SYSTEM_HAS_STDINT_H +# endif +# if defined BOOST_DECL_EXPORTS +# define BOOST_DECL __declspec(dllexport) +# else +# define BOOST_DECL __declspec(dllimport) +# endif + +# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks + +// Sun Workshop Compiler C++ ------------------------------------------------// + +# elif defined __SUNPRO_CC +# if __SUNPRO_CC <= 0x500 +# define BOOST_NO_MEMBER_TEMPLATES +# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# endif + +// Microsoft Visual C++ (excluding Intel/EDG front end) --------------------// +// +// Must remain the last #elif since some other vendors (Metrowerks, for +// example) also #define _MSC_VER + +# elif defined _MSC_VER +# define BOOST_MSVC _MSC_VER + + // turn off the warnings before we #include anything +# pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info +# pragma warning( disable : 4503 ) // warning: decorated name length exceeded + +# if _MSC_VER <= 1200 // 1200 == VC++ 6.0 +# define BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# define BOOST_NO_PRIVATE_IN_AGGREGATE + +# define BOOST_NO_INTEGRAL_INT64_T +# define BOOST_NO_INTRINSIC_WCHAR_T + +// VC++ 6.0 has member templates but they have numerous problems including +// cases of silent failure, so for safety we define: +# define BOOST_NO_MEMBER_TEMPLATES +// For VC++ experts wishing to attempt workarounds, we define: +# define BOOST_MSVC6_MEMBER_TEMPLATES + +# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS + +# include // not sure this is the right way to do this -JGS +# if __SGI_STL_PORT >= 0x400 || __SGI_STL_PORT >= 0x321 && defined(__STL_USE_NAMESPACES) + // a perfectly good implementation of std::iterator is supplied +# elif defined(__SGI_STL_ITERATOR) +# define BOOST_NO_STD_ITERATOR // No std::iterator in this case +# else +# define BOOST_MSVC_STD_ITERATOR 1 +# define BOOST_NO_SLIST +# define BOOST_NO_HASH +# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# define BOOST_NO_STD_ALLOCATOR +# ifndef _CPPLIB_VER + // Updated Dinkum library defines this, and provides + // its own min and max definitions. +# define BOOST_NO_STD_MIN_MAX +# undef min +# undef max +# endif +# ifndef NOMINMAX + // avoid spurious NOMINMAX redefinition warning +# define NOMINMAX +# endif +# endif +# define BOOST_NO_STD_ITERATOR_TRAITS +# define BOOST_NO_CV_VOID_SPECIALIZATIONS + + +// Make sure at least one standard library header is included so that library +// implementation detection will work, even if no standard headers have been +// included in front of a boost header. (Ed Brey 5 Jun 00) +# include + +// Determine if the standard library implementation is already pulling names +// into std. STLport defines the following if so. (Ed Brey 5 Jun 00) +# ifndef __STL_IMPORT_VENDOR_CSTD +# define BOOST_NO_STDC_NAMESPACE +# endif + +# endif + +# if defined BOOST_DECL_EXPORTS +# define BOOST_DECL __declspec(dllexport) +# else +# define BOOST_DECL __declspec(dllimport) +# endif + +# endif // Microsoft (excluding Intel/EDG frontend) + +# ifndef BOOST_DECL +# define BOOST_DECL // default for compilers not needing this decoration. +# endif + +// end of compiler specific portion ----------------------------------------// + +#ifndef BOOST_STD_EXTENSION_NAMESPACE +# define BOOST_STD_EXTENSION_NAMESPACE std +#endif + +// Check for old name "BOOST_NMEMBER_TEMPLATES" for compatibility -----------// +// Don't use BOOST_NMEMBER_TEMPLATES. It is deprecated and will be removed soon. +#if defined( BOOST_NMEMBER_TEMPLATES ) && !defined( BOOST_NO_MEMBER_TEMPLATES ) + #define BOOST_NO_MEMBER_TEMPLATES +#endif + +// BOOST_NO_STDC_NAMESPACE workaround --------------------------------------// +// +// Because std::size_t usage is so common, even in boost headers which do not +// otherwise use the C library, the workaround is included here so +// that ugly workaround code need not appear in many other boost headers. +// NOTE WELL: This is a workaround for non-conforming compilers; +// must still be #included in the usual places so that inclusion +// works as expected with standard conforming compilers. The resulting +// double inclusion of is harmless. + +# ifdef BOOST_NO_STDC_NAMESPACE +# include + namespace std { using ::ptrdiff_t; using ::size_t; } + // using ::wchar_t; removed since wchar_t is a C++ built-in type (Ed Brey) +# endif + +#ifdef BOOST_NO_STD_MIN_MAX +namespace std { + template + inline const _Tp& min(const _Tp& __a, const _Tp& __b) { + return __b < __a ? __b : __a; + } + template + inline const _Tp& max(const _Tp& __a, const _Tp& __b) { + return __a < __b ? __b : __a; + } +#ifdef BOOST_MSVC + inline long min(long __a, long __b) { + return __b < __a ? __b : __a; + } + inline long max(long __a, long __b) { + return __a < __b ? __b : __a; + } +#endif +} +#endif + +#endif // BOOST_CONFIG_HPP + + + + + + diff --git a/development/include/boost/detail/call_traits.hpp b/development/include/boost/detail/call_traits.hpp new file mode 100644 index 0000000..304a686 --- /dev/null +++ b/development/include/boost/detail/call_traits.hpp @@ -0,0 +1,138 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & 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. + +// See http://www.boost.org for most recent version including documentation. + +// call_traits: defines typedefs for function usage +// (see libs/utility/call_traits.htm) + +/* Release notes: + 23rd July 2000: + Fixed array specialization. (JM) + Added Borland specific fixes for reference types + (issue raised by Steve Cleary). +*/ + +#ifndef BOOST_DETAIL_CALL_TRAITS_HPP +#define BOOST_DETAIL_CALL_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#ifndef BOOST_TYPE_TRAITS_HPP +#include +#endif + +namespace boost{ + +namespace detail{ + +template +struct ct_imp +{ + typedef const T& param_type; +}; + +template +struct ct_imp +{ + typedef T const param_type; +}; + +template +struct ct_imp +{ + typedef T const param_type; +}; + +} + +template +struct call_traits +{ +public: + typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + // + // C++ Builder workaround: we should be able to define a compile time + // constant and pass that as a single template parameter to ct_imp, + // however compiler bugs prevent this - instead pass three bool's to + // ct_imp and add an extra partial specialisation + // of ct_imp to handle the logic. (JM) + typedef typename detail::ct_imp::type>::value, ::boost::is_arithmetic::type>::value, sizeof(T) <= sizeof(void*)>::param_type param_type; +}; + +template +struct call_traits +{ + typedef T& value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T& param_type; // hh removed const +}; + +#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x551) +// these are illegal specialisations; cv-qualifies applied to +// references have no effect according to [8.3.2p1], +// C++ Builder requires them though as it treats cv-qualified +// references as distinct types... +template +struct call_traits +{ + typedef T& value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T& param_type; // hh removed const +}; +template +struct call_traits +{ + typedef T& value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T& param_type; // hh removed const +}; +template +struct call_traits +{ + typedef T& value_type; + typedef T& reference; + typedef const T& const_reference; + typedef T& param_type; // hh removed const +}; +#endif + +template +struct call_traits +{ +private: + typedef T array_type[N]; +public: + // degrades array to pointer: + typedef const T* value_type; + typedef array_type& reference; + typedef const array_type& const_reference; + typedef const T* const param_type; +}; + +template +struct call_traits +{ +private: + typedef const T array_type[N]; +public: + // degrades array to pointer: + typedef const T* value_type; + typedef array_type& reference; + typedef const array_type& const_reference; + typedef const T* const param_type; +}; + +} + +#endif // BOOST_DETAIL_CALL_TRAITS_HPP diff --git a/development/include/boost/detail/ob_call_traits.hpp b/development/include/boost/detail/ob_call_traits.hpp new file mode 100644 index 0000000..a031f17 --- /dev/null +++ b/development/include/boost/detail/ob_call_traits.hpp @@ -0,0 +1,125 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & 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. + +// See http://www.boost.org for most recent version including documentation. +// +// Crippled version for crippled compilers: +// see libs/utility/call_traits.htm +// + +/* Release notes: + 01st October 2000: + Fixed call_traits on VC6, using "poor man's partial specialisation", + using ideas taken from "Generative programming" by Krzysztof Czarnecki + & Ulrich Eisenecker. +*/ + +#ifndef BOOST_OB_CALL_TRAITS_HPP +#define BOOST_OB_CALL_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#ifndef BOOST_TYPE_TRAITS_HPP +#include +#endif + +namespace boost{ + +#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES) +// +// use member templates to emulate +// partial specialisation: +// +namespace detail{ + +template +struct standard_call_traits +{ + typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + typedef const T& param_type; +}; +template +struct simple_call_traits +{ + typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + typedef const T param_type; +}; +template +struct reference_call_traits +{ + typedef T value_type; + typedef T reference; + typedef T const_reference; + typedef T param_type; +}; +template +struct call_traits_chooser +{ + template + struct rebind + { + typedef standard_call_traits type; + }; +}; +template <> +struct call_traits_chooser +{ + template + struct rebind + { + typedef simple_call_traits type; + }; +}; +template <> +struct call_traits_chooser +{ + template + struct rebind + { + typedef reference_call_traits type; + }; +}; +} // namespace detail +template +struct call_traits +{ +private: + typedef detail::call_traits_chooser<(is_pointer::value || is_arithmetic::value) && sizeof(T) <= sizeof(void*), is_reference::value> chooser; + typedef typename chooser::template rebind bound_type; + typedef typename bound_type::type call_traits_type; +public: + typedef typename call_traits_type::value_type value_type; + typedef typename call_traits_type::reference reference; + typedef typename call_traits_type::const_reference const_reference; + typedef typename call_traits_type::param_type param_type; +}; + +#else +// +// sorry call_traits is completely non-functional +// blame your broken compiler: +// + +template +struct call_traits +{ + typedef T value_type; + typedef T& reference; + typedef const T& const_reference; + typedef const T& param_type; +}; + +#endif // member templates + +} + +#endif // BOOST_OB_CALL_TRAITS_HPP diff --git a/development/include/boost/smart_ptr.hpp b/development/include/boost/smart_ptr.hpp new file mode 100644 index 0000000..59e42a7 --- /dev/null +++ b/development/include/boost/smart_ptr.hpp @@ -0,0 +1,379 @@ +// Boost smart_ptr.hpp header file -----------------------------------------// + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. 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. + +// See http://www.boost.org for most recent version including documentation. + +// Revision History +// 19 Oct 00 Make shared_ptr ctor from auto_ptr explicit. (Robert Vugts) +// 24 Jul 00 Change throw() to // never throws. See lib guidelines +// Exception-specification rationale. (Beman Dawes) +// 22 Jun 00 Remove #if continuations to fix GCC 2.95.2 problem (Beman Dawes) +// 1 Feb 00 Additional shared_ptr BOOST_NO_MEMBER_TEMPLATES workarounds +// (Dave Abrahams) +// 31 Dec 99 Condition tightened for no member template friend workaround +// (Dave Abrahams) +// 30 Dec 99 Moved BOOST_NMEMBER_TEMPLATES compatibility code to config.hpp +// (Dave Abrahams) +// 30 Nov 99 added operator ==, operator !=, and std::swap and std::less +// specializations for shared types (Darin Adler) +// 11 Oct 99 replaced op[](int) with op[](std::size_t) (Ed Brey, Valentin +// Bonnard), added shared_ptr workaround for no member template +// friends (Matthew Langston) +// 25 Sep 99 added shared_ptr::swap and shared_array::swap (Luis Coelho). +// 20 Jul 99 changed name to smart_ptr.hpp, #include , +// #include and use boost::noncopyable +// 17 May 99 remove scoped_array and shared_array operator*() as +// unnecessary (Beman Dawes) +// 14 May 99 reorder code so no effects when bad_alloc thrown (Abrahams/Dawes) +// 13 May 99 remove certain throw() specifiers to avoid generated try/catch +// code cost (Beman Dawes) +// 11 May 99 get() added, conversion to T* placed in macro guard (Valentin +// Bonnard, Dave Abrahams, and others argued for elimination +// of the automatic conversion) +// 28 Apr 99 #include fix (Valentin Bonnard) +// 28 Apr 99 rename transfer() to share() for clarity (Dave Abrahams) +// 28 Apr 99 remove unsafe shared_array template conversions(Valentin Bonnard) +// 28 Apr 99 p(r) changed to p(r.px) for clarity (Dave Abrahams) +// 21 Apr 99 reset() self assignment fix (Valentin Bonnard) +// 21 Apr 99 dispose() provided to improve clarity (Valentin Bonnard) +// 27 Apr 99 leak when new throws fixes (Dave Abrahams) +// 21 Oct 98 initial Version (Greg Colvin/Beman Dawes) + +#ifndef BOOST_SMART_PTR_HPP +#define BOOST_SMART_PTR_HPP + +#include // for broken compiler workarounds +#include // for std::size_t +#include // for std::auto_ptr +#include // for std::swap +#include // for boost::noncopyable +#include // for std::less + +namespace boost { + +// scoped_ptr --------------------------------------------------------------// + +// scoped_ptr mimics a built-in pointer except that it guarantees deletion +// of the object pointed to, either on destruction of the scoped_ptr or via +// an explicit reset(). scoped_ptr is a simple solution for simple needs; +// see shared_ptr (below) or std::auto_ptr if your needs are more complex. + +template class scoped_ptr : noncopyable { + + T* ptr; + + public: + typedef T element_type; + + explicit scoped_ptr( T* p=0 ) : ptr(p) {} // never throws + ~scoped_ptr() { delete ptr; } + + void reset( T* p=0 ) { if ( ptr != p ) { delete ptr; ptr = p; } } + T& operator*() const { return *ptr; } // never throws + T* operator->() const { return ptr; } // never throws + T* get() const { return ptr; } // never throws +#ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return ptr; } // never throws +#endif + }; // scoped_ptr + +// scoped_array ------------------------------------------------------------// + +// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to +// is guaranteed, either on destruction of the scoped_array or via an explicit +// reset(). See shared_array or std::vector if your needs are more complex. + +template class scoped_array : noncopyable { + + T* ptr; + + public: + typedef T element_type; + + explicit scoped_array( T* p=0 ) : ptr(p) {} // never throws + ~scoped_array() { delete [] ptr; } + + void reset( T* p=0 ) { if ( ptr != p ) {delete [] ptr; ptr=p;} } + + T* get() const { return ptr; } // never throws +#ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return ptr; } // never throws +#else + T& operator[](std::size_t i) const { return ptr[i]; } // never throws +#endif + }; // scoped_array + +// shared_ptr --------------------------------------------------------------// + +// An enhanced relative of scoped_ptr with reference counted copy semantics. +// The object pointed to is deleted when the last shared_ptr pointing to it +// is destroyed or reset. + +template class shared_ptr { + public: + typedef T element_type; + + explicit shared_ptr(T* p =0) : px(p) { + try { pn = new long(1); } // fix: prevent leak if new throws + catch (...) { delete p; throw; } + } + + shared_ptr(const shared_ptr& r) : px(r.px) { ++*(pn = r.pn); } // never throws + + ~shared_ptr() { dispose(); } + + shared_ptr& operator=(const shared_ptr& r) { + share(r.px,r.pn); + return *this; + } + +#if !defined( BOOST_NO_MEMBER_TEMPLATES ) + template + shared_ptr(const shared_ptr& r) : px(r.px) { // never throws + ++*(pn = r.pn); + } +#ifndef BOOST_NO_AUTO_PTR + template + explicit shared_ptr(std::auto_ptr& r) { + pn = new long(1); // may throw + px = r.release(); // fix: moved here to stop leak if new throws + } +#endif + + template + shared_ptr& operator=(const shared_ptr& r) { + share(r.px,r.pn); + return *this; + } + +#ifndef BOOST_NO_AUTO_PTR + template + shared_ptr& operator=(std::auto_ptr& r) { + // code choice driven by guarantee of "no effect if new throws" + if (*pn == 1) { delete px; } + else { // allocate new reference counter + long * tmp = new long(1); // may throw + --*pn; // only decrement once danger of new throwing is past + pn = tmp; + } // allocate new reference counter + px = r.release(); // fix: moved here so doesn't leak if new throws + return *this; + } +#endif +#else +#ifndef BOOST_NO_AUTO_PTR + explicit shared_ptr(std::auto_ptr& r) { + pn = new long(1); // may throw + px = r.release(); // fix: moved here to stop leak if new throws + } + + shared_ptr& operator=(std::auto_ptr& r) { + // code choice driven by guarantee of "no effect if new throws" + if (*pn == 1) { delete px; } + else { // allocate new reference counter + long * tmp = new long(1); // may throw + --*pn; // only decrement once danger of new throwing is past + pn = tmp; + } // allocate new reference counter + px = r.release(); // fix: moved here so doesn't leak if new throws + return *this; + } +#endif +#endif + + void reset(T* p=0) { + if ( px == p ) return; // fix: self-assignment safe + if (--*pn == 0) { delete px; } + else { // allocate new reference counter + try { pn = new long; } // fix: prevent leak if new throws + catch (...) { + ++*pn; // undo effect of --*pn above to meet effects guarantee + delete p; + throw; + } // catch + } // allocate new reference counter + *pn = 1; + px = p; + } // reset + + T& operator*() const { return *px; } // never throws + T* operator->() const { return px; } // never throws + T* get() const { return px; } // never throws + #ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return px; } // never throws + #endif + + long use_count() const { return *pn; } // never throws + bool unique() const { return *pn == 1; } // never throws + + void swap(shared_ptr& other) // never throws + { std::swap(px,other.px); std::swap(pn,other.pn); } + +// Tasteless as this may seem, making all members public allows member templates +// to work in the absence of member template friends. (Matthew Langston) +// Don't split this line into two; that causes problems for some GCC 2.95.2 builds +#if defined(BOOST_NO_MEMBER_TEMPLATES) || !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) + private: +#endif + + T* px; // contained pointer + long* pn; // ptr to reference counter + +// Don't split this line into two; that causes problems for some GCC 2.95.2 builds +#if !defined( BOOST_NO_MEMBER_TEMPLATES ) && !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) + template friend class shared_ptr; +#endif + + void dispose() { if (--*pn == 0) { delete px; delete pn; } } + + void share(T* rpx, long* rpn) { + if (pn != rpn) { + dispose(); + px = rpx; + ++*(pn = rpn); + } + } // share +}; // shared_ptr + +template + inline bool operator==(const shared_ptr& a, const shared_ptr& b) + { return a.get() == b.get(); } + +template + inline bool operator!=(const shared_ptr& a, const shared_ptr& b) + { return a.get() != b.get(); } + +// shared_array ------------------------------------------------------------// + +// shared_array extends shared_ptr to arrays. +// The array pointed to is deleted when the last shared_array pointing to it +// is destroyed or reset. + +template class shared_array { + public: + typedef T element_type; + + explicit shared_array(T* p =0) : px(p) { + try { pn = new long(1); } // fix: prevent leak if new throws + catch (...) { delete [] p; throw; } + } + + shared_array(const shared_array& r) : px(r.px) // never throws + { ++*(pn = r.pn); } + + ~shared_array() { dispose(); } + + shared_array& operator=(const shared_array& r) { + if (pn != r.pn) { + dispose(); + px = r.px; + ++*(pn = r.pn); + } + return *this; + } // operator= + + void reset(T* p=0) { + if ( px == p ) return; // fix: self-assignment safe + if (--*pn == 0) { delete [] px; } + else { // allocate new reference counter + try { pn = new long; } // fix: prevent leak if new throws + catch (...) { + ++*pn; // undo effect of --*pn above to meet effects guarantee + delete [] p; + throw; + } // catch + } // allocate new reference counter + *pn = 1; + px = p; + } // reset + + T* get() const { return px; } // never throws + #ifdef BOOST_SMART_PTR_CONVERSION + // get() is safer! Define BOOST_SMART_PTR_CONVERSION at your own risk! + operator T*() const { return px; } // never throws + #else + T& operator[](std::size_t i) const { return px[i]; } // never throws + #endif + + long use_count() const { return *pn; } // never throws + bool unique() const { return *pn == 1; } // never throws + + void swap(shared_array& other) // never throws + { std::swap(px,other.px); std::swap(pn,other.pn); } + + private: + + T* px; // contained pointer + long* pn; // ptr to reference counter + + void dispose() { if (--*pn == 0) { delete [] px; delete pn; } } + +}; // shared_array + +template + inline bool operator==(const shared_array& a, const shared_array& b) + { return a.get() == b.get(); } + +template + inline bool operator!=(const shared_array& a, const shared_array& b) + { return a.get() != b.get(); } + +} // namespace boost + +// specializations for things in namespace std -----------------------------// + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +namespace std { + +// Specialize std::swap to use the fast, non-throwing swap that's provided +// as a member function instead of using the default algorithm which creates +// a temporary and uses assignment. + +template + inline void swap(boost::shared_ptr& a, boost::shared_ptr& b) + { a.swap(b); } + +template + inline void swap(boost::shared_array& a, boost::shared_array& b) + { a.swap(b); } + +// Specialize std::less so we can use shared pointers and arrays as keys in +// associative collections. + +// It's still a controversial question whether this is better than supplying +// a full range of comparison operators (<, >, <=, >=). + +template + struct less< boost::shared_ptr > + : binary_function, boost::shared_ptr, bool> + { + bool operator()(const boost::shared_ptr& a, + const boost::shared_ptr& b) const + { return less()(a.get(),b.get()); } + }; + +template + struct less< boost::shared_array > + : binary_function, boost::shared_array, bool> + { + bool operator()(const boost::shared_array& a, + const boost::shared_array& b) const + { return less()(a.get(),b.get()); } + }; + +} // namespace std + +#endif // ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_SMART_PTR_HPP + + diff --git a/development/include/boost/timer.hpp b/development/include/boost/timer.hpp new file mode 100644 index 0000000..6ccb436 --- /dev/null +++ b/development/include/boost/timer.hpp @@ -0,0 +1,57 @@ +// boost timer.hpp header file ---------------------------------------------// + +// (C) Copyright Beman Dawes 1994-99. 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. + +// See http://www.boost.org for most recent version including documentation. + +// Revision History +// 25 Sep 99 elapsed_max() and elapsed_min() added (John Maddock) +// 16 Jul 99 Second beta +// 6 Jul 99 Initial boost version + +#ifndef BOOST_TIMER_HPP +#define BOOST_TIMER_HPP + +#include + +namespace boost { + +// timer -------------------------------------------------------------------// + +// A timer object measures elapsed time. + +// It is recommended that implementations measure wall clock rather than CPU +// time since the intended use is performance measurement on systems where +// total elapsed time is more important than just process or CPU time. + +// Warnings: The maximum measurable elapsed time may well be only 596.5+ hours +// due to implementation limitations. The accuracy of timings depends on the +// accuracy of timing information provided by the underlying platform, and +// this varies a great deal from platform to platform. + +class timer { + +public: + timer(); // postcondition: elapsed()==0 + timer( const timer& src ); // post: elapsed()==src.elapsed() + ~timer(); + timer& operator=( const timer& src ); // post: elapsed()==src.elapsed() + void restart(); // post: elapsed()==0 + double elapsed() const; // return elapsed time in seconds + + double elapsed_max() const; // return estimated maximum value for elapsed() + // Portability warning: elapsed_max() may return too high a value on systems + // where std::clock_t overflows or resets at surprising values. + double elapsed_min() const; // return minimum value for elapsed() + +private: + class _timer; + scoped_ptr<_timer> _imp; // hide implementation details + }; // timer + +} // namespace boost + +#endif // BOOST_TIMER_HPP diff --git a/development/include/boost/type_traits.hpp b/development/include/boost/type_traits.hpp new file mode 100644 index 0000000..04dcc68 --- /dev/null +++ b/development/include/boost/type_traits.hpp @@ -0,0 +1,42 @@ +// (C) Copyright Boost.org 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. + +// See http://www.boost.org for most recent version including documentation. +// See boost/detail/type_traits.hpp and boost/detail/ob_type_traits.hpp +// for full copyright notices. + +#ifndef BOOST_TYPE_TRAITS_HPP +#define BOOST_TYPE_TRAITS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/**************************************************************************/ + +// +// undefine helper macro's: +// +#undef BOOST_IS_CLASS +#undef BOOST_IS_ENUM +#undef BOOST_IS_UNION +#undef BOOST_IS_POD +#undef BOOST_IS_EMPTY +#undef BOOST_HAS_TRIVIAL_CONSTRUCTOR +#undef BOOST_HAS_TRIVIAL_COPY +#undef BOOST_HAS_TRIVIAL_ASSIGN +#undef BOOST_HAS_TRIVIAL_DESTRUCTOR + +#endif // BOOST_TYPE_TRAITS_HPP + + + diff --git a/development/include/boost/type_traits/alignment_traits.hpp b/development/include/boost/type_traits/alignment_traits.hpp new file mode 100644 index 0000000..b325017 --- /dev/null +++ b/development/include/boost/type_traits/alignment_traits.hpp @@ -0,0 +1,66 @@ + +// (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. + +// +// defines alignment_of: + +#ifndef ALIGNMENT_TYPE_TRAITS_HPP +#define ALIGNMENT_TYPE_TRAITS_HPP + +#include +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif + +namespace boost{ +// +// get the alignment of some arbitrary type: +namespace detail{ + +template +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; + +template +struct alignment_logic +{ + BOOST_DECL_MC(std::size_t, value, A < S ? A : S); +}; + +} // namespace detail + +template +struct alignment_of +{ + BOOST_DECL_MC(std::size_t, value, + (::boost::detail::alignment_logic< + sizeof(detail::alignment_of_hack) - sizeof(T), + sizeof(T) + >::value)); +}; + +// +// references have to be treated specially, assume +// that a reference is just a special pointer: +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +class alignment_of +{ +public: + BOOST_DECL_MC(std::size_t, value, alignment_of::value); +}; +#endif + +} // namespace boost + +#endif // ALIGNMENT_TYPE_TRAITS_HPP + + diff --git a/development/include/boost/type_traits/arithmetic_traits.hpp b/development/include/boost/type_traits/arithmetic_traits.hpp new file mode 100644 index 0000000..b3dd46b --- /dev/null +++ b/development/include/boost/type_traits/arithmetic_traits.hpp @@ -0,0 +1,262 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & 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. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines traits classes for arithmetic types: +// is_void, is_integral, is_float, is_arithmetic, is_fundamental. +// + + +#ifndef ARITHMETIC_TYPE_TRAITS_HPP +#define ARITHMETIC_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif + +namespace boost{ + +//* is a type T void - is_void +template struct is_void{ BOOST_DECL_MC(bool, value, false); }; +template <> struct is_void{ BOOST_DECL_MC(bool, value, true); }; + +//* is a type T an integral type described in the standard (3.9.1p3) +template struct is_integral +{ BOOST_DECL_MC(bool, value, false); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#ifndef BOOST_MSVC +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; + +#ifdef ULLONG_MAX +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif +#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__) +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral<__int64> +{ BOOST_DECL_MC(bool, value, true); }; +#endif + +//* is a type T a floating-point type described in the standard (3.9.1p8) +template struct is_float +{ BOOST_DECL_MC(bool, value, false); }; +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; + +// +// declare cv-qualified specialisations of these templates only +// if BOOST_NO_CV_SPECIALIZATIONS is not defined: +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> struct is_void +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_void +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_void +{ BOOST_DECL_MC(bool, value, true); }; +#endif +#ifndef BOOST_NO_CV_SPECIALIZATIONS +// const-variations: +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#ifndef BOOST_MSVC +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; + +#ifdef ULLONG_MAX +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif // ULLONG_MAX +#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__) +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif //__int64 + +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; + +// volatile-variations: +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#ifndef BOOST_MSVC +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; + +#ifdef ULLONG_MAX +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif // ULLONG_MAX +#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__) +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif //__int64 + +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; + +// const-volatile-variations: +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#ifndef BOOST_MSVC +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; + +#ifdef ULLONG_MAX +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif // ULLONG_MAX +#if defined(__BORLANDC__) || defined(_MSC_VER) && !defined(__MWERKS__) +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_integral +{ BOOST_DECL_MC(bool, value, true); }; +#endif //__int64 + +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; +template <> struct is_float +{ BOOST_DECL_MC(bool, value, true); }; + +#endif // BOOST_NO_CV_SPECIALIZATIONS + +//* is a type T an arithmetic type described in the standard (3.9.1p8) +template +struct is_arithmetic +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_or< + ::boost::is_integral::value, + ::boost::is_float::value + >::value)); +}; + +//* is a type T a fundamental type described in the standard (3.9.1) +template +struct is_fundamental +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_or< + ::boost::is_arithmetic::value, + ::boost::is_void::value + >::value)); +}; + +} // namespace boost + +#endif + + + + + diff --git a/development/include/boost/type_traits/composite_traits.hpp b/development/include/boost/type_traits/composite_traits.hpp new file mode 100644 index 0000000..fd7b62d --- /dev/null +++ b/development/include/boost/type_traits/composite_traits.hpp @@ -0,0 +1,357 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & 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. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines traits classes for composite types: +// is_array, is_pointer, is_reference, is_member_pointer, is_enum, is_union. +// +// Some workarounds in here use ideas suggested from "Generic: +// Mappings between Types and Values" +// by Andrei Alexandrescu (see http://www.cuj.com/experts/1810/alexandr.html). +// Mat Marcus and Jesse Jones posted a version of is_pointer very similar to this one +// on the boost list (Copyright 2000 Adobe Systems Incorporated and others. +// All rights reserved.). +// Fixes for is_array are based on a newgroup posting by Jonathan Lundquist. + +#ifndef COMPOSITE_TYPE_TRAITS_HPP +#define COMPOSITE_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_CONVERSION_TYPE_TRAITS_HPP +#include +#endif +#ifndef CV_TYPE_TRAITS_HPP +#include +#endif +#ifndef ARITHMETIC_TYPE_TRAITS_HPP +#include +#endif + +namespace boost{ + +/********************************************** + * + * is_array + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template struct is_array +{ BOOST_DECL_MC(bool, value, false); }; +template struct is_array +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_array +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_array +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_array +{ BOOST_DECL_MC(bool, value, true); }; +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail{ + struct pointer_helper + { + pointer_helper(const volatile void*); + }; + yes_type is_pointer_helper(pointer_helper); + no_type is_pointer_helper(...); + template + yes_type is_pointer_helper3(T (*)(void)); + template + yes_type is_pointer_helper3(T (*)(A1)); + template + yes_type is_pointer_helper3(T (*)(A1, A2)); + template + yes_type is_pointer_helper3(T (*)(A1, A2, A3)); + no_type is_pointer_helper3(...); + + yes_type is_array_helper(const volatile void*, const volatile void*); + template + no_type is_array_helper(T*const volatile*, const volatile void*); + no_type is_array_helper(...); +} // namespace detail +template +struct is_array +{ +private: + static T t; +public: + BOOST_DECL_MC(bool, value, (1 == sizeof(detail::is_array_helper(&t, t))) + & !is_reference::value + & !(1 == sizeof(detail::is_pointer_helper3(t))) ); +}; +template <> +struct is_array +{ + BOOST_DECL_MC(bool, value, false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_array +{ + BOOST_DECL_MC(bool, value, false); +}; +template <> +struct is_array +{ + BOOST_DECL_MC(bool, value, false); +}; +template <> +struct is_array +{ + BOOST_DECL_MC(bool, value, false); +}; +#endif + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +/********************************************** + * + * is_pointer + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail{ +template struct is_pointer_helper +{ BOOST_DECL_MC(bool, value, false); }; +template struct is_pointer_helper +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_pointer_helper +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_pointer_helper +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_pointer_helper +{ BOOST_DECL_MC(bool, value, true); }; +} // namespace detail +template struct is_pointer +{ BOOST_DECL_MC(bool, value, (::boost::type_traits::ice_and< ::boost::detail::is_pointer_helper::value, !::boost::is_member_pointer::value>::value)); }; +#else +template +struct is_pointer +{ +private: + static T t; +public: + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_and< + !::boost::is_reference::value, + !::boost::is_array::value, + (::boost::type_traits::ice_or< + (1 == sizeof(detail::is_pointer_helper(t))), + (1 == sizeof(detail::is_pointer_helper3(t))) + >::value) + >::value ) ); +}; +template <> +struct is_pointer +{ + BOOST_DECL_MC(bool, value, false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_pointer +{ + BOOST_DECL_MC(bool, value, false); +}; +template <> +struct is_pointer +{ + BOOST_DECL_MC(bool, value, false); +}; +template <> +struct is_pointer +{ + BOOST_DECL_MC(bool, value, false); +}; +#endif +#endif + +/********************************************** + * + * is_reference + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template struct is_reference +{ BOOST_DECL_MC(bool, value, false); }; +template struct is_reference +{ BOOST_DECL_MC(bool, value, true); }; +#if defined(__BORLANDC__) +// these are illegal specialisations; cv-qualifies applied to +// references have no effect according to [8.3.2p1], +// C++ Builder requires them though as it treats cv-qualified +// references as distinct types... +template struct is_reference +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_reference +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_reference +{ BOOST_DECL_MC(bool, value, true); }; +#endif +#else +# ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4181) +# endif // BOOST_MSVC +template struct is_reference +{ +private: + typedef T const volatile cv_t; +public: + BOOST_DECL_MC(bool, value, (::boost::type_traits::ice_or::value, !::boost::is_volatile::value>::value)); +}; +template <> struct is_reference +{ + BOOST_DECL_MC(bool, value, false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> struct is_reference +{ BOOST_DECL_MC(bool, value, false); }; +template <> struct is_reference +{ BOOST_DECL_MC(bool, value, false); }; +template <> struct is_reference +{ BOOST_DECL_MC(bool, value, false); }; +#endif + +# ifdef BOOST_MSVC +# pragma warning(pop) +# endif // BOOST_MSVC +#endif + +/********************************************** + * + * is_union + * + **********************************************/ +template struct is_union +{ +private: + typedef typename remove_cv::type cvt; +public: + BOOST_DECL_MC(bool, value, BOOST_IS_UNION(cvt)); +}; + +/********************************************** + * + * is_enum + * + **********************************************/ +namespace detail{ +struct int_convertible +{ + int_convertible(int); +}; +} // namespace detail +#ifndef __BORLANDC__ +template struct is_enum +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_and< + !::boost::is_arithmetic::value, + !::boost::is_reference::value, + ::boost::is_convertible::value + >::value)); +}; +#else // __BORLANDC__ +// +// buggy is_convertible prevents working +// implementation of is_enum: +template struct is_enum +{ +public: + BOOST_DECL_MC(bool, value, BOOST_IS_ENUM(T)); +}; +#endif + +/********************************************** + * + * is_member_pointer + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template struct is_member_pointer +{ BOOST_DECL_MC(bool, value, false); }; +template struct is_member_pointer +{ BOOST_DECL_MC(bool, value, true); }; +#ifdef __GNUC__ +// gcc workaround (JM 02 Oct 2000) +template struct is_member_pointer +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_member_pointer +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_member_pointer +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_member_pointer +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_member_pointer +{ BOOST_DECL_MC(bool, value, true); }; +template struct is_member_pointer +{ BOOST_DECL_MC(bool, value, true); }; +#endif +#else +namespace detail{ + template + yes_type is_member_pointer_helper(T (U::*)); + template + yes_type is_member_pointer_helper(T (U::*)(void)); + template + yes_type is_member_pointer_helper(T (U::*)(A1)); + template + yes_type is_member_pointer_helper(T (U::*)(A1, A2)); + template + yes_type is_member_pointer_helper(T (U::*)(A1, A2, A3)); + template + yes_type is_member_pointer_helper(T (U::*)(A1, A2, A3, A4)); + template + yes_type is_member_pointer_helper(T (U::*)(A1, A2, A3, A4, A5)); + no_type is_member_pointer_helper(...); +} +template +struct is_member_pointer +{ +private: + static T t; +public: + BOOST_DECL_MC(bool, value, (1 == sizeof(detail::is_member_pointer_helper(t))) ); +}; +template <> +struct is_member_pointer +{ + BOOST_DECL_MC(bool, value, false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_member_pointer +{ + BOOST_DECL_MC(bool, value, false); +}; +template <> +struct is_member_pointer +{ + BOOST_DECL_MC(bool, value, false); +}; +template <> +struct is_member_pointer +{ + BOOST_DECL_MC(bool, value, false); +}; +#endif + +#endif + + +} // namespace boost + +#endif // COMPOSITE_TYPE_TRAITS_HPP + + + + + diff --git a/development/include/boost/type_traits/conversion_traits.hpp b/development/include/boost/type_traits/conversion_traits.hpp new file mode 100644 index 0000000..1908191 --- /dev/null +++ b/development/include/boost/type_traits/conversion_traits.hpp @@ -0,0 +1,220 @@ + +// Copyright (C) 2000 John Maddock (john_maddock@compuserve.com) +// Copyright (C) 2000 Jeremy Siek (jsiek@lsc.nd.edu) +// Copyright (C) 1999, 2000 Jaakko J„rvi (jaakko.jarvi@cs.utu.fi) +// +// Permission to copy and use this software is granted, +// provided this copyright notice appears in all copies. +// Permission to modify the code and to distribute modified code is granted, +// provided this copyright notice appears in all copies, and a notice +// that the code was modified is included with the copyright notice. +// +// This software is provided "as is" without express or implied warranty, +// and with no claim as to its suitability for any purpose. + +#ifndef BOOST_CONVERSION_TYPE_TRAITS_HPP +#define BOOST_CONVERSION_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#ifndef ARITHMETIC_TYPE_TRAITS_HPP +#include +#endif +// +// is one type convertable to another? +// +// there are multiple versions of the is_convertible +// template, almost every compiler seems to require its +// own version: + +namespace boost{ + +#ifdef BOOST_MSVC + +// +// MS specific version: +// +namespace detail{ + + // This workaround is necessary to handle when From is void + // which is normally taken care of by the partial specialization + // of the is_convertible class. + using ::boost::type_traits::yes_type; + using ::boost::type_traits::no_type; + + struct from_not_void_conversion { + template + struct bind { + static no_type check(...); + static yes_type check(To); + public: + void foo(); // avoid warning about all members being private + static From from; + enum { exists = sizeof( check(from) ) == sizeof(yes_type) }; + }; + }; + struct from_is_void_conversion { + template + struct bind { + enum { exists = ::boost::is_void::value }; + }; + }; + + template + struct conversion_helper { + typedef from_not_void_conversion type; + }; + template <> + struct conversion_helper { + typedef from_is_void_conversion type; + }; +} // namespace detail + +template +struct is_convertible +{ + typedef typename detail::conversion_helper::type Selector; + typedef Selector::template bind Conversion; +public: + enum { value = Conversion::exists }; +}; + +#elif defined(__BORLANDC__) +// +// special version for Borland compilers +// this version breaks when used for some +// UDT conversions: +// +template +struct is_convertible_helper +{ +private: + // This workaround for Borland breaks the EDG C++ frontend, + // so we only use it for Borland. + template + struct checker + { + static type_traits::no_type check(...); + static type_traits::yes_type check(T); + }; + static From from; +public: + static const bool value = sizeof( checker::check(from) ) == sizeof(type_traits::yes_type); + + void foo(); // avoid warning about all members being private +}; + +template +struct is_convertible +{ +private: + typedef is_convertible_helper c_type; + enum{ v = c_type::value }; + char force_it[v ? 1 : 2]; +public: + static const bool value = is_convertible_helper::value; +}; + +template +struct is_convertible +{ + static const bool value = false; +}; +template +struct is_convertible +{ + static const bool value = false; +}; +template <> +struct is_convertible +{ + static const bool value = true; +}; + +#elif defined(__GNUC__) +// +// special version for gcc compiler +// +namespace detail{ + struct any_conversion + { + template + any_conversion(const T&); + }; + template + struct checker + { + static boost::type_traits::no_type check(any_conversion ...); + static boost::type_traits::yes_type check(T, int); + }; +} // namespace detail +template +struct is_convertible +{ +private: + static From from; +public: + static const bool value = sizeof( detail::checker::check(from, 0) ) == sizeof(type_traits::yes_type); + + void foo(); // avoid warning about all members being private +}; + +template +struct is_convertible +{ + static const bool value = false; +}; +template +struct is_convertible +{ + static const bool value = false; +}; +template <> +struct is_convertible +{ + static const bool value = true; +}; + +#else + +template +struct is_convertible +{ +private: + static type_traits::no_type check(...); + static type_traits::yes_type check(To); + static From from; +public: + BOOST_DECL_MC(bool, value, sizeof( check(from) ) == sizeof(type_traits::yes_type)); + void foo(); // avoid warning about all members being private +}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct is_convertible +{ + BOOST_DECL_MC(bool, value, false); +}; + +template +struct is_convertible +{ + BOOST_DECL_MC(bool, value, false); +}; + +template <> +struct is_convertible +{ + BOOST_DECL_MC(bool, value, true); +}; +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // is_convertible + +} // namespace boost + +#endif // include guard diff --git a/development/include/boost/type_traits/cv_traits.hpp b/development/include/boost/type_traits/cv_traits.hpp new file mode 100644 index 0000000..fe33530 --- /dev/null +++ b/development/include/boost/type_traits/cv_traits.hpp @@ -0,0 +1,214 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & 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. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines traits classes for cv-qualified types: +// is_const, is_volatile, remove_const, remove_volatile, remove_cv. +// + +#ifndef CV_TYPE_TRAITS_HPP +#define CV_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif + +namespace boost{ + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail{ +// +// implementation helper: +// +template +struct cv_traits_imp{}; + +template +struct cv_traits_imp +{ + BOOST_DECL_MC(bool, is_const, false); + BOOST_DECL_MC(bool, is_volatile, false); + typedef T unqualified_type; +}; + +template +struct cv_traits_imp +{ + BOOST_DECL_MC(bool, is_const, true); + BOOST_DECL_MC(bool, is_volatile, false); + typedef T unqualified_type; +}; + +template +struct cv_traits_imp +{ + BOOST_DECL_MC(bool, is_const, false); + BOOST_DECL_MC(bool, is_volatile, true); + typedef T unqualified_type; +}; + +template +struct cv_traits_imp +{ + BOOST_DECL_MC(bool, is_const, true); + BOOST_DECL_MC(bool, is_volatile, true); + typedef T unqualified_type; +}; + +template +struct remove_const_helper +{ + typedef T type; +}; +template +struct remove_const_helper +{ + typedef volatile T type; +}; + +template +struct remove_volatile_helper +{ + typedef T type; +}; +template +struct remove_volatile_helper +{ + typedef const T type; +}; + +} // namespace detail + +// * convert a type T to a non-volatile type - remove_volatile +template +struct remove_volatile +{ + typedef typename detail::cv_traits_imp::unqualified_type uq_type; + typedef typename detail::remove_volatile_helper::value>::type type; +}; +template struct remove_volatile{ typedef T& type; }; + +// * convert a type T to non-const type - remove_const +template +struct remove_const +{ + typedef typename detail::cv_traits_imp::unqualified_type uq_type; + typedef typename detail::remove_const_helper::value>::type type; +}; +template struct remove_const{ typedef T& type; }; + +// convert a type T to a non-cv-qualified type - remove_cv +template +struct remove_cv +{ + typedef typename detail::cv_traits_imp::unqualified_type type; +}; +template struct remove_cv{ typedef T& type; }; + +//* is a type T declared const - is_const +template +struct is_const +{ + BOOST_DECL_MC(bool, value, detail::cv_traits_imp::is_const); +}; + +//* is a type T declared volatile - is_volatile +template +struct is_volatile +{ + BOOST_DECL_MC(bool, value, detail::cv_traits_imp::is_volatile); +}; + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +// The following three don't work: +template struct remove_volatile{ typedef T type; }; +template struct remove_const{ typedef T type; }; +template struct remove_cv{ typedef T type; }; + +namespace detail{ + using ::boost::type_traits::yes_type; + using ::boost::type_traits::no_type; + yes_type is_const_helper(const volatile void*); + no_type is_const_helper(volatile void *); + yes_type is_volatile_helper(const volatile void*); + no_type is_volatile_helper(const void *); +} + +template +struct is_const +{ +private: + static T t; +public: + BOOST_DECL_MC(bool, value, (sizeof(detail::yes_type) == sizeof(detail::is_const_helper(&t)))); +}; + +template <> +struct is_const +{ + BOOST_DECL_MC(bool, value, false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_const +{ + BOOST_DECL_MC(bool, value, true); +}; +template <> +struct is_const +{ + BOOST_DECL_MC(bool, value, false); +}; +template <> +struct is_const +{ + BOOST_DECL_MC(bool, value, true); +}; +#endif + +template +struct is_volatile +{ +private: + static T t; +public: + BOOST_DECL_MC(bool, value, (sizeof(detail::yes_type) == sizeof(detail::is_volatile_helper(&t)))); +}; + +template <> +struct is_volatile +{ + BOOST_DECL_MC(bool, value, false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_volatile +{ + BOOST_DECL_MC(bool, value, false); +}; +template <> +struct is_volatile +{ + BOOST_DECL_MC(bool, value, true); +}; +template <> +struct is_volatile +{ + BOOST_DECL_MC(bool, value, true); +}; +#endif + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +} // namespace boost + + +#endif // CV_TYPE_TRAITS_HPP + + diff --git a/development/include/boost/type_traits/fwd.hpp b/development/include/boost/type_traits/fwd.hpp new file mode 100644 index 0000000..aae5e7f --- /dev/null +++ b/development/include/boost/type_traits/fwd.hpp @@ -0,0 +1,138 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & 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. +// +// See http://www.boost.org for most recent version including documentation. +// +// forward declarations of type_traits classes +// +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#define BOOST_FWD_TYPE_TRAITS_HPP + +#include + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +// +// Helper macros for builtin compiler support. +// If your compiler has builtin support for any of the following +// traits concepts, then redefine the appropriate macros to pick +// up on the compiler support: +// +// (these should largely ignore cv-qualifiers) +// BOOST_IS_CLASS(T) should evaluate to true if T is a class or struct type +// BOOST_IS_ENUM(T) should evaluate to true if T is an enumerator type +// BOOST_IS_UNION(T) should evaluate to true if T is a union type +// BOOST_IS_POD(T) should evaluate to true if T is a POD type +// BOOST_IS_EMPTY(T) should evaluate to true if T is an empty struct or union +// BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect +// BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy +// BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy +// BOOST_HAS_TRIVIAL_DESTRUCTOR(T) should evaluate to true if ~T() has no effect + +#define BOOST_IS_CLASS(T) false +#define BOOST_IS_ENUM(T) false +#define BOOST_IS_UNION(T) false +#define BOOST_IS_POD(T) false +#define BOOST_IS_EMPTY(T) false +#define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false +#define BOOST_HAS_TRIVIAL_COPY(T) false +#define BOOST_HAS_TRIVIAL_ASSIGN(T) false +#define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false + + +namespace boost{ +// +// forward declare all type traits templates here +// +// conversion_traits.hpp: +template +struct is_convertible; +// alignment_traits.hpp: +template +struct alignment_of; +// arithmetic_traits.hpp: +template +struct is_void; +template +struct is_integral; +template +struct is_float; +template +struct is_arithmetic; +template +struct is_fundamental; + +// cv_traits.hpp: +template +struct is_const; +template +struct is_volatile; +template +struct remove_const; +template +struct remove_volatile; +template +struct remove_cv; + +// composite_traits.hpp: +template +struct is_array; +template +struct is_pointer; +template +struct is_reference; +template +struct is_member_pointer; +template +struct is_enum; +template +struct is_union; + +// object_traits.hpp: +template +struct is_object; +template +struct is_scalar; +template +struct is_class; +template +struct is_compound; +template +struct is_POD; +template +struct has_trivial_constructor; +template +struct has_trivial_copy; +template +struct has_trivial_assign; +template +struct has_trivial_destructor; +template +struct is_empty; + +// transform_traits.hpp: +template +struct remove_reference; +template +struct add_reference; +template +struct remove_bounds; +template +struct remove_pointer; + +// same_traits.hpp: +template +struct is_same; + +} // namespace boost + +#endif // BOOST_FWD_TYPE_TRAITS_HPP + + + + diff --git a/development/include/boost/type_traits/ice.hpp b/development/include/boost/type_traits/ice.hpp new file mode 100644 index 0000000..eefe00f --- /dev/null +++ b/development/include/boost/type_traits/ice.hpp @@ -0,0 +1,75 @@ + +// (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. + +// See http://www.boost.org for most recent version including documentation. +// +// macros and helpers for working with integral-constant-expressions. + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#define BOOST_ICE_TYPE_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +#define BOOST_DECL_MC(type, name, value) enum{name = value } +#define BOOST_DECL_MC2(type, name, v1, v2) enum{name = v1,v2 } +#else +#define BOOST_DECL_MC(type, name, value) static const type name = value +#define BOOST_DECL_MC2(type, name, v1, v2) static const type name = v1,v2 +#endif + + +namespace boost{ +namespace type_traits{ + +typedef char yes_type; +typedef double no_type; + +template +struct ice_not +{ BOOST_DECL_MC(bool, value, true); }; +template <> +struct ice_not +{ BOOST_DECL_MC(bool, value, false); }; + +template +struct ice_or; +template +struct ice_or +{ + BOOST_DECL_MC(bool, value, true); +}; +template <> +struct ice_or +{ + BOOST_DECL_MC(bool, value, false); +}; + +template +struct ice_and; +template +struct ice_and +{ + BOOST_DECL_MC(bool, value, false); +}; +template <> +struct ice_and +{ + BOOST_DECL_MC(bool, value, true); +}; + + +} // namespace type_traits + +} // namespace boost + +#endif // BOOST_ICE_TYPE_TRAITS_HPP + + + diff --git a/development/include/boost/type_traits/object_traits.hpp b/development/include/boost/type_traits/object_traits.hpp new file mode 100644 index 0000000..31e353e --- /dev/null +++ b/development/include/boost/type_traits/object_traits.hpp @@ -0,0 +1,313 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & 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. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines object traits classes: +// is_object, is_scalar, is_class, is_compound, is_POD, +// has_trivial_constructor, has_trivial_copy, has_trivial_assign, +// has_trivial_destructor, is_empty. +// + +#ifndef OBJECT_TYPE_TRAITS_HPP +#define OBJECT_TYPE_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#ifndef COMPOSITE_TYPE_TRAITS_HPP +#include +#endif +#ifndef ARITHMETIC_TYPE_TRAITS_HPP +#include +#endif + +namespace boost{ + +/********************************************** + * + * is_object + * + **********************************************/ +template +struct is_object +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_and< + !::boost::is_reference::value, + !::boost::is_void::value + >::value)); +}; + +/********************************************** + * + * is_scalar + * + **********************************************/ +template +struct is_scalar +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_or< + ::boost::is_arithmetic::value, + ::boost::is_enum::value, + ::boost::is_pointer::value, + ::boost::is_member_pointer::value + >::value)); +}; + +/********************************************** + * + * is_class + * + **********************************************/ +template +struct is_class +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_and< + !::boost::is_union::value, + !::boost::is_scalar::value, + !::boost::is_array::value, + !::boost::is_reference::value, + !::boost::is_void::value + >::value)); +}; + +/********************************************** + * + * is_compound + * + **********************************************/ +template struct is_compound +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_or< + ::boost::is_array::value, + ::boost::is_pointer::value, + ::boost::is_reference::value, + ::boost::is_class::value, + ::boost::is_union::value, + ::boost::is_enum::value, + ::boost::is_member_pointer::value + >::value)); +}; + +/********************************************** + * + * is_POD + * + **********************************************/ +template struct is_POD +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_or< + ::boost::is_scalar::value, + BOOST_IS_POD(T) + >::value)); +}; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct is_POD +{ + BOOST_DECL_MC(bool, value, ::boost::is_POD::value); +}; +#endif + +/********************************************** + * + * has_trivial_constructor + * + **********************************************/ +template +struct has_trivial_constructor +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_or< + ::boost::is_POD::value, + BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) + >::value)); +}; + +/********************************************** + * + * has_trivial_copy + * + **********************************************/ +template +struct has_trivial_copy +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::is_POD::value, + BOOST_HAS_TRIVIAL_COPY(T) + >::value, + !::boost::is_volatile::value + >::value)); +}; + +/********************************************** + * + * has_trivial_assign + * + **********************************************/ +template +struct has_trivial_assign +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::is_POD::value, + BOOST_HAS_TRIVIAL_ASSIGN(T) + >::value, + !::boost::is_const::value, + !::boost::is_volatile::value + >::value)); +}; + +/********************************************** + * + * has_trivial_destructor + * + **********************************************/ +template +struct has_trivial_destructor +{ + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_or< + ::boost::is_POD::value, + BOOST_HAS_TRIVIAL_DESTRUCTOR(T) + >::value)); +}; + +/********************************************** + * + * is_empty + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail{ + +template +struct empty_helper_t1 : public T +{ +#ifdef __MWERKS__ + empty_helper_t1(); // hh compiler bug workaround +#endif + int i[256]; +}; +struct empty_helper_t2 { int i[256]; }; + +template +struct empty_helper{ BOOST_DECL_MC(bool, value, false); }; + +template +struct empty_helper +{ + BOOST_DECL_MC(bool, value, + (sizeof(empty_helper_t1) == sizeof(empty_helper_t2))); +}; +} + +template +struct is_empty +{ +private: + typedef typename remove_cv::type cvt; +public: + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_or< + ::boost::detail::empty_helper::value , + ::boost::is_convertible::value + >::value, + BOOST_IS_EMPTY(cvt) + >::value)); +}; + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES) + +namespace detail{ + +template +struct empty_helper_t1 : public T +{ + int i[256]; +}; +struct empty_helper_t2 { int i[256]; }; + +template +struct empty_helper_base +{ + enum{ value = (sizeof(empty_helper_t1) == sizeof(empty_helper_t2)) }; +}; + +template +struct empty_helper_nonbase +{ + enum{ value = false }; +}; + +template +struct empty_helper_chooser +{ + template + struct rebind + { + typedef empty_helper_nonbase type; + }; +}; + +template <> +struct empty_helper_chooser +{ + template + struct rebind + { + typedef empty_helper_base type; + }; +}; + +} // namespace detail + +template +struct is_empty +{ +private: + typedef detail::empty_helper_chooser< + !is_convertible::value + & !is_convertible::value + & !is_pointer::value + & !is_member_pointer::value + & !is_array::value + & !is_convertible::value> chooser; + typedef typename chooser::template rebind bound_type; + typedef typename bound_type::type eh_type; +public: + enum{ value = eh_type::value | BOOST_IS_EMPTY(T) }; +}; + +#else +template struct is_empty +{ enum{ value = BOOST_IS_EMPTY(T) }; }; +#endif // defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES) + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace boost + +#endif // OBJECT_TYPE_TRAITS_HPP + + + + + + diff --git a/development/include/boost/type_traits/same_traits.hpp b/development/include/boost/type_traits/same_traits.hpp new file mode 100644 index 0000000..40daaa1 --- /dev/null +++ b/development/include/boost/type_traits/same_traits.hpp @@ -0,0 +1,89 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & 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. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines is_same: + +#ifndef SAME_TRAITS_HPP +#define SAME_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#if !defined(COMPOSITE_TYPE_TRAITS_HPP) && defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#include +#endif + +namespace boost{ + +/********************************************** + * + * is_same + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +template +struct is_same +{ BOOST_DECL_MC(bool, value, false); }; + +template +struct is_same +{ BOOST_DECL_MC(bool, value, true); }; + +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#ifdef BOOST_MSVC + +namespace detail{ + +template +struct is_same_part_1 { + template struct part_2 { enum { value = false }; }; + template<> struct part_2 { enum { value = true }; }; +}; + +} // namespace detail + +template +struct is_same : detail::is_same_part_1::template part_2 {}; + +#else // BOOST_MSVC + +namespace detail{ + template + ::boost::type_traits::yes_type is_same_helper(T*, T*); + ::boost::type_traits::no_type is_same_helper(...); +} + +template +struct is_same +{ +private: + static T t; + static U u; +public: + BOOST_DECL_MC(bool, value, + (::boost::type_traits::ice_and< + (sizeof(type_traits::yes_type) == sizeof(detail::is_same_helper(&t,&u))), + (::boost::is_reference::value == ::boost::is_reference::value), + (sizeof(T) == sizeof(U)) + >::value)); +}; + +#endif // BOOST_MSVC + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace boost + +#endif // SAME_TRAITS_HPP + + diff --git a/development/include/boost/type_traits/transform_traits.hpp b/development/include/boost/type_traits/transform_traits.hpp new file mode 100644 index 0000000..f77e4bc --- /dev/null +++ b/development/include/boost/type_traits/transform_traits.hpp @@ -0,0 +1,152 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & 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. +// +// See http://www.boost.org for most recent version including documentation. +// +// defines traits classes for transforming one type to another: +// remove_reference, add_reference, remove_bounds, remove_pointer. +// + +#ifndef TRANSFORM_TRAITS_HPP +#define TRANSFORM_TRAITS_HPP + +#ifndef BOOST_ICE_TYPE_TRAITS_HPP +#include +#endif +#ifndef BOOST_FWD_TYPE_TRAITS_HPP +#include +#endif +#if !defined(COMPOSITE_TYPE_TRAITS_HPP) && defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#include +#endif + +namespace boost{ + +/********************************************** + * + * remove_reference + * + **********************************************/ +template +struct remove_reference +{ typedef T type; }; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct remove_reference +{ typedef T type; }; +#endif +#if defined(__BORLANDC__) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +// these are illegal specialisations; cv-qualifies applied to +// references have no effect according to [8.3.2p1], +// C++ Builder requires them though as it treats cv-qualified +// references as distinct types... +template +struct remove_reference +{ typedef T type; }; +template +struct remove_reference +{ typedef T type; }; +template +struct remove_reference +{ typedef T type; }; +#endif + +/********************************************** + * + * add_reference + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct add_reference +{ typedef T& type; }; +template +struct add_reference +{ typedef T& type; }; +#elif defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES) +namespace detail{ + +template +struct reference_adder +{ + template + struct rebind + { + typedef T& type; + }; +}; + +template <> +struct reference_adder +{ + template + struct rebind + { + typedef T type; + }; +}; + +} // namespace detail + +template +struct add_reference +{ +private: + typedef typename detail::reference_adder< ::boost::is_reference::value>::template rebind binder; +public: + typedef typename binder::type type; +}; + +#else +template +struct add_reference +{ typedef T& type; }; +#endif + +/********************************************** + * + * remove_bounds + * + **********************************************/ +template +struct remove_bounds +{ typedef T type; }; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct remove_bounds +{ typedef T type; }; +#endif + +/********************************************** + * + * remove_pointer + * + **********************************************/ +template +struct remove_pointer +{ typedef T type; }; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct remove_pointer +{ typedef T type; }; +template +struct remove_pointer +{ typedef T type; }; +template +struct remove_pointer +{ typedef T type; }; +template +struct remove_pointer +{ typedef T type; }; +#endif + + +} // namespace boost + +#endif // TRANSFORM_TRAITS_HPP + + + diff --git a/development/include/boost/type_traits/type_traits_test.hpp b/development/include/boost/type_traits/type_traits_test.hpp new file mode 100644 index 0000000..93f599f --- /dev/null +++ b/development/include/boost/type_traits/type_traits_test.hpp @@ -0,0 +1,324 @@ +// (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. + +// common test code for type-traits tests +// WARNING: contains code as well as declarations! + + +#ifndef BOOST_TYPE_TRAITS_TEST_HPP +#define BOOST_TYPE_TRAITS_TEST_HPP +#include +#include +// +// define tests here +unsigned failures = 0; +unsigned test_count = 0; +// +// This must get defined within the test file. +// All compilers have bugs, set this to the number of +// regressions *expected* from a given compiler, +// if there are no workarounds for the bugs, *and* +// the regressions have been investigated. +// +extern unsigned int expected_failures; +// +// proc check_result() +// Checks that there were no regressions: +// +int check_result(int argc, char** argv) +{ + std::cout << test_count << " tests completed, " + << failures << " failures found, " + << expected_failures << " failures expected from this compiler." << std::endl; + if((argc == 2) + && (argv[1][0] == '-') + && (argv[1][1] == 'a') + && (argv[1][2] == 0)) + { + std::cout << "Press any key to continue..."; + std::cin.get(); + } + return (failures == expected_failures) ? 0 : failures; +} + + +// +// this one is to verify that a constant is indeed a +// constant-integral-expression: +// +template +struct checker +{ + static void check(bool, bool, const char*){ ++test_count; } +}; + +template <> +struct checker +{ + static void check(bool o, bool n, const char* name) + { + ++test_count; + ++failures; + std::cout << "checking value of " << name << "...failed" << std::endl; + std::cout << "\tfound: " << n << " expected " << o << std::endl; + } +}; + +template +struct type_checker +{ + static void check(const char* TT, const char* TU, const char* expression) + { + ++test_count; +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + if((typeid(T) != typeid(U)) + || (::boost::is_reference::value != ::boost::is_reference::value) + || (::boost::is_const::value != ::boost::is_const::value) + || (::boost::is_volatile::value != ::boost::is_volatile::value)) + { +#endif + ++failures; + std::cout << "checking type of " << expression << "...failed" << std::endl; + std::cout << " expected type was " << TT << std::endl; + std::cout << " typeid(" << TT << ") was: " << typeid(T).name() << std::endl; + std::cout << " typeid(" << TU << ") was: " << typeid(U).name() << std::endl; + std::cout << " In template class " << typeid(type_checker).name() << std::endl; +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + } +#endif + } +}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct type_checker +{ + static void check(const char*, const char*, const char*) + { + ++test_count; + } +}; +#endif + + +#define value_test(v, x) checker<(v == x)>::check(v, x, #x); + +#define value_fail(v, x) \ + ++test_count; \ + ++failures; \ + std::cout << "checking value of " << #x << "...failed" << std::endl; \ + std::cout << " " #x " does not compile on this compiler" << std::endl; + + +#define type_test(v, x) type_checker::check(#v, #x, #x); +#define type_test3(v, x, z) type_checker::check(#v, #x "," #z, #x "," #z); + +template +struct test_align +{ + struct padded + { + char c; + T t; + }; + static void do_it() + { + padded p; + unsigned a = reinterpret_cast(&(p.t)) - reinterpret_cast(&p); + ++test_count; + if(a != boost::alignment_of::value) + { + ++failures; + std::cout << "checking value of " << typeid(boost::alignment_of).name() << "...failed" << std::endl; + std::cout << "\tfound: " << boost::alignment_of::value << " expected " << a << std::endl; + } + } +}; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template +struct test_align +{ + static void do_it() + { + // + // we can't do the usual test because we can't take the address + // of a reference, so check that the result is the same as for a + // pointer type instead: + unsigned a = boost::alignment_of::value; + ++test_count; + if(a != boost::alignment_of::value) + { + ++failures; + std::cout << "checking value of " << typeid(boost::alignment_of).name() << "...failed" << std::endl; + std::cout << "\tfound: " << boost::alignment_of::value << " expected " << a << std::endl; + } + } +}; +#endif + +#define align_test(T) test_align::do_it() + +// +// the following code allows us to test that a particular +// template functions correctly when instanciated inside another template +// (some bugs only show up in that situation). For each template +// we declare one NESTED_DECL(classname) that sets up the template class +// and multiple NESTED_TEST(classname, template-arg) declarations, to carry +// the actual tests: +template +struct nested_test +{ + typedef nested_test type; + bool run_time_value; + const char* what; + nested_test(bool b2, const char* w) : run_time_value(b2), what(w) { check(); } + void check() + { + ++test_count; + if(b != run_time_value) + { + ++failures; + std::cerr << "Mismatch between runtime and compile time values in " << what << std::endl; + } + } +}; + +#define NESTED_DECL(what)\ +template \ +struct BOOST_TT_JOIN(nested_tester_,what){\ + nested_test< (0 != ::boost::what::value)> tester;\ + BOOST_TT_JOIN(nested_tester_,what)(const char* s) : tester(::boost::what::value, s){}\ +}; +#define NESTED_TEST(what, with)\ +{BOOST_TT_JOIN(nested_tester_,what) check(#what "<" #with ">");} + +#define BOOST_TT_JOIN( X, Y ) BOOST_DO_TT_JOIN( X, Y ) +#define BOOST_DO_TT_JOIN( X, Y ) X##Y + + + +// +// define some types to test with: +// +enum enum_UDT{ one, two, three }; +struct UDT +{ + UDT(); + ~UDT(); + UDT(const UDT&); + UDT& operator=(const UDT&); + int i; + + void f1(); + int f2(); + int f3(int); + int f4(int, float); +}; + +typedef void(*f1)(); +typedef int(*f2)(int); +typedef int(*f3)(int, bool); +typedef void (UDT::*mf1)(); +typedef int (UDT::*mf2)(); +typedef int (UDT::*mf3)(int); +typedef int (UDT::*mf4)(int, float); +typedef int (UDT::*mp); + +// cv-qualifiers applied to reference types should have no effect +// declare these here for later use with is_reference and remove_reference: +# ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4181) +# endif // BOOST_MSVC +typedef int& r_type; +typedef const r_type cr_type; +# ifdef BOOST_MSVC +# pragma warning(pop) +# endif // BOOST_MSVC + +struct POD_UDT { int x; }; +struct empty_UDT{ ~empty_UDT(){}; }; +struct empty_POD_UDT{}; +union union_UDT +{ + int x; + double y; + ~union_UDT(); +}; +union POD_union_UDT +{ + int x; + double y; +}; +union empty_union_UDT +{ + ~empty_union_UDT(); +}; +union empty_POD_union_UDT{}; + +class Base { }; + +class Deriverd : public Base { }; + +class NonDerived { }; + +enum enum1 +{ + one_,two_ +}; + +enum enum2 +{ + three_,four_ +}; + +struct VB +{ + virtual ~VB(){}; +}; + +struct VD : VB +{ + ~VD(){}; +}; +// +// struct non_pointer: +// used to verify that is_pointer does not return +// true for class types that implement operator void*() +// +struct non_pointer +{ + operator void*(){return this;} +}; +struct non_int_pointer +{ + int i; + operator int*(){return &i;} +}; +struct int_constructible +{ + int_constructible(int); +}; +struct int_convertible +{ + operator int(); +}; +// +// struct non_empty: +// used to verify that is_empty does not emit +// spurious warnings or errors. +// +struct non_empty : boost::noncopyable +{ + int i; +}; + + + +#endif // BOOST_TYPE_TRAITS_TEST_HPP + + + + diff --git a/development/include/boost/utility.hpp b/development/include/boost/utility.hpp new file mode 100644 index 0000000..82a7d13 --- /dev/null +++ b/development/include/boost/utility.hpp @@ -0,0 +1,96 @@ +// boost utility.hpp header file -------------------------------------------// + +// (C) Copyright boost.org 1999. 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. + +// See http://www.boost.org for most recent version including documentation. + +// Classes appear in alphabetical order + +// Revision History +// 26 Jan 00 protected noncopyable destructor added (Miki Jovanovic) +// 10 Dec 99 next() and prior() templates added (Dave Abrahams) +// 30 Aug 99 moved cast templates to cast.hpp (Beman Dawes) +// 3 Aug 99 cast templates added +// 20 Jul 99 name changed to utility.hpp +// 9 Jun 99 protected noncopyable default ctor +// 2 Jun 99 Initial Version. Class noncopyable only contents (Dave Abrahams) + +#ifndef BOOST_UTILITY_HPP +#define BOOST_UTILITY_HPP + +#include +#include // for size_t +#include // for std::pair + +namespace boost +{ + +// next() and prior() template functions -----------------------------------// + + // Helper functions for classes like bidirectional iterators not supporting + // operator+ and operator-. + // + // Usage: + // const std::list::iterator p = get_some_iterator(); + // const std::list::iterator prev = boost::prior(p); + + // Contributed by Dave Abrahams + + template + T next(T x) { return ++x; } + + template + T prior(T x) { return --x; } + + +// class noncopyable -------------------------------------------------------// + + // Private copy constructor and copy assignment ensure classes derived from + // class noncopyable cannot be copied. + + // Contributed by Dave Abrahams + + class noncopyable + { + protected: + noncopyable(){} + ~noncopyable(){} + private: // emphasize the following members are private + noncopyable( const noncopyable& ); + const noncopyable& operator=( const noncopyable& ); + }; // noncopyable + +// class tied -------------------------------------------------------// + + // A helper for conveniently assigning the two values from a pair + // into separate variables. The idea for this comes from Jaakko J„rvi's + // Binder/Lambda Library. + + // Constributed by Jeremy Siek + + template + class tied { + public: + inline tied(A& a, B& b) : _a(a), _b(b) { } + template + inline tied& operator=(const std::pair& p) { + _a = p.first; + _b = p.second; + return *this; + } + protected: + A& _a; + B& _b; + }; + + template + inline tied tie(A& a, B& b) { return tied(a, b); } + +} // namespace boost + +#endif // BOOST_UTILITY_HPP + diff --git a/development/is_convertible_test.cpp b/development/is_convertible_test.cpp new file mode 100644 index 0000000..da375b2 --- /dev/null +++ b/development/is_convertible_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 +#include "boost/type_traits/type_traits_test.hpp" + + +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)); + value_test(true, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); +#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + value_test(false, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); +#endif + value_test(true, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + + value_test(false, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + 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)); + + value_test(true, (boost::is_convertible::value)); + value_test(false, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + value_test(true, (boost::is_convertible::value)); + + return check_result(argc, argv); +} + +// +// define the number of failures expected for given compilers: +#ifdef __BORLANDC__ +unsigned int expected_failures = 1; +#else +unsigned int expected_failures = 0; +#endif + + + + + + + diff --git a/development/is_same_test.cpp b/development/is_same_test.cpp new file mode 100644 index 0000000..056799a --- /dev/null +++ b/development/is_same_test.cpp @@ -0,0 +1,34 @@ + +// (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 + +#ifdef __BORLANDC__ +#pragma hrdstop +#endif +#include "boost/type_traits/type_traits_test.hpp" + +int main(int argc, char* argv[]) +{ + value_test(true, (::boost::is_same::value)) + value_test(false, (::boost::is_same::value)) + value_test(false, (::boost::is_same::value)) + value_test(false, (::boost::is_same::value)) + value_test(false, (::boost::is_same::value)) + value_test(false, (::boost::is_same::value)) + value_test(false, (::boost::is_same::value)) + value_test(false, (::boost::is_same::value)) + value_test(false, (::boost::is_same::value)) + value_test(false, (::boost::is_same::value)) + + return check_result(argc, argv); +} + +// +// define the number of failures expected for given compilers: +unsigned int expected_failures = 0; + diff --git a/development/iter_swap_example.cpp b/development/iter_swap_example.cpp new file mode 100644 index 0000000..898d0bd --- /dev/null +++ b/development/iter_swap_example.cpp @@ -0,0 +1,110 @@ + +/* + * + * Copyright (c) 1999 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * This file provides some example of type_traits usage - + * by "optimising" various algorithms: + * + * opt::iter_swap - uses type_traits to determine whether the iterator is a proxy + * in which case it uses a "safe" approach, otherwise calls swap + * on the assumption that swap may be specialised for the pointed-to type. + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +using std::cout; +using std::endl; +using std::cin; + +namespace opt{ + +// +// iter_swap: +// tests whether iterator is a proxying iterator or not, and +// uses optimal form accordingly: +// +namespace detail{ + +template +struct swapper +{ + template + static void do_swap(I one, I two) + { + typedef typename std::iterator_traits::value_type v_t; + v_t v = *one; + *one = *two; + *two = v; + } +}; + +#ifdef __GNUC__ +using std::swap; +#endif + +template <> +struct swapper +{ + template + static void do_swap(I one, I two) + { + using std::swap; + swap(*one, *two); + } +}; + +} + +template +inline void iter_swap(I1 one, I2 two) +{ + typedef typename std::iterator_traits::reference r1_t; + typedef typename std::iterator_traits::reference r2_t; + detail::swapper< + ::boost::type_traits::ice_and< + ::boost::is_reference::value, + ::boost::is_reference::value, + ::boost::is_same::value + >::value>::do_swap(one, two); +} + + +}; // namespace opt + +int main() +{ + // + // testing iter_swap + // really just a check that it does in fact compile... + std::vector v1; + v1.push_back(0); + v1.push_back(1); + std::vector v2; + v2.push_back(0); + v2.push_back(1); + opt::iter_swap(v1.begin(), v1.begin()+1); + opt::iter_swap(v2.begin(), v2.begin()+1); + + cout << "Press any key to exit..."; + cin.get(); +} + + diff --git a/development/object_type_traits_test.cpp b/development/object_type_traits_test.cpp new file mode 100644 index 0000000..bcf3fb6 --- /dev/null +++ b/development/object_type_traits_test.cpp @@ -0,0 +1,184 @@ + +// (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 + +#ifdef __BORLANDC__ +#pragma hrdstop +#endif +#include "boost/type_traits/type_traits_test.hpp" + +NESTED_DECL(is_class) +NESTED_DECL(is_object) +NESTED_DECL(is_scalar) +NESTED_DECL(is_compound) +NESTED_DECL(is_POD) + +int main(int argc, char* argv[]) +{ + NESTED_TEST(is_class, int) + NESTED_TEST(is_class, UDT) + NESTED_TEST(is_object, int) + NESTED_TEST(is_object, void) + NESTED_TEST(is_object, UDT) + NESTED_TEST(is_scalar, void) + NESTED_TEST(is_scalar, int) + NESTED_TEST(is_compound, int) + NESTED_TEST(is_compound, UDT) + NESTED_TEST(is_POD, int) + NESTED_TEST(is_POD, UDT) + + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(true, boost::is_class::value) + value_test(true, boost::is_class::value) + value_test(true, boost::is_class::value) + value_test(true, boost::is_class::value) + value_test(true, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + value_test(false, boost::is_class::value) + + value_test(true, boost::is_object::value) + value_test(true, boost::is_object::value) + value_test(false, boost::is_object::value) + value_test(false, boost::is_object::value) + + value_test(true, boost::is_scalar::value) + value_test(true, boost::is_scalar::value) + value_test(false, boost::is_scalar::value) + value_test(false, boost::is_scalar::value) + 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) + + value_test(true, boost::is_POD::value) + value_test(true, boost::is_POD::value) + value_test(false, boost::is_POD::value) + value_test(true, boost::is_POD::value) + value_test(true, boost::is_POD::value) + value_test(true, boost::is_POD::value) + value_test(false, boost::is_POD::value) + value_test(true, boost::is_POD::value) + value_test(true, boost::is_POD::value) + value_test(true, boost::is_POD::value) + value_test(true, boost::is_POD::value) + value_test(true, boost::is_POD::value) + value_test(false, boost::is_POD::value) + value_test(false, boost::is_POD::value) + value_test(true, boost::is_POD::value) + + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(false, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + value_test(true, boost::has_trivial_constructor::value) + + value_test(true, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + // Steve: was 'false' -- should be 'true' via 3.9p3, 3.9p10 + value_test(false, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + value_test(false, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + value_test(true, boost::has_trivial_copy::value) + + value_test(true, boost::has_trivial_assign::value) + value_test(true, boost::has_trivial_assign::value) + value_test(false, boost::has_trivial_assign::value) + value_test(false, boost::has_trivial_assign::value) + // Steve: was 'false' -- should be 'true' via 3.9p3, 3.9p10 + value_test(false, boost::has_trivial_assign::value) + value_test(true, boost::has_trivial_assign::value) + value_test(true, boost::has_trivial_assign::value) + value_test(true, boost::has_trivial_assign::value) + value_test(true, boost::has_trivial_assign::value) + value_test(true, boost::has_trivial_assign::value) + value_test(false, boost::has_trivial_assign::value) + value_test(true, boost::has_trivial_assign::value) + value_test(true, boost::has_trivial_assign::value) + + value_test(true, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + value_test(false, boost::has_trivial_destructor::value) + value_test(false, boost::has_trivial_destructor::value) + value_test(true, boost::has_trivial_destructor::value) + + value_test(false, boost::is_empty::value) + value_test(false, boost::is_empty::value) + value_test(false, boost::is_empty::value) +#if defined(__MWERKS__) + // apparent compiler bug causes this to fail to compile: + value_fail(false, boost::is_empty::value) +#else + value_test(false, boost::is_empty::value) +#endif + value_test(false, boost::is_empty::value) + value_test(false, boost::is_empty::value) + value_test(false, boost::is_empty::value) + value_test(true, boost::is_empty::value) + value_test(true, boost::is_empty::value) + // this one will not compile on most compilers, + // because we can't tell the difference between + // unions and classes: + value_fail(true, boost::is_empty::value) + value_test(false, boost::is_empty::value) + value_test(true, boost::is_empty::value) + value_test(false, boost::is_empty::value) + + return check_result(argc, argv); +} + +// +// define the number of failures expected for given compilers: +#ifdef __BORLANDC__ +// can't handle enum's or classes that are POD's +unsigned int expected_failures = 13; +#elif defined(__GNUC__) +// classes that are POD's, or empty: +unsigned int expected_failures = 7; +#elif defined(BOOST_MSVC) +// can't handle classes that are POD's or arrays that are POD's +unsigned int expected_failures = 19; +#else +unsigned int expected_failures = 0; +#endif + + diff --git a/development/regress.cfg b/development/regress.cfg new file mode 100644 index 0000000..1e16eb4 --- /dev/null +++ b/development/regress.cfg @@ -0,0 +1,14 @@ +run libs/type_traits/alignment_test.cpp +run libs/type_traits/arithmetic_traits_test.cpp +run libs/type_traits/composite_traits_test.cpp +run libs/type_traits/cv_traits_test.cpp +run libs/type_traits/is_convertible_test.cpp +run libs/type_traits/is_same_test.cpp +run libs/type_traits/object_type_traits_test.cpp +run libs/type_traits/transform_traits_test.cpp +compile libs/type_traits/trivial_destructor_example.cpp +compile libs/type_traits/copy_example.cpp +compile libs/type_traits/fill_example.cpp +compile libs/type_traits/iter_swap_example.cpp + + diff --git a/development/regression.out.txt b/development/regression.out.txt new file mode 100644 index 0000000..238e979 --- /dev/null +++ b/development/regression.out.txt @@ -0,0 +1,879 @@ +*** libs/type_traits/alignment_test.cpp *** + +** GCC 2.95.2 +g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/alignment_test.cpp +boosttmp.exe +13 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Borland C++ 5.5.1 +bcc32 -eboosttmp.exe -I../.. -j10 -q ../../libs/type_traits/alignment_test.cpp +../../libs/type_traits/alignment_test.cpp: +boosttmp.exe +13 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Microsoft Visual C++ +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/alignment_test.cpp /link user32.lib +alignment_test.cpp +../../libs/type_traits/alignment_test.cpp(15) : warning C4305: 'argument' : truncation from 'enum ' to 'bool' + ../../libs/type_traits/alignment_test.cpp(15) : while compiling class-template member function '__thiscall nested_tester_alignment_of::nested_tester_alignment_of(const char *)' +LINK : LNK6004: boosttmp.exe not found or not built by the last incremental link; performing full link +boosttmp.exe +10 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Microsoft Visual C++ with STLport +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport//stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/alignment_test.cpp /link /libpath:e:/stlport/lib user32.lib +alignment_test.cpp +../../libs/type_traits/alignment_test.cpp(15) : warning C4305: 'argument' : truncation from 'enum ' to 'bool' + ../../libs/type_traits/alignment_test.cpp(15) : while compiling class-template member function '__thiscall nested_tester_alignment_of::nested_tester_alignment_of(const char *)' +boosttmp.exe +10 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +*** libs/type_traits/arithmetic_traits_test.cpp *** + +** GCC 2.95.2 +g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/arithmetic_traits_test.cpp +boosttmp.exe +111 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Borland C++ 5.5.1 +bcc32 -eboosttmp.exe -I../.. -j10 -q ../../libs/type_traits/arithmetic_traits_test.cpp +../../libs/type_traits/arithmetic_traits_test.cpp: +boosttmp.exe +123 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Microsoft Visual C++ +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/arithmetic_traits_test.cpp /link user32.lib +arithmetic_traits_test.cpp +LINK : LNK6004: boosttmp.exe not found or not built by the last incremental link; performing full link +boosttmp.exe +123 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Microsoft Visual C++ with STLport +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport//stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/arithmetic_traits_test.cpp /link /libpath:e:/stlport/lib user32.lib +arithmetic_traits_test.cpp +boosttmp.exe +123 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +*** libs/type_traits/composite_traits_test.cpp *** + +** GCC 2.95.2 +g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/composite_traits_test.cpp +boosttmp.exe +checking value of boost::is_reference::value...failed + found: 0 expected 1 +65 tests completed, 1 failures found, 1 failures expected from this compiler. +Pass + +** Borland C++ 5.5.1 +bcc32 -eboosttmp.exe -I../.. -j10 -q ../../libs/type_traits/composite_traits_test.cpp +../../libs/type_traits/composite_traits_test.cpp: +boosttmp.exe +checking value of boost::is_pointer::value...failed + found: 1 expected 0 +checking value of boost::is_enum::value...failed + found: 0 expected 1 +65 tests completed, 2 failures found, 2 failures expected from this compiler. +Pass + +** Microsoft Visual C++ +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/composite_traits_test.cpp /link user32.lib +composite_traits_test.cpp +LINK : LNK6004: boosttmp.exe not found or not built by the last incremental link; performing full link +boosttmp.exe +checking value of boost::is_reference::value...failed + found: 0 expected 1 +65 tests completed, 1 failures found, 1 failures expected from this compiler. +Pass + +** Microsoft Visual C++ with STLport +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport//stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/composite_traits_test.cpp /link /libpath:e:/stlport/lib user32.lib +composite_traits_test.cpp +boosttmp.exe +checking value of boost::is_reference::value...failed + found: 0 expected 1 +65 tests completed, 1 failures found, 1 failures expected from this compiler. +Pass + +*** libs/type_traits/cv_traits_test.cpp *** + +** GCC 2.95.2 +g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/cv_traits_test.cpp +boosttmp.exe +18 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Borland C++ 5.5.1 +bcc32 -eboosttmp.exe -I../.. -j10 -q ../../libs/type_traits/cv_traits_test.cpp +../../libs/type_traits/cv_traits_test.cpp: +boosttmp.exe +18 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Microsoft Visual C++ +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/cv_traits_test.cpp /link user32.lib +cv_traits_test.cpp +LINK : LNK6004: boosttmp.exe not found or not built by the last incremental link; performing full link +boosttmp.exe +checking value of boost::is_const::value...failed + found: 0 expected 1 +checking value of boost::is_volatile::value...failed + found: 0 expected 1 +18 tests completed, 2 failures found, 2 failures expected from this compiler. +Pass + +** Microsoft Visual C++ with STLport +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport//stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/cv_traits_test.cpp /link /libpath:e:/stlport/lib user32.lib +cv_traits_test.cpp +boosttmp.exe +checking value of boost::is_const::value...failed + found: 0 expected 1 +checking value of boost::is_volatile::value...failed + found: 0 expected 1 +18 tests completed, 2 failures found, 2 failures expected from this compiler. +Pass + +*** libs/type_traits/is_convertible_test.cpp *** + +** GCC 2.95.2 +g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/is_convertible_test.cpp +boosttmp.exe +37 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Borland C++ 5.5.1 +bcc32 -eboosttmp.exe -I../.. -j10 -q ../../libs/type_traits/is_convertible_test.cpp +../../libs/type_traits/is_convertible_test.cpp: +Error E2396 ../../libs/type_traits/is_convertible_test.cpp 54: Template argument must be a constant expression in function main(int,char * *) +Error E2299 ../../libs/type_traits/is_convertible_test.cpp 54: Cannot generate template specialization from 'checker<(value)>' in function main(int,char * *) +Error E2379 ../../libs/type_traits/is_convertible_test.cpp 54: Statement missing ; in function main(int,char * *) +*** 3 errors in Compile *** +Fail + +** Microsoft Visual C++ +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/is_convertible_test.cpp /link user32.lib +is_convertible_test.cpp +LINK : LNK6004: boosttmp.exe not found or not built by the last incremental link; performing full link +boosttmp.exe +37 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Microsoft Visual C++ with STLport +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport//stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/is_convertible_test.cpp /link /libpath:e:/stlport/lib user32.lib +is_convertible_test.cpp +../..\boost/type_traits/conversion_traits.hpp(57) : warning C4244: 'argument' : conversion from 'float' to 'int', possible loss of data + ../..\boost/type_traits/conversion_traits.hpp(83) : see reference to class template instantiation 'boost::detail::from_not_void_conversion::bind' being compiled + ../../libs/type_traits/is_convertible_test.cpp(21) : see reference to class template instantiation 'boost::is_convertible' being compiled +boosttmp.exe +37 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +*** libs/type_traits/is_same_test.cpp *** + +** GCC 2.95.2 +g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/is_same_test.cpp +boosttmp.exe +10 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Borland C++ 5.5.1 +bcc32 -eboosttmp.exe -I../.. -j10 -q ../../libs/type_traits/is_same_test.cpp +../../libs/type_traits/is_same_test.cpp: +boosttmp.exe +10 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Microsoft Visual C++ +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/is_same_test.cpp /link user32.lib +is_same_test.cpp +LINK : LNK6004: boosttmp.exe not found or not built by the last incremental link; performing full link +boosttmp.exe +10 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +** Microsoft Visual C++ with STLport +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport//stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/is_same_test.cpp /link /libpath:e:/stlport/lib user32.lib +is_same_test.cpp +boosttmp.exe +10 tests completed, 0 failures found, 0 failures expected from this compiler. +Pass + +*** libs/type_traits/object_type_traits_test.cpp *** + +** GCC 2.95.2 +g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/object_type_traits_test.cpp +boosttmp.exe +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::is_empty::value...failed + found: 0 expected 1 +checking value of boost::is_empty::value...failed + found: 0 expected 1 +checking value of boost::is_empty::value...failed + boost::is_empty::value does not compile on this compiler +checking value of boost::is_empty::value...failed + found: 0 expected 1 +122 tests completed, 7 failures found, 7 failures expected from this compiler. +Pass + +** Borland C++ 5.5.1 +bcc32 -eboosttmp.exe -I../.. -j10 -q ../../libs/type_traits/object_type_traits_test.cpp +../../libs/type_traits/object_type_traits_test.cpp: +boosttmp.exe +checking value of boost::is_class::value...failed + found: 1 expected 0 +checking value of boost::is_POD::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_destructor::value...failed + found: 0 expected 1 +checking value of boost::is_empty::value...failed + found: 0 expected 1 +checking value of boost::is_empty::value...failed + found: 0 expected 1 +checking value of boost::is_empty::value...failed + boost::is_empty::value does not compile on this compiler +checking value of boost::is_empty::value...failed + found: 0 expected 1 +122 tests completed, 13 failures found, 13 failures expected from this compiler. +Pass + +** Microsoft Visual C++ +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/object_type_traits_test.cpp /link user32.lib +object_type_traits_test.cpp +LINK : LNK6004: boosttmp.exe not found or not built by the last incremental link; performing full link +boosttmp.exe +checking value of boost::is_POD::value...failed + found: 0 expected 1 +checking value of boost::is_POD::value...failed + found: 0 expected 1 +checking value of boost::is_POD::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_destructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_destructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_destructor::value...failed + found: 0 expected 1 +checking value of boost::is_empty::value...failed + boost::is_empty::value does not compile on this compiler +122 tests completed, 19 failures found, 19 failures expected from this compiler. +Pass + +** Microsoft Visual C++ with STLport +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport//stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/object_type_traits_test.cpp /link /libpath:e:/stlport/lib user32.lib +object_type_traits_test.cpp +boosttmp.exe +checking value of boost::is_POD::value...failed + found: 0 expected 1 +checking value of boost::is_POD::value...failed + found: 0 expected 1 +checking value of boost::is_POD::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_constructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_copy::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_assign::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_destructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_destructor::value...failed + found: 0 expected 1 +checking value of boost::has_trivial_destructor::value...failed + found: 0 expected 1 +checking value of boost::is_empty::value...failed + boost::is_empty::value does not compile on this compiler +122 tests completed, 19 failures found, 19 failures expected from this compiler. +Pass + +*** libs/type_traits/transform_traits_test.cpp *** + +** GCC 2.95.2 +g++ -o boosttmp.exe -ftemplate-depth-30 -I../.. ../../libs/type_traits/transform_traits_test.cpp +boosttmp.exe +checking type of boost::remove_reference::type...failed + expected type was int + typeid(int) was: i + typeid(boost::remove_reference::type) was: i + In template class t12type_checker2ZiZCRi +39 tests completed, 1 failures found, 1 failures expected from this compiler. +Pass + +** Borland C++ 5.5.1 +bcc32 -eboosttmp.exe -I../.. -j10 -q ../../libs/type_traits/transform_traits_test.cpp +../../libs/type_traits/transform_traits_test.cpp: +boosttmp.exe +checking type of boost::remove_const::type...failed + expected type was volatile int + typeid(volatile int) was: int + typeid(boost::remove_const::type) was: int + In template class type_checker +checking type of boost::remove_const::type...failed + expected type was volatile int + typeid(volatile int) was: int + typeid(boost::remove_const::type) was: int + In template class type_checker +checking type of boost::remove_volatile::type...failed + expected type was const int + typeid(const int) was: int + typeid(boost::remove_volatile::type) was: int + In template class type_checker +checking type of boost::remove_volatile::type...failed + expected type was const int + typeid(const int) was: int + typeid(boost::remove_volatile::type) was: int + In template class type_checker +39 tests completed, 4 failures found, 4 failures expected from this compiler. +Pass + +** Microsoft Visual C++ +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/transform_traits_test.cpp /link user32.lib +transform_traits_test.cpp +LINK : LNK6004: boosttmp.exe not found or not built by the last incremental link; performing full link +boosttmp.exe +checking type of boost::remove_const::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_const::type) was: int + In template class struct type_checker +checking type of boost::remove_const::type...failed + expected type was volatile int + typeid(volatile int) was: int + typeid(boost::remove_const::type) was: int + In template class struct type_checker +checking type of boost::remove_const::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_const::type) was: int * + In template class struct type_checker +checking type of boost::remove_volatile::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_volatile::type) was: int + In template class struct type_checker +checking type of boost::remove_volatile::type...failed + expected type was const int + typeid(const int) was: int + typeid(boost::remove_volatile::type) was: int + In template class struct type_checker +checking type of boost::remove_volatile::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_volatile::type) was: int * + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_cv::type) was: int + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_cv::type) was: int + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_cv::type) was: int + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_cv::type) was: int * + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_cv::type) was: int * + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_cv::type) was: int * + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was const int * + typeid(const int *) was: int const * + typeid(boost::remove_cv::type) was: int const * + In template class struct type_checker +checking type of boost::remove_reference::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_reference::type) was: int & + In template class struct type_checker +checking type of boost::remove_reference::type...failed + expected type was const int + typeid(const int) was: int + typeid(boost::remove_reference::type) was: int const & + In template class struct type_checker +checking type of boost::remove_reference::type...failed + expected type was volatile int + typeid(volatile int) was: int + typeid(boost::remove_reference::type) was: int volatile & + In template class struct type_checker +checking type of boost::remove_reference::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_reference::type) was: int & + In template class struct type_checker +checking type of boost::remove_bounds::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_bounds::type) was: int [3] + In template class struct type_checker +checking type of boost::remove_bounds::type...failed + expected type was int[3] + typeid(int[3]) was: int [3] + typeid(boost::remove_bounds::type) was: int [2][3] + In template class struct type_checker +checking type of boost::remove_pointer::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_pointer::type) was: int * + In template class struct type_checker +checking type of boost::remove_pointer::type...failed + expected type was const int + typeid(const int) was: int + typeid(boost::remove_pointer::type) was: int const * + In template class struct type_checker +checking type of boost::remove_pointer::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_pointer::type) was: int * + In template class struct type_checker +checking type of boost::remove_pointer::type...failed + expected type was volatile int + typeid(volatile int) was: int + typeid(boost::remove_pointer::type) was: int volatile * + In template class struct type_checker +39 tests completed, 23 failures found, 0 failures expected from this compiler. +Fail + +** Microsoft Visual C++ with STLport +cl /Feboosttmp.exe /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport//stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/transform_traits_test.cpp /link /libpath:e:/stlport/lib user32.lib +transform_traits_test.cpp +boosttmp.exe +checking type of boost::remove_const::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_const::type) was: int + In template class struct type_checker +checking type of boost::remove_const::type...failed + expected type was volatile int + typeid(volatile int) was: int + typeid(boost::remove_const::type) was: int + In template class struct type_checker +checking type of boost::remove_const::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_const::type) was: int * + In template class struct type_checker +checking type of boost::remove_volatile::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_volatile::type) was: int + In template class struct type_checker +checking type of boost::remove_volatile::type...failed + expected type was const int + typeid(const int) was: int + typeid(boost::remove_volatile::type) was: int + In template class struct type_checker +checking type of boost::remove_volatile::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_volatile::type) was: int * + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_cv::type) was: int + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_cv::type) was: int + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_cv::type) was: int + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_cv::type) was: int * + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_cv::type) was: int * + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was int* + typeid(int*) was: int * + typeid(boost::remove_cv::type) was: int * + In template class struct type_checker +checking type of boost::remove_cv::type...failed + expected type was const int * + typeid(const int *) was: int const * + typeid(boost::remove_cv::type) was: int const * + In template class struct type_checker +checking type of boost::remove_reference::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_reference::type) was: int & + In template class struct type_checker +checking type of boost::remove_reference::type...failed + expected type was const int + typeid(const int) was: int + typeid(boost::remove_reference::type) was: int const & + In template class struct type_checker +checking type of boost::remove_reference::type...failed + expected type was volatile int + typeid(volatile int) was: int + typeid(boost::remove_reference::type) was: int volatile & + In template class struct type_checker +checking type of boost::remove_reference::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_reference::type) was: int & + In template class struct type_checker +checking type of boost::remove_bounds::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_bounds::type) was: int [3] + In template class struct type_checker +checking type of boost::remove_bounds::type...failed + expected type was int[3] + typeid(int[3]) was: int [3] + typeid(boost::remove_bounds::type) was: int [2][3] + In template class struct type_checker +checking type of boost::remove_pointer::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_pointer::type) was: int * + In template class struct type_checker +checking type of boost::remove_pointer::type...failed + expected type was const int + typeid(const int) was: int + typeid(boost::remove_pointer::type) was: int const * + In template class struct type_checker +checking type of boost::remove_pointer::type...failed + expected type was int + typeid(int) was: int + typeid(boost::remove_pointer::type) was: int * + In template class struct type_checker +checking type of boost::remove_pointer::type...failed + expected type was volatile int + typeid(volatile int) was: int + typeid(boost::remove_pointer::type) was: int volatile * + In template class struct type_checker +39 tests completed, 23 failures found, 0 failures expected from this compiler. +Fail + +*** libs/type_traits/trivial_destructor_example.cpp *** + +** GCC 2.95.2 +g++ -c -ftemplate-depth-30 -I../.. ../../libs/type_traits/trivial_destructor_example.cpp +Pass + +** Borland C++ 5.5.1 +bcc32 -c -I../.. -j10 -q ../../libs/type_traits/trivial_destructor_example.cpp +../../libs/type_traits/trivial_destructor_example.cpp: +Warning W8027 ../..\boost/smart_ptr.hpp 124: Functions containing try are not expanded inline +Warning W8027 ../..\boost/smart_ptr.hpp 195: Functions containing try are not expanded inline +Warning W8027 ../..\boost/smart_ptr.hpp 265: Functions containing try are not expanded inline +Warning W8027 ../..\boost/smart_ptr.hpp 287: Functions containing try are not expanded inline +Pass + +** Microsoft Visual C++ +cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/trivial_destructor_example.cpp +trivial_destructor_example.cpp +Pass + +** Microsoft Visual C++ with STLport +cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport/stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/trivial_destructor_example.cpp +trivial_destructor_example.cpp +Pass + +*** libs/type_traits/copy_example.cpp *** + +** GCC 2.95.2 +g++ -c -ftemplate-depth-30 -I../.. ../../libs/type_traits/copy_example.cpp +Pass + +** Borland C++ 5.5.1 +bcc32 -c -I../.. -j10 -q ../../libs/type_traits/copy_example.cpp +../../libs/type_traits/copy_example.cpp: +Warning W8027 ../..\boost/smart_ptr.hpp 124: Functions containing try are not expanded inline +Warning W8027 ../..\boost/smart_ptr.hpp 195: Functions containing try are not expanded inline +Warning W8027 ../..\boost/smart_ptr.hpp 265: Functions containing try are not expanded inline +Warning W8027 ../..\boost/smart_ptr.hpp 287: Functions containing try are not expanded inline +Pass + +** Microsoft Visual C++ +cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/copy_example.cpp +copy_example.cpp +Pass + +** Microsoft Visual C++ with STLport +cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport/stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/copy_example.cpp +copy_example.cpp +Pass + +*** libs/type_traits/fill_example.cpp *** + +** GCC 2.95.2 +g++ -c -ftemplate-depth-30 -I../.. ../../libs/type_traits/fill_example.cpp +Pass + +** Borland C++ 5.5.1 +bcc32 -c -I../.. -j10 -q ../../libs/type_traits/fill_example.cpp +../../libs/type_traits/fill_example.cpp: +Warning W8027 ../..\boost/smart_ptr.hpp 124: Functions containing try are not expanded inline +Warning W8027 ../..\boost/smart_ptr.hpp 195: Functions containing try are not expanded inline +Warning W8027 ../..\boost/smart_ptr.hpp 265: Functions containing try are not expanded inline +Warning W8027 ../..\boost/smart_ptr.hpp 287: Functions containing try are not expanded inline +Pass + +** Microsoft Visual C++ +cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/fill_example.cpp +fill_example.cpp +Pass + +** Microsoft Visual C++ with STLport +cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport/stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/fill_example.cpp +fill_example.cpp +Pass + +*** libs/type_traits/iter_swap_example.cpp *** + +** GCC 2.95.2 +g++ -c -ftemplate-depth-30 -I../.. ../../libs/type_traits/iter_swap_example.cpp +Pass + +** Borland C++ 5.5.1 +bcc32 -c -I../.. -j10 -q ../../libs/type_traits/iter_swap_example.cpp +../../libs/type_traits/iter_swap_example.cpp: +Pass + +** Microsoft Visual C++ +cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/iter_swap_example.cpp +iter_swap_example.cpp +../../libs/type_traits/iter_swap_example.cpp(108) : warning C4508: 'main' : function should return a value; 'void' return type assumed +e:\VS98\INCLUDE\utility(81) : error C2039: 'iterator_category' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:\VS98\INCLUDE\utility(81) : error C2146: syntax error : missing ';' before identifier 'iterator_category' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:\VS98\INCLUDE\utility(81) : error C2868: 'iterator_category' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:\VS98\INCLUDE\utility(82) : error C2039: 'value_type' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:\VS98\INCLUDE\utility(82) : error C2146: syntax error : missing ';' before identifier 'value_type' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:\VS98\INCLUDE\utility(82) : error C2868: 'value_type' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:\VS98\INCLUDE\utility(83) : error C2039: 'distance_type' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:\VS98\INCLUDE\utility(83) : error C2146: syntax error : missing ';' before identifier 'distance_type' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:\VS98\INCLUDE\utility(83) : error C2868: 'distance_type' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(79) : error C2039: 'reference' : is not a member of 'iterator_traits' + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(79) : error C2146: syntax error : missing ';' before identifier 'r1_t' + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(79) : error C2065: 'r1_t' : undeclared identifier + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(80) : error C2039: 'reference' : is not a member of 'iterator_traits' + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(83) : error C2955: 'is_reference' : use of class template requires template argument list + ../..\boost/type_traits/composite_traits.hpp(209) : see declaration of 'is_reference' + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(84) : error C2027: use of undefined type 'is_reference' + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(84) : error C2065: 'value' : undeclared identifier + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(85) : error C2955: 'is_same' : use of class template requires template argument list + ../..\boost/type_traits/same_traits.hpp(56) : see declaration of 'is_same' + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(86) : error C2039: 'value' : is not a member of 'is_same' + ../..\boost/type_traits/same_traits.hpp(56) : see declaration of 'is_same' + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(86) : error C2955: 'ice_and' : use of class template requires template argument list + ../..\boost/type_traits/ice.hpp(60) : see declaration of 'ice_and' + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:\VS98\INCLUDE\utility(81) : error C2039: 'iterator_category' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +e:\VS98\INCLUDE\utility(81) : error C2146: syntax error : missing ';' before identifier 'iterator_category' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +e:\VS98\INCLUDE\utility(81) : error C2868: 'iterator_category' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +e:\VS98\INCLUDE\utility(82) : error C2039: 'value_type' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +e:\VS98\INCLUDE\utility(82) : error C2146: syntax error : missing ';' before identifier 'value_type' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +e:\VS98\INCLUDE\utility(82) : error C2868: 'value_type' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +e:\VS98\INCLUDE\utility(83) : error C2039: 'distance_type' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +e:\VS98\INCLUDE\utility(83) : error C2146: syntax error : missing ';' before identifier 'distance_type' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +e:\VS98\INCLUDE\utility(83) : error C2868: 'distance_type' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation 'std::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(79) : error C2039: 'reference' : is not a member of 'iterator_traits' + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(79) : error C2146: syntax error : missing ';' before identifier 'r1_t' + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(80) : error C2039: 'reference' : is not a member of 'iterator_traits' + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(83) : error C2955: 'is_reference' : use of class template requires template argument list + ../..\boost/type_traits/composite_traits.hpp(209) : see declaration of 'is_reference' + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(84) : error C2027: use of undefined type 'is_reference' + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(85) : error C2955: 'is_same' : use of class template requires template argument list + ../..\boost/type_traits/same_traits.hpp(56) : see declaration of 'is_same' + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(86) : error C2039: 'value' : is not a member of 'is_same' + ../..\boost/type_traits/same_traits.hpp(56) : see declaration of 'is_same' + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +../../libs/type_traits/iter_swap_example.cpp(86) : error C2955: 'ice_and' : use of class template requires template argument list + ../..\boost/type_traits/ice.hpp(60) : see declaration of 'ice_and' + ../../libs/type_traits/iter_swap_example.cpp(104) : see reference to function template instantiation 'void __cdecl opt::iter_swap(bool *,bool *)' being compiled +Fail + +** Microsoft Visual C++ with STLport +cl /c /nologo /Zm400 /MDd /W3 /GR /GX /Zi /Od /GZ /I "e:/stlport/stlport" /I "../.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_CONSOLE" ../../libs/type_traits/iter_swap_example.cpp +iter_swap_example.cpp +../../libs/type_traits/iter_swap_example.cpp(108) : warning C4508: 'main' : function should return a value; 'void' return type assumed +e:/stlport/stlport\stl/_iterator_base.h(103) : error C2039: 'iterator_category' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(103) : error C2146: syntax error : missing ';' before identifier 'iterator_category' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(103) : error C2868: 'iterator_category' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(104) : error C2039: 'value_type' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(104) : error C2146: syntax error : missing ';' before identifier 'value_type' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(104) : error C2868: 'value_type' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(105) : error C2039: 'difference_type' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(105) : error C2146: syntax error : missing ';' before identifier 'difference_type' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(105) : error C2868: 'difference_type' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(106) : error C2039: 'pointer' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(106) : error C2146: syntax error : missing ';' before identifier 'pointer' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(106) : error C2868: 'pointer' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(107) : error C2039: 'reference' : is not a member of '`global namespace'' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(107) : error C2146: syntax error : missing ';' before identifier 'reference' + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +e:/stlport/stlport\stl/_iterator_base.h(107) : error C2868: 'reference' : illegal syntax for using-declaration; expected qualified-name + ../../libs/type_traits/iter_swap_example.cpp(79) : see reference to class template instantiation '_STL::iterator_traits' being compiled + ../../libs/type_traits/iter_swap_example.cpp(103) : see reference to function template instantiation 'void __cdecl opt::iter_swap(int *,int *)' being compiled +Fail + diff --git a/development/transform_traits_test.cpp b/development/transform_traits_test.cpp new file mode 100644 index 0000000..48b7884 --- /dev/null +++ b/development/transform_traits_test.cpp @@ -0,0 +1,78 @@ + +// (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 +#include + +#ifdef __BORLANDC__ +#pragma hrdstop +#endif +#include "boost/type_traits/type_traits_test.hpp" + + +int main(int argc, char* argv[]) +{ + type_test(int, boost::remove_const::type) + type_test(volatile int, boost::remove_const::type) + type_test(volatile int, boost::remove_const::type) + type_test(int, boost::remove_const::type) + type_test(int*, boost::remove_const::type) + type_test(int, boost::remove_volatile::type) + type_test(const int, boost::remove_volatile::type) + type_test(const int, boost::remove_volatile::type) + type_test(int, boost::remove_volatile::type) + type_test(int*, boost::remove_volatile::type) + type_test(int, boost::remove_cv::type) + type_test(int, boost::remove_cv::type) + type_test(int, boost::remove_cv::type) + type_test(int, boost::remove_cv::type) + type_test(int*, boost::remove_cv::type) + type_test(int*, boost::remove_cv::type) + type_test(int*, boost::remove_cv::type) + type_test(const int *, boost::remove_cv::type) + + type_test(int, boost::remove_reference::type) + type_test(const int, boost::remove_reference::type) + type_test(int, boost::remove_reference::type) + type_test(const int, boost::remove_reference::type) + type_test(volatile int, boost::remove_reference::type) + type_test(int, boost::remove_reference::type) + + type_test(int, boost::remove_bounds::type) + type_test(int*, boost::remove_bounds::type) + type_test(int, boost::remove_bounds::type) + type_test(int[3], boost::remove_bounds::type) + + type_test(int, boost::remove_pointer::type) + type_test(int, boost::remove_pointer::type) + type_test(const int, boost::remove_pointer::type) + type_test(int, boost::remove_pointer::type) + type_test(volatile int, boost::remove_pointer::type) + type_test(int[3], boost::remove_pointer::type) + type_test(int[2][3], boost::remove_pointer::type) + + type_test(int&, boost::add_reference::type) + type_test(const int&, boost::add_reference::type) +#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES) + type_test(int&, boost::add_reference::type) + type_test(const int&, boost::add_reference::type) +#endif + + return check_result(argc, argv); +} + +// +// define the number of failures expected for given compilers: +#ifdef __BORLANDC__ +unsigned int expected_failures = 4; // cv-qualifiers +#elif defined(__GNUC__) +unsigned int expected_failures = 1; // cv-qualified references +#else +unsigned int expected_failures = 0; +#endif + + diff --git a/development/trivial_destructor_example.cpp b/development/trivial_destructor_example.cpp new file mode 100644 index 0000000..5bdcea4 --- /dev/null +++ b/development/trivial_destructor_example.cpp @@ -0,0 +1,165 @@ + +/* + * + * Copyright (c) 1999 + * Dr John Maddock + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Dr John Maddock makes no representations + * about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * This file provides some example of type_traits usage - + * by "optimising" various algorithms: + * + * opt::destroy_array - an example of optimisation based upon omitted destructor calls + * + */ + + +#include + +#include +#include + +using std::cout; +using std::endl; +using std::cin; + +namespace opt{ + +// +// algorithm destroy_array: +// The reverse of std::unitialized_copy, takes a block of +// unitialized memory and calls destructors on all objects therein. +// + +namespace detail{ + +template +struct array_destroyer +{ + template + static void destroy_array(T* i, T* j){ do_destroy_array(i, j); } +}; + +template <> +struct array_destroyer +{ + template + static void destroy_array(T*, T*){} +}; + +template +void do_destroy_array(T* first, T* last) +{ + while(first != last) + { + first->~T(); + ++first; + } +} + +}; // namespace detail + +template +inline void destroy_array(T* p1, T* p2) +{ + detail::array_destroyer::value>::destroy_array(p1, p2); +} + +// +// unoptimised versions of destroy_array: +// +template +void destroy_array1(T* first, T* last) +{ + while(first != last) + { + first->~T(); + ++first; + } +} +template +void destroy_array2(T* first, T* last) +{ + for(; first != last; ++first) first->~T(); +} + +} // namespace opt + +// +// define some global data: +// +const int array_size = 1000; +int i_array[array_size] = {0,}; +const int ci_array[array_size] = {0,}; +char c_array[array_size] = {0,}; +const char cc_array[array_size] = { 0,}; + +const int iter_count = 1000000; + + +int main() +{ + boost::timer t; + double result; + int i; + // + // test destroy_array, + // compare destruction time of an array of ints + // with unoptimised form. + // + cout << "Measuring times in micro-seconds per 1000 elements processed" << endl << endl; + cout << "testing destroy_array...\n" + "[Some compilers may be able to optimise the \"unoptimised\"\n versions as well as type_traits does.]" << endl; + + // cache load: + opt::destroy_array(i_array, i_array + array_size); + + // time optimised version: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + opt::destroy_array(i_array, i_array + array_size); + } + result = t.elapsed(); + cout << "destroy_array: " << result << endl; + + // cache load: + opt::destroy_array1(i_array, i_array + array_size); + + // time unoptimised version #1: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + opt::destroy_array1(i_array, i_array + array_size); + } + result = t.elapsed(); + cout << "destroy_array(unoptimised#1): " << result << endl; + + // cache load: + opt::destroy_array2(i_array, i_array + array_size); + + // time unoptimised version #2: + t.restart(); + for(i = 0; i < iter_count; ++i) + { + opt::destroy_array2(i_array, i_array + array_size); + } + result = t.elapsed(); + cout << "destroy_array(unoptimised#2): " << result << endl << endl; + + return 0; +} + + + + + + + +