/*
* Copyright 1995, 1996 Perforce Software. All rights reserved.
*
* This file is part of Perforce - the FAST SCM System.
*/
/*
* intarray.h -- a cheesy, zero-based, automatically resized int array
*/
class IntArray {
public:
IntArray( int nInts = 4 )
{
ints = 0;
lInts = 0;
ReAlloc( nInts );
}
~IntArray()
{
delete []ints;
}
int& operator []( int x )
{
// geometric growth
if( x >= lInts ) ReAlloc( x * 3 / 2 );
return ints[x];
}
private:
void ReAlloc( int nInts )
{
int i = 0;
int *old = ints;
ints = new int[nInts];
for( ; i < lInts; i++ ) ints[i] = old[i];
for( ; i < nInts; i++ ) ints[i] = 0;
lInts = nInts;
delete []old;
}
int lInts;
int *ints;
};
# |
Change |
User |
Description |
Committed |
|
#1
|
15903 |
Matt Attaway |
Everything should be happy now between the Workshop and the depot paths |
|
|
//guest/perforce_software/p4/2014_2/support/intarray.h |
#1
|
15901 |
Matt Attaway |
Clean up code to fit modern Workshop naming standards |
|
|
//guest/perforce_software/p4/2014.2/support/intarray.h |
#1
|
12189 |
Matt Attaway |
Initial (and much belated) drop of 2014.2 p4 source code |
|
|