[wx-dev] wxDataViewItem::m_id type confusion

Vadim Zeitlin vadim at wxwidgets.org
Mon Mar 3 15:37:15 PST 2008


On Sun, 02 Mar 2008 10:25:37 +0100 Robert Roebling wrote:

RR> Vadim wrote:
RR> 
RR> > RR> >  There is also something very strange going on with m_hash and m_useHash
RR> > RR> > in wxDataViewIndexListModel. The latter is always false under Mac AFAICS
RR> > RR> > but why then do we even compile all the code using m_hash there? I'm not
RR> > RR> > worried about inefficiency here as much as about code clarity: having 2
RR> > RR> > versions of each function isn't really ideal IMO. Why not provide 2
RR> > RR> > versions of the (base) class, one using the array and the other one not
RR> > RR> > using it?
RR> > RR> 
RR> > RR> Because the other platforms flip-flop between using a hash not
RR> > RR> not using it at runtime.
RR> > 
RR> > Hmm, could you please point me where does this happen? I only see
RR> > m_useHash being used in datavcmn.cpp.
RR> 
RR> My memory was wrong. The non-Mac code flip-flips between being
RR> "ordered" and not being ordered, which is relevant for fast
RR> lookup, but not between using the hash or not. So indeed, it
RR> could be split into two classes. I'm not sure if it is worth
RR> doing, though.

 You'll have to take my word for it but when you look at this code for the
first time it's very confusing. Using 2 classes, one using the array (why
is it called hash anyhow) and the other one not using it but interspersed
together is not ideal from code comprehension point of view.

RR> >  As you added wxQsort() anyhow we can use it with wxVector.
RR> 
RR> It would be nice if someone could implement a wxSort function
RR> template based on wxQsort in absence of STL.

 An STL version is supposed to be stable, I'm not sure if our wxQsort is?

 Regards,
VZ





More information about the wx-dev mailing list