Opened 12 years ago

Closed 12 years ago

#5046 closed Bugs (fixed)

directing tuples to ostream does not work as expected

Reported by: anonymous Owned by: Steven Watanabe
Milestone: To Be Determined Component: tuple
Version: Boost 1.45.0 Severity: Problem
Keywords: tuple output formatting Cc: meesters@…

Description

Assuming 'out' is a std::ostream the following code produces wrong output:

out <<  boost::tuples::set_open('[')
    <<  boost::tuples::set_close(']')
    <<  boost::tuples::set_delimiter(',')
    <<  std::setw(21) << std::right << some_boost_tuple;

Instead of being within a field of 21 spaces, the tuple is appended to those spaces.

When fixing the bug - is it possible to also account for double precision settings by '<< std::std::setprecision(integer)'? That would be really helpful if dealing with tuples containing doubles.

TIA Christian Meesters

Change History (2)

in reply to:  description comment:1 by Steven Watanabe, 12 years ago

Owner: changed from Joel de Guzman to Steven Watanabe
Status: newassigned

Replying to anonymous:

When fixing the bug - is it possible to also account for double precision settings by '<< std::std::setprecision(integer)'? That would be really helpful if dealing with tuples containing doubles.

Doesn't std::setprecision work now?

comment:2 by Steven Watanabe, 12 years ago

Resolution: fixed
Status: assignedclosed

(In [67751]) Handle width correctly. Fixes #5046.

Note: See TracTickets for help on using tickets.