Rgamer43
Rgamer43

Reputation: 662

No instance of function template with <typename T, int size> matches the argument list: rapidjson::GenericArray

I have a template function in C++, meant for converting a rapidjson::GenericArray into an std::array:

namespace jsonutils
{
    template <typename T, int size> 
    inline std::array<T, size> toArray(
        const rapidjson::GenericArray<false, rapidjson::Value>* value
    )
    {
        std::array<T, size> result;
        for (rapidjson::SizeType i = 0; i < value.Size(); i++)
        {
            result[i] = value[i];
        }
        return result;
    }
}

However, when I try the following:

const rapidjson::GenericArray<false, rapidjson::Value>* bNode = 
    &node["b"].GetArray();
int size = bNode->Size();
std::array<int, 3> b = jsonutils::toArray<int, size>(bNode);

I get the following errors:

When I hover over jsonutils::toArray in Visual Studio, it lists the template as template<class T, int size>.

Why does this call not work?

Upvotes: 0

Views: 49

Answers (0)

Related Questions