|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83337 - in sandbox/type_erasure: boost/type_erasure libs/type_erasure/test
From: steven_at_[hidden]
Date: 2013-03-06 17:29:45
Author: steven_watanabe
Date: 2013-03-06 17:29:44 EST (Wed, 06 Mar 2013)
New Revision: 83337
URL: http://svn.boost.org/trac/boost/changeset/83337
Log:
Fix print_sequence example
Text files modified:
sandbox/type_erasure/boost/type_erasure/any.hpp | 10 +++++++++-
sandbox/type_erasure/libs/type_erasure/test/test_construct.cpp | 14 ++++++++++++++
2 files changed, 23 insertions(+), 1 deletions(-)
Modified: sandbox/type_erasure/boost/type_erasure/any.hpp
==============================================================================
--- sandbox/type_erasure/boost/type_erasure/any.hpp (original)
+++ sandbox/type_erasure/boost/type_erasure/any.hpp 2013-03-06 17:29:44 EST (Wed, 06 Mar 2013)
@@ -446,7 +446,7 @@
{}
#else
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
any(any&& other)
: table(::boost::type_erasure::detail::access::table(other)),
data(::boost::type_erasure::call(
@@ -455,6 +455,14 @@
), std::move(other))
)
{}
+ any(any& other)
+ : table(::boost::type_erasure::detail::access::table(other)),
+ data(::boost::type_erasure::call(
+ ::boost::type_erasure::detail::make(
+ false? this->_boost_type_erasure_deduce_constructor(other) : 0
+ ), other)
+ )
+ {}
template<class Concept2, class Tag2>
any(any<Concept2, Tag2>& other)
: table(
Modified: sandbox/type_erasure/libs/type_erasure/test/test_construct.cpp
==============================================================================
--- sandbox/type_erasure/libs/type_erasure/test/test_construct.cpp (original)
+++ sandbox/type_erasure/libs/type_erasure/test/test_construct.cpp 2013-03-06 17:29:44 EST (Wed, 06 Mar 2013)
@@ -637,6 +637,20 @@
BOOST_CHECK_EQUAL(any_cast<int>(x), 4);
any<test_concept> y(x);
BOOST_CHECK_EQUAL(any_cast<int>(y), 4);
+ any<test_concept> z(as_rvalue(x));
+ BOOST_CHECK_EQUAL(any_cast<int>(z), 4);
+ any<test_concept> w(as_const(x));
+ BOOST_CHECK_EQUAL(any_cast<int>(w), 4);
+}
+
+BOOST_AUTO_TEST_CASE(test_copy_implicit)
+{
+ typedef ::boost::mpl::vector<common<>, common<_a> > test_concept;
+ any<test_concept> x(4, make_binding< ::boost::mpl::map< ::boost::mpl::pair<_self, int>, ::boost::mpl::pair<_a, int> > >());
+ BOOST_CHECK_EQUAL(any_cast<int>(x), 4);
+
+ any<test_concept> y = x;
+ BOOST_CHECK_EQUAL(any_cast<int>(y), 4);
any<test_concept> z = as_rvalue(x);
BOOST_CHECK_EQUAL(any_cast<int>(z), 4);
any<test_concept> w = as_const(x);
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