Boost logo

Boost Users :

Subject: Re: [Boost-users] using embedded stringstream on a single line.
From: Stuart Dootson (stuart.dootson_at_[hidden])
Date: 2009-08-26 11:26:06


On Wed, Aug 26, 2009 at 4:13 PM, Avi Bahra<avibahra_at_[hidden]> wrote:
>
> Is there anything in boost/design pattern that can help with following:
>
>     std::stringstream ss;
>     ss << "SUBMIT: Task(" << absPath << ") ";
>     log( Log::DBG, ss );
>
> The code I am working on does this all over the place, what I would like is
> :
>
>      log( Log::DBG,   "SUBMIT: Task(" << absPath << ") "  );
>
>
>   Best regards,
> Ta,
>    Avi

Slightly different, but how about Boost.Format?

   log( Log::DBG, str(boost::format("SUBMIT: Task( %s) ")%absPath) );

Internally, it uses streams, so your ostream inserters for custom
types will get used, I believe.

Stuart Dootson


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net