#include
#include
#include
#include
#include
using namespace std;
template
void print(T& c){
for( typename T::iterator i = c.begin(); i != c.end(); i++ ){
std::cout << *i << endl;
}
}
int main( )
{
const int n = 8;
vector pixels1( n, 250 );
vector int_pixels( pixels1.begin(), pixels1.end() );
print( int_pixels);
// create and display the second group of pixels
vector pixels2( n, 1 );
partial_sum( pixels2.begin(), pixels2.end(), pixels2.begin() );
int_pixels.assign( pixels2.begin(), pixels2.end() );
print( int_pixels);
// perform and display sum with wrap-around
vector sum( n );
transform( pixels1.begin(), pixels1.end(), pixels2.begin(),sum.begin(), plus() );
int_pixels.assign( sum.begin(), sum.end() );
print( int_pixels);
}