SkTDArrayarr; // create an empty array of integers arr.push_back(10); // add an element to the end of the array arr.push_back(20); arr.end()[-1] = 30; // modify the last element of the array
SkTDArrayThis code creates an array of SkPoint objects with an initial size of 3. The elements of the array are then assigned values and printed to the console. Package library: Skiapoints(3); // create an array of SkPoint objects with initial size 3 points[0] = {0, 0}; points[1] = {10, 0}; points[2] = {5, 5}; for (auto& p : points) { std::cout << "(" << p.x() << ", " << p.y() << ")" << std::endl; } // output the points in the array