RFC: where to put sorted vector template/class?

Andrew Douglas Pitonyak andrew at pitonyak.org
Wed Jul 11 22:00:12 PDT 2012


On 07/11/2012 09:20 AM, Noel Grandin wrote:
>
> On 2012-07-11 15:16, Andrew Douglas Pitonyak wrote:
>> How large do you expect the sorted vector to be? I ask because a 
>> linear search is used, which on average will take time n/2 to find 
>> the item and n to not find the item (assuming vector of size n).
>
> No, std::lower_bound performs a binary search.
> http://www.cplusplus.com/reference/algorithm/lower_bound/
Excellent! :-)

-- 
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php





More information about the LibreOffice mailing list