I am trying to overload the <<
operator for my C++ class called Box. It is not trivial and inside the definition I have to access the stdout
object of type FILE*
which is corresponding to the std::cout
. I need exactly this object since the interface of another code I will use in my operator (GNU MPFR library) requires this particular one. How can I extract it?
Simplified version below:
std::ostream& operator<<(std::ostream &os, const Box &box) {
x = ??? // get the stdout from os
mpfr_out_str(x, 10, 0, box.number, MPFR_RNDN);
return os;
}