This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] remove non-standard basic_filebuf members, fd, FILE filebufs



> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]