Using the Template II How about this code? int main() { vector< vector > v; // fill v with data cout << sum(v) << endl; }