Reputation: 662
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:
jsonutils::toArray
" matches the argument list
const rapidjson::GenericArray<false, rapidjson::Value>
)jsonutils::toArray
': no matching overloaded function foundWhen 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