# coding: latin-1 #include "mafonction.h" void somme_vecteur ( const std::vector<double> &v1, const std::vector<double> &v2, std::vector<double> &res) { if (v1.size () != v2.size ()) throw std::runtime_error ( "dimensions différentes") ; res.resize (v1.size ()) ; std::vector<double>:: const_iterator it1,it2 ; std::vector<double>::iterator it3 ; for (it1 = v1.begin (), it2 = v2.begin (), it3 = res.begin () ; it1 != v1.end () ; ++it1, ++it2, ++it3) *it3 = *it1 + *it2 ; }