I need a function that returns all members of a rapidjson::Value
as an std::vector
. I am trying to avoid to write if
s with IsArray()
everytime I need. Unfortunately the following code does not work.
std::vector<const rapidjson::Value&> valueToList(const rapidjson::Value& value)
{
std::vector<const rapidjson::Value&> valueList;
if (value.IsArray())
{
for (rapidjson::SizeType i = 0; i < value.Size(); i++)
{
valueList.push_back(val[i]);
}
}
else
{
valueList.push_back(val);
}
return valueList;
}
I get the error push_back is ambiguous. Is there an easy way to overcome this? Thanks.