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:
parent
c0847588ea
commit
1d71c6b80f
1 changed files with 42 additions and 0 deletions
|
@ -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 )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue