[SOLVED] What's wrong with my CachedValue?

Just following the example from SamplerPluginDemo but something is wrong:

class SamplerPanel : public Component
SamplerPanel(APVTS& apv);
APVTS& apvts;
CachedValue<Range<double>> totalRange;
SamplerPanel::SamplerPanel(APVTS& apv) :
    apvts(apv), totalRange(apv.state, IDS::totalRange, nullptr) {}

Generates this error:
/Applications/JUCE/modules/juce_core/containers/juce_Variant.h:352:61: No matching conversion for static_cast from 'const juce::var' to 'juce::Range<double>'

So basically I’m told that I can’t use Range<double> as a template argument for CachedValue, but this is working in the demo app, so what am I missing?

You haven’t implemented the VarientConverter for Range<>:

1 Like

Right! Thanks for the quick answer :+1: