"Jonathan Turkanis" <technews@kangaroologic.com> writes:
[color=blue]
> David Harmon wrote:[color=green]
>> On Sun, 02 Jan 2005 04:47:06 GMT in comp.lang.c++, Randy Yates
>> <yates@ieee.org> wrote,[color=darkred]
>>> istringstream(AWord(line)) >> day;[/color]
>>
>> The istringstream constructed is a nameless temporary value.
>> Operator>> requires binding a non-constant reference to it.
>> This is prohibited by a silly rule. Make it not a temporary.
>>
>> istringstream parser((AWord(line)));
>> parser >> day;[/color]
>
> I would agree with this analysis if operator>> were a non-member in this case.
> But the int extractor is a member function, so there should be no trouble
> invoking it on a temporary. Try making day a string and note the difference.[/color]
There is no difference - same error.
Note that I also get the exact same error if I rename the function AWord() to anything
non-existent, e.g., "istringstream(AVeryLongRidiculousWord(line)) >> day;" gives
me the same error.
--
% Randy Yates % "My Shangri-la has gone away, fading like
%% Fuquay-Varina, NC % the Beatles on 'Hey Jude'"
%%% 919-577-9882 %
%%%% <yates@ieee.org> % 'Shangri-La', *A New World Record*, ELO
http://home.earthlink.net/~yatescr