Boost logo

Boost :

Subject: Re: [boost] [devector] optimum growing/insertion policy
From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2017-10-26 17:59:37


El 26/10/2017 a las 17:08, Thorsten Ottosen escribió:
> Den 18-10-2017 kl. 16:37 skrev Joaquin M López Muñoz via Boost:
>> El 18/10/2017 a las 16:28, Joaquin M López Muñoz escribió:
>> 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);
>>
>> (clear would be the case where erasure happens at begin() and
>> n==size()).
>
> But the policy does not know size() unless we pass it that too.

Yes, it need access the size and front and back capacity. If the policy
is used via
CRTP (which is what I have in mind but admittedly didn't make clear)
then this info
can be retrived by the policy through devector's public interface. Other
designs
would require that the info be passed as additional arguments to the member
functions.

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