Say, I have this piece of code, in one of my classes, that defines
Right now, the signature to define the variable looks incredible.
std::map<std::string, std::map<std::string,
std::function<void(std::shared_ptr<HTTPRequest>,
std::shared_ptr<HTTPResponse>)>>> routeFunctions_;
I recently came to know about decltype, but unable to use this correctly.
decltype(x) routeFunctions_; // What should be there in the place of x ?
typedef to this type, if you often declare variables of it.auto or decltype, if you want to return value of this type from a function.decltype, if you want to get type of structure/class member.Look at this articles:
http://en.cppreference.com/w/cpp/language/auto http://en.cppreference.com/w/cpp/language/decltype
http://www.cprogramming.com/c++11/c++11-auto-decltype-return-value-after-function.html
Your choice in this case is a typedef:
typedef std::map<std::string, std::map<std::string,
std::function<void(std::shared_ptr<HTTPRequest>,
std::shared_ptr<HTTPResponse>)>>> RouteFunctionsContainer;
RouteFunctionsContainer routeFunctions_;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With