C++ arrays

1. Initialize array using STL:

const int ArraySize = 1000;
int Array[ArraySize];
std::generate(Array, Array+ArraySize, rand); // Generate random array
for(auto& x : Array) x++;
for(auto x : Array) cout << x;

2. STL array:

array MyArray;
MyArray.fill(40); // or 'assign'
for_each(MyArray.cbegin(), MyArray.cend(), 
      [](int n) { std::wcout << n << "\t";} );
auto pArray = MyArray.data();

typedef array MyArrayType;
MyArrayType Array1 = {1,2,4,8,16};
MyArrayType Array2;
Array2.assign(64);

Array1.swap(Array2);

if (Array2 == Array1)
    wcout << "Same";
else
    wcout << "Not Same";

some useful tips (mostly for myself)