From b16905ec8b84944ed45cd1e24c3acd9c8e4fb710 Mon Sep 17 00:00:00 2001 From: hyperxor Date: Wed, 8 Jan 2020 23:13:04 +0300 Subject: [PATCH] Fix Response move --- httplib.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/httplib.h b/httplib.h index d060c92..3aa3f7b 100644 --- a/httplib.h +++ b/httplib.h @@ -300,7 +300,7 @@ struct Request { struct Response { std::string version; - int status; + int status = -1; Headers headers; std::string body; @@ -324,8 +324,11 @@ struct Response { std::function provider, std::function resource_releaser = [] {}); - Response() : status(-1), content_length(0) {} - + Response() = default; + Response(const Response&) = default; + Response& operator=(const Response&) = default; + Response(Response&&) = default; + Response& operator=(Response&&) = default; ~Response() { if (content_provider_resource_releaser) { content_provider_resource_releaser(); @@ -333,7 +336,7 @@ struct Response { } // private members... - size_t content_length; + size_t content_length = 0; ContentProvider content_provider; std::function content_provider_resource_releaser; };