|
Boost : |
Subject: Re: [boost] Abstract STL Container Adaptors
From: Andy Jost (Andrew.Jost_at_[hidden])
Date: 2013-03-14 18:24:03
On 14 March 2013 16:31, Neil Groves <neil_at_[hidden]> wrote:
>>
>> Virtual functions calls add very appreciable overhead relative to the
>> numerous small functions that would need runtime polymorphism for the
>> idiom to work. The overhead is particularly severe with super-scalar
>> processor architectures. To some this won't be important of course.
>>
>Of course, if performance it isn't important, then just use std::set and be done with it.
>Is there any criterion besides performance that people choose between set and unordered_set where generalization would make any sense?
The key question is: who gets to make that decision? ``my_algorithm`` may be happy to use std::set, but it's really the caller's choice. Perhaps the information ``my_algorithm`` needs already lives somewhere in a boost::multi_index_container. Does it really need to be copied just to call ``my_algorithm``?
Perhaps I would like to compile ``my_algorithm`` once and stick it in a library file. Does it really need to be recompiled for each concrete container type?
-Andy
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk