I wrote an overload for + to add two vector<double>:
vector<double> operator+(vector<double> v, vector<double> u)
{
    int n = (v.size()<u.size()) ? v.size() : u.size();
    vector<double> w;
    for (int j = 0; j<n; ++j)
        w.push_back(v[j] + u[j]);
    return w;
};
If I put in a .cpp file it's fine. But if I put in a .hpp file it generates a lot of errors related to "xutils" system file. Is this normal?
                        
You don't have to define a global
operator+to add twostd::vectors STL has a facility for this. Defining global operators can really mess things up and cause conflicts. You could usestd::transform:LIVE DEMO