Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73163 - sandbox/conversion/libs/conversion_ext/test
From: vicente.botet_at_[hidden]
Date: 2011-07-17 05:21:01


Author: viboes
Date: 2011-07-17 05:20:55 EDT (Sun, 17 Jul 2011)
New Revision: 73163
URL: http://svn.boost.org/trac/boost/changeset/73163

Log:
conversion: added is_move_constructible and is_move_assignable
Added:
   sandbox/conversion/libs/conversion_ext/test/is_move_assignable.cpp (contents, props changed)
   sandbox/conversion/libs/conversion_ext/test/is_move_constructible.cpp (contents, props changed)
Text files modified:
   sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 | 2 ++
   1 files changed, 2 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 05:20:55 EDT (Sun, 17 Jul 2011)
@@ -54,6 +54,8 @@
      [ compile is_extrinsic_assignable.cpp ]
      [ compile is_convertible.cpp ]
      [ compile is_extrinsic_convertible.cpp ]
+ [ compile is_move_assignable.cpp ]
+ [ compile is_move_constructible.cpp ]
     ;
 
 

Added: sandbox/conversion/libs/conversion_ext/test/is_move_assignable.cpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/libs/conversion_ext/test/is_move_assignable.cpp 2011-07-17 05:20:55 EDT (Sun, 17 Jul 2011)
@@ -0,0 +1,70 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_move_assignable.hpp>
+
+
+
+class Empty
+{
+};
+
+class NotEmpty
+{
+public:
+ virtual ~NotEmpty();
+};
+
+union Union {};
+
+struct bit_zero
+{
+ int : 0;
+};
+
+struct A
+{
+ A();
+};
+
+#if defined(BOOST_CONVERSION_NO_IS_ASSIGNABLE)
+
+namespace boost {
+ // these specialization are needed because the compiler doesn't support SFINAE on expression
+ template <> struct is_assignable< Empty&, Empty const& > : true_type {};
+ template <> struct is_assignable< NotEmpty&, NotEmpty const& > : true_type {};
+ template <> struct is_assignable< Union&, Union const& > : true_type {};
+ template <> struct is_assignable< bit_zero&, bit_zero const& > : true_type {};
+ template <> struct is_assignable< A&, A const& > : true_type {};
+}
+
+#endif
+
+int main()
+{
+ BOOST_STATIC_ASSERT(( boost::is_move_assignable<int>::value));
+ BOOST_STATIC_ASSERT((!boost::is_move_assignable<const int>::value));
+ BOOST_STATIC_ASSERT((!boost::is_move_assignable<int[]>::value));
+ BOOST_STATIC_ASSERT((!boost::is_move_assignable<int[3]>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_assignable<int&>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_assignable<A>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_assignable<bit_zero>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_assignable<Union>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_assignable<NotEmpty>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_assignable<Empty>::value));
+}
+
+
+
+
+

Added: sandbox/conversion/libs/conversion_ext/test/is_move_constructible.cpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/libs/conversion_ext/test/is_move_constructible.cpp 2011-07-17 05:20:55 EDT (Sun, 17 Jul 2011)
@@ -0,0 +1,88 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_move_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(const A&);
+};
+
+#if ! defined BOOST_NO_RVALUE_REFERENCES
+struct B
+{
+ B(B&&);
+};
+#endif
+
+
+#if defined(BOOST_CONVERSION_NO_IS_CONSTRUCTIBLE)
+namespace boost
+{
+ template <> struct is_constructible< A, A const& > : true_type {};
+ template <> struct is_constructible< Empty, Empty const& > : true_type {};
+ template <> struct is_constructible< NotEmpty, NotEmpty const& > : true_type {};
+ template <> struct is_constructible< Union, Union const& > : true_type {};
+ template <> struct is_constructible< bit_zero, bit_zero const& > : true_type {};
+}
+#endif
+
+int main()
+{
+ BOOST_STATIC_ASSERT((!boost::is_move_constructible<Abstract>::value));
+ BOOST_STATIC_ASSERT((!boost::is_move_constructible<void>::value));
+ BOOST_STATIC_ASSERT((!boost::is_move_constructible<int[]>::value));
+ BOOST_STATIC_ASSERT((!boost::is_move_constructible<int[3]>::value));
+
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<A>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<int&>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<bit_zero>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<Union>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<NotEmpty>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<Empty>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<int>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<double>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<int*>::value));
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<const int*>::value));
+#if ! defined BOOST_NO_RVALUE_REFERENCES
+ BOOST_STATIC_ASSERT(( boost::is_move_constructible<B>::value));
+#endif
+}
+
+


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