Hi everybody,
I noticed that the NamedValueSet doesn’t have a constructor that takes a std::initializer_list
as parameter. This could be useful for writing almost JSON like data with a least possible amount of boilerplate like this:
NamedValueSet data =
{
{"item1", 20},
{"item2", "Blabla"}
};
The changes in the JUCE code are trivial. In NamedValueSet.h, add somewhere after the NamedValue definition:
#if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS
NamedValueSet(const std::initializer_list<NamedValue>& items) noexcept;
#endif
and in NamedValueSet.cpp:
#if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS
NamedValueSet::NamedValueSet(const std::initializer_list<NamedValue>& items) noexcept
: values(items)
{}
#endif
There is already something like this for ValueTrees, but the NamedValueSet deserves some C++11-love too…