Add std::vector of std::pairs to a ValueTree?

Hi All,

I’ve found myself needing to add a vector of std::pairs to a ValueTree.

I’d like to have a property on the tree “Pairs” which holds this data.

Anyone able to shed some light on how on earth I go about this ? Racking my brains.

So essentially a property in the tree with following structure:

<Pairs>
    <pair>
        <first>
            1
        </first>
        <second>
            2
        </second>
    </pair>
    <pair>
        <first>
            3
        </first>
        <second>
            4
        </second>
    </pair>
</Pairs>

Whats gonna be the cleanest way to do this ? Sorry guys, first attempts at using the ValueTree stuff.

Cheers

Oh wait. Being a numpty. Think I’ve got it.

fill us in!

1 Like

I haven’t done this myself, but as far as I know, you just need to implement these two functions for your type.
https://docs.juce.com/master/structVariantConverter.html