Reference-counting helpers - Clean-up

This commit is contained in:
Emmanuel BENOîT 2019-01-02 17:25:09 +01:00
parent 270da6492a
commit 5f3911a067
2 changed files with 14 additions and 12 deletions

View file

@ -164,17 +164,6 @@ class T_RcPtr
template< typename T > template< typename T >
void swap( T_RcPtr< T >& lhs , T_RcPtr< T >& rhs ) noexcept; void swap( T_RcPtr< T >& lhs , T_RcPtr< T >& rhs ) noexcept;
template< typename T >
inline T_RcPtr< T > T_RcPtr< T >::FromRaw(
T* ptr ) noexcept
{
assert( ptr->getReferenceCount( ) == 0 );
T_RcPtr< T > rv;
ptr->increaseReferences_( );
rv.target_ = ptr;
return rv;
}
} // namespace } // namespace
#endif // _H_EBCL_REFCOUNT #endif // _H_EBCL_REFCOUNT

View file

@ -47,6 +47,8 @@ inline T_RcPtr< T >::~T_RcPtr( ) noexcept
clear( ); clear( );
} }
/*----------------------------------------------------------------------------*/
template< typename T > template< typename T >
template< typename... AT > template< typename... AT >
inline T_RcPtr< T > T_RcPtr< T >::New( inline T_RcPtr< T > T_RcPtr< T >::New(
@ -58,6 +60,17 @@ inline T_RcPtr< T > T_RcPtr< T >::New(
return ptr; return ptr;
} }
template< typename T >
inline T_RcPtr< T > T_RcPtr< T >::FromRaw(
T* ptr ) noexcept
{
assert( ptr->getReferenceCount( ) == 0 );
T_RcPtr< T > rv;
ptr->increaseReferences_( );
rv.target_ = ptr;
return rv;
}
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
template< typename T > template< typename T >