I'm got a function in C++ that wraps an output stream constructor so it can pass in a pointer to a parent class that it's running in, ala:
pf_istream PF_Plugin::pf_open_in() {
return pf_istream(this);
}
When I do it that way, however, I get something like this:
pf_plugin.cc:103: error: no matching function for call to ‘pf_istream::pf_istream(pf_istream)’
pf_istream.hh:36: note: candidates are: pf_istream::pf_istream(const PF_Plugin*)
pf_istream.hh:29: note: pf_istream::pf_istream(pf_istream&)
I've got a copy constructor and assignment operator defined (as can be seen above), and if I write the function like so:
pf_istream PF_Plugin::pf_open_in() {
pf_istream to_ret(this);
return to_ret;
}
It works just fine. I get similar errors if I try to assign a pf_istream instance directly from a call to the function, eg:
pf_istream inFile = pf_open_in();
What else do I need to add to make this work?