@@ -133,6 +133,14 @@ public: | |||||
addAssumingCapacityIsReady (static_cast<ElementType&&> (firstNewElement), otherElements...); | addAssumingCapacityIsReady (static_cast<ElementType&&> (firstNewElement), otherElements...); | ||||
} | } | ||||
#if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||||
template <typename TypeToCreateFrom> | |||||
Array (const std::initializer_list<TypeToCreateFrom>& items) | |||||
{ | |||||
addArray (items); | |||||
} | |||||
#endif | |||||
/** Destructor. */ | /** Destructor. */ | ||||
~Array() | ~Array() | ||||
{ | { | ||||
@@ -67,6 +67,13 @@ StringArray::StringArray (const wchar_t* const* initialStrings, int numberOfStri | |||||
strings.addArray (initialStrings, numberOfStrings); | strings.addArray (initialStrings, numberOfStrings); | ||||
} | } | ||||
#if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||||
StringArray::StringArray (const std::initializer_list<const char*>& stringList) | |||||
{ | |||||
strings.addArray (stringList); | |||||
} | |||||
#endif | |||||
StringArray& StringArray::operator= (const StringArray& other) | StringArray& StringArray::operator= (const StringArray& other) | ||||
{ | { | ||||
strings = other.strings; | strings = other.strings; | ||||
@@ -49,6 +49,10 @@ public: | |||||
template <typename... OtherElements> | template <typename... OtherElements> | ||||
StringArray (StringRef firstValue, OtherElements... otherValues) : strings (firstValue, otherValues...) {} | StringArray (StringRef firstValue, OtherElements... otherValues) : strings (firstValue, otherValues...) {} | ||||
#if JUCE_COMPILER_SUPPORTS_INITIALIZER_LISTS | |||||
StringArray (const std::initializer_list<const char*>& strings); | |||||
#endif | |||||
/** Creates an array from a raw array of strings. | /** Creates an array from a raw array of strings. | ||||
@param strings an array of strings to add | @param strings an array of strings to add | ||||
@param numberOfStrings how many items there are in the array | @param numberOfStrings how many items there are in the array | ||||