|
-
September 24th, 2009, 07:55 PM
#16
Re: Need advice - what to use CStringArray or CStringList
 Originally Posted by ahmd
3. Then when I need to find if a certain file is in the array during the second pass I do the following:
Code:
for(int i = 0; i < pArrConvFiles->GetCount(); i++)
{
if(strFile.CompareNoCase(pArrConvFiles->GetAt(i)) == 0)
{
//Found it
return TRUE;
}
}
return FALSE;
If you sorted the array of names first, then you could use a binary search instead of looping through each element. Or maybe you should use a different container, one that has fast lookups (map, for example).
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|