/usr/include/boost/smart_ptr
NameSizeModeActions
detail/-0755rm
allocate_local_shared_array.hpp56550644editdlrm
allocate_shared_array.hpp99590644editdlrm
allocate_unique.hpp123690644editdlrm
atomic_shared_ptr.hpp58150644editdlrm
bad_weak_ptr.hpp17440644editdlrm
enable_shared_from.hpp11840644editdlrm
enable_shared_from_raw.hpp44790644editdlrm
enable_shared_from_this.hpp21750644editdlrm
intrusive_ptr.hpp94270644editdlrm
intrusive_ref_counter.hpp58170644editdlrm
local_shared_ptr.hpp193770644editdlrm
make_local_shared.hpp5760644editdlrm
make_local_shared_array.hpp21790644editdlrm
make_local_shared_object.hpp47870644editdlrm
make_shared.hpp7070644editdlrm
make_shared_array.hpp19960644editdlrm
make_shared_object.hpp246220644editdlrm
make_unique.hpp17830644editdlrm
owner_equal_to.hpp6710644editdlrm
owner_hash.hpp6000644editdlrm
owner_less.hpp8530644editdlrm
scoped_array.hpp33010644editdlrm
scoped_ptr.hpp40820644editdlrm
shared_array.hpp72520644editdlrm
shared_ptr.hpp311990644editdlrm
weak_ptr.hpp75820644editdlrm
Edit: /usr/include/boost/smart_ptr/make_local_shared_object.hpp (4787B)
#ifndef BOOST_SMART_PTR_MAKE_LOCAL_SHARED_OBJECT_HPP_INCLUDED #define BOOST_SMART_PTR_MAKE_LOCAL_SHARED_OBJECT_HPP_INCLUDED // make_local_shared_object.hpp // // Copyright 2017 Peter Dimov // // 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 // // See http://www.boost.org/libs/smart_ptr/ for documentation. #include #include #include #include #include #include namespace boost { namespace detail { // lsp_if_not_array template struct lsp_if_not_array { typedef boost::local_shared_ptr type; }; template struct lsp_if_not_array { }; template struct lsp_if_not_array { }; // lsp_ms_deleter template class lsp_ms_deleter: public local_counted_impl_em { private: typedef typename sp_aligned_storage::value>::type storage_type; storage_type storage_; A a_; bool initialized_; private: void destroy() BOOST_SP_NOEXCEPT { if( initialized_ ) { T * p = reinterpret_cast< T* >( storage_.data_ ); #if !defined( BOOST_NO_CXX11_ALLOCATOR ) std::allocator_traits::destroy( a_, p ); #else p->~T(); #endif initialized_ = false; } } public: explicit lsp_ms_deleter( A const & a ) BOOST_SP_NOEXCEPT : a_( a ), initialized_( false ) { } // optimization: do not copy storage_ lsp_ms_deleter( lsp_ms_deleter const & r ) BOOST_SP_NOEXCEPT : a_( r.a_), initialized_( false ) { } ~lsp_ms_deleter() BOOST_SP_NOEXCEPT { destroy(); } void operator()( T * ) BOOST_SP_NOEXCEPT { destroy(); } static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static { } void * address() BOOST_SP_NOEXCEPT { return storage_.data_; } void set_initialized() BOOST_SP_NOEXCEPT { initialized_ = true; } }; } // namespace detail template typename boost::detail::lsp_if_not_array::type allocate_local_shared( A const & a, Args&&... args ) { #if !defined( BOOST_NO_CXX11_ALLOCATOR ) typedef typename std::allocator_traits::template rebind_alloc A2; #else typedef typename A::template rebind::other A2; #endif A2 a2( a ); typedef boost::detail::lsp_ms_deleter D; boost::shared_ptr pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a2 ); D * pd = static_cast< D* >( pt._internal_get_untyped_deleter() ); void * pv = pd->address(); #if !defined( BOOST_NO_CXX11_ALLOCATOR ) std::allocator_traits::construct( a2, static_cast< T* >( pv ), std::forward( args )... ); #else ::new( pv ) T( std::forward( args )... ); #endif pd->set_initialized(); T * pt2 = static_cast< T* >( pv ); boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); pd->pn_ = pt._internal_count(); return boost::local_shared_ptr( boost::detail::lsp_internal_constructor_tag(), pt2, pd ); } template typename boost::detail::lsp_if_not_array::type allocate_local_shared_noinit( A const & a ) { #if !defined( BOOST_NO_CXX11_ALLOCATOR ) typedef typename std::allocator_traits::template rebind_alloc A2; #else typedef typename A::template rebind::other A2; #endif A2 a2( a ); typedef boost::detail::lsp_ms_deleter< T, std::allocator > D; boost::shared_ptr pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a2 ); D * pd = static_cast< D* >( pt._internal_get_untyped_deleter() ); void * pv = pd->address(); ::new( pv ) T; pd->set_initialized(); T * pt2 = static_cast< T* >( pv ); boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); pd->pn_ = pt._internal_count(); return boost::local_shared_ptr( boost::detail::lsp_internal_constructor_tag(), pt2, pd ); } template typename boost::detail::lsp_if_not_array::type make_local_shared( Args&&... args ) { typedef typename boost::remove_const::type T2; return boost::allocate_local_shared( std::allocator(), std::forward(args)... ); } template typename boost::detail::lsp_if_not_array::type make_local_shared_noinit() { typedef typename boost::remove_const::type T2; return boost::allocate_shared_noinit( std::allocator() ); } } // namespace boost #endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED