diff --git a/route.cc b/route.cc index 45cdaa2..4e23225 100644 --- a/route.cc +++ b/route.cc @@ -4,21 +4,21 @@ namespace route { using namespace std; - Match Route::set(string u) { + Match Route::set(const string& u) { url = u; path_to_regex = regex(path_pattern); Match m(*this); return m; } - string Match::get(string key) { + string Match::get(const string& key) { if (pairs.count(key)) { return pairs.at(key); } return ""; } - bool Match::test(string tmpl) { + bool Match::test(const string& tmpl) { pairs.clear(); Path path; diff --git a/route.h b/route.h index 31d4c03..5da4b0f 100644 --- a/route.h +++ b/route.h @@ -57,7 +57,7 @@ class Route { // set the url for this instance, create a regex // from the url and return a match instance. // - Match set(string u); + Match set(const string& u); Route(/* options */) { // @@ -77,8 +77,8 @@ class Match { public: int keys; - string get(string key); - bool test(string tmpl); + string get(const string& key); + bool test(const string& tmpl); Match(Route &r) : route(&r) {} ~Match() {}