mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-18 17:12:14 +11:00
🐎 thread_local
This commit is contained in:
parent
35ab4d9492
commit
805a7d05b3
1 changed files with 4 additions and 4 deletions
|
|
@ -1,15 +1,15 @@
|
||||||
#include "bank_resp.h"
|
#include "bank_resp.h"
|
||||||
|
|
||||||
BankResponse::BankResponse() noexcept = default;
|
BankResponse::BankResponse() noexcept = default;
|
||||||
BankResponse::BankResponse(drogon::HttpStatusCode code, std::string &&str) noexcept : first(code), second(str) {}
|
BankResponse::BankResponse(drogon::HttpStatusCode code, std::string &&str) noexcept : first(code), second(str) {}
|
||||||
BankResponse::BankResponse(drogon::HttpStatusCode code, const std::string &str) noexcept : first(code), second(str) {}
|
BankResponse::BankResponse(drogon::HttpStatusCode code, const std::string &str) noexcept : first(code), second(str) {}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
drogon::HttpResponsePtr drogon::toResponse(BankResponse &&data)
|
drogon::HttpResponsePtr drogon::toResponse(BankResponse &&data)
|
||||||
{
|
{
|
||||||
auto res = std::make_shared<HttpResponseImpl>(data.first, CT_APPLICATION_JSON);
|
static thread_local auto res = std::make_shared<HttpResponseImpl>(data.first, CT_APPLICATION_JSON);
|
||||||
res->setBody(std::move(data.second));
|
res->setBody(std::move(data.second));
|
||||||
auto &advices = HttpAppFrameworkImpl::instance().getResponseCreationAdvices();
|
static thread_local auto &advices = HttpAppFrameworkImpl::instance().getResponseCreationAdvices();
|
||||||
if (!advices.empty())
|
if (!advices.empty())
|
||||||
{
|
{
|
||||||
for (auto &advice : advices)
|
for (auto &advice : advices)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue