forked from boostorg/smart_ptr
Optimize make_local_shared to use a single allocation
This commit is contained in:
1 parent
1f86907a3d
commit
2b5869882a
9 files changed
+316
-62
No files matched your search
@@ -132,6 +132,10 @@ template< class E, class P, class D, class A > inline void lsp_allocator_constru
|
||||
pn = pd;
|
||||
}
|
||||
|
||||
struct lsp_internal_constructor_tag
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
//
|
||||
@@ -184,6 +188,11 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
// internal constructor, used by make_shared
|
||||
BOOST_CONSTEXPR local_shared_ptr( boost::detail::lsp_internal_constructor_tag, T * px_, boost::detail::local_counted_base * pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( pn_ )
|
||||
{
|
||||
}
|
||||
|
||||
template<class Y>
|
||||
explicit local_shared_ptr( Y * p ): px( p ), pn( 0 )
|
||||
{
|
||||
@@ -484,7 +493,7 @@ public:
|
||||
|
||||
if( pn )
|
||||
{
|
||||
return static_pointer_cast<Y>( pn->get_shared_ptr() );
|
||||
return static_pointer_cast<Y>( pn->local_cb_get_shared_ptr() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -502,7 +511,7 @@ public:
|
||||
|
||||
if( pn )
|
||||
{
|
||||
return static_pointer_cast<Y>( pn->get_shared_ptr() );
|
||||
return static_pointer_cast<Y>( pn->local_cb_get_shared_ptr() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user