mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Add fast enumeration
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27711 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2309fc7d1e
commit
afb0f171c7
3 changed files with 40 additions and 1 deletions
|
@ -74,4 +74,23 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
||||
objects: (id*)stackbuf
|
||||
count: (NSUInteger)len
|
||||
{
|
||||
IMP nextObject = [self methodForSelector: @selector(nextObject)];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
id next = nextObject(self, @selector(nextObject));
|
||||
|
||||
if (nil == next)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
*(stackbuf+i) = next;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue