Array in ValueTree

I'm using the ValueTree as the base for storing application data to disk.

So I got this Array<int> that I want to store. what is the best way to put the array inside the ValueTree?

You could add each int as a child ValueTree, or turn it into an Array<var> and store that in a var, which you can then store in a ValueTree.

You can trivially create an array like container that operates with the ValueTree for storage.  It's probably not as fast if you're in really time critical situation, but mighty convenient.

something like (untested): 

template <class ObjectType>

class ValueTreeArray {

ValueTreeArray(ValueTree & dataLocation) : tree(dataLocation) {}

ObjectType operator[](int i) const {

return tree.getChild(i)

}

private:

ValueTree tree; 

};

And so on until you have all the right container functionality.  If you put the right kind of iterator in as well it starts to get pretty useful.  I've got one here but it's got a depenency on something a bit too horrible to post :)

The advantage is that you can now have multiple arrays pointing at the same tree, but you can use it just like a normal array.