Open cmpunches opened 6 years ago
Particularly:
const std::string url = (crow::black_magic::const_str) route_specs.URL;
const std::string method = (crow::black_magic::const_str) route_specs.method;
const char * is also incompatible with crow::black_magic::const_str
It is compatible with constexpr char array. Have a look for the referenced issue for a small example. #281
It is compatible with constexpr char array. Have a look for the referenced issue for a small example. #281
It's not meant to work with const strings of any type, by design. Because it is declared constexpr
. So the value must be known at compile-time.
You have to use route_dynamic
, which is explained (with an example) in the linked issue.
It's also mentioned briefly in the documentation: https://crowcpp.org/master/guides/routes/#macro. But it's unclear why exactly its usage is "not recommended." It appears that many people still make use of it.
Probably this issue could be closed as works as designed, but I think this repo is abandoned.
/* #define CROW_ROUTE(app, url) app.route<crow::black_magic::get_parameter_tag(url)>(url) */
std::string url ="/xxx";
app.route<
crow::black_magic::get_parameter_tag(""
)>
(url.c_str())
These classes don't seem to be able to play well with built-ins which impacts abstractions during wrapping: