Function toResponse

Summary

#include <lib/inc/drogon/HttpResponse.h>

(1) template <typename T>
    HttpResponsePtr toResponse(T &&)

(2) template <>
    HttpResponsePtr toResponse(Json::Value &&pJson)

Function overload

Synopsis

#include <lib/inc/drogon/HttpResponse.h>

template <typename T>
HttpResponsePtr toResponse(T &&)

Description

This template is used to create a response object from a custom type object by calling the newCustomHttpResponse(). Users must specialize the template for a particular type.

Source

Lines 49-55 in lib/inc/drogon/HttpResponse.h.

template <typename T>
HttpResponsePtr toResponse(T &&)
{
    LOG_ERROR << "You must specialize the toResponse template for the type of "
              << DrClassMap::demangle(typeid(T).name());
    exit(1);
}

Synopsis

#include <lib/inc/drogon/HttpResponse.h>

template <>
HttpResponsePtr toResponse(Json::Value &&pJson)

Description

No description yet.

Source

Lines 381-385 in lib/inc/drogon/HttpResponse.h. Line 59 in lib/inc/drogon/HttpResponse.h.

template <>
inline HttpResponsePtr toResponse(Json::Value &&pJson)
{
    return HttpResponse::newHttpJsonResponse(std::move(pJson));
}





Add Discussion as Guest

Log in to DocsForge