This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: basic_filebuf question
- From: Phil Edwards <phil at jaj dot com>
- To: Stephan Buys <s dot buys at icon dot co dot za>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 29 Jan 2002 15:58:33 -0500
- Subject: Re: basic_filebuf question
- References: <200201291030.g0TAUf732631@disaster.jaj.com>
On Tue, Jan 29, 2002 at 12:37:20PM +0200, Stephan Buys wrote:
> I have thought about creating my own basic_filebuf class with Search
> implemented and then setting it by using MyFile.rdbuf(&MyBuf). According to
> documentation I read (C++ Programming Language) this should make my ifstream
> use my new buffer.
There are two versions of rdbuf(), the base class version and the derived
class version. The base class version is the one you want. Unfortunately,
it's hidden by the derived class version. (Somebody on the LWG needs
to be slapped for this.) You'll need to access your streams as a base
class for the member resolution to work properly; there are examples in
the mailing lists, on Usenet, and in our own testsuite.
Phil
--
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace. We seek
not your counsel, nor your arms. Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen. - Samuel Adams