Topic: basic_istream::get()


Author: pjp@dinkumware.com ("P.J. Plauger")
Date: Wed, 16 Oct 2002 16:22:32 +0000 (UTC)
Raw View
""George van den Driessche"" <NgOrSePbAeM@bigfoot.com> wrote in message
news:aojvqe$nh5$1$8302bc10@news.demon.co.uk...

> as I understand it, there are six overloads of basic_istream::get(), one of
> which returns an int and five of which return a basic_istream&. In
> particular, there are:
>
> basic_istream& get(basic_streambuf<E, T> *sb);
> basic_istream& get(basic_streambuf<E, T> *sb, E delim);
>
> (these from the Visual C++ 6 documentation, but also I found many
> equivalents distributed over the Web.)
>
> However, I find that in the actual implementation, the Visual C++ 6 version
> of istream.h declares:
>
> istream& get(streambuf&,char ='\n');
>
> and the STLPort 4.5.0 in stl/_istream.h similarly declares:
> _Self& get(basic_streambuf<_CharT, _Traits>& __buf,
>
> char_type __delim);
>
> _Self& get(basic_streambuf<_CharT, _Traits>& __buf)
>
> { return get(__buf, this->widen('\n')); }
>
> Which is correct, the version that takes a basic_streambuf* or the version
> that takes a basic_streambuf&?

IIRC, the signature changed from basic_streambuf* to basic_streambuf&
as the C++ Standard evolved. So the code is correct and the V6 documentation
is lagging behind.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: NgOrSePbAeM@bigfoot.com ("George van den Driessche")
Date: Wed, 16 Oct 2002 15:22:58 +0000 (UTC)
Raw View
as I understand it, there are six overloads of basic_istream::get(), one of
which returns an int and five of which return a basic_istream&. In
particular, there are:

basic_istream& get(basic_streambuf<E, T> *sb);
basic_istream& get(basic_streambuf<E, T> *sb, E delim);

(these from the Visual C++ 6 documentation, but also I found many
equivalents distributed over the Web.)

However, I find that in the actual implementation, the Visual C++ 6 version
of istream.h declares:

istream& get(streambuf&,char ='\n');

and the STLPort 4.5.0 in stl/_istream.h similarly declares:
_Self& get(basic_streambuf<_CharT, _Traits>& __buf,

char_type __delim);

_Self& get(basic_streambuf<_CharT, _Traits>& __buf)

{ return get(__buf, this->widen('\n')); }

Which is correct, the version that takes a basic_streambuf* or the version
that takes a basic_streambuf&?



Cheers,

George





---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]