diff --git a/src/StrongPtr.cpp b/src/StrongPtr.cpp index 1f3b5c5..cdabcb0 100644 --- a/src/StrongPtr.cpp +++ b/src/StrongPtr.cpp @@ -15,6 +15,9 @@ #include +#include +#include + #include #ifdef DO_EXTRA_LOKI_TESTS #include @@ -38,6 +41,45 @@ namespace Private // ---------------------------------------------------------------------------- +void DeleteArrayBase::Swap( DeleteArrayBase & rhs ) +{ + assert( NULL != this ); + + const size_t temp = m_itemCount; + m_itemCount = rhs.m_itemCount; + rhs.m_itemCount = temp; +} + +// ---------------------------------------------------------------------------- + +void DeleteArrayBase::OnInit( const void * p ) const +{ + assert( NULL != this ); + if ( NULL == p ) + { + assert( 0 == m_itemCount ); + } + else + { + assert( 0 < m_itemCount ); + } +} + +// ---------------------------------------------------------------------------- + +void DeleteArrayBase::OnCheckRange( size_t index ) const +{ + assert( NULL != this ); + + if ( index < m_itemCount ) + return; + + const ::std::string message( "index out of range in ::Loki::DeleteArrayBase::OnCheckRange" ); + throw ::std::out_of_range( message ); +} + +// ---------------------------------------------------------------------------- + OneOwnerRefCountInfo::OneOwnerRefCountInfo( SingleOwnerRefCount * ptr ) : m_pointer( NULL ) , m_strongPtr( ptr )