diff --git a/examples/simple_example/api_v1_ApiTest.cc b/examples/simple_example/api_v1_ApiTest.cc index 1b8dfe09..5a7c3bfe 100755 --- a/examples/simple_example/api_v1_ApiTest.cc +++ b/examples/simple_example/api_v1_ApiTest.cc @@ -1,7 +1,7 @@ #include "api_v1_ApiTest.h" using namespace api::v1; //add definition of your processing function here -void ApiTest::get(const HttpRequestPtr& req,const std::function&callback,int p1,std::string p2) +void ApiTest::get(const HttpRequestPtr& req,const std::function&callback,int p1,std::string &&p2) { HttpViewData data; data.insert("title",std::string("ApiTest::get")); diff --git a/examples/simple_example/api_v1_ApiTest.h b/examples/simple_example/api_v1_ApiTest.h index cea661dd..63036d99 100755 --- a/examples/simple_example/api_v1_ApiTest.h +++ b/examples/simple_example/api_v1_ApiTest.h @@ -15,7 +15,7 @@ namespace api METHOD_LIST_END //your declaration of processing function maybe like this: - void get(const HttpRequestPtr& req,const std::function&callback,int p1,std::string p2); + void get(const HttpRequestPtr& req,const std::function&callback,int p1,std::string &&p2); void your_method_name(const HttpRequestPtr& req,const std::function&callback,double p1,int p2) const; }; } diff --git a/lib/inc/drogon/HttpApiBinder.h b/lib/inc/drogon/HttpApiBinder.h index 4d834f72..59c7153d 100755 --- a/lib/inc/drogon/HttpApiBinder.h +++ b/lib/inc/drogon/HttpApiBinder.h @@ -38,6 +38,10 @@ namespace drogon{ }; template struct BinderArgTypeTraits{ + static const bool isValid=true; + }; + template + struct BinderArgTypeTraits{ static const bool isValid=false; }; template @@ -108,7 +112,7 @@ namespace drogon{ { //call this function recursively until parameter's count equals to the count of target function parameters static_assert(BinderArgTypeTraits>::isValid, - "your handler argument type must be value type or const left reference type" + "your handler argument type must be value type or const left reference type or right reference type" ); typedef typename std::remove_cv>::type>::type ValueType; ValueType value=ValueType();