Q:

is it possible to have getline() function accept wistream&

Just for clarification, I'm referring to the global getline() function in the string class. 
What I want to do is to have something like this:
int main()
{
   wifstream in(L"textfile.txt");
   someFunc(in);
   return 0;
}

void someFunc(const wistream& read)
{
   wstring buff;

   while(getline(read, buff))
   {
      //do some processing here
   }
}

but I'm getting a:
Error   2   error C2664: 'std::getline' : cannot convert parameter 1 from 'const std::wistream' to 'std::basic_istream<_Elem,_Traits> &'

In order to fix it, I need to remove the const from const wistream& read. I understand why this is happening but is it possible to configure getline() to accept a wistream instead without any conversions or should I just ignore it and remove the const?

A:

It does accept a wistream, but getline() demands a non-const argument because it modifies the stream. Try changing it to:
...
void someFunc(wistream& read)
...

A:

Reading characters from the stream modifies the stream.  You can't mark the stream const and expect that to work correctly.

