Opened 20 years ago

Closed 19 years ago

#90 closed Bugs (Out of Date)

boost::format bug

Reported by: mpolatov Owned by: samuel_k
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

1. Function boost::io::detail::maybe_throw_exception is 
defined in parsing.hpp so link error happended when you 
include file boost/format.hpp in two or more .cpp 
modules (inline specifier missed? :).

2. Why class basic_format has members
operator<< ( std::basic_ostream<Ch, Tr>& , const 
basic_format& );
and string_t str() const;
instead of just operator string_t() const; ?

Every time you just want to build string and pass it to 
somewhere you need to write statement something like 
that:
( boost::format( "%1%..." % ... ) ).str()

I believe it looks ugly...

Having operator string_t() const; also eliminate 
operator<< ( std::basic_ostream<Ch, Tr>& , const 
basic_format& ); if I not mistaken.

Best Regards,
Misha

Change History (1)

comment:1 by samuel_k, 19 years ago

Status: assignedclosed
Logged In: YES 
user_id=545049

1. the fix was commited on 2002/06/17

2. it is a design choice to not provide implicit conversion, to 
prevent pitfalls.
e.g. :

string s1, s2;
format(fstr) % s1+s2 ;

where the user didnt think about % preceding +, and just wants :
format(fstr) % (s1+s2) ;


with operator string(), it is legal, interpreted as :
string(format(fstr)% s1) + s2;

Without, the compilation aborts, the user realises his
mistake and all his well.
Note: See TracTickets for help on using tickets.