Consider the following:
typedef struct { int a; int b; int c; int d; } ABCD; typedef std::vector VecABCD;
Say
Use std::accumulate :)