Greetings,
 
I'm trying to come up with an algorithm that will "collapse" a sequence of integer constants by adding like elements together.  For example,
 
    typedef vector_c< int, 1,1,1,3,5,5,7,10,10 > input;
 
would become:
 
    typedef vector_c< int, 3, 3, 10, 7, 20 > result;
 
You can assume the sequence is already sorted.  Would appreciate any tips.
 
Thanks,
Eric.