diff --git a/include/etl/delegate.h b/include/etl/delegate.h index 5539c61c..4cd8a595 100644 --- a/include/etl/delegate.h +++ b/include/etl/delegate.h @@ -49,7 +49,6 @@ Original publication: https://www.codeproject.com/Articles/1170503/The-Impossibl #define ETL_DELEGATE_INCLUDED #include "platform.h" -#include "type_traits.h" #if ETL_CPP11_SUPPORTED == 0 #error NOT SUPPORTED FOR C++03 OR BELOW @@ -77,10 +76,8 @@ namespace etl //************************************************************************* // Constructor from lambda or functor. //************************************************************************* - template >::value, int>::type> - delegate(TLambda& instance) + template + delegate(const TLambda& instance) { assign((void*)(&instance), lambda_stub); } @@ -97,10 +94,8 @@ namespace etl //************************************************************************* /// Create from Lambda or Functor. //************************************************************************* - template >::value, int>::type> - static delegate create(TLambda& instance) + template + static delegate create(const TLambda& instance) { return delegate((void*)(&instance), lambda_stub); } @@ -130,6 +125,9 @@ namespace etl return delegate((void*)(&instance), const_method_stub); } + //************************************************************************* + /// Disable create from rvalue instance method (Run time). + //************************************************************************* template static delegate create(T&& instance) = delete; @@ -179,10 +177,8 @@ namespace etl //************************************************************************* /// Create from Lambda or Functor. //************************************************************************* - template >::value, int>::type> - delegate& operator =(TLambda& instance) + template + delegate& operator =(const TLambda& instance) { assign((void*)(&instance), lambda_stub); return *this;