Boost logo

Boost :

Subject: Re: [boost] [review] Heaps
From: Tim Blechmann (tim_at_[hidden])
Date: 2011-06-01 12:14:44


> >>>> I'd like to announce the beginning of the review of the Heap library,
> >>>> written by Tim Blechmann
> >>>
> >>> A quick glance. On the surface it looks really good.
> >>
> >> Also, if it is not already possible, those heaps that use
> >> an std::vector ir similar internally should have this data-structure
> >> as a template argument s.t. we can easily change this. In some
> >> application it might even be possible to use boost::array<T,N>.
> >
> > hm ... not sure about this: the implementations requires
> > push_back/pop_back (which are not available for boost::array) and random
> > access iterators. the std::vector can be configured to use a different
> > allocator using parameters and one can use `reserve' to reserve memory
> > for the vector ...
> >
> > so i do not really see a specific use case, where one really wants to use
> > a different container, or do you have a specific case?
>
> You might now the max size of your heap, and so you can make a simple
> wrapper around an array. Other cases would be to use something like
> stlsoft::auto_buffer.

one could use a `container' argument similar to the std::priority_queue ... but
i somehow like the way to pass the allocator as template argument (mainly for
consistency among the different heaps) ... but of course, it would be possible
to catch this at compile time ... so that either a container or an allocator is
passed, but not both ...

tim




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk