libcamera/include
Barnabás Pőcze e879a86979 libcamera: yaml_parser: Take string keys in std::string_view
In many cases a static string literal is used as key. Thus
having the argument type be `const std::string&` is suboptimal
since an `std::string` object needs to be constructed before
the call.

C++17 introduced `std::string_view`, using which the call
can be done with less overhead, as the `std::string_view`
is non-owning and may be passed in registers entirely.

So make `YamlObject::{contains,operator[]}` take the string keys
in `std::string_view`s.

Unfortunately, that is not sufficient yet, because `std::map::find()`
takes an reference to `const key_type`, which would be `const std::string&`
in the case of `YamlParser`. However, with a transparent comparator
such as `std::less<>` `std::map::find()` is able to accept any
object as the argument, and it forwards it to the comparator.

So make `YamlParser::dictionary_` use `std::less<>` as the comparator
to enable the use of `std::map::find()` with any type of argument.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-03 01:36:29 +03:00
..
android android: Add missing SPDX headers to Android headers 2022-09-30 21:51:18 +03:00
libcamera libcamera: yaml_parser: Take string keys in std::string_view 2024-10-03 01:36:29 +03:00
linux include: linux: Update headers for rkisp1 extensible parameters 2024-08-27 12:28:42 +03:00
meson.build libcamera: tracing: fix header generation when built as subproject 2022-11-24 14:52:00 +00:00