|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62248 - in trunk: boost/smart_ptr libs/smart_ptr/test
From: pdimov_at_[hidden]
Date: 2010-05-26 14:18:12
Author: pdimov
Date: 2010-05-26 14:18:10 EDT (Wed, 26 May 2010)
New Revision: 62248
URL: http://svn.boost.org/trac/boost/changeset/62248
Log:
Resolve the ambiguity between the zero argument make_shared and the variadic one. Refs #3856.
Added:
trunk/libs/smart_ptr/test/make_shared_fp_test.cpp (contents, props changed)
Text files modified:
trunk/boost/smart_ptr/make_shared.hpp | 8 ++++----
trunk/libs/smart_ptr/test/Jamfile.v2 | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
Modified: trunk/boost/smart_ptr/make_shared.hpp
==============================================================================
--- trunk/boost/smart_ptr/make_shared.hpp (original)
+++ trunk/boost/smart_ptr/make_shared.hpp 2010-05-26 14:18:10 EDT (Wed, 26 May 2010)
@@ -139,7 +139,7 @@
// Variadic templates, rvalue reference
-template< class T, class... Args > boost::shared_ptr< T > make_shared( Args && ... args )
+template< class T, class Arg1, class... Args > boost::shared_ptr< T > make_shared( Arg1 && arg1, Args && ... args )
{
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
@@ -147,7 +147,7 @@
void * pv = pd->address();
- ::new( pv ) T( boost::detail::sp_forward<Args>( args )... );
+ ::new( pv ) T( boost::detail::sp_forward<Arg1>( arg1 ), boost::detail::sp_forward<Args>( args )... );
pd->set_initialized();
T * pt2 = static_cast< T* >( pv );
@@ -156,7 +156,7 @@
return boost::shared_ptr< T >( pt, pt2 );
}
-template< class T, class A, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Args && ... args )
+template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Arg1 && arg1, Args && ... args )
{
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
@@ -164,7 +164,7 @@
void * pv = pd->address();
- ::new( pv ) T( boost::detail::sp_forward<Args>( args )... );
+ ::new( pv ) T( boost::detail::sp_forward<Arg1>( arg1 ), boost::detail::sp_forward<Args>( args )... );
pd->set_initialized();
T * pt2 = static_cast< T* >( pv );
Modified: trunk/libs/smart_ptr/test/Jamfile.v2
==============================================================================
--- trunk/libs/smart_ptr/test/Jamfile.v2 (original)
+++ trunk/libs/smart_ptr/test/Jamfile.v2 2010-05-26 14:18:10 EDT (Wed, 26 May 2010)
@@ -64,5 +64,6 @@
[ compile-fail auto_ptr_lv_fail.cpp ]
[ run atomic_count_test2.cpp ]
[ run sp_typeinfo_test.cpp ]
+ [ compile make_shared_fp_test.cpp ]
;
}
Added: trunk/libs/smart_ptr/test/make_shared_fp_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/smart_ptr/test/make_shared_fp_test.cpp 2010-05-26 14:18:10 EDT (Wed, 26 May 2010)
@@ -0,0 +1,19 @@
+//
+// make_shared_fp_test.cpp
+//
+// Copyright 2010 Georg Fritzsche
+//
+// 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
+//
+
+
+#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
+
+int main()
+{
+ typedef boost::shared_ptr<int>(*FP)();
+ FP fp = boost::make_shared<int>;
+}
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