How can i return a function object based on a string literal argument?
This argument need not be a template, but I want to be able to input a string literal and return a function object
Im looking for something like:
template<const char * s> func_pointer(int arg);
I have tried returning a lambda. I have also tried returning a class operator() and a templated function. None work.
Any help is appreciated!
EDIT: calling the function with an extern variable
will not work for my purposes either.
EDIT: I am writing a language parser. I want to build framework for the parser to avoid rewriting a lot of code. Therefore, I want to be able to have a bunch of functions that parse the text. I want to have a base function that parses a single string literal (the program is lexed.), and I want to be able to pass in the string for each possible base function.
EDIT: Note that any function object that can convert a lambda and a function pointer to a generalized type(like std::function) will do.