add FindIndex

This commit is contained in:
Glenn Maynard
2003-11-17 03:38:14 +00:00
parent 1697c25278
commit 929c8108c8
+9
View File
@@ -191,6 +191,15 @@ void SortCStringArray( CStringArray &AddTo, const bool bSortAcsending = true );
float calc_mean(const float *start, const float *end);
float calc_stddev(const float *start, const float *end);
template<class T1, class T2>
int FindIndex( const T1 &array, const T2 *p )
{
T1::const_iterator it = find( array.begin(), array.end(), p );
if( it == array.end() )
return -1;
return it - array.begin();
}
void TrimLeft(CString &str, const char *s = "\r\n\t ");
void TrimRight(CString &str, const char *s = "\r\n\t ");
void StripCrnl(CString &s);