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 // sink
#include // 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 > 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