Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73145 - sandbox/conversion/libs/conversion_ext/test
From: vicente.botet_at_[hidden]
Date: 2011-07-16 08:21:48


Author: viboes
Date: 2011-07-16 08:21:48 EDT (Sat, 16 Jul 2011)
New Revision: 73145
URL: http://svn.boost.org/trac/boost/changeset/73145

Log:
conversion: added is_default_constructible.cpp test
Added:
   sandbox/conversion/libs/conversion_ext/test/is_default_constructible.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-16 08:21:48 EDT (Sat, 16 Jul 2011)
@@ -49,6 +49,7 @@
      [ compile is_constructible.cpp ]
      [ compile is_copy_assignable.cpp ]
      [ compile is_copy_constructible.cpp ]
+ [ compile is_default_constructible.cpp ]
      [ compile is_explicitly_convertible.cpp ]
      [ compile is_extrinsic_assignable.cpp ]
      [ compile is_convertible.cpp ]

Added: sandbox/conversion/libs/conversion_ext/test/is_default_constructible.cpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/libs/conversion_ext/test/is_default_constructible.cpp 2011-07-16 08:21:48 EDT (Sat, 16 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_default_constructible.hpp>
+
+
+
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+public:
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+class Abstract
+{
+public:
+ virtual ~Abstract() = 0;
+};
+
+struct A
+{
+ A();
+};
+
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+namespace boost
+{
+ template <> struct is_constructible< A > : true_type {};
+ template <> struct is_constructible< Empty > : true_type {};
+ template <> struct is_constructible< NotEmpty > : true_type {};
+ template <> struct is_constructible< Union > : true_type {};
+ template <> struct is_constructible< bit_zero > : true_type {};
+}
+#endif
+
+int main()
+{
+ BOOST_STATIC_ASSERT((!boost::is_default_constructible<Abstract>::value));
+ BOOST_STATIC_ASSERT((!boost::is_default_constructible<void>::value));
+ BOOST_STATIC_ASSERT((!boost::is_default_constructible<int[]>::value));
+ BOOST_STATIC_ASSERT((! boost::is_default_constructible<int&>::value));
+
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<A>::value));
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<bit_zero>::value));
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<Union>::value));
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<NotEmpty>::value));
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<Empty>::value));
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<int>::value));
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<double>::value));
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<int*>::value));
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<const int*>::value));
+ BOOST_STATIC_ASSERT(( boost::is_default_constructible<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