diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-11-11 13:02:30 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-11-13 15:38:18 +0200 |
commit | 5c71df927ddaaa01204bff1e647c9d2bf653d95f (patch) | |
tree | f9aaf31f53f0209b89a08d5474c1f999f695b233 /src/android/mm/generic_camera_buffer.cpp | |
parent | 6d9baefca8a7e8d7e74dcd03e6cd06a30f2c1601 (diff) |
libcamera: yaml_parser: Use std::from_chars()
std::from_chars(), introduced in C++17, is a fast, locale-independent
string-to-arithmetic conversion function. The C++ standard library
provides overloads for all integer types, making it a prime candidate to
replace the manual handling of integer sizes in the YamlParser string to
integer conversion.
Compared to std::strtol(), std::from_chars() doesn't recognize the '0x'
prefix or '+' prefix, and doesn't ignore leading white space. As the
YamlParser doesn't require those features, std::from_chars() can be used
safely, reducing the amount of code.
C++17 also requires the standard C++ library to provide overloads for
floating-point types, but libc++ does not implement those. The float and
bool implementations of YamlParser::Getter::get() are therefore kept
as-is.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/android/mm/generic_camera_buffer.cpp')
0 files changed, 0 insertions, 0 deletions