M
ma740988
I'm perusing a question and curiosity got the best of me in part
because I cant solve the problem
Consider:
typedef unsigned int word_type ;
class foo {
public:
void set_mx_digits_1 ( word_type wt ) {}
void set_mx_digits_2 ( double dt ) { }
// lots more.
};
Within a file, you're given a typedef'd representation of the foo
functions and the input arguments to the functions. In other words:
// filename input_file.dat
typedef void ( foo::*set_mx_digits_1 )( word_type wt ), 15
typedef void ( foo::*set_mx_digits_2 )( double dt ), 3.6
// lots more
The goal is to read the contents of the file into an appropriate
container then invoke the member functions with the input arguments.
Now I could read the contents into a string and convert the numbers
from string to int, string to double etc, but how could one store the
typedef'd representation into a map without manual intervention ( I'm
not seeing a way to read a file and store function pointers in a
map ..to compound things the input arguments are different) is beyond
me.
Maybe I misunderstood, however, if a solution exists I'd like to see
it because I'm coming up short. Thanks in advance.
because I cant solve the problem
Consider:
typedef unsigned int word_type ;
class foo {
public:
void set_mx_digits_1 ( word_type wt ) {}
void set_mx_digits_2 ( double dt ) { }
// lots more.
};
Within a file, you're given a typedef'd representation of the foo
functions and the input arguments to the functions. In other words:
// filename input_file.dat
typedef void ( foo::*set_mx_digits_1 )( word_type wt ), 15
typedef void ( foo::*set_mx_digits_2 )( double dt ), 3.6
// lots more
The goal is to read the contents of the file into an appropriate
container then invoke the member functions with the input arguments.
Now I could read the contents into a string and convert the numbers
from string to int, string to double etc, but how could one store the
typedef'd representation into a map without manual intervention ( I'm
not seeing a way to read a file and store function pointers in a
map ..to compound things the input arguments are different) is beyond
me.
Maybe I misunderstood, however, if a solution exists I'd like to see
it because I'm coming up short. Thanks in advance.