shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
#include <boost/signals2/detail/null_output_iterator.hpp>
|
||||
#include <boost/signals2/detail/unique_lock.hpp>
|
||||
#include <boost/signals2/slot.hpp>
|
||||
@@ -48,11 +48,11 @@ namespace boost
|
||||
_connected = false;
|
||||
}
|
||||
virtual bool connected() const = 0;
|
||||
shared_ptr<void> get_blocker()
|
||||
std::shared_ptr<void> get_blocker()
|
||||
{
|
||||
unique_lock<connection_body_base> local_lock(*this);
|
||||
shared_ptr<void> blocker = _weak_blocker.lock();
|
||||
if(blocker == shared_ptr<void>())
|
||||
std::shared_ptr<void> blocker = _weak_blocker.lock();
|
||||
if(blocker == std::shared_ptr<void>())
|
||||
{
|
||||
blocker.reset(this, &null_deleter);
|
||||
_weak_blocker = blocker;
|
||||
@@ -161,26 +161,26 @@ namespace boost
|
||||
~connection() {}
|
||||
void disconnect() const
|
||||
{
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
boost::std::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
if(connectionBody == 0) return;
|
||||
connectionBody->disconnect();
|
||||
}
|
||||
bool connected() const
|
||||
{
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
boost::std::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
if(connectionBody == 0) return false;
|
||||
return connectionBody->connected();
|
||||
}
|
||||
bool blocked() const
|
||||
{
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
boost::std::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
if(connectionBody == 0) return true;
|
||||
return connectionBody->blocked();
|
||||
}
|
||||
bool operator==(const connection& other) const
|
||||
{
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
boost::shared_ptr<detail::connection_body_base> otherConnectionBody(other._weak_connection_body.lock());
|
||||
boost::std::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
boost::std::shared_ptr<detail::connection_body_base> otherConnectionBody(other._weak_connection_body.lock());
|
||||
return connectionBody == otherConnectionBody;
|
||||
}
|
||||
bool operator!=(const connection& other) const
|
||||
@@ -189,8 +189,8 @@ namespace boost
|
||||
}
|
||||
bool operator<(const connection& other) const
|
||||
{
|
||||
boost::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
boost::shared_ptr<detail::connection_body_base> otherConnectionBody(other._weak_connection_body.lock());
|
||||
boost::std::shared_ptr<detail::connection_body_base> connectionBody(_weak_connection_body.lock());
|
||||
boost::std::shared_ptr<detail::connection_body_base> otherConnectionBody(other._weak_connection_body.lock());
|
||||
return connectionBody < otherConnectionBody;
|
||||
}
|
||||
void swap(connection &other)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
// deconstruct.hpp
|
||||
//
|
||||
// A factory function for creating a shared_ptr which creates
|
||||
// an object and its owning shared_ptr with one allocation, similar
|
||||
// A factory function for creating a std::shared_ptr which creates
|
||||
// an object and its owning std::shared_ptr with one allocation, similar
|
||||
// to make_shared<T>(). It also supports postconstructors
|
||||
// and predestructors through unqualified calls of adl_postconstruct() and
|
||||
// adl_predestruct, relying on argument-dependent
|
||||
@@ -25,7 +25,7 @@
|
||||
// for more information
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
#include <boost/signals2/deconstruct_ptr.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
@@ -50,11 +50,11 @@ template<typename T>
|
||||
class postconstructor_invoker
|
||||
{
|
||||
public:
|
||||
operator const shared_ptr<T> & () const
|
||||
operator const std::shared_ptr<T> & () const
|
||||
{
|
||||
return postconstruct();
|
||||
}
|
||||
const shared_ptr<T>& postconstruct() const
|
||||
const std::shared_ptr<T>& postconstruct() const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
{
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
}
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template<class... Args>
|
||||
const shared_ptr<T>& postconstruct(Args && ... args)
|
||||
const std::shared_ptr<T>& postconstruct(Args && ... args)
|
||||
{
|
||||
if(!_postconstructed)
|
||||
{
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
}
|
||||
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template<typename A1>
|
||||
const shared_ptr<T>& postconstruct(const A1 &a1) const
|
||||
const std::shared_ptr<T>& postconstruct(const A1 &a1) const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
{
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
return _sp;
|
||||
}
|
||||
template<typename A1, typename A2>
|
||||
const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2) const
|
||||
const std::shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2) const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
{
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
return _sp;
|
||||
}
|
||||
template<typename A1, typename A2, typename A3>
|
||||
const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3) const
|
||||
const std::shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3) const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
{
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
return _sp;
|
||||
}
|
||||
template<typename A1, typename A2, typename A3, typename A4>
|
||||
const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) const
|
||||
const std::shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
{
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
return _sp;
|
||||
}
|
||||
template<typename A1, typename A2, typename A3, typename A4, typename A5>
|
||||
const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) const
|
||||
const std::shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
{
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
}
|
||||
template<typename A1, typename A2, typename A3, typename A4, typename A5,
|
||||
typename A6>
|
||||
const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5,
|
||||
const std::shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5,
|
||||
const A6 &a6) const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
}
|
||||
template<typename A1, typename A2, typename A3, typename A4, typename A5,
|
||||
typename A6, typename A7>
|
||||
const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5,
|
||||
const std::shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5,
|
||||
const A6 &a6, const A7 &a7) const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
}
|
||||
template<typename A1, typename A2, typename A3, typename A4, typename A5,
|
||||
typename A6, typename A7, typename A8>
|
||||
const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5,
|
||||
const std::shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5,
|
||||
const A6 &a6, const A7 &a7, const A8 &a8) const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
}
|
||||
template<typename A1, typename A2, typename A3, typename A4, typename A5,
|
||||
typename A6, typename A7, typename A8, typename A9>
|
||||
const shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5,
|
||||
const std::shared_ptr<T>& postconstruct(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5,
|
||||
const A6 &a6, const A7 &a7, const A8 &a8, const A9 &a9) const
|
||||
{
|
||||
if(!_postconstructed)
|
||||
@@ -186,10 +186,10 @@ public:
|
||||
#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
private:
|
||||
friend class boost::signals2::deconstruct_access;
|
||||
postconstructor_invoker(const shared_ptr<T> & sp):
|
||||
postconstructor_invoker(const std::shared_ptr<T> & sp):
|
||||
_sp(sp), _postconstructed(false)
|
||||
{}
|
||||
shared_ptr<T> _sp;
|
||||
std::shared_ptr<T> _sp;
|
||||
mutable bool _postconstructed;
|
||||
};
|
||||
|
||||
@@ -269,7 +269,7 @@ public:
|
||||
template< class T >
|
||||
static postconstructor_invoker<T> deconstruct()
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -278,7 +278,7 @@ public:
|
||||
new( pv ) T();
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
|
||||
@@ -291,7 +291,7 @@ public:
|
||||
template< class T, class... Args >
|
||||
static postconstructor_invoker<T> deconstruct( Args && ... args )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -300,7 +300,7 @@ public:
|
||||
new( pv ) T( std::forward<Args>( args )... );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
template< class T, class A1 >
|
||||
static postconstructor_invoker<T> deconstruct( A1 const & a1 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -319,7 +319,7 @@ public:
|
||||
new( pv ) T( a1 );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
@@ -327,7 +327,7 @@ public:
|
||||
template< class T, class A1, class A2 >
|
||||
static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
new( pv ) T( a1, a2 );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public:
|
||||
template< class T, class A1, class A2, class A3 >
|
||||
static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -353,7 +353,7 @@ public:
|
||||
new( pv ) T( a1, a2, a3 );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
@@ -361,7 +361,7 @@ public:
|
||||
template< class T, class A1, class A2, class A3, class A4 >
|
||||
static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -370,7 +370,7 @@ public:
|
||||
new( pv ) T( a1, a2, a3, a4 );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
@@ -378,7 +378,7 @@ public:
|
||||
template< class T, class A1, class A2, class A3, class A4, class A5 >
|
||||
static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -387,7 +387,7 @@ public:
|
||||
new( pv ) T( a1, a2, a3, a4, a5 );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
@@ -395,7 +395,7 @@ public:
|
||||
template< class T, class A1, class A2, class A3, class A4, class A5, class A6 >
|
||||
static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -404,7 +404,7 @@ public:
|
||||
new( pv ) T( a1, a2, a3, a4, a5, a6 );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
@@ -412,7 +412,7 @@ public:
|
||||
template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 >
|
||||
static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -421,7 +421,7 @@ public:
|
||||
new( pv ) T( a1, a2, a3, a4, a5, a6, a7 );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
@@ -429,7 +429,7 @@ public:
|
||||
template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 >
|
||||
static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -438,7 +438,7 @@ public:
|
||||
new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8 );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
@@ -446,7 +446,7 @@ public:
|
||||
template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 >
|
||||
static postconstructor_invoker<T> deconstruct( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 )
|
||||
{
|
||||
boost::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
boost::std::shared_ptr< T > pt( static_cast< T* >( 0 ), detail::deconstruct_deleter< T >() );
|
||||
|
||||
detail::deconstruct_deleter< T > * pd = boost::get_deleter< detail::deconstruct_deleter< T > >( pt );
|
||||
|
||||
@@ -455,7 +455,7 @@ public:
|
||||
new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
|
||||
pd->set_initialized();
|
||||
|
||||
boost::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::std::shared_ptr< T > retval( pt, static_cast< T* >( pv ) );
|
||||
boost::detail::sp_enable_shared_from_this(&retval, retval.get(), retval.get());
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// DEPRECATED in favor of adl_postconstruct and adl_predestruct with
|
||||
// deconstruct<T>().
|
||||
// A factory function for creating a shared_ptr that enhances the plain
|
||||
// shared_ptr constructors by adding support for postconstructors
|
||||
// A factory function for creating a std::shared_ptr that enhances the plain
|
||||
// std::shared_ptr constructors by adding support for postconstructors
|
||||
// and predestructors through the boost::signals2::postconstructible and
|
||||
// boost::signals2::predestructible base classes.
|
||||
//
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/signals2/postconstructible.hpp>
|
||||
#include <boost/signals2/predestructible.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -63,17 +63,17 @@ namespace boost
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
shared_ptr<T> deconstruct_ptr(T *ptr)
|
||||
std::shared_ptr<T> deconstruct_ptr(T *ptr)
|
||||
{
|
||||
if(ptr == 0) return shared_ptr<T>(ptr);
|
||||
shared_ptr<T> shared(ptr, boost::signals2::predestructing_deleter<T>());
|
||||
if(ptr == 0) return std::shared_ptr<T>(ptr);
|
||||
std::shared_ptr<T> shared(ptr, boost::signals2::predestructing_deleter<T>());
|
||||
detail::do_postconstruct(ptr);
|
||||
return shared;
|
||||
}
|
||||
template<typename T, typename D>
|
||||
shared_ptr<T> deconstruct_ptr(T *ptr, D deleter)
|
||||
std::shared_ptr<T> deconstruct_ptr(T *ptr, D deleter)
|
||||
{
|
||||
shared_ptr<T> shared(ptr, deleter);
|
||||
std::shared_ptr<T> shared(ptr, deleter);
|
||||
if(ptr == 0) return shared;
|
||||
detail::do_postconstruct(ptr);
|
||||
return shared;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// helper code for dealing with tracking non-boost shared_ptr/weak_ptr
|
||||
// helper code for dealing with tracking non-boost std::shared_ptr/weak_ptr
|
||||
|
||||
// Copyright Frank Mori Hess 2009.
|
||||
// Distributed under the Boost Software License, Version
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<typename T> class shared_ptr;
|
||||
template<typename T> class std::shared_ptr;
|
||||
template<typename T> class weak_ptr;
|
||||
|
||||
namespace signals2
|
||||
@@ -40,7 +40,7 @@ namespace boost
|
||||
{};
|
||||
template<typename T> struct weak_ptr_traits<boost::weak_ptr<T> >
|
||||
{
|
||||
typedef boost::shared_ptr<T> shared_type;
|
||||
typedef boost::std::shared_ptr<T> shared_type;
|
||||
};
|
||||
#ifndef BOOST_SIGNALS2_NO_CXX11_SMART_PTR
|
||||
template<typename T> struct weak_ptr_traits<std::weak_ptr<T> >
|
||||
@@ -52,7 +52,7 @@ namespace boost
|
||||
template<typename SharedPtr> struct shared_ptr_traits
|
||||
{};
|
||||
|
||||
template<typename T> struct shared_ptr_traits<boost::shared_ptr<T> >
|
||||
template<typename T> struct shared_ptr_traits<boost::std::shared_ptr<T> >
|
||||
{
|
||||
typedef boost::weak_ptr<T> weak_type;
|
||||
};
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace boost
|
||||
{}
|
||||
|
||||
ExtendedSlotFunction _fun;
|
||||
boost::shared_ptr<connection> _connection;
|
||||
boost::std::shared_ptr<connection> _connection;
|
||||
};
|
||||
|
||||
template<BOOST_SIGNALS2_SIGNAL_TEMPLATE_DECL(BOOST_SIGNALS2_NUM_ARGS)>
|
||||
@@ -139,7 +139,7 @@ namespace boost
|
||||
#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
typedef slot_call_iterator_cache<nonvoid_slot_result_type, slot_invoker> slot_call_iterator_cache_type;
|
||||
typedef typename group_key<Group>::type group_key_type;
|
||||
typedef shared_ptr<connection_body<group_key_type, slot_type, Mutex> > connection_body_type;
|
||||
typedef std::shared_ptr<connection_body<group_key_type, slot_type, Mutex> > connection_body_type;
|
||||
typedef grouped_list<Group, GroupCompare, connection_body_type> connection_list_type;
|
||||
typedef BOOST_SIGNALS2_BOUND_EXTENDED_SLOT_FUNCTION_N(BOOST_SIGNALS2_NUM_ARGS)<extended_slot_function_type>
|
||||
bound_extended_slot_function_type;
|
||||
@@ -191,7 +191,7 @@ namespace boost
|
||||
// disconnect slot(s)
|
||||
void disconnect_all_slots()
|
||||
{
|
||||
shared_ptr<invocation_state> local_state =
|
||||
std::shared_ptr<invocation_state> local_state =
|
||||
get_readable_state();
|
||||
typename connection_list_type::iterator it;
|
||||
for(it = local_state->connection_bodies().begin();
|
||||
@@ -202,7 +202,7 @@ namespace boost
|
||||
}
|
||||
void disconnect(const group_type &group)
|
||||
{
|
||||
shared_ptr<invocation_state> local_state =
|
||||
std::shared_ptr<invocation_state> local_state =
|
||||
get_readable_state();
|
||||
group_key_type group_key(grouped_slots, group);
|
||||
typename connection_list_type::iterator it;
|
||||
@@ -223,7 +223,7 @@ namespace boost
|
||||
// emit signal
|
||||
result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS))
|
||||
{
|
||||
shared_ptr<invocation_state> local_state;
|
||||
std::shared_ptr<invocation_state> local_state;
|
||||
typename connection_list_type::iterator it;
|
||||
{
|
||||
unique_lock<mutex_type> list_lock(_mutex);
|
||||
@@ -247,7 +247,7 @@ namespace boost
|
||||
}
|
||||
result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const
|
||||
{
|
||||
shared_ptr<invocation_state> local_state;
|
||||
std::shared_ptr<invocation_state> local_state;
|
||||
typename connection_list_type::iterator it;
|
||||
{
|
||||
unique_lock<mutex_type> list_lock(_mutex);
|
||||
@@ -271,7 +271,7 @@ namespace boost
|
||||
}
|
||||
std::size_t num_slots() const
|
||||
{
|
||||
shared_ptr<invocation_state> local_state =
|
||||
std::shared_ptr<invocation_state> local_state =
|
||||
get_readable_state();
|
||||
typename connection_list_type::iterator it;
|
||||
std::size_t count = 0;
|
||||
@@ -284,7 +284,7 @@ namespace boost
|
||||
}
|
||||
bool empty() const
|
||||
{
|
||||
shared_ptr<invocation_state> local_state =
|
||||
std::shared_ptr<invocation_state> local_state =
|
||||
get_readable_state();
|
||||
typename connection_list_type::iterator it;
|
||||
for(it = local_state->connection_bodies().begin();
|
||||
@@ -396,8 +396,8 @@ namespace boost
|
||||
private:
|
||||
invocation_state(const invocation_state &);
|
||||
|
||||
shared_ptr<connection_list_type> _connection_bodies;
|
||||
shared_ptr<combiner_type> _combiner;
|
||||
std::shared_ptr<connection_list_type> _connection_bodies;
|
||||
std::shared_ptr<combiner_type> _combiner;
|
||||
};
|
||||
// Destructor of invocation_janitor does some cleanup when a signal invocation completes.
|
||||
// Code can't be put directly in signal's operator() due to complications from void return types.
|
||||
@@ -500,7 +500,7 @@ namespace boost
|
||||
}
|
||||
nolock_cleanup_connections_from(false, _shared_state->connection_bodies().begin());
|
||||
}
|
||||
shared_ptr<invocation_state> get_readable_state() const
|
||||
std::shared_ptr<invocation_state> get_readable_state() const
|
||||
{
|
||||
unique_lock<mutex_type> list_lock(_mutex);
|
||||
return _shared_state;
|
||||
@@ -517,7 +517,7 @@ namespace boost
|
||||
template<typename T>
|
||||
void do_disconnect(const T &slot, mpl::bool_<false> /* is_group */)
|
||||
{
|
||||
shared_ptr<invocation_state> local_state =
|
||||
std::shared_ptr<invocation_state> local_state =
|
||||
get_readable_state();
|
||||
typename connection_list_type::iterator it;
|
||||
for(it = local_state->connection_bodies().begin();
|
||||
@@ -576,7 +576,7 @@ namespace boost
|
||||
}
|
||||
|
||||
// _shared_state is mutable so we can do force_cleanup_connections during a const invocation
|
||||
mutable shared_ptr<invocation_state> _shared_state;
|
||||
mutable std::shared_ptr<invocation_state> _shared_state;
|
||||
mutable typename connection_list_type::iterator _garbage_collector_it;
|
||||
// connection list mutex must never be locked when attempting a blocking lock on a slot,
|
||||
// or you could deadlock.
|
||||
@@ -715,12 +715,12 @@ namespace boost
|
||||
return (*_pimpl).set_combiner(combiner_arg);
|
||||
}
|
||||
protected:
|
||||
virtual shared_ptr<void> lock_pimpl() const
|
||||
virtual std::shared_ptr<void> lock_pimpl() const
|
||||
{
|
||||
return _pimpl;
|
||||
}
|
||||
private:
|
||||
shared_ptr<impl_class>
|
||||
std::shared_ptr<impl_class>
|
||||
_pimpl;
|
||||
};
|
||||
|
||||
@@ -747,7 +747,7 @@ namespace boost
|
||||
{}
|
||||
result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS))
|
||||
{
|
||||
shared_ptr<detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)
|
||||
std::shared_ptr<detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)
|
||||
<BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> >
|
||||
shared_pimpl(_weak_pimpl.lock());
|
||||
if(shared_pimpl == 0) boost::throw_exception(expired_slot());
|
||||
@@ -755,7 +755,7 @@ namespace boost
|
||||
}
|
||||
result_type operator ()(BOOST_SIGNALS2_SIGNATURE_FULL_ARGS(BOOST_SIGNALS2_NUM_ARGS)) const
|
||||
{
|
||||
shared_ptr<detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)
|
||||
std::shared_ptr<detail::BOOST_SIGNALS2_SIGNAL_IMPL_CLASS_NAME(BOOST_SIGNALS2_NUM_ARGS)
|
||||
<BOOST_SIGNALS2_SIGNAL_TEMPLATE_INSTANTIATION> >
|
||||
shared_pimpl(_weak_pimpl.lock());
|
||||
if(shared_pimpl == 0) boost::throw_exception(expired_slot());
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// A simple framework for creating objects with postconstructors.
|
||||
// The objects must inherit from boost::signals2::postconstructible, and
|
||||
// have their lifetimes managed by
|
||||
// boost::shared_ptr created with the boost::signals2::deconstruct_ptr()
|
||||
// boost::std::shared_ptr created with the boost::signals2::deconstruct_ptr()
|
||||
// function.
|
||||
//
|
||||
// Copyright Frank Mori Hess 2007-2008.
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<typename T> class shared_ptr;
|
||||
template<typename T> class std::shared_ptr;
|
||||
|
||||
namespace signals2
|
||||
{
|
||||
@@ -37,7 +37,7 @@ namespace boost
|
||||
public:
|
||||
friend void detail::do_postconstruct(const postconstructible *ptr);
|
||||
template<typename T>
|
||||
friend void adl_postconstruct(const shared_ptr<T> &sp, postconstructible *p)
|
||||
friend void adl_postconstruct(const std::shared_ptr<T> &sp, postconstructible *p)
|
||||
{
|
||||
p->postconstruct();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// A simple framework for creating objects with predestructors.
|
||||
// The objects must inherit from boost::signals2::predestructible, and
|
||||
// have their lifetimes managed by
|
||||
// boost::shared_ptr created with the boost::signals2::deconstruct_ptr()
|
||||
// boost::std::shared_ptr created with the boost::signals2::deconstruct_ptr()
|
||||
// function.
|
||||
//
|
||||
// Copyright Frank Mori Hess 2007-2008.
|
||||
@@ -29,7 +29,7 @@ namespace boost
|
||||
predestructible() {}
|
||||
public:
|
||||
template<typename T>
|
||||
friend void adl_postconstruct(const shared_ptr<T> &, ...)
|
||||
friend void adl_postconstruct(const std::shared_ptr<T> &, ...)
|
||||
{}
|
||||
friend void adl_predestruct(predestructible *p)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef BOOST_SIGNALS2_SHARED_CONNECTION_BLOCK_HPP
|
||||
#define BOOST_SIGNALS2_SHARED_CONNECTION_BLOCK_HPP
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
#include <boost/signals2/connection.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace boost
|
||||
void block()
|
||||
{
|
||||
if(blocking()) return;
|
||||
boost::shared_ptr<detail::connection_body_base> connection_body(_weak_connection_body.lock());
|
||||
boost::std::shared_ptr<detail::connection_body_base> connection_body(_weak_connection_body.lock());
|
||||
if(connection_body == 0)
|
||||
{
|
||||
// Make _blocker non-empty so the blocking() method still returns the correct value
|
||||
@@ -47,7 +47,7 @@ namespace boost
|
||||
}
|
||||
bool blocking() const
|
||||
{
|
||||
shared_ptr<void> empty;
|
||||
std::shared_ptr<void> empty;
|
||||
return _blocker < empty || empty < _blocker;
|
||||
}
|
||||
signals2::connection connection() const
|
||||
@@ -56,7 +56,7 @@ namespace boost
|
||||
}
|
||||
private:
|
||||
boost::weak_ptr<detail::connection_body_base> _weak_connection_body;
|
||||
shared_ptr<void> _blocker;
|
||||
std::shared_ptr<void> _blocker;
|
||||
};
|
||||
}
|
||||
} // end namespace boost
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
#include <boost/signals2/connection.hpp>
|
||||
#include <boost/signals2/detail/unique_lock.hpp>
|
||||
#include <boost/signals2/detail/replace_slot_function.hpp>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#define BOOST_SIGNALS2_SIGNAL_BASE_HPP
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace signals2 {
|
||||
@@ -25,7 +25,7 @@ namespace boost {
|
||||
|
||||
virtual ~signal_base() {}
|
||||
protected:
|
||||
virtual shared_ptr<void> lock_pimpl() const = 0;
|
||||
virtual std::shared_ptr<void> lock_pimpl() const = 0;
|
||||
};
|
||||
} // end namespace signals2
|
||||
} // end namespace boost
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define BOOST_SIGNALS2_SLOT_BASE_HPP
|
||||
|
||||
#include <boost/any.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <boost/signals2/detail/foreign_ptr.hpp>
|
||||
#include <boost/signals2/expired_slot.hpp>
|
||||
@@ -32,7 +32,7 @@ namespace boost
|
||||
class tracked_objects_visitor;
|
||||
|
||||
typedef boost::variant<boost::weak_ptr<void>, detail::foreign_void_weak_ptr > void_weak_ptr_variant;
|
||||
typedef boost::variant<boost::shared_ptr<void>, detail::foreign_void_shared_ptr > void_shared_ptr_variant;
|
||||
typedef boost::variant<boost::std::shared_ptr<void>, detail::foreign_void_shared_ptr > void_shared_ptr_variant;
|
||||
class lock_weak_ptr_visitor
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#define BOOST_SIGNALS2_TRACKABLE_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace signals2 {
|
||||
@@ -36,12 +36,12 @@ namespace boost {
|
||||
~trackable() {}
|
||||
private:
|
||||
friend class detail::tracked_objects_visitor;
|
||||
const shared_ptr<void>& get_shared_ptr() const
|
||||
const std::shared_ptr<void>& get_shared_ptr() const
|
||||
{
|
||||
return _tracked_ptr;
|
||||
}
|
||||
|
||||
shared_ptr<void> _tracked_ptr;
|
||||
std::shared_ptr<void> _tracked_ptr;
|
||||
};
|
||||
} // end namespace signals2
|
||||
} // end namespace boost
|
||||
|
||||
Reference in New Issue
Block a user