[dali_2.3.32] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / public-api / signals / functor-delegate.cpp
index 5a18b9e..fa7772f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@
 // CLASS HEADER
 #include <dali/public-api/signals/functor-delegate.h>
 
-// INTERNAL INCLUDES
-#include <dali/public-api/common/compile-time-assert.h>
+// EXTERNAL INCLUDES
+#include <type_traits>
 
 namespace Dali
 {
@@ -31,34 +31,30 @@ namespace
  * functions and regular functions.
  * If this assert fails, please implement the template specialisation for C functions.
  */
-#if !defined(EMSCRIPTEN)
-void Function() __attribute__((unused));
-void Function() { }
-DALI_COMPILE_TIME_ASSERT( sizeof(void*) == sizeof(&Function) );
-#endif
-}
+static_assert(sizeof(void*) == sizeof(&FunctorDispatcher<void>::Dispatch), "Need to implement template specialisation for C functions");
+} // namespace
 
 FunctorDelegate::~FunctorDelegate()
 {
-  if( mFunctorPointer )
+  if(mFunctorPointer)
   {
-    (*mDestructorDispatcher)( mFunctorPointer );
+    (*mDestructorDispatcher)(mFunctorPointer);
   }
 }
 
 void FunctorDelegate::Execute()
 {
-  if( mFunctorPointer )
+  if(mFunctorPointer)
   {
     Dispatcher dispatcher = mMemberFunctionDispatcher;
-    (*dispatcher)( mFunctorPointer );
+    (*dispatcher)(mFunctorPointer);
   }
 }
 
-FunctorDelegate::FunctorDelegate( void* objectPtr, Dispatcher dispatcher, Destructor destructor )
-: mFunctorPointer( objectPtr ),
-  mMemberFunctionDispatcher( dispatcher ),
-  mDestructorDispatcher( destructor )
+FunctorDelegate::FunctorDelegate(void* objectPtr, Dispatcher dispatcher, Destructor destructor)
+: mFunctorPointer(objectPtr),
+  mMemberFunctionDispatcher(dispatcher),
+  mDestructorDispatcher(destructor)
 {
 }