|
Boost : |
Subject: Re: [boost] [smart_ptr] extra colon on make_shared variadic template instantiation
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-09-19 01:36:59
Le 17/09/13 19:45, Vicente J. Botet Escriba a écrit :
> Hi,
>
> while instantiating this template, the Intel compiler finds that there
> is an extra colon when Args is empty.
>
>
> ::new( pv ) T( boost::detail::sp_forward<Arg1>( arg1 ),
> boost::detail::sp_forward<Args>( args )... );
> ^
> Is this a bug on the compiler or on Boost.SmartPtr?
>
>
> Best,
> Vicente
>
> template< class T, class Arg1, class... Args > typename
> boost::detail::sp_if_not_array< T >::type make_shared( Arg1 && arg1,
> Args && ... args )
> {
> boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T
> ) );
>
> boost::detail::sp_ms_deleter< T > * pd =
> static_cast<boost::detail::sp_ms_deleter< T > *>(
> pt._internal_get_untyped_deleter() );
>
> void * pv = pd->address();
>
> ::new( pv ) T( boost::detail::sp_forward<Arg1>( arg1 ),
> boost::detail::sp_forward<Args>( args )... );
>
> pd->set_initialized();
>
> T * pt2 = static_cast< T* >( pv );
>
> boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
> return boost::shared_ptr< T >( pt, pt2 );
> }
>
>
Hi,
could I commit this patch
pc3:smart_ptr viboes$ svn diff
Index: make_shared_object.hpp
===================================================================
--- make_shared_object.hpp (revision 85776)
+++ make_shared_object.hpp (working copy)
@@ -207,6 +207,23 @@
// Variadic templates, rvalue reference
+template< class T, class... Args > typename
boost::detail::sp_if_not_array< T >::type make_shared( Args && ... args )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) );
+
+ boost::detail::sp_ms_deleter< T > * pd =
static_cast<boost::detail::sp_ms_deleter< T > *>(
pt._internal_get_untyped_deleter() );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( boost::detail::sp_forward<Args>( args )... );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk