Geoff McLane wrote:
>
> Hi,
>
> I can see nothing 'wrong' in the construct in
> FGPropertyManager.h that should give 'pause'
> to a compiler ... as other compilers have proved.
>
The construct is legal Std C++. MSVC is at fault.
> You will note msvc does NOT require any such
> 'agressively additional casting' when used in the
> 5 parameters case -
>
> That is, from say FGAircraft.cpp -
> This FAILS ????
> PropertyManager->Tie("metrics/eyepoint-z-ft", this,3,
> &FGAircraft::GetXYZep);
>
> While this WORKS ???? Why ???
> PropertyManager->Tie("metrics/alpha-max-deg", this,
> &FGAircraft::GetAlphaCLMax,
> &FGAircraft::SetAlphaCLMax,
> true);
>
> The difference is in the 'casting' of the (*getter).
>
> In the second the getter is 'double get()' style, while
> the 'other' getter is 'double get(index)' style, and the
> compiler misses the connection ...
>
The difference is that there are two FGAircraft::GetXYZep functions:
class FGAircraft {
inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
inline double GetXYZep(int idx) const { return vXYZep(idx); }
MSVC is unable to disambiguate them given that the
FGPropertyManager::Tie prototype is visible and that "V
(T::*getter)(int) const" is an exact match when T=FGAircraft and
V=double. Removing the inlines doesn't help either. The conclusion is
that MSVC is wrong but we can help it by providing a "hint" in the form
of an appropriate cast.
Your second example works because there is only one
FGAircraft::GetAlphaCLMax(). As a test I added an overloaded
"GetAlphaCLMax(int) const" member function and got the same compilation
error.
Cheers,
Bernie
_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel