[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [PATCH 3/3] Fix incorrect use of unqualified GetLabel().
From: |
Vadim Zeitlin |
Subject: |
Re: [lmi] [PATCH 3/3] Fix incorrect use of unqualified GetLabel(). |
Date: |
Thu, 2 Oct 2014 16:48:56 +0200 |
On Thu, 02 Oct 2014 14:34:32 +0000 Greg Chicares <address@hidden> wrote:
GC> On 2014-09-29 14:30Z, Vadim Zeitlin wrote:
GC> [...]
GC> > multidimgrid_tools.hpp | 2 +-
GC> [...]
GC> > @@ -360,7 +360,7 @@ void
AdjustableMaxBoundAxis<Integral>::UpdateChoiceControl
GC> >
GC> > while(choice.GetCount() < new_count)
GC> > {
GC> > - choice.Append(GetLabel(choice.GetCount() + min_value));
GC> > + choice.Append(this->GetLabel(choice.GetCount() + min_value));
GC> > }
GC>
GC> Okay, I see the problem, although I don't understand the solution.
GC> 'this' is of type AdjustableMaxBoundAxis<Integral>, which is
GC> derived from MultiDimAdjustableAxis, which is derived from...well,
GC> I guess ultimately this must lead to a wx class that implements
GC> GetLabel,
No, the class hierarchy is
AdjustableMaxBoundAxis<Integral>
MultiDimAdjustableAxis<T,MultiDimIntegralAxis<Integral>> // CRTP
MultiDimIntegralAxis<Integral>
MultiDimAxis<Integral>
MultiDimAxisAny
and GetLabel() is a pure virtual method of MultiDimAxisAny (which doesn't
derive from any wx-related class) and its implementation is provided by
MultiDimIntegralAxis<Integral>.
GC> though I didn't take the time to follow every link in a
GC> chain whose end I can't immediately see. Would it be okay if I
GC> instead used applied the following change?
GC>
GC> - choice.Append(GetLabel(choice.GetCount() + min_value));
GC> + choice.Append(choice.GetLabel(choice.GetCount() + min_value));
GC>
GC> I figure that 'choice.Append()' and 'choice.GetCount()' are
GC> already known to work, so 'choice.GetLabel()' should work as well.
I didn't test it, so this might work as well if the same labels are used
by wxChoice and MultiDimIntegralAxis<Integral>::GetLabel(), but this
doesn't look obvious, so I'd rather apply my proposed change and avoid
changing the code behaviour if it runs correctly now.
Regards,
VZ