[wx-dev] wxDataViewItem::m_id type confusion

Robert Roebling robert at roebling.de
Sun Mar 2 01:25:37 PST 2008


Vadim wrote:

> RR> >  There is also something very strange going on with m_hash and m_useHash
> RR> > in wxDataViewIndexListModel. The latter is always false under Mac AFAICS
> RR> > but why then do we even compile all the code using m_hash there? I'm not
> RR> > worried about inefficiency here as much as about code clarity: having 2
> RR> > versions of each function isn't really ideal IMO. Why not provide 2
> RR> > versions of the (base) class, one using the array and the other one not
> RR> > using it?
> RR> 
> RR> Because the other platforms flip-flop between using a hash not
> RR> not using it at runtime.
> 
> Hmm, could you please point me where does this happen? I only see
> m_useHash being used in datavcmn.cpp.

My memory was wrong. The non-Mac code flip-flips between being
"ordered" and not being ordered, which is relevant for fast
lookup, but not between using the hash or not. So indeed, it
could be split into two classes. I'm not sure if it is worth
doing, though.

> RR> >  And as a final question, shouldn't we use wxVector instead of
> RR> > WX_DEFINE_ARRAY in this (new) code?
> RR> 
> RR> wxVector probably wasn't finished then. I'm also not sure 
> RR> what support for sorting we have in wxVector without STL.
> 
>  As you added wxQsort() anyhow we can use it with wxVector.

It would be nice if someone could implement a wxSort function
template based on wxQsort in absence of STL.

  Robert







More information about the wx-dev mailing list