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
+1 -1
View File
@@ -16,7 +16,7 @@ Json::Value StringToJson(const std::string& str) {
Json::Value json;
Json::CharReaderBuilder builder;
std::stringstream stream(str);
std::istringstream stream{ str };
std::string errs;
if (!Json::parseFromStream(builder, stream, &json, &errs)) {
std::cerr << errs << std::endl;
+2 -2
View File
@@ -39,11 +39,11 @@ int main(int argc, char* argv[]) {
std::make_shared<BookListView>(),
{ "GET", "POST" });
server.Route(webcc::R("/books/(\\d+)"),
server.Route(webcc::R{ "/books/(\\d+)" },
std::make_shared<BookDetailView>(photo_dir),
{ "GET", "PUT", "DELETE" });
server.Route(webcc::R("/books/(\\d+)/photo"),
server.Route(webcc::R{ "/books/(\\d+)/photo" },
std::make_shared<BookPhotoView>(photo_dir),
{ "GET", "PUT", "DELETE" });