M
Mike Copeland
I am trying to combine std::left and std::setw() as a single
function. The following code ignores the "left" manipulator. What am I
doing wrong? TIA
struct leftsetw // combined functions (left/width)
{
leftsetw(int w) : width(w) {}
int width;
};
ostream &operator<<(ostream &o, const leftsetw &a)
{
o.left, o.width(a.width);
return o;
}
ostringstream oss;
oss.str(""); oss << "Test " << leftsetw(12) << 42;
function. The following code ignores the "left" manipulator. What am I
doing wrong? TIA
struct leftsetw // combined functions (left/width)
{
leftsetw(int w) : width(w) {}
int width;
};
ostream &operator<<(ostream &o, const leftsetw &a)
{
o.left, o.width(a.width);
return o;
}
ostringstream oss;
oss.str(""); oss << "Test " << leftsetw(12) << 42;