C++ ostream out manipulation

well basically it should list all the vector coords in this kind of format :

(x, y, z)

but at the moment it does like this (x, y, z, )

easiest way would be using if in the for cycle, but can i substract a small piece of string from the out variable?

my code:

    template <unsigned short m>
    std::ostream& operator<<(std::ostream& out, const Vector<m>& v) {
    out << "(";
    for(int i = 0; i < m; i++) {
        out << v.coords[i] << ", ";
    }
    out << ")";
    return out;
}
5
задан Jaanus 13 March 2011 в 08:56
поделиться