mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Merge branch 'development'
This commit is contained in:
commit
e3dac1e33e
5
.gitignore
vendored
5
.gitignore
vendored
@ -403,3 +403,8 @@ test/syntax_check/bgcc
|
||||
test/vs2022/Debug MSVC C++23
|
||||
test/vs2022/Debug MSVC C++23 - No STL
|
||||
.vs
|
||||
examples/UniquePtrWithPool/CMakeFiles
|
||||
examples/UniquePtrWithPool/cmake_install.cmake
|
||||
examples/UniquePtrWithPool/Makefile
|
||||
examples/UniquePtrWithPool/CMakeCache.txt
|
||||
examples/UniquePtrWithPool/UniquePtrWithPool
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Embedded Template Library ETL",
|
||||
"version": "20.42.2",
|
||||
"version": "20.43.0",
|
||||
"authors": {
|
||||
"name": "John Wellbelove",
|
||||
"email": "john.wellbelove@etlcpp.com"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name=Embedded Template Library ETL
|
||||
version=20.42.2
|
||||
version=20.43.0
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
license=MIT
|
||||
|
||||
10
examples/UniquePtrWithPool/CmakeLists.txt
Normal file
10
examples/UniquePtrWithPool/CmakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(UniquePtrWithPool LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Add source files
|
||||
add_executable(UniquePtrWithPool Main.cpp)
|
||||
|
||||
target_include_directories(UniquePtrWithPool PRIVATE ../../include)
|
||||
37
examples/UniquePtrWithPool/Main.cpp
Normal file
37
examples/UniquePtrWithPool/Main.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "etl/memory.h"
|
||||
#include "etl/pool.h"
|
||||
|
||||
struct S
|
||||
{
|
||||
S(int a_, double b_)
|
||||
: a(a_), b(b_)
|
||||
{
|
||||
}
|
||||
|
||||
int a;
|
||||
double b;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
etl::pool<S, 10> pool;
|
||||
auto pool_deleter = [&pool](auto ptr)
|
||||
{
|
||||
std::cout << "Releasing S(" << ptr->a << ", " << ptr->b << ") back to pool." << std::endl;
|
||||
pool.destroy(ptr);
|
||||
};
|
||||
using Unique = etl::unique_ptr<S, decltype(pool_deleter)>;
|
||||
|
||||
Unique us1(pool.create(1, 2), pool_deleter);
|
||||
std::cout << "Created S(" << us1->a << ", " << us1->b << ") from pool." << std::endl;
|
||||
|
||||
{
|
||||
Unique us2(pool.create(3, 4), pool_deleter);
|
||||
std::cout << "Created S(" << us2->a << ", " << us2->b << ") from pool." << std::endl;
|
||||
}
|
||||
|
||||
Unique us3(pool.create(5, 6), pool_deleter);
|
||||
std::cout << "Created S(" << us3->a << ", " << us3->b << ") from pool." << std::endl;
|
||||
}
|
||||
31
examples/UniquePtrWithPool/UniquePtrWithPool.sln
Normal file
31
examples/UniquePtrWithPool/UniquePtrWithPool.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36408.4 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniquePtrWithPool", "UniquePtrWithPool.vcxproj", "{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Debug|x64.Build.0 = Debug|x64
|
||||
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Debug|x86.Build.0 = Debug|Win32
|
||||
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Release|x64.ActiveCfg = Release|x64
|
||||
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Release|x64.Build.0 = Release|x64
|
||||
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Release|x86.ActiveCfg = Release|Win32
|
||||
{B9ED2FDF-2529-4315-9AEF-02A98B804DEC}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D21FA849-65C8-4A81-BD9D-B38BFBD73494}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
133
examples/UniquePtrWithPool/UniquePtrWithPool.vcxproj
Normal file
133
examples/UniquePtrWithPool/UniquePtrWithPool.vcxproj
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{b9ed2fdf-2529-4315-9aef-02a98b804dec}</ProjectGuid>
|
||||
<RootNamespace>UniquePtrWithPool</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>../../include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>../../include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@ -107,4 +107,5 @@ SOFTWARE.
|
||||
#define ETL_UNALIGNED_TYPE_FILE_ID "74"
|
||||
#define ETL_SPAN_FILE_ID "75"
|
||||
#define ETL_ALGORITHM_FILE_ID "76"
|
||||
#define ETL_NOT_NULL_FILE_ID "77"
|
||||
#endif
|
||||
|
||||
@ -170,8 +170,7 @@ namespace etl
|
||||
{
|
||||
ETL_STATIC_ASSERT(etl::alignment_of<U>::value <= VAlignment, "Type has incompatible alignment");
|
||||
ETL_STATIC_ASSERT(sizeof(U) <= VTypeSize, "Type too large for pool");
|
||||
p_object->~U();
|
||||
ipool::release(p_object);
|
||||
ipool::destroy(p_object);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -338,8 +337,7 @@ namespace etl
|
||||
{
|
||||
ETL_STATIC_ASSERT(etl::alignment_of<U>::value <= VAlignment, "Type has incompatible alignment");
|
||||
ETL_STATIC_ASSERT(sizeof(U) <= VTypeSize, "Type too large for pool");
|
||||
p_object->~U();
|
||||
ipool::release(p_object);
|
||||
ipool::destroy(p_object);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
265
include/etl/not_null.h
Normal file
265
include/etl/not_null.h
Normal file
@ -0,0 +1,265 @@
|
||||
///\file
|
||||
|
||||
/******************************************************************************
|
||||
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.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef ETL_NOT_NULL_INCLUDED
|
||||
#define ETL_NOT_NULL_INCLUDED
|
||||
|
||||
#include "platform.h"
|
||||
#include "error_handler.h"
|
||||
#include "exception.h"
|
||||
#include "static_assert.h"
|
||||
#include "memory.h"
|
||||
#include "type_traits.h"
|
||||
|
||||
namespace etl
|
||||
{
|
||||
//***************************************************************************
|
||||
/// The base class for not_null exceptions.
|
||||
//***************************************************************************
|
||||
class not_null_exception : public exception
|
||||
{
|
||||
public:
|
||||
|
||||
not_null_exception(string_type reason_, string_type file_name_, numeric_type line_number_) ETL_NOEXCEPT_IF_NO_THROW
|
||||
: exception(reason_, file_name_, line_number_)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// The exception when the not_null contains a null.
|
||||
//***************************************************************************
|
||||
class not_null_contains_null : public not_null_exception
|
||||
{
|
||||
public:
|
||||
|
||||
not_null_contains_null(string_type file_name_, numeric_type line_number_) ETL_NOEXCEPT_IF_NO_THROW
|
||||
: not_null_exception(ETL_ERROR_TEXT("not_null:contains null", ETL_NOT_NULL_FILE_ID"A"), file_name_, line_number_)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
// not_null
|
||||
// Primary template
|
||||
//***************************************************************************
|
||||
template <typename T>
|
||||
class not_null;
|
||||
|
||||
//***************************************************************************
|
||||
// Specialisation for T*
|
||||
// A container for pointers that are not allowed to be null.
|
||||
//***************************************************************************
|
||||
template <typename T>
|
||||
class not_null<T*>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef pointer underlying_type;
|
||||
|
||||
//*********************************
|
||||
/// Constructs a not_null from a pointer.
|
||||
/// Asserts if the pointer is null.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 explicit not_null(underlying_type ptr_) ETL_NOEXCEPT_IF_NO_THROW
|
||||
: ptr(ptr_)
|
||||
{
|
||||
ETL_ASSERT(ptr_ != ETL_NULLPTR, ETL_ERROR(not_null_contains_null));
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Copy construct from a not_null pointer.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 not_null(const etl::not_null<T*>& other) ETL_NOEXCEPT
|
||||
: ptr(other.get())
|
||||
{
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Assignment from a pointer.
|
||||
/// Asserts if the pointer is null.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 not_null& operator =(underlying_type rhs) ETL_NOEXCEPT_IF_NO_THROW
|
||||
{
|
||||
ETL_ASSERT_OR_RETURN_VALUE(rhs != ETL_NULLPTR, ETL_ERROR(not_null_contains_null), *this);
|
||||
|
||||
ptr = rhs;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Assignment from a not_null.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 not_null& operator =(const etl::not_null<T*>& rhs) ETL_NOEXCEPT
|
||||
{
|
||||
ptr = rhs.get();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Gets the underlying pointer.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 pointer get() const ETL_NOEXCEPT
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Implicit conversion to pointer.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 operator pointer() const ETL_NOEXCEPT
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Dereference operator.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 reference operator*() const ETL_NOEXCEPT
|
||||
{
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Arrow operator.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 pointer operator->() const ETL_NOEXCEPT
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/// The underlying pointer.
|
||||
pointer ptr;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
// Partial specialisation for etl::unique_ptr
|
||||
// A container for unique_ptr that are not allowed to be null.
|
||||
//***************************************************************************
|
||||
template <typename T, typename TDeleter>
|
||||
class not_null<etl::unique_ptr<T, TDeleter> >
|
||||
{
|
||||
private:
|
||||
|
||||
typedef etl::not_null<etl::unique_ptr<T, TDeleter> > this_type;
|
||||
typedef etl::unique_ptr<T, TDeleter> underlying_type;
|
||||
|
||||
public:
|
||||
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
//*********************************
|
||||
/// Constructs a not_null from a unique_ptr.
|
||||
/// Asserts if the unique_ptr contains null.
|
||||
/// Moves from the unique_ptr.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 explicit not_null(underlying_type&& u_ptr_) ETL_NOEXCEPT_IF_NO_THROW
|
||||
: u_ptr(etl::move(u_ptr_))
|
||||
{
|
||||
ETL_ASSERT(u_ptr.get() != ETL_NULLPTR, ETL_ERROR(not_null_contains_null));
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Assign from a unique_ptr.
|
||||
/// Asserts if the unique_ptr contains null.
|
||||
/// Moves from the unique_ptr.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 not_null& operator =(underlying_type&& rhs) ETL_NOEXCEPT_IF_NO_THROW
|
||||
{
|
||||
ETL_ASSERT_OR_RETURN_VALUE(rhs.get() != ETL_NULLPTR, ETL_ERROR(not_null_contains_null), *this);
|
||||
|
||||
u_ptr = etl::move(rhs);
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
//*********************************
|
||||
/// Gets the underlying ptr.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 pointer get() const ETL_NOEXCEPT
|
||||
{
|
||||
return u_ptr.get();
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Implicit conversion to pointer.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 operator pointer() const ETL_NOEXCEPT
|
||||
{
|
||||
return u_ptr.get();
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Dereference operator.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 reference operator*() const ETL_NOEXCEPT
|
||||
{
|
||||
return *u_ptr;
|
||||
}
|
||||
|
||||
//*********************************
|
||||
/// Arrow operator.
|
||||
//*********************************
|
||||
ETL_CONSTEXPR14 pointer operator->() const ETL_NOEXCEPT
|
||||
{
|
||||
return u_ptr.get();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
ETL_CONSTEXPR14 explicit not_null(const this_type& u_ptr_) ETL_NOEXCEPT ETL_DELETE;
|
||||
ETL_CONSTEXPR14 not_null& operator=(const this_type& rhs) ETL_NOEXCEPT ETL_DELETE;
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
ETL_CONSTEXPR14 explicit not_null(this_type&& u_ptr_) ETL_NOEXCEPT = delete;
|
||||
ETL_CONSTEXPR14 not_null& operator=(this_type&& rhs) ETL_NOEXCEPT = delete;
|
||||
#endif
|
||||
|
||||
/// The underlying unique_ptr.
|
||||
underlying_type u_ptr;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -331,13 +331,15 @@ SOFTWARE.
|
||||
#define ETL_ENUM_CLASS(name) enum class name
|
||||
#define ETL_ENUM_CLASS_TYPE(name, type) enum class name : type
|
||||
#define ETL_LVALUE_REF_QUALIFIER &
|
||||
#define ETL_NOEXCEPT noexcept
|
||||
#define ETL_NOEXCEPT_EXPR(...) noexcept(__VA_ARGS__)
|
||||
|
||||
#if ETL_USING_EXCEPTIONS
|
||||
#define ETL_NOEXCEPT noexcept
|
||||
#define ETL_NOEXCEPT_EXPR(...) noexcept(__VA_ARGS__)
|
||||
#if ETL_NOT_USING_EXCEPTIONS
|
||||
#define ETL_NOEXCEPT_IF_NO_THROW noexcept
|
||||
#define ETL_NOEXCEPT_IF_NO_THROW_EXPR(...) noexcept(__VA_ARGS__)
|
||||
#else
|
||||
#define ETL_NOEXCEPT
|
||||
#define ETL_NOEXCEPT_EXPR(...)
|
||||
#define ETL_NOEXCEPT_IF_NO_THROW
|
||||
#define ETL_NOEXCEPT_IF_NO_THROW_EXPR(...)
|
||||
#endif
|
||||
#else
|
||||
#define ETL_CONSTEXPR
|
||||
@ -354,6 +356,8 @@ SOFTWARE.
|
||||
#define ETL_ENUM_CLASS(name) enum name
|
||||
#define ETL_ENUM_CLASS_TYPE(name, type) enum name
|
||||
#define ETL_LVALUE_REF_QUALIFIER
|
||||
#define ETL_NOEXCEPT_IF_NO_THROW
|
||||
#define ETL_NOEXCEPT_IF_NO_THROW_EXPR(...)
|
||||
#endif
|
||||
|
||||
//*************************************
|
||||
|
||||
@ -818,6 +818,26 @@ namespace etl
|
||||
TReturn(*ptr)(TArgs...);
|
||||
};
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP17 && !defined(ETL_FORCE_CPP11_NONTYPE)
|
||||
//*****************************************************************************
|
||||
// Wraps a non-type template parameter as a type.
|
||||
//*****************************************************************************
|
||||
template <auto Value>
|
||||
struct nontype_t
|
||||
{
|
||||
static constexpr decltype(Value) value = Value;
|
||||
};
|
||||
#elif ETL_USING_CPP11
|
||||
//*****************************************************************************
|
||||
// Wraps a non-type template parameter as a type.
|
||||
//*****************************************************************************
|
||||
template <typename T, T Value>
|
||||
struct nontype_t
|
||||
{
|
||||
static constexpr T value = Value;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -39,8 +39,8 @@ SOFTWARE.
|
||||
///\ingroup utilities
|
||||
|
||||
#define ETL_VERSION_MAJOR 20
|
||||
#define ETL_VERSION_MINOR 42
|
||||
#define ETL_VERSION_PATCH 2
|
||||
#define ETL_VERSION_MINOR 43
|
||||
#define ETL_VERSION_PATCH 0
|
||||
|
||||
#define ETL_VERSION ETL_STRING(ETL_VERSION_MAJOR) "." ETL_STRING(ETL_VERSION_MINOR) "." ETL_STRING(ETL_VERSION_PATCH)
|
||||
#define ETL_VERSION_W ETL_WIDE_STRING(ETL_VERSION_MAJOR) L"." ETL_WIDE_STRING(ETL_VERSION_MINOR) L"." ETL_WIDE_STRING(ETL_VERSION_PATCH)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Embedded Template Library",
|
||||
"version": "20.42.2",
|
||||
"version": "20.43.0",
|
||||
"authors": {
|
||||
"name": "John Wellbelove",
|
||||
"email": "john.wellbelove@etlcpp.com"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name=Embedded Template Library
|
||||
version=20.42.2
|
||||
version=20.43.0
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
license=MIT
|
||||
|
||||
@ -1 +1 @@
|
||||
python .\update_release.py
|
||||
python3 ./update_release.py
|
||||
|
||||
@ -1 +1 @@
|
||||
python .\update_version.py
|
||||
python3 ./update_version.py
|
||||
|
||||
@ -5,6 +5,8 @@ Updates:
|
||||
Added 'emplace' constructor to etl::optional
|
||||
Added etl::delegate_observable
|
||||
Added return_type and argument_types to etl::delegate
|
||||
Added etl::nontype_t<>
|
||||
Added etl::not_null<>
|
||||
#1054 Using #pragma once
|
||||
#1159 etl::fsm helper to check states id sequence at compile time
|
||||
#1160 Feature request: rounded division (similar to scaled rounding)
|
||||
|
||||
@ -229,6 +229,9 @@ add_executable(etl_tests
|
||||
test_multi_span.cpp
|
||||
test_multi_vector.cpp
|
||||
test_murmur3.cpp
|
||||
test_not_null_pointer.cpp
|
||||
test_not_null_pointer_constexpr.cpp
|
||||
test_not_null_unique_pointer.cpp
|
||||
test_nth_type.cpp
|
||||
test_numeric.cpp
|
||||
test_observer.cpp
|
||||
|
||||
@ -126,6 +126,8 @@ target_sources(tests PRIVATE
|
||||
crc16_maxim.h.t.cpp
|
||||
crc16_mcrf4xx.h.t.cpp
|
||||
crc16_modbus.h.t.cpp
|
||||
crc16_opensafety_a.h.t.cpp
|
||||
crc16_opensafety_b.h.t.cpp
|
||||
crc16_profibus.h.t.cpp
|
||||
crc16_riello.h.t.cpp
|
||||
crc16_t10dif.h.t.cpp
|
||||
@ -154,12 +156,14 @@ target_sources(tests PRIVATE
|
||||
crc8_j1850.h.t.cpp
|
||||
crc8_j1850_zero.h.t.cpp
|
||||
crc8_maxim.h.t.cpp
|
||||
crc8_opensafety.h.t.cpp
|
||||
crc8_rohc.h.t.cpp
|
||||
crc8_wcdma.h.t.cpp
|
||||
cyclic_value.h.t.cpp
|
||||
debounce.h.t.cpp
|
||||
debug_count.h.t.cpp
|
||||
delegate.h.t.cpp
|
||||
delegate_observable.h.t.cpp
|
||||
delegate_service.h.t.cpp
|
||||
deque.h.t.cpp
|
||||
endianness.h.t.cpp
|
||||
@ -242,6 +246,7 @@ target_sources(tests PRIVATE
|
||||
murmur3.h.t.cpp
|
||||
mutex.h.t.cpp
|
||||
negative.h.t.cpp
|
||||
not_null.h.t.cpp
|
||||
nth_type.h.t.cpp
|
||||
nullptr.h.t.cpp
|
||||
null_type.h.t.cpp
|
||||
|
||||
29
test/syntax_check/crc16_opensafety_a.h.t.cpp
Normal file
29
test/syntax_check/crc16_opensafety_a.h.t.cpp
Normal 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/crc16_opensafety_a.h>
|
||||
29
test/syntax_check/crc16_opensafety_b.h.t.cpp
Normal file
29
test/syntax_check/crc16_opensafety_b.h.t.cpp
Normal 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/crc16_opensafety_b.h>
|
||||
29
test/syntax_check/crc8_opensafety.h.t.cpp
Normal file
29
test/syntax_check/crc8_opensafety.h.t.cpp
Normal 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/crc8_opensafety.h>
|
||||
28
test/syntax_check/delegate_observable.h.t.cpp
Normal file
28
test/syntax_check/delegate_observable.h.t.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/******************************************************************************
|
||||
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/delegate_observable.h>
|
||||
29
test/syntax_check/not_null.h.t.cpp
Normal file
29
test/syntax_check/not_null.h.t.cpp
Normal 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/not_null.h>
|
||||
164
test/test_not_null_pointer.cpp
Normal file
164
test/test_not_null_pointer.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
/******************************************************************************
|
||||
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 "unit_test_framework.h"
|
||||
#include "etl/not_null.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct S
|
||||
{
|
||||
int x;
|
||||
|
||||
int get() const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
SUITE(test_not_null_pointer)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_construct_from_non_null_pointer)
|
||||
{
|
||||
int value = 123;
|
||||
etl::not_null<int*> nn(&value);
|
||||
CHECK_EQUAL(&value, nn.get());
|
||||
CHECK_EQUAL(123, *nn);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_copy_construct)
|
||||
{
|
||||
int value = 123;
|
||||
etl::not_null<int*> nn1(&value);
|
||||
etl::not_null<int*> nn2(nn1); // Copy constructor
|
||||
CHECK_EQUAL(&value, nn2.get());
|
||||
CHECK_EQUAL(123, *nn2);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_assign_from_pointer)
|
||||
{
|
||||
int value1 = 123;
|
||||
etl::not_null<int*> nn1(&value1);
|
||||
|
||||
int value2 = 456;
|
||||
|
||||
nn1 = &value2;
|
||||
CHECK_EQUAL(&value2, nn1.get());
|
||||
CHECK_EQUAL(456, *nn1);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_assign_from_not_null)
|
||||
{
|
||||
int value1 = 123;
|
||||
etl::not_null<int*> nn1(&value1);
|
||||
|
||||
int value2 = 456;
|
||||
etl::not_null<int*> nn2(&value2);
|
||||
|
||||
nn1 = nn2;
|
||||
CHECK_EQUAL(&value2, nn2.get());
|
||||
CHECK_EQUAL(456, *nn2);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_implicit_conversion)
|
||||
{
|
||||
S s{123};
|
||||
etl::not_null<S*> nn(&s);
|
||||
|
||||
S* raw = nn;
|
||||
CHECK_EQUAL(&s, raw);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_arrow_operator)
|
||||
{
|
||||
S s{123};
|
||||
etl::not_null<S*> nn(&s);
|
||||
|
||||
CHECK_EQUAL(s.x, nn->x);
|
||||
CHECK_EQUAL(s.get(), nn->get());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_dereference_operator)
|
||||
{
|
||||
S s{123};
|
||||
etl::not_null<S*> nn(&s);
|
||||
|
||||
CHECK_EQUAL(s.x, (*nn).x);
|
||||
CHECK_EQUAL(s.get(), (*nn).get());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_construct_from_null_pointer_asserts)
|
||||
{
|
||||
CHECK_THROW(etl::not_null<int*> nn(nullptr), etl::not_null_contains_null);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_assign_null_pointer_asserts)
|
||||
{
|
||||
int value = 1;
|
||||
etl::not_null<int*> nn(&value);
|
||||
|
||||
CHECK_THROW(nn = nullptr, etl::not_null_contains_null);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_non_null_comparisons)
|
||||
{
|
||||
int value[2] = { 123, 456 };
|
||||
etl::not_null<int*> nn1(&value[0]);
|
||||
etl::not_null<int*> nn2(&value[1]);
|
||||
CHECK_TRUE(nn1 == nn1);
|
||||
CHECK_TRUE(nn1 != nn2);
|
||||
CHECK_TRUE(nn2 != nn1);
|
||||
|
||||
CHECK_FALSE(nn1 < nn1);
|
||||
CHECK_TRUE(nn1 < nn2);
|
||||
CHECK_FALSE(nn2 < nn1);
|
||||
|
||||
CHECK_TRUE(nn1 <= nn1);
|
||||
CHECK_TRUE(nn1 <= nn2);
|
||||
CHECK_FALSE(nn2 <= nn1);
|
||||
|
||||
CHECK_FALSE(nn1 > nn1);
|
||||
CHECK_FALSE(nn1 > nn2);
|
||||
CHECK_TRUE(nn2 > nn1);
|
||||
|
||||
CHECK_TRUE(nn1 >= nn1);
|
||||
CHECK_FALSE(nn1 >= nn2);
|
||||
CHECK_TRUE(nn2 >= nn1);
|
||||
}
|
||||
};
|
||||
}
|
||||
154
test/test_not_null_pointer_constexpr.cpp
Normal file
154
test/test_not_null_pointer_constexpr.cpp
Normal file
@ -0,0 +1,154 @@
|
||||
/******************************************************************************
|
||||
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 "unit_test_framework.h"
|
||||
#include "etl/not_null.h"
|
||||
|
||||
#if ETL_USING_CPP14
|
||||
namespace
|
||||
{
|
||||
struct S
|
||||
{
|
||||
int x;
|
||||
|
||||
constexpr int get() const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
//*************************************************************************
|
||||
constexpr etl::not_null<const int*> CreateNotNullAssignFromPointer(const int* p1, const int* p2)
|
||||
{
|
||||
// Create a not_null pointer from a pointer.
|
||||
etl::not_null<const int*> nn(p1);
|
||||
|
||||
// Assign a different pointer to the not_null.
|
||||
nn = p2;
|
||||
|
||||
return nn;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
constexpr etl::not_null<const int*> CreateNotNullAssignFromNotNull(const int* p1, const int* p2)
|
||||
{
|
||||
// Create a not_null pointer from a pointer.
|
||||
etl::not_null<const int*> nn1(p1);
|
||||
etl::not_null<const int*> nn2(p2);
|
||||
|
||||
nn1 = nn2;
|
||||
|
||||
return nn1;
|
||||
}
|
||||
|
||||
SUITE(test_not_null_pointer)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_construct_from_non_null_pointer)
|
||||
{
|
||||
static constexpr const int value = 123;
|
||||
static constexpr etl::not_null<const int*> nn(&value);
|
||||
static constexpr const int* p = nn.get();
|
||||
static constexpr const int v = *nn;
|
||||
CHECK_EQUAL(&value, p);
|
||||
CHECK_EQUAL(123, v);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_copy_construct)
|
||||
{
|
||||
static constexpr const int value = 123;
|
||||
static constexpr etl::not_null<const int*> nn1(&value);
|
||||
static constexpr etl::not_null<const int*> nn2(nn1); // Copy constructor
|
||||
static constexpr const int* p = nn2.get();
|
||||
static constexpr const int v = *nn2;
|
||||
CHECK_EQUAL(&value, p);
|
||||
CHECK_EQUAL(123, v);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_assign_from_pointer)
|
||||
{
|
||||
static constexpr const int value1 = 123;
|
||||
static constexpr const int value2 = 456;
|
||||
static constexpr etl::not_null<const int*> nn(CreateNotNullAssignFromPointer(&value1, &value2));
|
||||
|
||||
CHECK_EQUAL(&value2, nn.get());
|
||||
CHECK_EQUAL(456, *nn);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_assign_from_not_null)
|
||||
{
|
||||
static constexpr const int value1 = 123;
|
||||
static constexpr const int value2 = 456;
|
||||
static constexpr etl::not_null<const int*> nn(CreateNotNullAssignFromNotNull(&value1, &value2));
|
||||
|
||||
CHECK_EQUAL(&value2, nn.get());
|
||||
CHECK_EQUAL(456, *nn);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_implicit_conversion)
|
||||
{
|
||||
static constexpr const S s{123};
|
||||
static constexpr etl::not_null<const S*> nn(&s);
|
||||
|
||||
static constexpr const S* raw = nn;
|
||||
CHECK_EQUAL(&s, raw);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_arrow_operator)
|
||||
{
|
||||
static constexpr const S s{123};
|
||||
static constexpr etl::not_null<const S*> nn(&s);
|
||||
|
||||
static constexpr int x1 = nn->x;
|
||||
static constexpr int x2 = nn->get();
|
||||
|
||||
CHECK_EQUAL(s.x, x1);
|
||||
CHECK_EQUAL(s.get(), x2);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_dereference_operator)
|
||||
{
|
||||
static constexpr const S s{123};
|
||||
static constexpr etl::not_null<const S*> nn(&s);
|
||||
|
||||
static constexpr int x1 = (*nn).x;
|
||||
static constexpr int x2 = (*nn).get();
|
||||
|
||||
CHECK_EQUAL(s.x, x1);
|
||||
CHECK_EQUAL(s.get(), x2);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
120
test/test_not_null_unique_pointer.cpp
Normal file
120
test/test_not_null_unique_pointer.cpp
Normal file
@ -0,0 +1,120 @@
|
||||
/******************************************************************************
|
||||
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 "unit_test_framework.h"
|
||||
#include "etl/not_null.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct S
|
||||
{
|
||||
int x;
|
||||
|
||||
int get() const
|
||||
{
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
SUITE(test_not_null_unique_pointer)
|
||||
{
|
||||
//*************************************************************************
|
||||
TEST(test_construct_from_non_null_unique_ptr)
|
||||
{
|
||||
using up_t = etl::unique_ptr<int>;
|
||||
up_t up(new int{ 123 });
|
||||
etl::not_null<up_t> nn(etl::move(up));
|
||||
|
||||
CHECK_EQUAL(123, *nn);
|
||||
CHECK_EQUAL(123, *nn.get());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_assign_from_unique_ptr)
|
||||
{
|
||||
using up_t = etl::unique_ptr<int>;
|
||||
up_t up1(new int{ 123 });
|
||||
etl::not_null<up_t> nn1(etl::move(up1));
|
||||
|
||||
using up_t = etl::unique_ptr<int>;
|
||||
up_t up2(new int);
|
||||
*up2 = 456;
|
||||
|
||||
nn1 = etl::move(up2);
|
||||
|
||||
CHECK_EQUAL(456, *nn1.get());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_implicit_conversion)
|
||||
{
|
||||
using up_t = etl::unique_ptr<S>;
|
||||
up_t up1(new S{ 123 });
|
||||
etl::not_null<up_t> nn1(etl::move(up1));
|
||||
|
||||
S s = *nn1;
|
||||
|
||||
CHECK_EQUAL(123, s.x);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_arrow_operator)
|
||||
{
|
||||
S s{ 123 };
|
||||
|
||||
using up_t = etl::unique_ptr<S>;
|
||||
up_t up1(new S{ 123 });
|
||||
etl::not_null<up_t> nn1(etl::move(up1));
|
||||
|
||||
CHECK_EQUAL(s.x, nn1->x);
|
||||
CHECK_EQUAL(s.get(), nn1->get());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_dereference_operator)
|
||||
{
|
||||
S s{ 123 };
|
||||
|
||||
using up_t = etl::unique_ptr<S>;
|
||||
up_t up1(new S{ 123 });
|
||||
etl::not_null<up_t> nn1(etl::move(up1));
|
||||
|
||||
CHECK_EQUAL(s.x, (*nn1).x);
|
||||
CHECK_EQUAL(s.get(), (*nn1).get());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_construct_from_null_pointer_asserts)
|
||||
{
|
||||
using up_t = etl::unique_ptr<int>;
|
||||
up_t up1(nullptr);
|
||||
|
||||
CHECK_THROW(etl::not_null<up_t> nn1(etl::move(up1)), etl::not_null_contains_null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -37,6 +37,7 @@ SOFTWARE.
|
||||
#include "etl/unaligned_type.h"
|
||||
#include "etl/pool.h"
|
||||
#include "etl/largest.h"
|
||||
#include "etl/memory.h"
|
||||
|
||||
typedef TestDataDC<std::string> Test_Data;
|
||||
typedef TestDataNDC<std::string> Test_Data2;
|
||||
@ -156,6 +157,39 @@ namespace
|
||||
return os;
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
S()
|
||||
: a(7), b(8)
|
||||
{
|
||||
++instance_count;
|
||||
}
|
||||
|
||||
S(int a_, double b_)
|
||||
: a(a_), b(b_)
|
||||
{
|
||||
++instance_count;
|
||||
}
|
||||
|
||||
S(const S& other)
|
||||
: a(other.a), b(other.b)
|
||||
{
|
||||
++instance_count;
|
||||
}
|
||||
|
||||
~S()
|
||||
{
|
||||
--instance_count;
|
||||
}
|
||||
|
||||
int a;
|
||||
double b;
|
||||
|
||||
static int instance_count;
|
||||
};
|
||||
|
||||
int S::instance_count = 0;
|
||||
|
||||
SUITE(test_pool)
|
||||
{
|
||||
//*************************************************************************
|
||||
@ -735,4 +769,91 @@ namespace
|
||||
CHECK(!(begin != end));
|
||||
CHECK_EQUAL(etl::distance(begin, end), 0);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_releaser_functor_with_unique_ptr)
|
||||
{
|
||||
etl::pool<S, 10> pool;
|
||||
auto pool_deleter = [&pool](S* ptr) { pool.release(ptr); };
|
||||
using Unique = etl::unique_ptr<S, decltype(pool_deleter)>;
|
||||
|
||||
S::instance_count = 0;
|
||||
|
||||
CHECK_EQUAL(10, pool.available());
|
||||
|
||||
{
|
||||
S* ps;
|
||||
|
||||
ps = pool.allocate();
|
||||
::new(ps) S(1, 2);
|
||||
Unique us1(ps, pool_deleter);
|
||||
CHECK_EQUAL(1, S::instance_count);
|
||||
CHECK_EQUAL(1, us1->a);
|
||||
CHECK_EQUAL(2, us1->b);
|
||||
CHECK_EQUAL(9, pool.available());
|
||||
|
||||
{
|
||||
ps = pool.allocate();
|
||||
::new(ps) S(3, 4);
|
||||
Unique us2(ps, pool_deleter);
|
||||
CHECK_EQUAL(2, S::instance_count);
|
||||
CHECK_EQUAL(3, us2->a);
|
||||
CHECK_EQUAL(4, us2->b);
|
||||
CHECK_EQUAL(8, pool.available());
|
||||
us2->~S();
|
||||
}
|
||||
|
||||
ps = pool.allocate();
|
||||
::new(ps) S(5, 6);
|
||||
Unique us3(ps, pool_deleter);
|
||||
CHECK_EQUAL(2, S::instance_count);
|
||||
CHECK_EQUAL(5, us3->a);
|
||||
CHECK_EQUAL(6, us3->b);
|
||||
CHECK_EQUAL(8, pool.available());
|
||||
us1->~S();
|
||||
us3->~S();
|
||||
}
|
||||
|
||||
CHECK_EQUAL(0, S::instance_count);
|
||||
CHECK_EQUAL(10, pool.available());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_destroyer_functor_with_unique_ptr)
|
||||
{
|
||||
etl::pool<S, 10> pool;
|
||||
auto pool_deleter = [&pool](S* ptr) { pool.destroy(ptr); };
|
||||
using Unique = etl::unique_ptr<S, decltype(pool_deleter)>;
|
||||
|
||||
S::instance_count = 0;
|
||||
|
||||
CHECK_EQUAL(10, pool.available());
|
||||
|
||||
{
|
||||
Unique us1(pool.create(1, 2), pool_deleter);
|
||||
CHECK_EQUAL(1, S::instance_count);
|
||||
CHECK_EQUAL(1, us1->a);
|
||||
CHECK_EQUAL(2, us1->b);
|
||||
CHECK_EQUAL(9, pool.available());
|
||||
|
||||
{
|
||||
Unique us2(pool.create(3, 4), pool_deleter);
|
||||
CHECK_EQUAL(2, S::instance_count);
|
||||
CHECK_EQUAL(3, us2->a);
|
||||
CHECK_EQUAL(4, us2->b);
|
||||
CHECK_EQUAL(8, pool.available());
|
||||
}
|
||||
|
||||
CHECK_EQUAL(1, S::instance_count);
|
||||
|
||||
Unique us3(pool.create(5, 6), pool_deleter);
|
||||
CHECK_EQUAL(2, S::instance_count);
|
||||
CHECK_EQUAL(5, us3->a);
|
||||
CHECK_EQUAL(6, us3->b);
|
||||
CHECK_EQUAL(8, pool.available());
|
||||
}
|
||||
|
||||
CHECK_EQUAL(0, S::instance_count);
|
||||
CHECK_EQUAL(10, pool.available());
|
||||
}
|
||||
}
|
||||
|
||||
@ -789,4 +789,42 @@ namespace
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#if ETL_USING_CPP17 && !defined(ETL_FORCE_CPP11_NONTYPE)
|
||||
//*********************************
|
||||
TEST(test_nontype_t_cpp17)
|
||||
{
|
||||
// Test with int
|
||||
CHECK_TRUE(42 == etl::nontype_t<42>::value);
|
||||
|
||||
// Test with bool
|
||||
CHECK_TRUE(true == etl::nontype_t<true>::value);
|
||||
|
||||
// Test with char
|
||||
CHECK_TRUE('A' == etl::nontype_t<'A'>::value);
|
||||
|
||||
// Test with enum
|
||||
enum class E : uint8_t { A = 1, B = 2 };
|
||||
CHECK_TRUE(E::A == etl::nontype_t<E::A>::value);
|
||||
CHECK_TRUE(E::B == etl::nontype_t<E::B>::value);
|
||||
}
|
||||
#elif ETL_USING_CPP11
|
||||
enum class E : uint8_t { A = 1, B = 2 };
|
||||
|
||||
TEST(test_nontype_t_cpp11)
|
||||
{
|
||||
// Test with int
|
||||
CHECK_TRUE(42 == (etl::nontype_t<int, 42>::value));
|
||||
|
||||
// Test with bool
|
||||
CHECK_TRUE(true == (etl::nontype_t<bool, true>::value));
|
||||
|
||||
// Test with char
|
||||
CHECK_TRUE('A' == (etl::nontype_t<char, 'A'>::value));
|
||||
|
||||
// Test with enum
|
||||
CHECK_TRUE(E::A == (etl::nontype_t<E, E::A>::value));
|
||||
CHECK_TRUE(E::B == (etl::nontype_t<E, E::B>::value));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -38,3 +38,25 @@
|
||||
#define CHECK_ARRAY_EQUAL
|
||||
#define CHECK_CLOSE
|
||||
#define CHECK_THROW
|
||||
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
|
||||
// such as names of functions and macros.
|
||||
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
|
||||
#define ETL_NOEXCEPT_IF_NO_THROW
|
||||
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
|
||||
// such as names of functions and macros.
|
||||
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
|
||||
#define ETL_NOEXCEPT
|
||||
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
|
||||
// such as names of functions and macros.
|
||||
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
|
||||
#define ETL_ASSERT(b, e)
|
||||
#define ETL_ASSERT(b, e) {if (!(b)) ETL_UNLIKELY {etl::error_handler::error((e)); throw((e));}}
|
||||
#define ETL_ASSERT(b, e) {if (!(b)) ETL_UNLIKELY {throw((e));}}
|
||||
#define ETL_ASSERT(b, e) {if (!(b)) ETL_UNLIKELY {etl::error_handler::error((e));}}
|
||||
#define ETL_ASSERT(b, e) assert((b))
|
||||
#define ETL_ASSERT(b, e) {if (!(b)) ETL_UNLIKELY {etl::private_error_handler::assert_handler<0>::assert_function_ptr((e));}}
|
||||
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
|
||||
// such as names of functions and macros.
|
||||
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
|
||||
#define ETL_ERROR(e) (e(__FILE__, __LINE__))
|
||||
#define ETL_ERROR(e) (e("", __LINE__))
|
||||
|
||||
@ -3362,6 +3362,7 @@
|
||||
<ClInclude Include="..\..\include\etl\math.h" />
|
||||
<ClInclude Include="..\..\include\etl\message_broker.h" />
|
||||
<ClInclude Include="..\..\include\etl\monostate.h" />
|
||||
<ClInclude Include="..\..\include\etl\not_null.h" />
|
||||
<ClInclude Include="..\..\include\etl\poly_span.h" />
|
||||
<ClInclude Include="..\..\include\etl\private\bitset_legacy.h" />
|
||||
<ClInclude Include="..\..\include\etl\private\bitset_new.h" />
|
||||
@ -5268,6 +5269,42 @@
|
||||
<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\crc16_opensafety_a.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\crc16_opensafety_b.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\crc16_profibus.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>
|
||||
@ -5772,6 +5809,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\crc8_opensafety.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\crc8_rohc.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>
|
||||
@ -5898,6 +5953,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\delegate_observable.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\delegate_service.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>
|
||||
@ -7390,6 +7463,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\not_null.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\nth_type.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>
|
||||
@ -9400,6 +9491,9 @@
|
||||
<ClCompile Include="..\test_math_functions.cpp" />
|
||||
<ClCompile Include="..\test_message.cpp" />
|
||||
<ClCompile Include="..\test_message_broker.cpp" />
|
||||
<ClCompile Include="..\test_not_null_pointer.cpp" />
|
||||
<ClCompile Include="..\test_not_null_pointer_constexpr.cpp" />
|
||||
<ClCompile Include="..\test_not_null_unique_pointer.cpp" />
|
||||
<ClCompile Include="..\test_poly_span_dynamic_extent.cpp" />
|
||||
<ClCompile Include="..\test_poly_span_fixed_extent.cpp" />
|
||||
<ClCompile Include="..\test_pseudo_moving_average.cpp" />
|
||||
|
||||
@ -196,27 +196,12 @@
|
||||
<Filter Include="Tests\Syntax Checks">
|
||||
<UniqueIdentifier>{8a3300fa-c2cd-44dd-8582-692f97ec4dc0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tests\Syntax Checks\C++03">
|
||||
<UniqueIdentifier>{ca522a34-8cf0-4f64-8ca1-33f52f65a9a7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tests\Syntax Checks\C++11">
|
||||
<UniqueIdentifier>{ba2bf848-6023-4906-a0d4-14a4c8fba0e5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tests\Syntax Checks\C++14">
|
||||
<UniqueIdentifier>{527f4d9a-8968-4352-8cdf-f6ccc391dcf9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tests\Syntax Checks\C++17">
|
||||
<UniqueIdentifier>{57b110fa-b3d8-4cc4-9619-ca510a29c213}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tests\Syntax Checks\Logs">
|
||||
<UniqueIdentifier>{5b76fd56-eb83-489f-b9a6-798c07c5fa76}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tests\Syntax Checks\Source">
|
||||
<UniqueIdentifier>{a05ae045-3218-4ca2-9f25-08cc977898df}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tests\Syntax Checks\C++20">
|
||||
<UniqueIdentifier>{3336d15c-7c22-4df0-a6b2-1eb605099a1a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Tests\Messaging">
|
||||
<UniqueIdentifier>{c75cedd3-8b6c-4662-b965-aecbe7fd5d1c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@ -1536,6 +1521,9 @@
|
||||
<ClInclude Include="..\..\include\etl\callback_timer_deferred_locked.h">
|
||||
<Filter>ETL\Frameworks</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\etl\not_null.h">
|
||||
<Filter>ETL\Utilities</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\test_string_char.cpp">
|
||||
@ -3701,6 +3689,18 @@
|
||||
<ClCompile Include="..\test_rounded_integral_division.cpp">
|
||||
<Filter>Tests\Maths</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_not_null_pointer.cpp">
|
||||
<Filter>Tests\Misc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_not_null_unique_pointer.cpp">
|
||||
<Filter>Tests\Misc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\syntax_check\not_null.h.t.cpp">
|
||||
<Filter>Tests\Syntax Checks\Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_not_null_pointer_constexpr.cpp">
|
||||
<Filter>Tests\Misc</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\library.properties">
|
||||
|
||||
@ -1 +1 @@
|
||||
20.42.2
|
||||
20.43.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user