function pointer trouble
string::size_type (*find_delimiter)(const basic_string&, string::size_type);
Keeps giving me a parameter mismatch error.
Either this is because find_last_of has several different versions that take didfferent types or numbers of parameters, or it's because the function pointer I declare is incorrect.
The prototypes according to the VC++ help file is
The last one is the one I want.
size_type find_last_of(E c, size_type pos = npos) const;
size_type find_last_of(const E *s, size_type pos = npos) const;
size_type find_last_of(const E *s, size_type pos, size_type n = npos) const;
size_type find_last_of(const basic_string& str, size_type pos = npos) const;
If I don't add string:: in front of size_type I get an error that size_type is undefined. So I changed it to string::size_type
Function Pointer Tutorial that I'm using
Correct me if I'm wrong, but it seems that you are trying to assign a pointer to a class method. Unless the method if static, I don't believe you can do this in standard C++.
In the tutorial they show how to assign class member functions to function pointers and call them using the pointer, but none of the functions have complexe parameters like find_last_of does.
One of the problems was with the multiple signatures of find_last_of. The VC++ documentation shows to add the signature in the assignment statement to define which find_last_of I want.
I also replaced all the typedefs. The is what I have now.
On the second line I get the error C2143: syntax error : missing ')' before 'const'
unsigned int(*find_delimiter)(const class std::basic_string &,unsigned int);
find_delimiter = &string::find_last_of(const class std::basic_string &,unsigned int);
Thanks in advance for the help.