libcamera: base: utils: Simplify enumerate()
`std::{begin,end}()` support C-style arrays, thus there is no need for
a second overload. The only reason it is currently needed is that the
trailing return type of the first overload uses `iterable.begin()`, which
leads to a substitution failure, so that overload is not considered.
So remove the array overload, and let CTAD deduce the `Base` template
parameter of `enumerate_adapter`, which will make things work for
arrays as well.
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -355,19 +355,11 @@ private:
|
||||
} /* namespace details */
|
||||
|
||||
template<typename T>
|
||||
auto enumerate(T &iterable) -> details::enumerate_adapter<decltype(iterable.begin())>
|
||||
auto enumerate(T &iterable)
|
||||
{
|
||||
return { std::begin(iterable), std::end(iterable) };
|
||||
return details::enumerate_adapter{ std::begin(iterable), std::end(iterable) };
|
||||
}
|
||||
|
||||
#ifndef __DOXYGEN__
|
||||
template<typename T, size_t N>
|
||||
auto enumerate(T (&iterable)[N]) -> details::enumerate_adapter<T *>
|
||||
{
|
||||
return { std::begin(iterable), std::end(iterable) };
|
||||
}
|
||||
#endif
|
||||
|
||||
class Duration : public std::chrono::duration<double, std::nano>
|
||||
{
|
||||
using BaseDuration = std::chrono::duration<double, std::nano>;
|
||||
|
||||
Reference in New Issue
Block a user