mirror of
https://github.com/Braffolk/ds_array.git
synced 2025-06-18 08:55:32 -04:00
Optimised find_index
This commit is contained in:
parent
276bfd4a02
commit
4c67a16d41
11
TArray.h
11
TArray.h
@ -98,15 +98,8 @@ class TArray_type : public TArray {
|
||||
}
|
||||
|
||||
inline int find_index( double val, int offset ) {
|
||||
int index = -1;
|
||||
T find = ( T ) val;
|
||||
for( int n = offset; n < this->size; n++ ) {
|
||||
if( this->data[ n ] == find ) {
|
||||
index = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
int found = std::find( this->data + offset, this->data + this->size, ( T ) val ) - this->data;
|
||||
return ( found != this->size ) ? ( found ) : ( -1 );
|
||||
}
|
||||
|
||||
inline unsigned int write_compressed( char* buffer, unsigned int offset ) {
|
||||
|
Loading…
Reference in New Issue
Block a user