Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73180 - sandbox/conversion/libs/conversion_ext/test
From: vicente.botet_at_[hidden]
Date: 2011-07-17 08:51:19


Author: viboes
Date: 2011-07-17 08:51:18 EDT (Sun, 17 Jul 2011)
New Revision: 73180
URL: http://svn.boost.org/trac/boost/changeset/73180

Log:
conversion: added is_destructible
Added:
   sandbox/conversion/libs/conversion_ext/test/is_destructible.cpp (contents, props changed)
Text files modified:
   sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 | 1 +
   1 files changed, 1 insertions(+), 0 deletions(-)

Modified: sandbox/conversion/libs/conversion_ext/test/Jamfile.v2
==============================================================================
--- sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 (original)
+++ sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 2011-07-17 08:51:18 EDT (Sun, 17 Jul 2011)
@@ -56,6 +56,7 @@
      [ compile is_extrinsic_convertible.cpp ]
      [ compile is_move_assignable.cpp ]
      [ compile is_move_constructible.cpp ]
+ [ compile is_destructible.cpp ]
     ;
 
 

Added: sandbox/conversion/libs/conversion_ext/test/is_destructible.cpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/libs/conversion_ext/test/is_destructible.cpp 2011-07-17 08:51:18 EDT (Sun, 17 Jul 2011)
@@ -0,0 +1,78 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011. Distributed under 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)
+//
+// See http://www.boost.org/libs/conversion for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+#include <iostream>
+#include <boost/static_assert.hpp>
+#include <boost/conversion/type_traits/is_destructible.hpp>
+
+
+
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+public:
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+public:
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ ~A();
+};
+
+namespace boost
+{
+#if defined(BOOST_CONVERSION_NO_IS_DESTRUCTIBLE)
+ template <> struct is_destructible< A > : true_type {};
+ template <> struct is_destructible< Empty > : true_type {};
+ template <> struct is_destructible< Union > : true_type {};
+ template <> struct is_destructible< bit_zero > : true_type {};
+#endif
+ template <> struct is_destructible< NotEmpty > : false_type {};
+}
+
+int main()
+{
+ BOOST_STATIC_ASSERT((! boost::is_destructible<Abstract>::value));
+ BOOST_STATIC_ASSERT((! boost::is_destructible<void>::value));
+ BOOST_STATIC_ASSERT((! boost::is_destructible<int[]>::value));
+ BOOST_STATIC_ASSERT((boost::is_destructible<int&>::value));
+
+ BOOST_STATIC_ASSERT(( boost::is_destructible<A>::value));
+ BOOST_STATIC_ASSERT(( boost::is_destructible<bit_zero>::value));
+ BOOST_STATIC_ASSERT(( boost::is_destructible<Union>::value));
+ BOOST_STATIC_ASSERT(( ! boost::is_destructible<NotEmpty>::value));
+ BOOST_STATIC_ASSERT(( boost::is_destructible<Empty>::value));
+ BOOST_STATIC_ASSERT(( boost::is_destructible<int>::value));
+ BOOST_STATIC_ASSERT(( boost::is_destructible<double>::value));
+ BOOST_STATIC_ASSERT(( boost::is_destructible<int*>::value));
+ BOOST_STATIC_ASSERT(( boost::is_destructible<const int*>::value));
+ BOOST_STATIC_ASSERT(( boost::is_destructible<int[3]>::value));
+}
+
+
+


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