Boost logo

Boost :

From: Samuel Krempp (krempp_at_[hidden])
Date: 2003-08-23 16:51:18


Paul Hamilton wrote:

>"Peter Dimov" <pdimov_at_[hidden]> wrote:
>
>
>
>>This will work, although I had
>>
>>template<class Tr, class Ch> inline
>> void empty_buf(BOOST_IO_STD basic_ostringstream<Ch,Tr> & os) {
>> os.str( std::basic_string<Ch, Tr>() );
>> }
>>
>>in mind as it is a smaller change.
>>
>>
>This works just fine also:
>
>*** feed_args.hpp.orig Thu Aug 21 22:45:28 2003
>--- feed_args.hpp Fri Aug 22 10:19:55 2003
>***************
>*** 35,40 ****
> template<class Tr, class Ch> inline
> void empty_buf(BOOST_IO_STD basic_ostringstream<Ch,Tr> & os) {
>! static const std::basic_string<Ch, Tr> emptyStr;
>! os.str(emptyStr);
> }
>
>--- 35,39 ----
> template<class Tr, class Ch> inline
> void empty_buf(BOOST_IO_STD basic_ostringstream<Ch,Tr> & os) {
>! os.str(std::basic_string<Ch, Tr>());
> }
>
>Paul.
>
>

ok, I'll commit that on monday. I had made the empty string as a static
variable hoping it could help avoid re-allocating memory for the
temporary strings, but it doesnt seem to, so it's best to simplify that
anyway.

But, for curiosity, isn't this static-variable in function supposed to
work here, according to the standard ?

-- 
Samuel

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk