I am trying to create a redis credit. I have a class Querythat handles Redis requests. Each initial query word is a redis command, for example: GET fooor SET foo 123. When analyzing each request, I want to call a function that will analyze the request in accordance with the original word.
I created a string std::map<std::string, std::string(*)(std::string)>from a string to a function pointer.
query = "GET foo";
query_handler[query_type](query);
Now I have a question, where should these functions go? Within the class definition? Or a separate namespace? Or somewhere else?
source
share