Roland Schwarz | 1 Mar 11:58
Picon

manipulators for filtering_stream s


Larry Evans wrote:
> A long time ago, I had one and was intending *eventually* to add it to
> iostreams, but never got around to it.  It's in:
> 
> http://svn.boost.org/trac/boost/browser/sandbox-branches/cppljevans/boost/io/filters

Thank you. Al though google revealed some postings about
margin_ostream it failed to get me to the sources.

I am not sure however you noticed the difference to my implementation:

I am storing state _in_ the stream, i.e. in ios base member and thus
allowing
out << indent_in << "blah blah\n";
out << "still indented\n";

And a function
void foo(ostream& os)

that gets passed down my indent_filter'ed stream still knowns
the indentation status.

The margin_ostream implements indent operation only the stream object.
Does is also have manipulators?

Will margin_ostream also work when downcasted to a plain ostream?

--

-- 
_________________________________________
(Continue reading)

Larry Evans | 1 Mar 14:52

Re: manipulators for filtering_stream s

On 03/01/08 04:58, Roland Schwarz wrote:
> 
> Larry Evans wrote:
>> A long time ago, I had one and was intending *eventually* to add it to
>> iostreams, but never got around to it.  It's in:
>>
>> http://svn.boost.org/trac/boost/browser/sandbox-branches/cppljevans/boost/io/filters
> 
> Thank you. Al though google revealed some postings about
> margin_ostream it failed to get me to the sources.

The above http reference should show the sources.  I must be
misunderstanding you :(.  I haven't used svn to download it
recently, but I guess using a command similar to that shown here:

   http://svn.boost.org/trac/boost/wiki/BoostSubversion

, except with the appropriate directory substituted for trunk, would
work.

> 
> I am not sure however you noticed the difference to my implementation:
> 
> I am storing state _in_ the stream, i.e. in ios base member and thus
> allowing
> out << indent_in << "blah blah\n";
> out << "still indented\n";
> 
> And a function
> void foo(ostream& os)
(Continue reading)

Larry Evans | 1 Mar 16:23

Re: manipulators for filtering_stream s

On 03/01/08 07:52, Larry Evans wrote:
[snip]
> 
> I'll be trying out indent.hpp after I'm done with the proto review.
> 
I couldn't resist trying it now; however, I'm getting wrong output :(

The attached test driver (indent_test.cpp) is the same as the one
used for marg_ostream but modified to use indent.hpp as appropriate.

The expected output is shown in test_mout.cpp.out.
The actual output is shown in indent_test.cpp.out.

How can I get the expected output with indent.hpp?

-regards,
Larry

Attachment (indent_test.cpp): text/x-c++src, 1836 bytes
cd /home/evansl/prog_dev/boost-root.ln/boost_dev/libs/io/filters/tests/
make run
g++-3.3 -g -c -I../../../.. -o test_mout.o test_mout.cpp
g++-3.3 -v -o test_mout.exe test_mout.o ../../../../libs/io/filters/src/mout.o
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.2/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls
(Continue reading)

Hartmut Kaiser | 1 Mar 16:31
Picon
Gravatar

[Review] Proto review starts today, March 1st

Hi all,

The review of Eric Nieblers Proto library starts today, March 1st 2008, and
will end on March 14th. 
I really hope to see your vote and your participation in the discussions on
the Boost mailing lists!

---------------------------------------------------

About the library:

Proto is a framework for building Domain Specific Embedded Languages in C++.
It provides tools for constructing, type-checking, transforming and
executing expression templates. More specifically, Proto provides:
 * An expression tree data structure.
 * Operator overloads for building the tree from an expression.
 * Utilities for defining the grammar to which an expression must conform.
 * An extensible mechanism for immediately executing an expression template.
 * An extensible set of tree transformations to apply to expression trees.
 * A mechanism for giving expressions additional behaviors and members.

Documentation is here:
http://boost-sandbox.sourceforge.net/libs/proto

Download proto.zip from here:
http://www.boost-consulting.com/vault/index.php?directory=Template%20Metapro
gramming

Proto is a very important infrastructure library, IHMO. It has been used as
the backbone for several other library writing efforts already, such as
(Continue reading)

Roland Schwarz | 1 Mar 16:40
Picon

Re: **** SPAM ****Re: manipulators for filtering_stream s


Larry Evans wrote:
> I couldn't resist trying it now;
;-)

> however, I'm getting wrong output :(

Hmm,  I did not test it, but from looking at your source:

marg_ostream& mout(void)
{
    return std::cout;
}

gives you back std::cout, while it should hand back
  ; boost::iostreams::filtering_ostream out

The state is stored in out instance of course,
not cout.

--

-- 
_________________________________________
  _  _  | Roland Schwarz
 |_)(_  | aka. speedsnail
 | \__) | mailto:roland.schwarz <at> chello.at
________| http://www.blackspace.at
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

(Continue reading)

Larry Evans | 1 Mar 16:50

Re: **** SPAM ****Re: manipulators for filtering_stream s

On 03/01/08 09:40, Roland Schwarz wrote:
> Larry Evans wrote:
>> I couldn't resist trying it now;
> ;-)
> 
>> however, I'm getting wrong output :(
> 
> Hmm,  I did not test it, but from looking at your source:
> 
> marg_ostream& mout(void)
> {
>     return std::cout;
> }
> 
> gives you back std::cout, while it should hand back
>   ; boost::iostreams::filtering_ostream out
> 
> The state is stored in out instance of course,
> not cout.
> 
Right.  So, should:

<-- cut here --
#include "indent.hpp"
typedef boost::iostreams::filtering_ostream marg_ostream;
marg_ostream out;
#include <iostream>
marg_ostream& mout(void)
{
     return out;
(Continue reading)

Roland Schwarz | 1 Mar 17:19
Picon

Re: **** SPAM ****Re: manipulators for filtering_stream s

The attached file works for me, and gives indented
output.

-- 
_________________________________________
  _  _  | Roland Schwarz
 |_)(_  | aka. speedsnail
 | \__) | mailto:roland.schwarz <at> chello.at
________| http://www.blackspace.at
Attachment (indent_test.cpp): text/x-c++src, 1874 bytes
line1
  line1.1
    line1.1.1
  line1.2:unsigned=22
  line1.3:float=3.1416
line2:a_test=:my_str=a_test string:my_dbl=9.999

  (test*)0=(test*)0
  &a_test=*(test*)=:my_str=a_test string:my_dbl=9.999

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Andrey Semashev | 1 Mar 17:37
Picon
Gravatar

[thread] Questions about TSS

Hi, I have a couple of questions about thread_specific_ptr in 1.35.

1. I can see that there is an ability to set up a logic of reclaiming
resources that thread_specific_ptr points to. Why is it limited (a) only
to a pointer to function and (b) can only be set up in
thread_specific_ptr's constructor? It might be better to provide
interface similar to shared_ptr in this way? BTW, I can see that
although the cleanup function is required to receive T* as its argument,
it is being passed void* in the run_custom_cleanup_function. Isn't an
explicit cast required here?

2. Why thread_specific_ptr isn't copyable? Why can't it share TLS keys
(or whatever it uses to find the thread-specific resource) in the
dynamically allocated cleanup object? I would expect
thread_specific_ptr, being a pointer as its name implies, to be copyable.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Larry Evans | 1 Mar 17:49

Re: **** SPAM ****Re: manipulators for filtering_stream s

On 03/01/08 10:19, Roland Schwarz wrote:
> The attached file works for me, and gives indented
> output.
> 
Thanks.  I got correct output also.
indent.hpp has got my vote for boost inclusion :)

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Steve Ward | 1 Mar 19:56
Picon

Re: Ann: Floating Point Utilities Review starts today

On Wed, Feb 27, 2008 at 10:56 AM, Johan RĂ¥de <rade <at> maths.lth.se> wrote:

> John Maddock wrote:
>
> > There is one other useful function worth having IMO:
> >
> > template <class T>
> > int sign(T x);
> >
> > returns 0 (x is zero), +1 (x is > 0) or -1 (x is < 0).  This is trivial
> to
> > implement (lot's of old C code - for example the Numerical Recipies
> stuff -
> > implement this as a helper macro), and there's an undocumented version
> > currently in Boost.Math.  Is this worth integrating with Johan's code?
>  I've
> > found it quite useful in Boost.Math from time to time.
>
> The library deals with signbits, not with signs.
> So I think that adding this function to the library would just create
> confusion.
> It may be a useful function, but I don't think it belongs here.
>
> --Johan
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

(Continue reading)


Gmane