introduce string_view

This commit is contained in:
Chunting Gu
2021-06-17 18:58:53 +08:00
parent 751a3539ae
commit 26bb6b341a
38 changed files with 404 additions and 344 deletions
+2 -4
View File
@@ -8,13 +8,12 @@
namespace webcc {
bool Router::Route(const std::string& url, ViewPtr view,
const Strings& methods) {
bool Router::Route(string_view url, ViewPtr view, const Strings& methods) {
assert(view);
// TODO: More error check
routes_.push_back({ url, {}, view, methods });
routes_.push_back({ ToString(url), {}, view, methods });
return true;
}
@@ -26,7 +25,6 @@ bool Router::Route(const UrlRegex& regex_url, ViewPtr view,
// TODO: More error check
try {
routes_.push_back({ "", regex_url(), view, methods });
} catch (const std::regex_error& e) {