FR: StringArray constructor with initializer_list<String>



StringArray (const std::initializer_list<String>& strings);


StringArray::StringArray (const std::initializer_list<String>& stringList)
    strings.addArray (stringList);

Usage example:

StringArray daysOfTheWeek =
    TRANS ("Sunday"),
    TRANS ("Monday"),
    TRANS ("Tuesday"),
    TRANS ("Wednesday"),
    TRANS ("Thursday"),
    TRANS ("Friday"),
    TRANS ("Saturday")


I thought that was already added:

StringArray (const std::initializer_list<const char*>& strings);

Aah… never mind… I see your addition :blush:



To some extent it’s there, but only for const char*!


Yes, I noticed the difference but it was too late to delete my post… hence the :blush:




Bump, before getting drowned out by DSP module things!


I had been planning to add a bunch of variadic constructors and add methods to the arrays for this kind of thing, which should be more versatile than an initializer_list


Presumably this would mean, in terms of StringArray, that you can specify primitive types and various string formats (CharPointer_UTF8, CharPointer_UTF16)?


I think anything that could be cast to a string would work.