Fixed C++03 compatibility

Added syntax checks for closure.h
This commit is contained in:
John Wellbelove 2025-07-06 20:24:19 +01:00
parent 3c783e2de7
commit feeb0d480a
5 changed files with 63 additions and 7 deletions

View File

@ -86,7 +86,7 @@ namespace etl
class closure<R(Arg0)>
{
public:
using fct = etl::delegate<R(Arg0)>;
typedef etl::delegate<R(Arg0)> fct;
closure(fct const& f, Arg0 const arg0)
: m_f(f), m_arg0(arg0)
@ -106,7 +106,7 @@ namespace etl
class closure<R(Arg0, Arg1)>
{
public:
using fct = etl::delegate<R(Arg0, Arg1)>;
typedef etl::delegate<R(Arg0, Arg1)> fct;
closure(fct const& f, Arg0 const arg0, Arg1 const arg1)
: m_f(f), m_arg0(arg0), m_arg1(arg1)
@ -127,7 +127,7 @@ namespace etl
class closure<R(Arg0, Arg1, Arg2)>
{
public:
using fct = etl::delegate<R(Arg0, Arg1, Arg2)>;
typedef etl::delegate<R(Arg0, Arg1, Arg2)> fct;
closure(fct const& f, Arg0 const arg0, Arg1 const arg1, Arg2 const arg2)
: m_f(f), m_arg0(arg0), m_arg1(arg1), m_arg2(arg2)
@ -149,7 +149,7 @@ namespace etl
class closure<R(Arg0, Arg1, Arg2, Arg3)>
{
public:
using fct = etl::delegate<R(Arg0, Arg1, Arg2, Arg3)>;
typedef etl::delegate<R(Arg0, Arg1, Arg2, Arg3)> fct;
closure(fct const& f, Arg0 const arg0, Arg1 const arg1, Arg2 const arg2, Arg3 const arg3)
: m_f(f), m_arg0(arg0), m_arg1(arg1), m_arg2(arg2), m_arg3(arg3)
@ -172,7 +172,7 @@ namespace etl
class closure<R(Arg0, Arg1, Arg2, Arg3, Arg4)>
{
public:
using fct = etl::delegate<R(Arg0, Arg1, Arg2, Arg3, Arg4)>;
typedef etl::delegate<R(Arg0, Arg1, Arg2, Arg3, Arg4)> fct;
closure(fct const& f, Arg0 const arg0, Arg1 const arg1, Arg2 const arg2, Arg3 const arg3, Arg4 const arg4)
: m_f(f), m_arg0(arg0), m_arg1(arg1), m_arg2(arg2), m_arg3(arg3), m_arg4(arg4)

View File

@ -99,6 +99,7 @@ target_sources(tests PRIVATE
chrono.h.t.cpp
circular_buffer.h.t.cpp
circular_iterator.h.t.cpp
closure.h.t.cpp
combinations.h.t.cpp
compare.h.t.cpp
constant.h.t.cpp

View File

@ -0,0 +1,29 @@
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2025 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#include <etl/closure.h>

View File

@ -3288,6 +3288,7 @@
<ClInclude Include="..\..\include\etl\chrono.h" />
<ClInclude Include="..\..\include\etl\circular_buffer.h" />
<ClInclude Include="..\..\include\etl\circular_iterator.h" />
<ClInclude Include="..\..\include\etl\closure.h" />
<ClInclude Include="..\..\include\etl\combinations.h" />
<ClInclude Include="..\..\include\etl\compare.h" />
<ClInclude Include="..\..\include\etl\constant.h" />
@ -4759,6 +4760,24 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++20 - Force C++03|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++20 - Force C++03 - No virtual messages|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\syntax_check\closure.h.t.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++20|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++20 - No virtual imessage|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++ 20 - No Tests|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++23 - No STL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++23|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++20 - No STL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++14|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release MSVC C++20 - No STL - Optimised -O2|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release MSVC C++20 - No STL - Optimised -O2 - Sanitiser|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++20 - Force C++03 - No virtual messages|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++17|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++17 - No STL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release MSVC C++20 - Optimised O2|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++20 - No virtual messages|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++14 - No STL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++20 - Force C++03|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\syntax_check\combinations.h.t.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++20|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC C++23|Win32'">true</ExcludedFromBuild>
@ -9271,6 +9290,7 @@
<ClCompile Include="..\test_circular_buffer.cpp" />
<ClCompile Include="..\test_circular_buffer_external_buffer.cpp" />
<ClCompile Include="..\test_circular_iterator.cpp" />
<ClCompile Include="..\test_closure.cpp" />
<ClCompile Include="..\test_correlation.cpp" />
<ClCompile Include="..\test_covariance.cpp" />
<ClCompile Include="..\test_crc1.cpp" />

View File

@ -1515,6 +1515,9 @@
<ClInclude Include="..\..\include\etl\const_map.h">
<Filter>ETL\Containers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\closure.h">
<Filter>ETL\Utilities</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\test_string_char.cpp">
@ -3596,8 +3599,11 @@
<ClCompile Include="..\test_chrono_literals.cpp">
<Filter>Tests\Chrono</Filter>
</ClCompile>
<ClCompile Include="..\test_const_map.cpp">
<Filter>Tests\Containers</Filter>
<ClCompile Include="..\test_closure.cpp">
<Filter>Tests\Callbacks &amp; Delegates</Filter>
</ClCompile>
<ClCompile Include="..\syntax_check\closure.h.t.cpp">
<Filter>Tests\Syntax Checks\Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>