From 5a9fc4dd00a62de3e4ce90b0f5fedd04157ce44c Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 4 Aug 2022 15:33:43 +0100 Subject: [PATCH] Fixed C++03 delegate compatibility --- include/etl/private/delegate_cpp03.h | 34 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/include/etl/private/delegate_cpp03.h b/include/etl/private/delegate_cpp03.h index 01218a89..8afb09c9 100644 --- a/include/etl/private/delegate_cpp03.h +++ b/include/etl/private/delegate_cpp03.h @@ -66,11 +66,11 @@ namespace etl //*********************************** template struct call_if_impl - { - TDelegate& d = static_cast(*this); - + { etl::optional call_if(TParam param) { + TDelegate& d = static_cast(*this); + etl::optional result; if (d.is_valid()) @@ -88,8 +88,8 @@ namespace etl { bool call_if() { - TDelegate& d = static_cast(*this); - + TDelegate& d = static_cast(*this); + if (d.is_valid()) { d(); @@ -106,10 +106,10 @@ namespace etl template struct call_if_impl { - TDelegate& d = static_cast(*this); - etl::optional call_if() { + TDelegate& d = static_cast(*this); + etl::optional result; if (d.is_valid()) @@ -435,7 +435,11 @@ namespace etl //************************************************************************* struct invocation_element { - invocation_element() = default; + invocation_element() + : object(ETL_NULLPTR) + , stub(ETL_NULLPTR) + { + } //*********************************************************************** invocation_element(void* object_, stub_type stub_) @@ -457,8 +461,8 @@ namespace etl } //*********************************************************************** - void* object = ETL_NULLPTR; - stub_type stub = ETL_NULLPTR; + void* object; + stub_type stub; }; //************************************************************************* @@ -823,7 +827,11 @@ namespace etl //************************************************************************* struct invocation_element { - invocation_element() = default; + invocation_element() + : object(ETL_NULLPTR) + , stub(ETL_NULLPTR) + { + } //*********************************************************************** invocation_element(void* object_, stub_type stub_) @@ -845,8 +853,8 @@ namespace etl } //*********************************************************************** - void* object = ETL_NULLPTR; - stub_type stub = ETL_NULLPTR; + void* object; + stub_type stub; }; //*************************************************************************