At the moment I having following problem:
I want to assign an object of a class too a map struct
My goal is: If I call the map with the ids inside the brackets, the function must be start!
I know the following approach doesn't work. But I would be very nice, I someone can give me an idea or a tip how I can realize this approach...
Here is an example:
#include <map>
#include <functional>
#include <iostream>
class start {
public:
void sayhello() {
std::cout << "Hallo!!" << std::endl;
}
};
class end {
public:
void saybye() {
std::cout << "Bye!" << std::endl;
}
}
typedef void (*method)(void);
int main() {
std::map<int, std::map<int, std::map<int, method>>> myMap;
myMap[1][5][10] = start::sayhello;
myMap[2][1][20] = end::saybye;
// // usage:
myMap[1][5][10]();
myMap[2][1][20]();
}
Thank you very much for your support! <3