Пример #1
0
Association::~Association()
{
    if( !ownsElements() )
        return;
    if( &aKey != ZERO )
        delete &aKey;
    if( &aValue != ZERO )
        delete &aValue;
}
void Array::addAt( Object& toAdd, int atIndex )
{
    PRECONDITION( atIndex >= lowerbound );
    if( atIndex > upperbound )
        reallocate( atIndex - lowerbound + 1 );

    if( ptrAt( atIndex ) != ZERO )
        {
        if( ownsElements() )
            delete ptrAt( atIndex );
        itemsInContainer--;
        }

    setData( atIndex, &toAdd );
    itemsInContainer++;
    CHECK( itemsInContainer > 0 );
}