From 5f3911a06776d888be67150117202be584a3dc8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Wed, 2 Jan 2019 17:25:09 +0100 Subject: [PATCH] Reference-counting helpers - Clean-up --- include/ebcl/RefCount.hh | 13 +------------ include/ebcl/inline/RefCount.hh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/ebcl/RefCount.hh b/include/ebcl/RefCount.hh index d8a0797..d82d14f 100644 --- a/include/ebcl/RefCount.hh +++ b/include/ebcl/RefCount.hh @@ -162,18 +162,7 @@ class T_RcPtr }; template< typename T > -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; -} + void swap( T_RcPtr< T >& lhs , T_RcPtr< T >& rhs ) noexcept; } // namespace diff --git a/include/ebcl/inline/RefCount.hh b/include/ebcl/inline/RefCount.hh index a10d80f..e23feca 100644 --- a/include/ebcl/inline/RefCount.hh +++ b/include/ebcl/inline/RefCount.hh @@ -47,6 +47,8 @@ inline T_RcPtr< T >::~T_RcPtr( ) noexcept clear( ); } +/*----------------------------------------------------------------------------*/ + template< typename T > template< typename... AT > inline T_RcPtr< T > T_RcPtr< T >::New( @@ -58,6 +60,17 @@ inline T_RcPtr< T > T_RcPtr< T >::New( 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 >