From b5eff18f1aef980fa7eb55184996710a6fc9523e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 16 Feb 2020 02:10:10 +0200 Subject: libcamera: Use C++14 std::*_t type traits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C++14 introduced useful type traits helpers named std::*_t as aliases to std::*<...>::type. Use them to simplify the code. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- include/libcamera/bound_method.h | 6 +++--- include/libcamera/object.h | 2 +- include/libcamera/signal.h | 4 ++-- src/libcamera/ipa_module.cpp | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h index 7ffd2e42..983bb5cb 100644 --- a/include/libcamera/bound_method.h +++ b/include/libcamera/bound_method.h @@ -38,7 +38,7 @@ public: { } - std::tuple::type...> args_; + std::tuple...> args_; R ret_; }; @@ -51,7 +51,7 @@ public: { } - std::tuple::type...> args_; + std::tuple...> args_; }; class BoundMethodBase @@ -63,7 +63,7 @@ public: } virtual ~BoundMethodBase() {} - template::value>::type * = nullptr> + template::value> * = nullptr> bool match(T *obj) { return obj == obj_; } bool match(Object *object) { return object == object_; } diff --git a/include/libcamera/object.h b/include/libcamera/object.h index 4d16f3f2..9a3dd070 100644 --- a/include/libcamera/object.h +++ b/include/libcamera/object.h @@ -30,7 +30,7 @@ public: void postMessage(std::unique_ptr msg); template::value>::type * = nullptr> + typename std::enable_if_t::value> * = nullptr> R invokeMethod(R (T::*func)(FuncArgs...), ConnectionType type, Args... args) { diff --git a/include/libcamera/signal.h b/include/libcamera/signal.h index c13bb30f..ed30eb55 100644 --- a/include/libcamera/signal.h +++ b/include/libcamera/signal.h @@ -45,7 +45,7 @@ public: } #ifndef __DOXYGEN__ - template::value>::type * = nullptr> + template::value> * = nullptr> void connect(T *obj, R (T::*func)(Args...), ConnectionType type = ConnectionTypeAuto) { @@ -53,7 +53,7 @@ public: SignalBase::connect(new BoundMethodMember(obj, object, func, type)); } - template::value>::type * = nullptr> + template::value> * = nullptr> #else template #endif diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index de65525b..a01d0757 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -42,20 +42,20 @@ LOG_DEFINE_CATEGORY(IPAModule) namespace { template -typename std::remove_extent::type *elfPointer(void *map, off_t offset, - size_t fileSize, size_t objSize) +typename std::remove_extent_t *elfPointer(void *map, off_t offset, + size_t fileSize, size_t objSize) { size_t size = offset + objSize; if (size > fileSize || size < objSize) return nullptr; - return reinterpret_cast::type *> + return reinterpret_cast *> (static_cast(map) + offset); } template -typename std::remove_extent::type *elfPointer(void *map, off_t offset, - size_t fileSize) +typename std::remove_extent_t *elfPointer(void *map, off_t offset, + size_t fileSize) { return elfPointer(map, offset, fileSize, sizeof(T)); } -- cgit v1.2.1