|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86298 - in branches/release: boost libs/any libs/any/test
From: antoshkka_at_[hidden]
Date: 2013-10-14 08:40:08
Author: apolukhin
Date: 2013-10-14 08:40:08 EDT (Mon, 14 Oct 2013)
New Revision: 86298
URL: http://svn.boost.org/trac/boost/changeset/86298
Log:
Merge from trunk:
* Fixed construction of `any` from `const any&&` (fixes #9215)
Properties modified:
branches/release/boost/any.hpp (contents, props changed)
branches/release/libs/any/ (props changed)
Text files modified:
branches/release/boost/any.hpp | 5 ++++-
branches/release/libs/any/test/any_test_rv.cpp | 16 ++++++++++++++++
2 files changed, 20 insertions(+), 1 deletions(-)
Modified: branches/release/boost/any.hpp
==============================================================================
--- branches/release/boost/any.hpp Mon Oct 14 07:05:12 2013 (r86297)
+++ branches/release/boost/any.hpp 2013-10-14 08:40:08 EDT (Mon, 14 Oct 2013) (r86298)
@@ -27,6 +27,7 @@
#include <boost/static_assert.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_const.hpp>
// See boost/python/type_id.hpp
// TODO: add BOOST_TYPEID_COMPARE_BY_NAME to config.hpp
@@ -76,7 +77,9 @@
// Perfect forwarding of ValueType
template<typename ValueType>
- any(ValueType&& value, typename boost::disable_if<boost::is_same<any&, ValueType> >::type* = 0)
+ any(ValueType&& value
+ , typename boost::disable_if<boost::is_same<any&, ValueType> >::type* = 0 // disable if value has type `any&`
+ , typename boost::disable_if<boost::is_const<ValueType> >::type* = 0) // disable if value has type `const ValueType&&`
: content(new holder< typename decay<ValueType>::type >(static_cast<ValueType&&>(value)))
{
}
Modified: branches/release/libs/any/test/any_test_rv.cpp
==============================================================================
--- branches/release/libs/any/test/any_test_rv.cpp Mon Oct 14 07:05:12 2013 (r86297)
+++ branches/release/libs/any/test/any_test_rv.cpp 2013-10-14 08:40:08 EDT (Mon, 14 Oct 2013) (r86298)
@@ -51,6 +51,7 @@
void test_move_assignment_from_value();
void test_copy_construction_from_value();
void test_copy_assignment_from_value();
+ void test_construction_from_const_any_rv();
void test_cast_to_rv();
@@ -65,6 +66,7 @@
{ "move assignment from value", test_move_assignment_from_value },
{ "copy construction from value", test_copy_construction_from_value },
{ "copy assignment from value", test_copy_assignment_from_value },
+ { "constructing from const any&&", test_construction_from_const_any_rv },
{ "casting to rvalue reference", test_cast_to_rv }
};
@@ -275,6 +277,20 @@
"checking move counts");
}
+ const any helper_method() {
+ return true;
+ }
+
+ const bool helper_method1() {
+ return true;
+ }
+
+ void test_construction_from_const_any_rv()
+ {
+ any values[] = {helper_method(), helper_method1() };
+ (void)values;
+ }
+
void test_cast_to_rv()
{
move_copy_conting_class value0;
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