MakeArray()

System::MakeArray(std::initializer_list<T>) function

A factory function that constructs a new Array object, fills it with the elements from the specified initialization list and returns a smart pointer pointing to the Array object.

template<typename T> ArrayPtr<T> System::MakeArray(std::initializer_list<T> init)

Template parameters

ParameterDescription
TThe type of elements of the Array object the function constructs
#include "system/array.h"
#include <iostream>

int main()
{
  // Fill the array.
  auto arr = System::MakeArray<int>({-1, -123, 5, 3, 7});

  // Print elements of the array.
  for(auto item: arr)
  {
    std::cout << item << ' ';
  }
  std::cout << std::endl;

  return 0;
}
/
This code example produces the following output:
-1 -123 5 3 7
/

Arguments

ParameterTypeDescription
initstd::initializer_list<T>The initialization list containing the elements to fill the array with

Return Value

A smart pointer pointing to the constructed Array object

System::MakeArray(Args&&…) function

A factory function that constructs a new Array object passing the specified arguments to its constructor.

template<class T,class...> ArrayPtr<T> System::MakeArray(Args &&... args)

Template parameters

ParameterDescription
TThe type of elements of the Array object the function constructs

Arguments

ParameterTypeDescription
argsArgs&&…The arguments that are passed to the constructor of the Array object being constructed

Return Value

A smart pointer pointing to the constructed Array object

System::MakeArray(Integral, Args&&…) function

A factory function that constructs a new Array object passing the specified arguments to its constructor.

template<class T,class Integral,class...> std::enable_if<std::is_integral<Integral>::value, ArrayPtr<T>>::type System::MakeArray(Integral size, Args &&... args)

Template parameters

ParameterDescription
TThe type of elements of the Array object the function constructs
IntegralType of array size.

Arguments

ParameterTypeDescription
sizeIntegralSize of the array being created.
argsArgs&&…The arguments that are passed to the constructor of the Array object being constructed

Return Value

A smart pointer pointing to the constructed Array object

See Also