Opened 16 years ago

Closed 15 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:


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 
( 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,

Attachments (0)

Change History (1)

comment:1 Changed 15 years ago by samuel_k

Status: assignedclosed
Logged In: YES 

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.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain samuel_k.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.