J
jack
I have a class which overloads the insertion operator '<<' for every
type that ostream handles. I do this so that I can use my class a
direct replacement for cout and cerr where the insertion syntax is
used. The reason for this is that I have a log file class that needs
to know how many lines have been written. When the line exceeds a
certain number, I need to close the log file, and open a new one.
I would like to be able to track the number of times that the 'endl'
manipulator is passed to the insertion operator.
I realise that I can't simply compare the pf pointer with endl in this
function
ostream_type&
operator<<(ostream_type& (*pf) (ostream_type&))
{
if(pf == endl)
count++;
}
because it won't compile. But I was wondering if there is a way to get
the address of the concrete implementation of the endl manipulator for
the cout and cerr implementation explicitely.
Thanks
type that ostream handles. I do this so that I can use my class a
direct replacement for cout and cerr where the insertion syntax is
used. The reason for this is that I have a log file class that needs
to know how many lines have been written. When the line exceeds a
certain number, I need to close the log file, and open a new one.
I would like to be able to track the number of times that the 'endl'
manipulator is passed to the insertion operator.
I realise that I can't simply compare the pf pointer with endl in this
function
ostream_type&
operator<<(ostream_type& (*pf) (ostream_type&))
{
if(pf == endl)
count++;
}
because it won't compile. But I was wondering if there is a way to get
the address of the concrete implementation of the endl manipulator for
the cout and cerr implementation explicitely.
Thanks