|
Boost Users : |
From: Daniel Lidström (daniel.lidstrom_at_[hidden])
Date: 2005-11-17 03:04:57
Hello!
when compiled in debug mode, the following program causes an exception
in the file p:\boost_1_33_0\include\boost-1_33\boost\iostreams\detail\
optional.hpp, line 54 (I'm using VC 7.1.3088, Windows XP):
#include <iostream>
#include <boost/iostreams/concepts.hpp> // sink
#include <boost/iostreams/stream.hpp> // stream
using namespace std;
class IOutput
{
public:
virtual void print(int, const char*) const = 0;
};
class Output : public IOutput
{
public:
void print(int id, const char* a) const { cout << a; }
};
static IOutput* gpOutput;
template<int id>
class my_sink : public boost::iostreams::sink
{
public:
std::streamsize write(const char* s, std::streamsize n)
{
gpOutput->print(id, s);
std::streamsize sz = 0;
for( const char* p=s; *p; ++p ) sz++;
return sz;
}
};
typedef boost::iostreams::stream<my_sink<5> > output;
int main()
{
gpOutput = new Output;
output stream;
stream << "Daniel" << endl;
return 0;
}
When I compile in release mode the program prints `Daniel',
just as expected. Is there a problem with my program?
Thanks in advance!
Hälsningar,
Daniel
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