I just upgraded to XCode 2 / gcc 4 and I'm trying to get my code up
to spec for the new compiler. I'm getting an error related to 'const'
and I'm not sure what changes I need to fix it.
In particular, I have a template class called TObjectArray that
extends my TArray template class. The difference between TObjectArray
and TArray is that TObjectArray stores instance *pointers* and acts
as their primary storage. I built this class so that as the array is
resized there is no need to relocate instance data, and as items are
added/removed they get constructed/deconstructed properly. Anyhow, I
have a set of methods that looks like this:
The last method is the one that gets the error in gcc4:
TArray.h:418: error: invalid conversion from 'FPChordGroup** const'
to 'const FPChordGroup**'
TArray.h:418: error: initializing argument 2 of 'void
TObjectArray<T>::InsertCopyBefore(UInt16, const T**, UInt16) [with T
= FPChordGroup]'
I can remove 'const' from the front of the &src argument and the
error goes away. The thing is, I want the source array (argument 2)
to be const to reassure the compiler that no changes will be made to
that array. But I'm probably misunderstanding the concept of const-
ness in some way.
What changes can I make to my code so that this error won't occur and
yet maintain the const-ness of that argument?
(Or would I save a lot of headaches by just using a subclass of
std::vector?)
--
Scott Lahteine
Thinkyhead Software
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden