This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] remove non-standard basic_filebuf members, fd, FILE filebufs
- From: Phil Edwards <phil at jaj dot com>
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Mon, 29 Apr 2002 17:20:51 -0400
- Subject: Re: [v3] remove non-standard basic_filebuf members, fd, FILE filebufs
- References: <200204270520.g3R5KRS26509@fillmore.constant.com>
> This patch is posted for discussion only. I'm curious to see what
> other people think.
I'm for anything which simplifies I/O debugging and documentation.
The file/fd class merge you mentioned in a followup also sounds good.
Here are some random thoughts:
> + template<typename _CharT>
> + class enc_filebuf
> + : public std::basic_filebuf<_CharT, enc_char_traits<_CharT> >
> + {
> + public:
> + typedef typename enc_char_traits<_CharT>::state_type state_type;
> +
> + enc_filebuf(state_type& __state)
> + : std::basic_filebuf<_CharT, enc_char_traits<_CharT> >()
> + {
> + // Set state type to something useful.
> + // Something more than copyconstructible is needed here, so
> + // require copyconstructible + assignment operator.
> + _M_state_cur = __state;
> + _M_state_cur._M_init();
Dare I suggest
__glibcpp_class_requires(state_type, _SGIAssignableConcept)
say, just before the _M_state_cur assignment?
> + template<typename _CharT, typename _Traits = std::char_traits<_CharT> >
> + class file_filebuf : public std::basic_filebuf<_CharT, _Traits>
How about naming this class cfile_filebuf instead? This highlights the
point of FILE* compatability, and follows the <c*> header naming convention.
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