This is less a bugreport than maybe just a question:
I am not so much into C++, but i wonder whether there cannot occur an error reading from/writing to a stream.
I suspect readline() can send unexpected eofbit or failbit.
I think this shall be reflected in error_code of PResult.
So another error code would be necessary.