Taking advantage of std::make_unique()

This commit is contained in:
Veloman Yunkan 2023-11-29 21:19:55 +04:00
parent 7a85c92025
commit 5f27b4b651
1 changed files with 3 additions and 8 deletions

View File

@ -134,7 +134,7 @@ void Response::set_kind(Kind k)
std::unique_ptr<Response> Response::build()
{
return std::unique_ptr<Response>(new Response());
return std::make_unique<Response>();
}
std::unique_ptr<Response> Response::build_304(const ETag& etag)
@ -389,9 +389,7 @@ std::unique_ptr<ContentResponse> ContentResponse::build(
const std::string& content,
const std::string& mimetype)
{
return std::unique_ptr<ContentResponse>(new ContentResponse(
content,
mimetype));
return std::make_unique<ContentResponse>(content, mimetype);
}
std::unique_ptr<ContentResponse> ContentResponse::build(
@ -432,10 +430,7 @@ std::unique_ptr<Response> ItemResponse::build(const RequestContext& request, con
return response;
}
return std::unique_ptr<Response>(new ItemResponse(
item,
mimetype,
byteRange));
return std::make_unique<ItemResponse>(item, mimetype, byteRange);
}
MHD_Response*