[libcamera-devel] [PATCH] libcamera: Drop unnecessary typename keyword used with std::enable_if_t
Jacopo Mondi
jacopo at jmondi.org
Thu Jul 28 17:41:08 CEST 2022
Hi Laurent,
On Thu, Jul 28, 2022 at 02:13:03PM +0300, Laurent Pinchart via libcamera-devel wrote:
> Usage of the std::enable_if_t type doesn't need to be prefixed by
> typename. Drop the unnecessary keyword.
>
> Reported-by: Jacopo Mondi <jacopo at jmondi.org>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Thanks, all occurrences seems addressed to me!
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Thanks
j
> ---
> include/libcamera/base/bound_method.h | 2 +-
> include/libcamera/base/flags.h | 8 ++--
> include/libcamera/base/object.h | 2 +-
> include/libcamera/base/signal.h | 8 ++--
> include/libcamera/controls.h | 38 +++++++++----------
> .../libcamera/internal/ipa_data_serializer.h | 2 +-
> include/libcamera/internal/yaml_parser.h | 4 +-
> src/libcamera/yaml_parser.cpp | 2 +-
> 8 files changed, 33 insertions(+), 33 deletions(-)
>
> diff --git a/include/libcamera/base/bound_method.h b/include/libcamera/base/bound_method.h
> index e73a4d98ddae..c0275249f389 100644
> --- a/include/libcamera/base/bound_method.h
> +++ b/include/libcamera/base/bound_method.h
> @@ -72,7 +72,7 @@ public:
> }
> virtual ~BoundMethodBase() = default;
>
> - template<typename T, typename std::enable_if_t<!std::is_same<Object, T>::value> * = nullptr>
> + template<typename T, std::enable_if_t<!std::is_same<Object, T>::value> * = nullptr>
> bool match(T *obj) { return obj == obj_; }
> bool match(Object *object) { return object == object_; }
>
> diff --git a/include/libcamera/base/flags.h b/include/libcamera/base/flags.h
> index bff3b93c85a1..a1b404bdf23b 100644
> --- a/include/libcamera/base/flags.h
> +++ b/include/libcamera/base/flags.h
> @@ -147,7 +147,7 @@ struct flags_enable_operators {
> };
>
> template<typename E>
> -typename std::enable_if_t<flags_enable_operators<E>::enable, Flags<E>>
> +std::enable_if_t<flags_enable_operators<E>::enable, Flags<E>>
> operator|(E lhs, E rhs)
> {
> using type = std::underlying_type_t<E>;
> @@ -155,7 +155,7 @@ operator|(E lhs, E rhs)
> }
>
> template<typename E>
> -typename std::enable_if_t<flags_enable_operators<E>::enable, Flags<E>>
> +std::enable_if_t<flags_enable_operators<E>::enable, Flags<E>>
> operator&(E lhs, E rhs)
> {
> using type = std::underlying_type_t<E>;
> @@ -163,7 +163,7 @@ operator&(E lhs, E rhs)
> }
>
> template<typename E>
> -typename std::enable_if_t<flags_enable_operators<E>::enable, Flags<E>>
> +std::enable_if_t<flags_enable_operators<E>::enable, Flags<E>>
> operator^(E lhs, E rhs)
> {
> using type = std::underlying_type_t<E>;
> @@ -171,7 +171,7 @@ operator^(E lhs, E rhs)
> }
>
> template<typename E>
> -typename std::enable_if_t<flags_enable_operators<E>::enable, Flags<E>>
> +std::enable_if_t<flags_enable_operators<E>::enable, Flags<E>>
> operator~(E rhs)
> {
> using type = std::underlying_type_t<E>;
> diff --git a/include/libcamera/base/object.h b/include/libcamera/base/object.h
> index eef1a2c98ef9..933336361155 100644
> --- a/include/libcamera/base/object.h
> +++ b/include/libcamera/base/object.h
> @@ -32,7 +32,7 @@ public:
> void postMessage(std::unique_ptr<Message> msg);
>
> template<typename T, typename R, typename... FuncArgs, typename... Args,
> - typename std::enable_if_t<std::is_base_of<Object, T>::value> * = nullptr>
> + std::enable_if_t<std::is_base_of<Object, T>::value> * = nullptr>
> R invokeMethod(R (T::*func)(FuncArgs...), ConnectionType type,
> Args&&... args)
> {
> diff --git a/include/libcamera/base/signal.h b/include/libcamera/base/signal.h
> index 91000d0d6349..efb591bc5073 100644
> --- a/include/libcamera/base/signal.h
> +++ b/include/libcamera/base/signal.h
> @@ -44,7 +44,7 @@ public:
> }
>
> #ifndef __DOXYGEN__
> - template<typename T, typename R, typename std::enable_if_t<std::is_base_of<Object, T>::value> * = nullptr>
> + template<typename T, typename R, std::enable_if_t<std::is_base_of<Object, T>::value> * = nullptr>
> void connect(T *obj, R (T::*func)(Args...),
> ConnectionType type = ConnectionTypeAuto)
> {
> @@ -52,7 +52,7 @@ public:
> SignalBase::connect(new BoundMethodMember<T, R, Args...>(obj, object, func, type));
> }
>
> - template<typename T, typename R, typename std::enable_if_t<!std::is_base_of<Object, T>::value> * = nullptr>
> + template<typename T, typename R, std::enable_if_t<!std::is_base_of<Object, T>::value> * = nullptr>
> #else
> template<typename T, typename R>
> #endif
> @@ -63,7 +63,7 @@ public:
>
> #ifndef __DOXYGEN__
> template<typename T, typename Func,
> - typename std::enable_if_t<std::is_base_of<Object, T>::value> * = nullptr>
> + std::enable_if_t<std::is_base_of<Object, T>::value> * = nullptr>
> void connect(T *obj, Func func, ConnectionType type = ConnectionTypeAuto)
> {
> Object *object = static_cast<Object *>(obj);
> @@ -71,7 +71,7 @@ public:
> }
>
> template<typename T, typename Func,
> - typename std::enable_if_t<!std::is_base_of<Object, T>::value> * = nullptr>
> + std::enable_if_t<!std::is_base_of<Object, T>::value> * = nullptr>
> #else
> template<typename T, typename Func>
> #endif
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index 7920abbad2eb..b1b52acba0fd 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -99,10 +99,10 @@ public:
> ControlValue();
>
> #ifndef __DOXYGEN__
> - template<typename T, typename std::enable_if_t<!details::is_span<T>::value &&
> - details::control_type<T>::value &&
> - !std::is_same<std::string, std::remove_cv_t<T>>::value,
> - std::nullptr_t> = nullptr>
> + template<typename T, std::enable_if_t<!details::is_span<T>::value &&
> + details::control_type<T>::value &&
> + !std::is_same<std::string, std::remove_cv_t<T>>::value,
> + std::nullptr_t> = nullptr>
> ControlValue(const T &value)
> : type_(ControlTypeNone), numElements_(0)
> {
> @@ -110,9 +110,9 @@ public:
> &value, 1, sizeof(T));
> }
>
> - template<typename T, typename std::enable_if_t<details::is_span<T>::value ||
> - std::is_same<std::string, std::remove_cv_t<T>>::value,
> - std::nullptr_t> = nullptr>
> + template<typename T, std::enable_if_t<details::is_span<T>::value ||
> + std::is_same<std::string, std::remove_cv_t<T>>::value,
> + std::nullptr_t> = nullptr>
> #else
> template<typename T>
> #endif
> @@ -144,9 +144,9 @@ public:
> }
>
> #ifndef __DOXYGEN__
> - template<typename T, typename std::enable_if_t<!details::is_span<T>::value &&
> - !std::is_same<std::string, std::remove_cv_t<T>>::value,
> - std::nullptr_t> = nullptr>
> + template<typename T, std::enable_if_t<!details::is_span<T>::value &&
> + !std::is_same<std::string, std::remove_cv_t<T>>::value,
> + std::nullptr_t> = nullptr>
> T get() const
> {
> assert(type_ == details::control_type<std::remove_cv_t<T>>::value);
> @@ -155,9 +155,9 @@ public:
> return *reinterpret_cast<const T *>(data().data());
> }
>
> - template<typename T, typename std::enable_if_t<details::is_span<T>::value ||
> - std::is_same<std::string, std::remove_cv_t<T>>::value,
> - std::nullptr_t> = nullptr>
> + template<typename T, std::enable_if_t<details::is_span<T>::value ||
> + std::is_same<std::string, std::remove_cv_t<T>>::value,
> + std::nullptr_t> = nullptr>
> #else
> template<typename T>
> #endif
> @@ -172,18 +172,18 @@ public:
> }
>
> #ifndef __DOXYGEN__
> - template<typename T, typename std::enable_if_t<!details::is_span<T>::value &&
> - !std::is_same<std::string, std::remove_cv_t<T>>::value,
> - std::nullptr_t> = nullptr>
> + template<typename T, std::enable_if_t<!details::is_span<T>::value &&
> + !std::is_same<std::string, std::remove_cv_t<T>>::value,
> + std::nullptr_t> = nullptr>
> void set(const T &value)
> {
> set(details::control_type<std::remove_cv_t<T>>::value, false,
> reinterpret_cast<const void *>(&value), 1, sizeof(T));
> }
>
> - template<typename T, typename std::enable_if_t<details::is_span<T>::value ||
> - std::is_same<std::string, std::remove_cv_t<T>>::value,
> - std::nullptr_t> = nullptr>
> + template<typename T, std::enable_if_t<details::is_span<T>::value ||
> + std::is_same<std::string, std::remove_cv_t<T>>::value,
> + std::nullptr_t> = nullptr>
> #else
> template<typename T>
> #endif
> diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h
> index a87449c9be48..30bdaebcd830 100644
> --- a/include/libcamera/internal/ipa_data_serializer.h
> +++ b/include/libcamera/internal/ipa_data_serializer.h
> @@ -32,7 +32,7 @@ LOG_DECLARE_CATEGORY(IPADataSerializer)
> namespace {
>
> template<typename T,
> - typename std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>
> + std::enable_if_t<std::is_arithmetic_v<T>> * = nullptr>
> void appendPOD(std::vector<uint8_t> &vec, T val)
> {
> constexpr size_t byteWidth = sizeof(val);
> diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h
> index 78c359f749bf..5ba777d364fa 100644
> --- a/include/libcamera/internal/yaml_parser.h
> +++ b/include/libcamera/internal/yaml_parser.h
> @@ -163,7 +163,7 @@ public:
>
> #ifndef __DOXYGEN__
> template<typename T,
> - typename std::enable_if_t<
> + std::enable_if_t<
> std::is_same_v<bool, T> ||
> std::is_same_v<double, T> ||
> std::is_same_v<int16_t, T> ||
> @@ -185,7 +185,7 @@ public:
>
> #ifndef __DOXYGEN__
> template<typename T,
> - typename std::enable_if_t<
> + std::enable_if_t<
> std::is_same_v<bool, T> ||
> std::is_same_v<double, T> ||
> std::is_same_v<int16_t, T> ||
> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp
> index 440e35c47cab..84cb57d6de83 100644
> --- a/src/libcamera/yaml_parser.cpp
> +++ b/src/libcamera/yaml_parser.cpp
> @@ -307,7 +307,7 @@ std::optional<Size> YamlObject::get() const
> #ifndef __DOXYGEN__
>
> template<typename T,
> - typename std::enable_if_t<
> + std::enable_if_t<
> std::is_same_v<bool, T> ||
> std::is_same_v<double, T> ||
> std::is_same_v<int16_t, T> ||
>
> base-commit: c13f86704b129636bb6d84f8b8ca37826ded3238
> --
> Regards,
>
> Laurent Pinchart
>
More information about the libcamera-devel
mailing list