|
Boost : |
Subject: Re: [boost] [poly_collection] Memory allocation and allocator propagation
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2017-05-17 10:04:50
Den 16-05-2017 kl. 23:59 skrev Joaquin M López Muñoz via Boost:
> El 16/05/2017 a las 23:41, Ion Gaztañaga escribió:
>> I don't know if anyone will use poly_collection with many different
>> types and few elements per segment. As always users will surprise us ;-)
I agree with Joaquin that we should not store the size.
>> In any case I would recommend documenting this visible somewhere
>> (ideally in the method description as Complexity) with a complexity
>> similar to (I hope I don't get it wrong):
>>
>> O(distance(segment_traversal().begin(), segment_traversal().end()))
>>
>> as typically most programmers would think about those as extremely
>> cheap operations and might call them in a loop.
>
> Noted.
>
I think if your documentation defines n = # of elements in container, k
= # of segments in container, then simply saying
Complexity: O(k)
or
Complexity: linear in k
is nicer to read than all the range stuff.
kind regards
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk