G
glen stark
Hi all.
I'm working with an array of member function pointers (they are all get
function of the class Bead). The typedef is:
typedef _real (Bead::*_beadGfp)(void);
I have a class System which contains both an array of function pointers:
std::vector<_beadGfp> msmtFPs;
And an array of pointers to RTSM, a class I've implemented for measurements.
std::vector<RTSM*> msmtPts;
I've overloaded the input operator '>>' for a value of _real (which is
just a typedef for long double)
//! Add a value to the time series
INLINE RTSM& operator>>(_real& is, RTSM& rtsm){
rtsm.bin[rtsm.bindex] = is;
++rtsm.bindex;
return rtsm;
}
And I'm trying call the member function, and feed the value it returns
into it's corresponding RTSM object. The code is this:
void System::do_measurements(){
for (_index i = 0; i<msmtPts.size(); ++i){
_real sh_t = (bead.*msmtFPs)();
(a) sh_t >>*(msmtPts);
(b) bead.*(msmtFPs)()>> *(msmtPts);
}
}
(a) works., (b) gives me:
system.cpp: In member function `void System::do_measurements()':
system.cpp:161: no match for `_real (Bead::*&)() >> RTSM&' operator
results.hpp:24: candidates are: RM& operator>>(_real&, RM&)
results.hpp:81: RTSM& operator>>(_real&, RTSM&)
which I guess a few of you would predict. Although I may understant why
this happens, I don't know how to get around it, other than by declaring
a temporary variable like (a). Can someone educate me?
Thanks,
Glen Stark.
(www.glenstark.org)
I'm working with an array of member function pointers (they are all get
function of the class Bead). The typedef is:
typedef _real (Bead::*_beadGfp)(void);
I have a class System which contains both an array of function pointers:
std::vector<_beadGfp> msmtFPs;
And an array of pointers to RTSM, a class I've implemented for measurements.
std::vector<RTSM*> msmtPts;
I've overloaded the input operator '>>' for a value of _real (which is
just a typedef for long double)
//! Add a value to the time series
INLINE RTSM& operator>>(_real& is, RTSM& rtsm){
rtsm.bin[rtsm.bindex] = is;
++rtsm.bindex;
return rtsm;
}
And I'm trying call the member function, and feed the value it returns
into it's corresponding RTSM object. The code is this:
void System::do_measurements(){
for (_index i = 0; i<msmtPts.size(); ++i){
_real sh_t = (bead.*msmtFPs)();
(a) sh_t >>*(msmtPts);
(b) bead.*(msmtFPs)()>> *(msmtPts);
}
}
(a) works., (b) gives me:
system.cpp: In member function `void System::do_measurements()':
system.cpp:161: no match for `_real (Bead::*&)() >> RTSM&' operator
results.hpp:24: candidates are: RM& operator>>(_real&, RM&)
results.hpp:81: RTSM& operator>>(_real&, RTSM&)
which I guess a few of you would predict. Although I may understant why
this happens, I don't know how to get around it, other than by declaring
a temporary variable like (a). Can someone educate me?
Thanks,
Glen Stark.
(www.glenstark.org)