[libcamera-devel] [RFC PATCH v2 5/9] libcamera: Implement a ControlList

Kieran Bingham kieran.bingham at ideasonboard.com
Wed Jun 26 16:02:59 CEST 2019


Hi Laurent,

On 26/06/2019 14:51, Laurent Pinchart wrote:
 <snip>

>> Any ideas or suggestions on how to do these helpers nicely? Ideally I'd
>> want the ControlList to look like a class object - but I don't think I
>> can just extend the std::unordered_map() interface ...
>>
>> I'd also want a helper for the .contains() method
>>
>> (which is a shame, because in C++20 .contains() is available directly on
>> the unordered_map)
> 
> How about keeping the ControlList class, but making it derive from the
> container ? That would allow you to add the few helpers you need without
> a need to proxy everything else. You also won't need to document or test
> the proxy methods.

I sort of want to do exactly that - but too many comments online say
"Never derive the STL containers":

https://stackoverflow.com/questions/10477839/c-inheriting-from-stdmap
https://www.researchgate.net/post/I_really_want_to_understand_if_there_is_any_reason_why_one_should_not_inherit_from_the_stl_vector_class_in_c2


I think the reasoning is that the STL does not implement virtual
destructors, but does this matter if I don't implement a custom destructor?

<snip>

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list