Boost logo

Boost :

From: Brian Braatz (brianb_at_[hidden])
Date: 2005-02-28 18:38:48

In working with the code below, I just moved it to VC70. The iostreams
docs point me to not officially supporting vc71, but they do say some of
the support has been left in.

While trying to compile below, I got caught up with a static assert, I
noticed the


Was around the static assert. So being a gambling sorta guy, I #defined
static assert.

I am now having issues with detail::resolve_traits

// Deduces the return type of resolve.
template<typename Mode, typename Ch, typename T>
struct resolve_traits {

I have been digging through trying to figure this one out. I have not

My Question- is there a workaround that allows for minimal \ limited
useage of iostreams with VC70. (I have a project I am working on code
for that is STUCK on that compiler)..

The code below is what I am trying to make work.

Many Thanks,


-----Original Message-----
From: Brian Braatz
Sent: Monday, February 28, 2005 1:54 PM
To: 'boost_at_[hidden]'
Subject: Iostreams Question: Best way to output to win32
debugger\outwindow ?

First off THANK YOU Johnathon Turkanis for help with "tee" earlier. That
saved me a great amount of pain.

Below is part of what I am trying to use it with.

My next question is what is the best way to deal with an "output" device
having a different cr\lf than another one?

My basic problem is this-

I want to be able to take

cout << "hi" << endl << "there" << endl;

and have it properly give an end of line for the MSVC debugger (the same
issue exists with the windows edit control)

the problem is with both the windows edit control and the MSVC debug out
window, you need to give it a \r\n instead of just a \n

As you will see in my code below, there is "stupidity" (i.e. look for
the memcpy :) )

My question is this- What is your suggested way to do what I am trying
to do.
(code below DOES work)

using namespace std;
using namespace boost::io;

    struct tee : boost::io::multichar_output_filter
        tee(std::ostream& dest) : dest(dest) { }

        template<typename Sink>
        void write(Sink& snk, const char* s, std::streamsize n)
            // Write to the downstream Sink
            boost::io::write(snk, s, n);

            // Write to the stored ostream:
            dest.write(s, n);

        std::ostream& dest;

    struct debug_out_sink : public sink
        { }
       void write( const char* s, std::streamsize n)
            // copy the incoming data into a new location so we can NULL
            char * sout = new char[(n+1)*2];
            sout[n] = 0;
            // make a std::string from null terminated string
            std::string ssOut = sout;
            // replace all occurances of \n with \r\n
            // this is the end of line sequence used for the win32
            // (this is also for edit controls on the windows platform)
            // clean up
            delete [] sout;
            sout = NULL;
        void Test_Profile()
        using namespace boost::io;
        filtering_ostream out;
        std::ofstream log("log.txt");
        debug_out_sink dbosink;
        out <<"LINE ONE" << endl << "Next line" << endl << "third line"
<< endl;

Boost list run by bdawes at, gregod at, cpdaniel at, john at