Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68555 - in sandbox/type_traits: boost/type_traits libs/type_traits/test
From: frederic.bron_at_[hidden]
Date: 2011-01-30 02:40:00


Author: bronf
Date: 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
New Revision: 68555
URL: http://svn.boost.org/trac/boost/changeset/68555

Log:
added support for pointer types for prefix and postfix unary operator traits
Added:
   sandbox/type_traits/libs/type_traits/test/has_postfix_increment_operator_test.hpp
      - copied, changed from r68546, /sandbox/type_traits/libs/type_traits/test/has_postfix_operator_test.hpp
   sandbox/type_traits/libs/type_traits/test/has_prefix_increment_operator_test.hpp (contents, props changed)
   sandbox/type_traits/libs/type_traits/test/has_prefix_minus_operator_test.hpp
      - copied, changed from r68546, /sandbox/type_traits/libs/type_traits/test/has_prefix_operator_test.hpp
   sandbox/type_traits/libs/type_traits/test/has_prefix_plus_not_operator_test.hpp (contents, props changed)
Removed:
   sandbox/type_traits/libs/type_traits/test/has_postfix_operator_test.hpp
   sandbox/type_traits/libs/type_traits/test/has_prefix_operator_test.hpp
Text files modified:
   sandbox/type_traits/boost/type_traits/has_operator_postfix_decrement.hpp | 8 +++++++-
   sandbox/type_traits/boost/type_traits/has_operator_postfix_increment.hpp | 5 ++++-
   sandbox/type_traits/boost/type_traits/has_operator_prefix_decrement.hpp | 8 +++++++-
   sandbox/type_traits/boost/type_traits/has_operator_prefix_increment.hpp | 5 ++++-
   sandbox/type_traits/boost/type_traits/has_operator_unary_minus.hpp | 4 +++-
   sandbox/type_traits/libs/type_traits/test/has_operator_logical_not_test.cpp | 2 +-
   sandbox/type_traits/libs/type_traits/test/has_operator_postfix_increment_test.cpp | 2 +-
   sandbox/type_traits/libs/type_traits/test/has_operator_prefix_increment_test.cpp | 2 +-
   sandbox/type_traits/libs/type_traits/test/has_operator_unary_minus_test.cpp | 2 +-
   sandbox/type_traits/libs/type_traits/test/has_operator_unary_plus_test.cpp | 2 +-
   sandbox/type_traits/libs/type_traits/test/has_postfix_decrement_operator_test.hpp | 9 +++++++++
   sandbox/type_traits/libs/type_traits/test/has_postfix_increment_operator_test.hpp | 9 +++++++++
   sandbox/type_traits/libs/type_traits/test/has_prefix_decrement_operator_test.hpp | 9 +++++++++
   sandbox/type_traits/libs/type_traits/test/has_prefix_minus_operator_test.hpp | 9 +++++++++
   14 files changed, 66 insertions(+), 10 deletions(-)

Modified: sandbox/type_traits/boost/type_traits/has_operator_postfix_decrement.hpp
==============================================================================
--- sandbox/type_traits/boost/type_traits/has_operator_postfix_decrement.hpp (original)
+++ sandbox/type_traits/boost/type_traits/has_operator_postfix_decrement.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -13,7 +13,13 @@
 #define BOOST_TT_TRAIT_OP --
 #define BOOST_TT_DEFAULT_RET void
 #define BOOST_TT_FORBIDDEN_IF\
- boost::is_same< bool, typename boost::remove_cv< typename boost::remove_reference<LHS>::type >::type >::value
+ /* bool or void* */\
+ boost::is_same< bool, typename boost::remove_cv< typename boost::remove_reference<LHS>::type >::type >::value\
+ or\
+ (\
+ boost::is_pointer< typename boost::remove_reference<LHS>::type >::value and\
+ boost::is_void< typename boost::remove_pointer<LHS>::type >::value\
+ )
 
 
 #include <boost/type_traits/detail/has_postfix_operator.hpp>

Modified: sandbox/type_traits/boost/type_traits/has_operator_postfix_increment.hpp
==============================================================================
--- sandbox/type_traits/boost/type_traits/has_operator_postfix_increment.hpp (original)
+++ sandbox/type_traits/boost/type_traits/has_operator_postfix_increment.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -13,7 +13,10 @@
 #define BOOST_TT_TRAIT_OP ++
 #define BOOST_TT_DEFAULT_RET void
 #define BOOST_TT_FORBIDDEN_IF\
- false
+ /* void* */\
+ boost::is_pointer< typename boost::remove_reference<LHS>::type >::value and\
+ boost::is_void< typename boost::remove_pointer<LHS>::type >::value
+
 
 #include <boost/type_traits/detail/has_postfix_operator.hpp>
 

Modified: sandbox/type_traits/boost/type_traits/has_operator_prefix_decrement.hpp
==============================================================================
--- sandbox/type_traits/boost/type_traits/has_operator_prefix_decrement.hpp (original)
+++ sandbox/type_traits/boost/type_traits/has_operator_prefix_decrement.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -13,7 +13,13 @@
 #define BOOST_TT_TRAIT_OP --
 #define BOOST_TT_DEFAULT_RET void
 #define BOOST_TT_FORBIDDEN_IF\
- boost::is_same< bool, typename boost::remove_cv< typename boost::remove_reference<RHS>::type >::type >::value
+ /* bool or void* */\
+ boost::is_same< bool, typename boost::remove_cv< typename boost::remove_reference<RHS>::type >::type >::value\
+ or\
+ (\
+ boost::is_pointer< typename boost::remove_reference<RHS>::type >::value and\
+ boost::is_void< typename boost::remove_pointer<RHS>::type >::value\
+ )
 
 
 #include <boost/type_traits/detail/has_prefix_operator.hpp>

Modified: sandbox/type_traits/boost/type_traits/has_operator_prefix_increment.hpp
==============================================================================
--- sandbox/type_traits/boost/type_traits/has_operator_prefix_increment.hpp (original)
+++ sandbox/type_traits/boost/type_traits/has_operator_prefix_increment.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -13,7 +13,10 @@
 #define BOOST_TT_TRAIT_OP ++
 #define BOOST_TT_DEFAULT_RET void
 #define BOOST_TT_FORBIDDEN_IF\
- false
+ /* void* */\
+ boost::is_pointer< typename boost::remove_reference<RHS>::type >::value and\
+ boost::is_void< typename boost::remove_pointer<RHS>::type >::value
+
 
 #include <boost/type_traits/detail/has_prefix_operator.hpp>
 

Modified: sandbox/type_traits/boost/type_traits/has_operator_unary_minus.hpp
==============================================================================
--- sandbox/type_traits/boost/type_traits/has_operator_unary_minus.hpp (original)
+++ sandbox/type_traits/boost/type_traits/has_operator_unary_minus.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -13,7 +13,9 @@
 #define BOOST_TT_TRAIT_OP -
 #define BOOST_TT_DEFAULT_RET void
 #define BOOST_TT_FORBIDDEN_IF\
- false
+ /* pointer */\
+ boost::is_pointer< typename boost::remove_reference<RHS>::type >::value
+
 
 #include <boost/type_traits/detail/has_prefix_operator.hpp>
 

Modified: sandbox/type_traits/libs/type_traits/test/has_operator_logical_not_test.cpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_operator_logical_not_test.cpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_operator_logical_not_test.cpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -15,4 +15,4 @@
 #define BOOST_TT_TRAIT_NAME has_operator_logical_not
 #define BOOST_TT_TRAIT_OP !
 
-#include "has_prefix_operator_test.hpp"
+#include "has_prefix_plus_not_operator_test.hpp"

Modified: sandbox/type_traits/libs/type_traits/test/has_operator_postfix_increment_test.cpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_operator_postfix_increment_test.cpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_operator_postfix_increment_test.cpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -15,4 +15,4 @@
 #define BOOST_TT_TRAIT_NAME has_operator_postfix_increment
 #define BOOST_TT_TRAIT_OP ++
 
-#include "has_postfix_operator_test.hpp"
+#include "has_postfix_increment_operator_test.hpp"

Modified: sandbox/type_traits/libs/type_traits/test/has_operator_prefix_increment_test.cpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_operator_prefix_increment_test.cpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_operator_prefix_increment_test.cpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -15,4 +15,4 @@
 #define BOOST_TT_TRAIT_NAME has_operator_prefix_increment
 #define BOOST_TT_TRAIT_OP ++
 
-#include "has_prefix_operator_test.hpp"
+#include "has_prefix_increment_operator_test.hpp"

Modified: sandbox/type_traits/libs/type_traits/test/has_operator_unary_minus_test.cpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_operator_unary_minus_test.cpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_operator_unary_minus_test.cpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -15,4 +15,4 @@
 #define BOOST_TT_TRAIT_NAME has_operator_unary_minus
 #define BOOST_TT_TRAIT_OP -
 
-#include "has_prefix_operator_test.hpp"
+#include "has_prefix_minus_operator_test.hpp"

Modified: sandbox/type_traits/libs/type_traits/test/has_operator_unary_plus_test.cpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_operator_unary_plus_test.cpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_operator_unary_plus_test.cpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -15,4 +15,4 @@
 #define BOOST_TT_TRAIT_NAME has_operator_unary_plus
 #define BOOST_TT_TRAIT_OP +
 
-#include "has_prefix_operator_test.hpp"
+#include "has_prefix_plus_not_operator_test.hpp"

Modified: sandbox/type_traits/libs/type_traits/test/has_postfix_decrement_operator_test.hpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_postfix_decrement_operator_test.hpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_postfix_decrement_operator_test.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -135,6 +135,15 @@
         TEST_TR(Derived1, bool, true);
         TEST_TR(Base2, bool, false);
         TEST_TR(Derived2, bool, true);
+ // pointers
+ TEST_T(void*, false);
+ TEST_T(bool*, true);
+ TEST_T(char*, true);
+ TEST_T(int*, true);
+ TEST_T(long*, true);
+ TEST_T(wchar_t*, true);
+ TEST_T(double*, true);
+ TEST_T(without*, true);
 }
 }
 

Copied: sandbox/type_traits/libs/type_traits/test/has_postfix_increment_operator_test.hpp (from r68546, /sandbox/type_traits/libs/type_traits/test/has_postfix_operator_test.hpp)
==============================================================================
--- /sandbox/type_traits/libs/type_traits/test/has_postfix_operator_test.hpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_postfix_increment_operator_test.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -135,6 +135,15 @@
         TEST_TR(Derived1, bool, true);
         TEST_TR(Base2, bool, false);
         TEST_TR(Derived2, bool, true);
+ // pointers
+ TEST_T(void*, false);
+ TEST_T(bool*, true);
+ TEST_T(char*, true);
+ TEST_T(int*, true);
+ TEST_T(long*, true);
+ TEST_T(wchar_t*, true);
+ TEST_T(double*, true);
+ TEST_T(without*, true);
 }
 }
 

Deleted: sandbox/type_traits/libs/type_traits/test/has_postfix_operator_test.hpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_postfix_operator_test.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
+++ (empty file)
@@ -1,143 +0,0 @@
-// (C) Copyright Frederic Bron 2009-2010.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#include <iostream>
-#include <typeinfo>
-#include <string>
-
-// test with one template parameter
-#define TEST_T(TYPE,RESULT) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::BOOST_TT_TRAIT_NAME<TYPE>::value), RESULT)
-// test with one template parameter plus return value
-#define TEST_TR(TYPE,RET,RESULT) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::BOOST_TT_TRAIT_NAME<TYPE,RET>::value), RESULT)
-
-namespace {
-
-struct ret { };
-
-struct without { };
-
-struct internal { ret operator BOOST_TT_TRAIT_OP (int) const; };
-
-struct external { };
-ret operator BOOST_TT_TRAIT_OP (const external&, int);
-
-class internal_private { ret operator BOOST_TT_TRAIT_OP (int) const; };
-
-struct returns_int { int operator BOOST_TT_TRAIT_OP (int); };
-
-struct returns_void { void operator BOOST_TT_TRAIT_OP (int); };
-
-struct returns_void_star { void *operator BOOST_TT_TRAIT_OP (int); };
-
-struct returns_double { double operator BOOST_TT_TRAIT_OP (int); };
-
-struct returns_string { std::string operator BOOST_TT_TRAIT_OP (int); };
-
-//struct convertible_to_bool { operator bool () const; };
-//struct returns_convertible_to_bool { convertible_to_bool operator BOOST_TT_TRAIT_OP (int); };
-
-class Base1 { };
-class Derived1 : public Base1 { };
-
-bool operator BOOST_TT_TRAIT_OP (const Base1&, int) { return true; }
-
-class Base2 { };
-struct Derived2 : public Base2 {
- Derived2(int); // to check if it works with a class that is not default constructible
-};
-
-bool operator BOOST_TT_TRAIT_OP (const Derived2&, int) { return true; }
-
-struct tag { };
-
-void run() {
- // test with only one template parameter
- TEST_T(bool, true);
- TEST_T(char, true);
- TEST_T(signed char, true);
- TEST_T(short int, true);
- TEST_T(int, true);
- TEST_T(long int, true);
- TEST_T(unsigned char, true);
- TEST_T(unsigned short int, true);
- TEST_T(unsigned int, true);
- TEST_T(unsigned long int, true);
- TEST_T(wchar_t, true);
- TEST_T(float, true);
- TEST_T(double, true);
- TEST_T(long double, true);
- TEST_T(void, false);
-
-// test with three template parameters
- TEST_TR(bool, bool, true);
- TEST_TR(char, bool, true);
- TEST_TR(signed char, bool, true);
- TEST_TR(short int, bool, true);
- TEST_TR(int, bool, true);
- TEST_TR(long int, bool, true);
- TEST_TR(unsigned char, bool, true);
- TEST_TR(unsigned short int, bool, true);
- TEST_TR(unsigned int, bool, true);
- TEST_TR(unsigned long int, bool, true);
- TEST_TR(wchar_t, bool, true);
- TEST_TR(float, bool, true);
- TEST_TR(double, bool, true);
- TEST_TR(long double, bool, true);
- TEST_TR(bool, tag, false);
- TEST_TR(char, tag, false);
- TEST_TR(signed char, tag, false);
- TEST_TR(short int, tag, false);
- TEST_TR(int, tag, false);
- TEST_TR(long int, tag, false);
- TEST_TR(unsigned char, tag, false);
- TEST_TR(unsigned short int, tag, false);
- TEST_TR(unsigned int, tag, false);
- TEST_TR(unsigned long int, tag, false);
- TEST_TR(wchar_t, tag, false);
- TEST_TR(float, tag, false);
- TEST_TR(double, tag, false);
- TEST_TR(long double, tag, false);
-
- TEST_T(without, false);
- TEST_T(internal, true);
- TEST_T(external, true);
-// compile time error
-// TEST_T(internal_private, false);
- TEST_T(returns_int, true);
- TEST_T(returns_void, true);
- TEST_T(returns_void_star, true);
- TEST_T(returns_double, true);
- TEST_T(returns_string, true);
-// TEST_T(convertible_to_bool, true);
- TEST_T(Base1, true);
- TEST_T(Derived1, true);
- TEST_T(Base2, false);
- TEST_T(Derived2, true);
-
- TEST_TR(without, bool, false);
- TEST_TR(internal, bool, false);
- TEST_TR(internal, ret, true);
- TEST_TR(external, bool, false);
- TEST_TR(external, ret, true);
- TEST_TR(returns_int, bool, true);
- TEST_TR(returns_int, int, true);
- TEST_TR(returns_void, void, true);
- TEST_TR(returns_void, bool, false);
- TEST_TR(returns_void_star, bool, true);
- TEST_TR(returns_double, bool, true);
- TEST_TR(returns_double, double, true);
- TEST_TR(returns_string, bool, false);
- TEST_TR(returns_string, std::string, true);
-// TEST_TR(convertible_to_bool, bool, true);
- TEST_TR(Base1, bool, true);
- TEST_TR(Derived1, bool, true);
- TEST_TR(Base2, bool, false);
- TEST_TR(Derived2, bool, true);
-}
-}
-
-TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME)
- run();
-TT_TEST_END

Modified: sandbox/type_traits/libs/type_traits/test/has_prefix_decrement_operator_test.hpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_prefix_decrement_operator_test.hpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_prefix_decrement_operator_test.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -135,6 +135,15 @@
         TEST_TR(Derived1, bool, true);
         TEST_TR(Base2, bool, false);
         TEST_TR(Derived2, bool, true);
+ // pointers
+ TEST_T(void*, false);
+ TEST_T(bool*, true);
+ TEST_T(char*, true);
+ TEST_T(int*, true);
+ TEST_T(long*, true);
+ TEST_T(wchar_t*, true);
+ TEST_T(double*, true);
+ TEST_T(without*, true);
 }
 }
 

Added: sandbox/type_traits/libs/type_traits/test/has_prefix_increment_operator_test.hpp
==============================================================================
--- (empty file)
+++ sandbox/type_traits/libs/type_traits/test/has_prefix_increment_operator_test.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -0,0 +1,152 @@
+// (C) Copyright Frederic Bron 2009-2010.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iostream>
+#include <typeinfo>
+#include <string>
+
+// test with one template parameter
+#define TEST_T(TYPE,RESULT) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::BOOST_TT_TRAIT_NAME<TYPE>::value), RESULT)
+// test with one template parameter plus return value
+#define TEST_TR(TYPE,RET,RESULT) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::BOOST_TT_TRAIT_NAME<TYPE,RET>::value), RESULT)
+
+namespace {
+
+struct ret { };
+
+struct without { };
+
+struct internal { ret operator BOOST_TT_TRAIT_OP () const; };
+
+struct external { };
+ret operator BOOST_TT_TRAIT_OP (const external&);
+
+class internal_private { ret operator BOOST_TT_TRAIT_OP () const; };
+
+struct returns_int { int operator BOOST_TT_TRAIT_OP (); };
+
+struct returns_void { void operator BOOST_TT_TRAIT_OP (); };
+
+struct returns_void_star { void *operator BOOST_TT_TRAIT_OP (); };
+
+struct returns_double { double operator BOOST_TT_TRAIT_OP (); };
+
+struct returns_string { std::string operator BOOST_TT_TRAIT_OP (); };
+
+//struct convertible_to_bool { operator bool () const; };
+//struct returns_convertible_to_bool { convertible_to_bool operator BOOST_TT_TRAIT_OP (); };
+
+class Base1 { };
+class Derived1 : public Base1 { };
+
+bool operator BOOST_TT_TRAIT_OP (const Base1&) { return true; }
+
+class Base2 { };
+struct Derived2 : public Base2 {
+ Derived2(int); // to check if it works with a class that is not default constructible
+};
+
+bool operator BOOST_TT_TRAIT_OP (const Derived2&) { return true; }
+
+struct tag { };
+
+void run() {
+ // test with only one template parameter
+ TEST_T(bool, true);
+ TEST_T(char, true);
+ TEST_T(signed char, true);
+ TEST_T(short int, true);
+ TEST_T(int, true);
+ TEST_T(long int, true);
+ TEST_T(unsigned char, true);
+ TEST_T(unsigned short int, true);
+ TEST_T(unsigned int, true);
+ TEST_T(unsigned long int, true);
+ TEST_T(wchar_t, true);
+ TEST_T(float, true);
+ TEST_T(double, true);
+ TEST_T(long double, true);
+ TEST_T(void, false);
+
+// test with three template parameters
+ TEST_TR(bool, bool, true);
+ TEST_TR(char, bool, true);
+ TEST_TR(signed char, bool, true);
+ TEST_TR(short int, bool, true);
+ TEST_TR(int, bool, true);
+ TEST_TR(long int, bool, true);
+ TEST_TR(unsigned char, bool, true);
+ TEST_TR(unsigned short int, bool, true);
+ TEST_TR(unsigned int, bool, true);
+ TEST_TR(unsigned long int, bool, true);
+ TEST_TR(wchar_t, bool, true);
+ TEST_TR(float, bool, true);
+ TEST_TR(double, bool, true);
+ TEST_TR(long double, bool, true);
+ TEST_TR(bool, tag, false);
+ TEST_TR(char, tag, false);
+ TEST_TR(signed char, tag, false);
+ TEST_TR(short int, tag, false);
+ TEST_TR(int, tag, false);
+ TEST_TR(long int, tag, false);
+ TEST_TR(unsigned char, tag, false);
+ TEST_TR(unsigned short int, tag, false);
+ TEST_TR(unsigned int, tag, false);
+ TEST_TR(unsigned long int, tag, false);
+ TEST_TR(wchar_t, tag, false);
+ TEST_TR(float, tag, false);
+ TEST_TR(double, tag, false);
+ TEST_TR(long double, tag, false);
+
+ TEST_T(without, false);
+ TEST_T(internal, true);
+ TEST_T(external, true);
+// compile time error
+// TEST_T(internal_private, false);
+ TEST_T(returns_int, true);
+ TEST_T(returns_void, true);
+ TEST_T(returns_void_star, true);
+ TEST_T(returns_double, true);
+ TEST_T(returns_string, true);
+// TEST_T(convertible_to_bool, true);
+ TEST_T(Base1, true);
+ TEST_T(Derived1, true);
+ TEST_T(Base2, false);
+ TEST_T(Derived2, true);
+
+ TEST_TR(without, bool, false);
+ TEST_TR(internal, bool, false);
+ TEST_TR(internal, ret, true);
+ TEST_TR(external, bool, false);
+ TEST_TR(external, ret, true);
+ TEST_TR(returns_int, bool, true);
+ TEST_TR(returns_int, int, true);
+ TEST_TR(returns_void, void, true);
+ TEST_TR(returns_void, bool, false);
+ TEST_TR(returns_void_star, bool, true);
+ TEST_TR(returns_double, bool, true);
+ TEST_TR(returns_double, double, true);
+ TEST_TR(returns_string, bool, false);
+ TEST_TR(returns_string, std::string, true);
+// TEST_TR(convertible_to_bool, bool, true);
+ TEST_TR(Base1, bool, true);
+ TEST_TR(Derived1, bool, true);
+ TEST_TR(Base2, bool, false);
+ TEST_TR(Derived2, bool, true);
+ // pointers
+ TEST_T(void*, false);
+ TEST_T(bool*, true);
+ TEST_T(char*, true);
+ TEST_T(int*, true);
+ TEST_T(long*, true);
+ TEST_T(wchar_t*, true);
+ TEST_T(double*, true);
+ TEST_T(without*, true);
+}
+}
+
+TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME)
+ run();
+TT_TEST_END

Copied: sandbox/type_traits/libs/type_traits/test/has_prefix_minus_operator_test.hpp (from r68546, /sandbox/type_traits/libs/type_traits/test/has_prefix_operator_test.hpp)
==============================================================================
--- /sandbox/type_traits/libs/type_traits/test/has_prefix_operator_test.hpp (original)
+++ sandbox/type_traits/libs/type_traits/test/has_prefix_minus_operator_test.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -135,6 +135,15 @@
         TEST_TR(Derived1, bool, true);
         TEST_TR(Base2, bool, false);
         TEST_TR(Derived2, bool, true);
+ // pointers
+ TEST_T(void*, false);
+ TEST_T(bool*, false);
+ TEST_T(char*, false);
+ TEST_T(int*, false);
+ TEST_T(long*, false);
+ TEST_T(wchar_t*, false);
+ TEST_T(double*, false);
+ TEST_T(without*, false);
 }
 }
 

Deleted: sandbox/type_traits/libs/type_traits/test/has_prefix_operator_test.hpp
==============================================================================
--- sandbox/type_traits/libs/type_traits/test/has_prefix_operator_test.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
+++ (empty file)
@@ -1,143 +0,0 @@
-// (C) Copyright Frederic Bron 2009-2010.
-// Use, modification and distribution are subject to the
-// Boost Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#include <iostream>
-#include <typeinfo>
-#include <string>
-
-// test with one template parameter
-#define TEST_T(TYPE,RESULT) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::BOOST_TT_TRAIT_NAME<TYPE>::value), RESULT)
-// test with one template parameter plus return value
-#define TEST_TR(TYPE,RET,RESULT) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::BOOST_TT_TRAIT_NAME<TYPE,RET>::value), RESULT)
-
-namespace {
-
-struct ret { };
-
-struct without { };
-
-struct internal { ret operator BOOST_TT_TRAIT_OP () const; };
-
-struct external { };
-ret operator BOOST_TT_TRAIT_OP (const external&);
-
-class internal_private { ret operator BOOST_TT_TRAIT_OP () const; };
-
-struct returns_int { int operator BOOST_TT_TRAIT_OP (); };
-
-struct returns_void { void operator BOOST_TT_TRAIT_OP (); };
-
-struct returns_void_star { void *operator BOOST_TT_TRAIT_OP (); };
-
-struct returns_double { double operator BOOST_TT_TRAIT_OP (); };
-
-struct returns_string { std::string operator BOOST_TT_TRAIT_OP (); };
-
-//struct convertible_to_bool { operator bool () const; };
-//struct returns_convertible_to_bool { convertible_to_bool operator BOOST_TT_TRAIT_OP (); };
-
-class Base1 { };
-class Derived1 : public Base1 { };
-
-bool operator BOOST_TT_TRAIT_OP (const Base1&) { return true; }
-
-class Base2 { };
-struct Derived2 : public Base2 {
- Derived2(int); // to check if it works with a class that is not default constructible
-};
-
-bool operator BOOST_TT_TRAIT_OP (const Derived2&) { return true; }
-
-struct tag { };
-
-void run() {
- // test with only one template parameter
- TEST_T(bool, true);
- TEST_T(char, true);
- TEST_T(signed char, true);
- TEST_T(short int, true);
- TEST_T(int, true);
- TEST_T(long int, true);
- TEST_T(unsigned char, true);
- TEST_T(unsigned short int, true);
- TEST_T(unsigned int, true);
- TEST_T(unsigned long int, true);
- TEST_T(wchar_t, true);
- TEST_T(float, true);
- TEST_T(double, true);
- TEST_T(long double, true);
- TEST_T(void, false);
-
-// test with three template parameters
- TEST_TR(bool, bool, true);
- TEST_TR(char, bool, true);
- TEST_TR(signed char, bool, true);
- TEST_TR(short int, bool, true);
- TEST_TR(int, bool, true);
- TEST_TR(long int, bool, true);
- TEST_TR(unsigned char, bool, true);
- TEST_TR(unsigned short int, bool, true);
- TEST_TR(unsigned int, bool, true);
- TEST_TR(unsigned long int, bool, true);
- TEST_TR(wchar_t, bool, true);
- TEST_TR(float, bool, true);
- TEST_TR(double, bool, true);
- TEST_TR(long double, bool, true);
- TEST_TR(bool, tag, false);
- TEST_TR(char, tag, false);
- TEST_TR(signed char, tag, false);
- TEST_TR(short int, tag, false);
- TEST_TR(int, tag, false);
- TEST_TR(long int, tag, false);
- TEST_TR(unsigned char, tag, false);
- TEST_TR(unsigned short int, tag, false);
- TEST_TR(unsigned int, tag, false);
- TEST_TR(unsigned long int, tag, false);
- TEST_TR(wchar_t, tag, false);
- TEST_TR(float, tag, false);
- TEST_TR(double, tag, false);
- TEST_TR(long double, tag, false);
-
- TEST_T(without, false);
- TEST_T(internal, true);
- TEST_T(external, true);
-// compile time error
-// TEST_T(internal_private, false);
- TEST_T(returns_int, true);
- TEST_T(returns_void, true);
- TEST_T(returns_void_star, true);
- TEST_T(returns_double, true);
- TEST_T(returns_string, true);
-// TEST_T(convertible_to_bool, true);
- TEST_T(Base1, true);
- TEST_T(Derived1, true);
- TEST_T(Base2, false);
- TEST_T(Derived2, true);
-
- TEST_TR(without, bool, false);
- TEST_TR(internal, bool, false);
- TEST_TR(internal, ret, true);
- TEST_TR(external, bool, false);
- TEST_TR(external, ret, true);
- TEST_TR(returns_int, bool, true);
- TEST_TR(returns_int, int, true);
- TEST_TR(returns_void, void, true);
- TEST_TR(returns_void, bool, false);
- TEST_TR(returns_void_star, bool, true);
- TEST_TR(returns_double, bool, true);
- TEST_TR(returns_double, double, true);
- TEST_TR(returns_string, bool, false);
- TEST_TR(returns_string, std::string, true);
-// TEST_TR(convertible_to_bool, bool, true);
- TEST_TR(Base1, bool, true);
- TEST_TR(Derived1, bool, true);
- TEST_TR(Base2, bool, false);
- TEST_TR(Derived2, bool, true);
-}
-}
-
-TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME)
- run();
-TT_TEST_END

Added: sandbox/type_traits/libs/type_traits/test/has_prefix_plus_not_operator_test.hpp
==============================================================================
--- (empty file)
+++ sandbox/type_traits/libs/type_traits/test/has_prefix_plus_not_operator_test.hpp 2011-01-30 02:39:53 EST (Sun, 30 Jan 2011)
@@ -0,0 +1,152 @@
+// (C) Copyright Frederic Bron 2009-2010.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <iostream>
+#include <typeinfo>
+#include <string>
+
+// test with one template parameter
+#define TEST_T(TYPE,RESULT) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::BOOST_TT_TRAIT_NAME<TYPE>::value), RESULT)
+// test with one template parameter plus return value
+#define TEST_TR(TYPE,RET,RESULT) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::BOOST_TT_TRAIT_NAME<TYPE,RET>::value), RESULT)
+
+namespace {
+
+struct ret { };
+
+struct without { };
+
+struct internal { ret operator BOOST_TT_TRAIT_OP () const; };
+
+struct external { };
+ret operator BOOST_TT_TRAIT_OP (const external&);
+
+class internal_private { ret operator BOOST_TT_TRAIT_OP () const; };
+
+struct returns_int { int operator BOOST_TT_TRAIT_OP (); };
+
+struct returns_void { void operator BOOST_TT_TRAIT_OP (); };
+
+struct returns_void_star { void *operator BOOST_TT_TRAIT_OP (); };
+
+struct returns_double { double operator BOOST_TT_TRAIT_OP (); };
+
+struct returns_string { std::string operator BOOST_TT_TRAIT_OP (); };
+
+//struct convertible_to_bool { operator bool () const; };
+//struct returns_convertible_to_bool { convertible_to_bool operator BOOST_TT_TRAIT_OP (); };
+
+class Base1 { };
+class Derived1 : public Base1 { };
+
+bool operator BOOST_TT_TRAIT_OP (const Base1&) { return true; }
+
+class Base2 { };
+struct Derived2 : public Base2 {
+ Derived2(int); // to check if it works with a class that is not default constructible
+};
+
+bool operator BOOST_TT_TRAIT_OP (const Derived2&) { return true; }
+
+struct tag { };
+
+void run() {
+ // test with only one template parameter
+ TEST_T(bool, true);
+ TEST_T(char, true);
+ TEST_T(signed char, true);
+ TEST_T(short int, true);
+ TEST_T(int, true);
+ TEST_T(long int, true);
+ TEST_T(unsigned char, true);
+ TEST_T(unsigned short int, true);
+ TEST_T(unsigned int, true);
+ TEST_T(unsigned long int, true);
+ TEST_T(wchar_t, true);
+ TEST_T(float, true);
+ TEST_T(double, true);
+ TEST_T(long double, true);
+ TEST_T(void, false);
+
+// test with three template parameters
+ TEST_TR(bool, bool, true);
+ TEST_TR(char, bool, true);
+ TEST_TR(signed char, bool, true);
+ TEST_TR(short int, bool, true);
+ TEST_TR(int, bool, true);
+ TEST_TR(long int, bool, true);
+ TEST_TR(unsigned char, bool, true);
+ TEST_TR(unsigned short int, bool, true);
+ TEST_TR(unsigned int, bool, true);
+ TEST_TR(unsigned long int, bool, true);
+ TEST_TR(wchar_t, bool, true);
+ TEST_TR(float, bool, true);
+ TEST_TR(double, bool, true);
+ TEST_TR(long double, bool, true);
+ TEST_TR(bool, tag, false);
+ TEST_TR(char, tag, false);
+ TEST_TR(signed char, tag, false);
+ TEST_TR(short int, tag, false);
+ TEST_TR(int, tag, false);
+ TEST_TR(long int, tag, false);
+ TEST_TR(unsigned char, tag, false);
+ TEST_TR(unsigned short int, tag, false);
+ TEST_TR(unsigned int, tag, false);
+ TEST_TR(unsigned long int, tag, false);
+ TEST_TR(wchar_t, tag, false);
+ TEST_TR(float, tag, false);
+ TEST_TR(double, tag, false);
+ TEST_TR(long double, tag, false);
+
+ TEST_T(without, false);
+ TEST_T(internal, true);
+ TEST_T(external, true);
+// compile time error
+// TEST_T(internal_private, false);
+ TEST_T(returns_int, true);
+ TEST_T(returns_void, true);
+ TEST_T(returns_void_star, true);
+ TEST_T(returns_double, true);
+ TEST_T(returns_string, true);
+// TEST_T(convertible_to_bool, true);
+ TEST_T(Base1, true);
+ TEST_T(Derived1, true);
+ TEST_T(Base2, false);
+ TEST_T(Derived2, true);
+
+ TEST_TR(without, bool, false);
+ TEST_TR(internal, bool, false);
+ TEST_TR(internal, ret, true);
+ TEST_TR(external, bool, false);
+ TEST_TR(external, ret, true);
+ TEST_TR(returns_int, bool, true);
+ TEST_TR(returns_int, int, true);
+ TEST_TR(returns_void, void, true);
+ TEST_TR(returns_void, bool, false);
+ TEST_TR(returns_void_star, bool, true);
+ TEST_TR(returns_double, bool, true);
+ TEST_TR(returns_double, double, true);
+ TEST_TR(returns_string, bool, false);
+ TEST_TR(returns_string, std::string, true);
+// TEST_TR(convertible_to_bool, bool, true);
+ TEST_TR(Base1, bool, true);
+ TEST_TR(Derived1, bool, true);
+ TEST_TR(Base2, bool, false);
+ TEST_TR(Derived2, bool, true);
+ // pointers
+ TEST_T(void*, true);
+ TEST_T(bool*, true);
+ TEST_T(char*, true);
+ TEST_T(int*, true);
+ TEST_T(long*, true);
+ TEST_T(wchar_t*, true);
+ TEST_T(double*, true);
+ TEST_T(without*, true);
+}
+}
+
+TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME)
+ run();
+TT_TEST_END


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk