Function asArray

Synopsis

#include <orm_lib/inc/drogon/orm/Field.h>

template <typename T>
std::vector< std::shared_ptr< T > > asArray() const

Description

No description yet.

Source

Lines 120-145 in orm_lib/inc/drogon/orm/Field.h.

template <typename T>
std::vector<std::shared_ptr<T>> asArray() const
{
    std::vector<std::shared_ptr<T>> ret;
    auto arrParser = getArrayParser();
    while (1)
    {
        auto arrVal = arrParser.getNext();
        if (arrVal.first == ArrayParser::juncture::done)
        {
            break;
        }
        if (arrVal.first == ArrayParser::juncture::string_value)
        {
            T val;
            std::stringstream ss(std::move(arrVal.second));
            ss >> val;
            ret.push_back(std::shared_ptr<T>(new T(val)));
        }
        else if (arrVal.first == ArrayParser::juncture::null_value)
        {
            ret.push_back(std::shared_ptr<T>());
        }
    }
    return ret;
}





Add Discussion as Guest

Log in to DocsForge