Objective-C++ template compile problem
Objective-C++ template compile problem
- Subject: Objective-C++ template compile problem
- From: David Cittadini <email@hidden>
- Date: Thu, 1 May 2003 05:10:34 +1000
I have just decided to look at Objective-C++ and templates. I have
tried to compile the following simple main.mm file but I get the error
message "internal error: Bus error". Does anyone know how I can get
around this? The example code I am using is from the Apple
Objective-C++ documentation.
Thanks, David.
#import <Cocoa/Cocoa.h>
template <class ARR, class TYPE> class TestT
{
public:
TYPE k;
int abc( ARR *array ) {
return [array count] * k;
}
};
template <class TYPE>
NSString *getDesc(void) {
return [TYPE description];
}
template <class TYPE>
int abc( TYPE *xyz, NSArray *array ) {
return [xyz count] + [array count];
}
int main(void)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"%@ == NSArray", getDesc<NSArray>());
NSArray* a1 = [[NSArray alloc]init];
NSArray* a2 = [[NSArray alloc]init];
TestT<NSArray, int> t;
t.k = 5;
NSLog(@"%d == %d", t.abc(a1) + t.abc(a2), abc(a1, a2) * t.k);
[pool release];
return 0;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.