Added ability for StrongPtr to handle arrays.

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1105 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
rich_sposato 2011-09-20 17:51:46 +00:00
parent c0847588ea
commit 1d71c6b80f

View file

@ -15,6 +15,9 @@
#include <loki/StrongPtr.h> #include <loki/StrongPtr.h>
#include <stdexcept>
#include <string>
#include <memory.h> #include <memory.h>
#ifdef DO_EXTRA_LOKI_TESTS #ifdef DO_EXTRA_LOKI_TESTS
#include <cassert> #include <cassert>
@ -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 ) OneOwnerRefCountInfo::OneOwnerRefCountInfo( SingleOwnerRefCount * ptr )
: m_pointer( NULL ) : m_pointer( NULL )
, m_strongPtr( ptr ) , m_strongPtr( ptr )