I have some trouble saving an Array (containing a list of int’s) and then loading it again. The loaded array contains 0 elements for some weird reason. What am I doing wrong here?
std::vector<int> myData; // Contains data I want to save
// ...later I do the following:
jassert(myData.size() >= 2);
juce::Array<var> outputData;
outputData.resize((int) myData.size());
for (int i = 0; i < myData.size(); ++i)
outputData.getReference(i) = myData[i];
juce::ValueTree node(MyIDs::type);
node.setProperty(MyIDs::this_and_that, outputData, nullptr);
// ...elsewhere I load the above data:
jassert(node.hasProperty(MyIDs::this_and_that));
juce::Array<var> inputData = node[MyIDs::this_and_that];
jassert(inputData.size() >= 2);
// Assertion failed: the list size is 0!