SOLVED Best way to fill a maxon::BaseArray

Hi,
Sometimes I feel like a C++ dinosaur.
While the range-based for loop is available for quite a long time, I only discovered it a few years ago.
Same for some other new and exciting stuff ...

Probably known to many for a while (or longer), the following isn't yet set in stone into my aging memory.

// example 1
int myValues[] = { 1, 2, 3, 4 }; 

// example 2
std::vector<int> myValues = { 1, 2, 3, 4 };

Quite like how these options can reduce code.
Wondering how to initialize a maxon::BaseArray<> with known values, with least amount of code ?

Example 1 is the initialization of a C-array from a brace-enclosed list.

Example 2 is the construction of a std::vector object using an initializer list.

So, does maxon::BaseArray has initializer list constructors or methods?

Looking at the API, it seems it does not have such a constructor, but methods handling std::initializer_list. So you can actually write:

maxon::BaseArray<maxon::Int> testArray;
testArray.Append({ 1,2,3 }) iferr_return;

Kudos to @PluginStudent saying in Best way to fill a maxon::BaseArray:

maxon::BaseArraymaxon::Int testArray;
testArray.Append({ 1,2,3 }) iferr_return;

I confirm that only BaseArray::Append(), BaseArray::Insert() and BaseArray::Insert() can use an initialization list to add data to a BaseArray.

Cheers, R

@PluginStudent
@r_gigante
Thanks for chipping in.

If no more needs to be added I will set this as solved.

Just saw this thread...

What if I want to fill the whole array with the same value?

In Python this would be:

arrayOfOnes = [1] * 10000

Cheers,
Frank

Unfortunately, differently from std lib where it's possible to define and init a vector pretty easily using one-line statement( std::vector<int> a (10, 100);) this looks like being not currently possible with maxon::BaseArray() and you need to make it the usual way.

Best, R