Boost logo

Boost Users :

From: Steven T. Hatton (hattons_at_[hidden])
Date: 2005-08-07 13:27:50

On Sunday 07 August 2005 13:21, Jonathan Turkanis wrote:
> Steven T. Hatton wrote:
> > I just happened to open Konqueror to the root of a recent boost CVS,
> > and discovered an HTML file with some information I've never seen
> > before. Among that information was a link to the Boost.Iostreams
> > library. I don't see any reference to it on the Boost homepage, and
> > when I searched the site I didn't find much there. But I've found it
> > elsewhere on the Internet. I'm confused as to the status of the
> > library. Is it a continuing project? I sure hope so.
> Boost.Iostreams was accepted almost a year ago (can it be that long?) but
> will make its first official appearance as part of Boost in the 1.33
> release -- any day now.
> You can view the docs here:
> (this version of the documentation contains some mistakes which have been
> corrected in the release branch)
> Thanks for your interest!
> Jonathan

Thank you. This is good news.

I do have a question/observation regarding the mapped_file classes. I see
they advertise their element type as `typedef char char_type;'. I'm treating
it as a container in the STL sense. In ISO/IEC 14882:2003(E) 32.1
containers are specified to have `X::value_type T' as well as a
difference_type which is the same as the difference_type for the iterator
type defined for the container. In the case of a mapped_file, I guess that
would be what is given by applying one of these to char_type:


  template<class T> struct iterator_traits<T*> {
    typedef ptrdiff_t difference_type;
    typedef T value_type;
    typedef T* pointer;
    typedef T& reference;
    typedef random_access_iterator_tag iterator_category;

  template<class T> struct iterator_traits<const T*> {
    typedef ptrdiff_t difference_type;
    typedef T value_type;
    typedef const T* pointer;
    typedef const T& reference;
    typedef random_access_iterator_tag iterator_category;

I think you could do something like:

mapped_file {
  typedef char* iterator; // which you have
  typedef iterator_traits<iterator>::difference_type difference_type;
  typedef iterator_traits<iterator>::value_type value_type;
  typedef iterator_traits<iterator>::pointer pointer;
  typedef iterator_traits<iterator>::reference reference;

  typedef const char* const_iterator; // which you also have

  typedef iterator_traits<const_iterator>::const_reference const_reference;
  typedef std::reverse_iterator<iterator> reverse_iterator;
  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;


I see that mapped_file has some "Container interface" items, so it's an idea
that's already been partially implemented. It seems reasonable to flesh it
out, unless there's some obstacle to doing so.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at