N
nick.keighley.zczc
Yes I read the FAQ! I'm not using a typedef as they don't seem to work withtemplates in C++98.
template<typename WB>
void EditProgramWizard:
opulateButton (MParameterButton* paramButton, WB* band,
int (WB::*read)(),
void (WB::*write)(int))
{
int (WB::*const_read)() = const_cast<int (WB::*)() const> (read);
PopulateButton (paramButton, band, const_read, write);
}
the cast fails with:
myprog.cpp: In member function ‘void EditProgramWizard:
opulateButton(MParameterButton*, WB*, int (WB::*)(), void (WB::*)(int)) [with WB = WeightBand]’:
myprog.cpp:464:125: instantiated from here
myprog.cpp:1521:68: error: invalid use of const_cast with type ‘int (WeightBand::*)()const’, which is not a pointer, reference, nor a pointer-to-data-member type
I was under the impression ‘int (WeightBand::*)()const' *was* a pointer.
Oh. Are pointers to member functions not const castable?
template<typename WB>
void EditProgramWizard:
int (WB::*read)(),
void (WB::*write)(int))
{
int (WB::*const_read)() = const_cast<int (WB::*)() const> (read);
PopulateButton (paramButton, band, const_read, write);
}
the cast fails with:
myprog.cpp: In member function ‘void EditProgramWizard:
myprog.cpp:464:125: instantiated from here
myprog.cpp:1521:68: error: invalid use of const_cast with type ‘int (WeightBand::*)()const’, which is not a pointer, reference, nor a pointer-to-data-member type
I was under the impression ‘int (WeightBand::*)()const' *was* a pointer.
Oh. Are pointers to member functions not const castable?