On Tue, Jul 21, 2009 at 10:08 AM, Douglas Gregor<[email protected]> wrote: > On Jul 9, 2009, at 1:00 PM, Fariborz Jahanian wrote: >> + int Last = AllBaseOrMembers.size(); >> + int curIndex = 0; >> + CXXBaseOrMemberInitializer *PrevMember = 0; >> + for (unsigned i = 0; i < NumMemInits; i++) { >> + CXXBaseOrMemberInitializer *Member = >> + static_cast<CXXBaseOrMemberInitializer*>(MemInits[i]); >> + void *MemberInCtorList; >> + if (Member->isBaseInitializer()) >> + MemberInCtorList = Member->getBaseClass(); >> + else >> + MemberInCtorList = Member->getMember(); >> + >> + int j; >> + for (j = curIndex; j < Last; j++) >> + if (MemberInCtorList == AllBaseOrMembers[j]) >> + break; > > It's too bad that this is O(N^2), but I can't think of a way to make > it faster without having the ability to sort the initializer list by > its initialization-position. Besides, the initializer list will > generally be short.
Am I missing something, why not just create a DenseMap from AllBaseOrMembers[j] -> j? (Assuming the contents of that array are distinct). (A SmallDenseMap ideally, if we happened to have that ADT) - Daniel _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
