Subject: Re: [boost] [exception] ostringstream like
From: Fabien Castan (fcastan_at_[hidden])
Date: 2010-08-16 10:21:57
> No, I mean that if you do advanced string manipulation in the exception
> itself, you may screw up, adn cause a bad_alloc beign thrown and masking
> your own exception.
Create an error sentence with some values inside is not really an
advanced string manipulation.
You can have 2 kinds of errors: bug inside a custom operator<< or a
There is no particular reason to not have sufficient memory to create an
error sentence when throwing something like a logic_error.
> Just make your own, informative exception type deriving from logic_error.
The problem is not really the kind of exception, but an easy way to
create message with boost exception tag system.
The idea is to create a new base class for tags allowing to use an
ostringstream with tags, which is not possible.
typedef ::boost::error_info<struct tag_message,std::ostringstream> message;
This little class only remap operator+ call to operator<< on an internal
I use it in my code, but I ask here if we can hope to see such things in
I would prefer to use a standard boost object rather than a custom class.