You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ab...@apache.org on 2020/06/15 20:22:22 UTC
[nifi-minifi-cpp] 02/03: MINIFICPP-1260 make void_t fwd-compatible
with C++17
This is an automated email from the ASF dual-hosted git repository.
aboda pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 0f14a48788c12d5faf536402bb19196ce96a184c
Author: Marton Szasz <sz...@gmail.com>
AuthorDate: Mon Jun 15 12:55:19 2020 +0200
MINIFICPP-1260 make void_t fwd-compatible with C++17
... and make `make_unique` follow the standard version more closely
Signed-off-by: Arpad Boda <ab...@apache.org>
This closes #814
---
libminifi/include/utils/GeneralUtils.h | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/libminifi/include/utils/GeneralUtils.h b/libminifi/include/utils/GeneralUtils.h
index 08e4ca3..63145fe 100644
--- a/libminifi/include/utils/GeneralUtils.h
+++ b/libminifi/include/utils/GeneralUtils.h
@@ -35,7 +35,7 @@ namespace utils {
#if __cplusplus < 201402L
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) {
- return std::unique_ptr<T>{ new T{ std::forward<Args>(args)... } };
+ return std::unique_ptr<T>{ new T(std::forward<Args>(args)...) };
}
#else
using std::make_unique;
@@ -57,13 +57,16 @@ T exchange(T& obj, U&& new_value) {
obj = std::forward<U>(new_value);
return old_value;
}
+#else
+using std::exchange;
+#endif /* < C++14 */
+#if __cplusplus < 201703L
template<typename...>
using void_t = void;
-
#else
-using std::exchange;
-#endif /* < C++14 */
+using std::void_t;
+#endif /* < C++17 */
} // namespace utils
} // namespace minifi