@@ -84,10 +84,15 @@ @implementation OFMutableArray_placeholder - init { return (id)[[OFMutableArray_adjacent alloc] init]; } + +- initWithCapacity: (size_t)capacity +{ + return (id)[[OFMutableArray_adjacent alloc] initWithCapacity: capacity]; +} - initWithObject: (id)object { return (id)[[OFMutableArray_adjacent alloc] initWithObject: object]; } @@ -166,10 +171,15 @@ if (self == [OFMutableArray class]) return (id)&placeholder; return [super alloc]; } + ++ (instancetype)arrayWithCapacity: (size_t)capacity +{ + return [[[self alloc] initWithCapacity: capacity] autorelease]; +} - init { if (object_getClass(self) == [OFMutableArray class]) { @try { @@ -181,10 +191,22 @@ } } return [super init]; } + +- initWithCapacity: (size_t)capacity +{ + @try { + [self doesNotRecognizeSelector: _cmd]; + } @catch (id e) { + [self release]; + @throw e; + } + + abort(); +} - copy { return [[OFArray alloc] initWithArray: self]; }