?? sortarry.cpp
字號:
/*------------------------------------------------------------------------*/
/* */
/* SORTARRY.CPP */
/* */
/* Copyright Borland International 1991 */
/* All Rights Reserved */
/* */
/*------------------------------------------------------------------------*/
#if !defined( __SORTARRY_H )
#include <SortArry.h>
#endif // __SORTARRY_H
#ifndef __STDLIB_H
#include <stdlib.h>
#endif
#if !defined( __IOSTREAM_H )
#include <iostream.h>
#endif // __IOSTREAM_H
void SortedArray::add( Object& toAdd )
{
if( toAdd.isSortable() )
{
if( lastElementIndex == upperbound )
{
reallocate( arraySize() + 1 );
}
int insertionPoint = lowerbound;
while( insertionPoint <= lastElementIndex &&
(Sortable&)objectAt( insertionPoint ) < (Sortable&)toAdd
)
insertionPoint++;
insertEntry( insertionPoint );
setData( insertionPoint, &toAdd );
itemsInContainer++;
lastElementIndex++;
}
else
ClassLib_error( __ENOTSORT );
}
void SortedArray::detach( Object& toDetach, DeleteType dt )
{
int detachPoint = find( toDetach );
if( detachPoint != INT_MIN )
{
if( delObj(dt) )
delete ptrAt( detachPoint );
removeEntry( detachPoint );
itemsInContainer--;
if( detachPoint <= lastElementIndex )
lastElementIndex--;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -