pistache icon indicating copy to clipboard operation
pistache copied to clipboard

Big parameter passed by value (PASS_BY_VALUE)

Open bradyguyer opened this issue 5 years ago • 1 comments

pass_by_value: Passing parameter response of type Pistache::Http::ResponseWriter (size 704 bytes) by value. File: router.h Line: 365

bradyguyer avatar Jan 13 '20 20:01 bradyguyer

@bradyguyer I'm not sure, but I think I cannot agree with you. In this casePistache::Http::ResponseWriter object is passed by value using move semantics: onRequest [std::move(resp)] -> route [std::move(response)] -> invokeHandler [std::forward<Args>(args)...] and as a result no copying here. and also moved in lamdba: func(request, std::move(response)); that is bound as a handler. You can go through these call and check. Also copying of ResponseWriter objects is prohibited:

    ResponseWriter& operator=(const ResponseWriter& other) = delete;

hyperxor avatar Jan 18 '20 21:01 hyperxor