From bd2dd4a8e41da76d3b4cd65e79a410c46c1d211d Mon Sep 17 00:00:00 2001 From: ushiyake Date: Mon, 9 Jan 2017 21:24:01 +0900 Subject: [PATCH] Fixed a problem that warning appeared in c ++ 11 --- include/crow/routing.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/include/crow/routing.h b/include/crow/routing.h index a8aa233c9..a7995bb51 100644 --- a/include/crow/routing.h +++ b/include/crow/routing.h @@ -456,10 +456,16 @@ namespace crow static_assert(!std::is_same()...))>::value, "Handler function cannot have void return type; valid return types: string, int, crow::resposne, crow::json::wvalue"); - handler_ = [f = std::move(f)](const request&, response& res, Args ... args){ + handler_ = ( +#ifdef CROW_CAN_USE_CPP14 + [f = std::move(f)] +#else + [f] +#endif + (const request&, response& res, Args ... args){ res = response(f(args...)); res.end(); - }; + }); } template @@ -475,10 +481,16 @@ namespace crow static_assert(!std::is_same(), std::declval()...))>::value, "Handler function cannot have void return type; valid return types: string, int, crow::resposne, crow::json::wvalue"); - handler_ = [f = std::move(f)](const crow::request& req, crow::response& res, Args ... args){ + handler_ = ( +#ifdef CROW_CAN_USE_CPP14 + [f = std::move(f)] +#else + [f] +#endif + (const crow::request& req, crow::response& res, Args ... args){ res = response(f(req, args...)); res.end(); - }; + }); } template