diff --git a/include/etl/private/delegate_cpp03.h b/include/etl/private/delegate_cpp03.h index 74da0e497..5a1798cb8 100644 --- a/include/etl/private/delegate_cpp03.h +++ b/include/etl/private/delegate_cpp03.h @@ -168,6 +168,23 @@ namespace etl } }; + //***************************************************************** + /// The tag to identify an etl::delegate. + ///\ingroup delegate + //***************************************************************** + struct delegate_tag + { + }; + + //*************************************************************************** + /// is_delegate + //*************************************************************************** + template + struct is_delegate + { + static const bool value = etl::is_base_of::value; + }; + //************************************************************************* /// Declaration. //************************************************************************* @@ -175,10 +192,10 @@ namespace etl class delegate; template - class delegate : public private_delegate::call_if_impl, TReturn, TParam> + class delegate : public private_delegate::call_if_impl, TReturn, TParam>, public delegate_tag { private: - + typedef delegate delegate_type; public: @@ -204,7 +221,7 @@ namespace etl // Construct from a functor. //************************************************************************* template - delegate(TFunctor& instance, typename etl::enable_if::value && !etl::is_same::value, int>::type = 0) + delegate(TFunctor& instance, typename etl::enable_if::value && !is_delegate::value, int>::type = 0) { assign((void*)(&instance), functor_stub); } @@ -213,7 +230,7 @@ namespace etl // Construct from a const functor. //************************************************************************* template - delegate(const TFunctor& instance, typename etl::enable_if::value && !etl::is_same::value, int>::type = 0) + delegate(const TFunctor& instance, typename etl::enable_if::value && !is_delegate::value, int>::type = 0) { assign((void*)(&instance), const_functor_stub); } @@ -232,7 +249,7 @@ namespace etl //************************************************************************* template static - typename etl::enable_if::value &&!etl::is_same::value, delegate>::type + typename etl::enable_if::value &&!is_delegate::value, delegate>::type create(TFunctor& instance) { return delegate((void*)(&instance), functor_stub); @@ -243,7 +260,7 @@ namespace etl //************************************************************************* template static - typename etl::enable_if::value && !etl::is_same::value, delegate>::type + typename etl::enable_if::value && !is_delegate::value, delegate>::type create(const TFunctor& instance) { return delegate((void*)(&instance), const_functor_stub); @@ -330,7 +347,7 @@ namespace etl /// Set from Functor. //************************************************************************* template - typename etl::enable_if::value && !etl::is_same::value, void>::type + typename etl::enable_if::value && !is_delegate::value, void>::type set(TFunctor& instance) { assign((void*)(&instance), functor_stub); @@ -340,7 +357,7 @@ namespace etl /// Set from const Functor. //************************************************************************* template - typename etl::enable_if::value && !etl::is_same::value, void>::type + typename etl::enable_if::value && !is_delegate::value, void>::type set(const TFunctor& instance) { assign((void*)(&instance), const_functor_stub); @@ -467,7 +484,7 @@ namespace etl /// Create from Functor. //************************************************************************* template - typename etl::enable_if::value && !etl::is_same::value, delegate&>::type + typename etl::enable_if::value && !is_delegate::value, delegate&>::type operator =(TFunctor& instance) { assign((void*)(&instance), functor_stub); @@ -478,7 +495,7 @@ namespace etl /// Create from const Functor. //************************************************************************* template - typename etl::enable_if::value && !etl::is_same::value, delegate&>::type + typename etl::enable_if::value && !is_delegate::value, delegate&>::type operator =(const TFunctor& instance) { assign((void*)(&instance), const_functor_stub); @@ -705,7 +722,7 @@ namespace etl // Construct from functor. //************************************************************************* template - delegate(TFunctor& instance, typename etl::enable_if::value && !etl::is_same::value, int>::type = 0) + delegate(TFunctor& instance, typename etl::enable_if::value && !is_delegate::value, int>::type = 0) { assign((void*)(&instance), functor_stub); } @@ -714,7 +731,7 @@ namespace etl // Construct from const functor. //************************************************************************* template - delegate(const TFunctor& instance, typename etl::enable_if::value && !etl::is_same::value, int>::type = 0) + delegate(const TFunctor& instance, typename etl::enable_if::value && !is_delegate::value, int>::type = 0) { assign((void*)(&instance), const_functor_stub); } @@ -733,7 +750,7 @@ namespace etl //************************************************************************* template static - typename etl::enable_if::value && !etl::is_same::value, delegate>::type + typename etl::enable_if::value && !is_delegate::value, delegate>::type create(TFunctor& instance) { return delegate((void*)(&instance), functor_stub); @@ -744,7 +761,7 @@ namespace etl //************************************************************************* template static - typename etl::enable_if::value && !etl::is_same::value, delegate>::type + typename etl::enable_if::value && !is_delegate::value, delegate>::type create(const TFunctor& instance) { return delegate((void*)(&instance), const_functor_stub); @@ -831,7 +848,7 @@ namespace etl /// Set from Functor. //************************************************************************* template - typename etl::enable_if::value && !etl::is_same::value, void>::type + typename etl::enable_if::value && !is_delegate::value, void>::type set(TFunctor& instance) { assign((void*)(&instance), functor_stub); @@ -841,7 +858,7 @@ namespace etl /// Set from const Functor. //************************************************************************* template - typename etl::enable_if::value && !etl::is_same::value, void>::type + typename etl::enable_if::value && !is_delegate::value, void>::type set(const TFunctor& instance) { assign((void*)(&instance), const_functor_stub); @@ -968,7 +985,7 @@ namespace etl /// Create from Functor. //************************************************************************* template - typename etl::enable_if::value && !etl::is_same::value, delegate&>::type + typename etl::enable_if::value && !is_delegate::value, delegate&>::type operator =(TFunctor& instance) { assign((void*)(&instance), functor_stub); @@ -979,7 +996,7 @@ namespace etl /// Create from const Functor. //************************************************************************* template - typename etl::enable_if::value && !etl::is_same::value, delegate&>::type + typename etl::enable_if::value && !is_delegate::value, delegate&>::type operator =(const TFunctor& instance) { assign((void*)(&instance), const_functor_stub);