Question: I have this function I am trying to make the second argument in the function into a const string &. Is there a way i
I have this function

I am trying to make the second argument in the function into a const string &. Is there a way i can do this and return same results? If not just say no.I tried to convert it const string & but cant because of the copy ().
std::string::const_iterator refillBuffer(std::string::const_iterator pc, std::string& buffer, long& totalBytes) { // find number of unprocessed characters [pc, buffer.cend()) auto d = std:: distance(pc, buffer.cend()); // move unprocessed characters, [PC, buffer.cend()), to start of the buffer std::copy (pc, buffer.cendo, buffer.begin(); == (ssize_t) -1) && // read in trying to read whole blocks ssize_t numbytes = 0; const int BUFFER_SIZE = 16 * 16 * 4096; while (((numbytes = READ(0, (void) (buffer.data() + a), (size_t) (BUFFER_SIZE - d))) (errno == EINTR)) { } // error in read if (numbytes == -1) return buffer.cend(); // EOF if (numbytes == 0) return buffer.cend(); + if ((std::string:: size_type) (numbytes buffer.resize(numbytes + d); d)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
