You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2021/11/07 14:39:55 UTC

[GitHub] [celix] rlenferink commented on a change in pull request #373: Updates C++ header only to C++17

rlenferink commented on a change in pull request #373:
URL: https://github.com/apache/celix/pull/373#discussion_r744268463



##########
File path: libs/framework/include/celix/BundleActivator.h
##########
@@ -25,73 +25,71 @@
 #include "celix_bundle_activator.h"
 #include "celix/BundleContext.h"
 
-namespace celix {
-    namespace impl {
+namespace celix::impl {
 
-        template<typename I>
-        struct BundleActivatorData {
-            long bndId;
-            std::shared_ptr<celix::BundleContext> ctx;
-            std::unique_ptr<I> bundleActivator;
-        };
+    template<typename I>
+    struct BundleActivatorData {
+        long bndId{};
+        std::shared_ptr<celix::BundleContext> ctx;
+        std::unique_ptr<I> bundleActivator;
+    };
 
 
-        template<typename I>
-        typename std::enable_if<std::is_constructible<I, std::shared_ptr<celix::BundleContext>>::value, celix_status_t>::type
-        createActivator(celix_bundle_context_t *cCtx, void **out) {
-            auto ctx = std::make_shared<celix::BundleContext>(cCtx);
-            auto act = std::unique_ptr<I>(new I{ctx});
-            auto *data = new BundleActivatorData<I>{ctx->getBundleId(), std::move(ctx), std::move(act)};
-            *out = (void *) data;
-            return CELIX_SUCCESS;
-        }
+    template<typename I>
+    typename std::enable_if<std::is_constructible<I, std::shared_ptr<celix::BundleContext>>::value, celix_status_t>::type
+    createActivator(celix_bundle_context_t *cCtx, void **out) {
+        auto ctx = std::make_shared<celix::BundleContext>(cCtx);
+        auto act = std::unique_ptr<I>(new I{ctx});

Review comment:
       Ah, I forgot that the framework [is still at C++11](https://github.com/apache/celix/blob/master/libs/framework/CMakeLists.txt#L22) while the root CMakelists already [is aiming at C++17](https://github.com/apache/celix/blob/master/CMakeLists.txt#L51). In that case I'm also okay with what you have right now. No strong preference from my side.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org