TEST(ArrayTest, testAlgorithm) { // create and initialize array const int SIZE = 10; typedef Poco::Array<int,SIZE> IArray; IArray a = { { 1, 2, 3, 4, 5 } }; IArray b(a); // modify elements directly for (unsigned i=0; i<b.size(); ++i) { ++b[i]; } // try iterators for (IArray::iterator pos =b.begin(); pos<b.end(); ++pos) { --(*pos); } for (unsigned i=0; i<a.size(); ++i) { EXPECT_TRUE(a[i] == b[i]); } // change order using an STL algorithm std::reverse(a.begin(),a.end()); for (unsigned i=0; i<a.size(); ++i) { EXPECT_TRUE(a[SIZE-i-1] == b[i]); } std::reverse(a.begin(),a.end()); // negate elements using STL framework std::transform( a.begin(),a.end(), // source a.begin(), // destination std::negate<int>()); // operation for (unsigned i=0; i<a.size(); ++i) { EXPECT_TRUE(a[i] == -b[i]); } }