From 98e3e7b3c19e4baac46c244210759106fe85fc95 Mon Sep 17 00:00:00 2001 From: yhirose Date: Mon, 31 Mar 2014 21:07:56 -0400 Subject: [PATCH] Changed test and README to use the generic lambda. --- README.md | 4 ++-- test/Makefile | 6 +++--- test/test.cc | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a31ac10..e9d68a5 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Inspired by [Sinatra](http://www.sinatrarb.com/) and [express](https://github.co Server svr; - svr.get("/hi", [](const Request& req, Response& res) { + svr.get("/hi", [](const auto& req, auto& res) { res.set_content("Hello World!", "text/plain"); }); @@ -43,4 +43,4 @@ Client Example } } -Copyright (c) 2012 Yuji Hirose. All rights reserved. +Copyright (c) 2014 Yuji Hirose. All rights reserved. diff --git a/test/Makefile b/test/Makefile index 7f6c4ea..11ce67d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,10 +3,10 @@ USE_CLANG = 1 ifdef USE_CLANG CC = clang++ -CCFLAGS = -std=c++0x -stdlib=libc++ -g -DGTEST_USE_OWN_TR1_TUPLE +CCFLAGS = -std=c++1y -stdlib=libc++ -g -DGTEST_USE_OWN_TR1_TUPLE else -CC = g++-4.7 -CCFLAGS = -std=c++11 -g +CC = g++-4.9 +CCFLAGS = -std=c++1y -g endif all : test diff --git a/test/test.cc b/test/test.cc index 3bf1fa2..274c363 100644 --- a/test/test.cc +++ b/test/test.cc @@ -105,15 +105,15 @@ protected: virtual void SetUp() { svr_.set_base_dir("./www"); - svr_.get("/hi", [&](const Request& req, Response& res) { + svr_.get("/hi", [&](const auto& req, auto& res) { res.set_content("Hello World!", "text/plain"); }); - svr_.get("/", [&](const Request& req, Response& res) { + svr_.get("/", [&](const auto& req, auto& res) { res.set_redirect("/hi"); }); - svr_.post("/person", [&](const Request& req, Response& res) { + svr_.post("/person", [&](const auto& req, auto& res) { if (req.has_param("name") && req.has_param("note")) { persons_[req.params.at("name")] = req.params.at("note"); } else { @@ -121,7 +121,7 @@ protected: } }); - svr_.get("/person/(.*)", [&](const Request& req, Response& res) { + svr_.get("/person/(.*)", [&](const auto& req, auto& res) { string name = req.matches[1]; if (persons_.find(name) != persons_.end()) { auto note = persons_[name]; @@ -131,7 +131,7 @@ protected: } }); - svr_.get("/stop", [&](const Request& req, Response& res) { + svr_.get("/stop", [&](const auto& req, auto& res) { svr_.stop(); });