Boost logo

Boost :

Subject: Re: [boost] [devector] optimum growing/insertion policy
From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2017-11-03 09:26:57


El 02/11/2017 a las 19:10, Thorsten Ottosen escribió:
> Den 18-10-2017 kl. 16:37 skrev Joaquin M López Muñoz via Boost:
>
>> Writing this has led me to realize that a generic growing/insertion
>> policy also
>> needs a member function to indicate what to do on erasure:
>>
>>    struct free_space{std::size_t back,front;};
>>    free_space query_for_insertion(std::size_t pos,std::size_t n);
>>    free_space query_for_erasure(std::size_t pos,std::size_t n);
>
> I don't get how we know if we have a push_back or push_front. So I
> think we should use
>
>   free_space query_for_middle_insertion(std::size_t pos,std::size_t n);
>   free_space query_for_back_insertion(std::size_t pos,std::size_t n);
>   free_space query_for_front_insertion(std::size_t pos,std::size_t n);
>
> so we have clear control over inserts/push to either end.

push_back is query_for_insertion(size(),1), push_front is
query_for_insertion(0,1); I don't
think we need specialized member functions for those, don't you think?

Joaquín M López Muñoz


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