mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 22:59:47 +08:00
Updates to mem_cast
This commit is contained in:
parent
8af219c0b3
commit
b19471dc8a
@ -34,22 +34,22 @@ SOFTWARE.
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../platform.h"
|
#include "platform.h"
|
||||||
#include "../memory.h"
|
#include "memory.h"
|
||||||
#include "../static_assert.h"
|
#include "static_assert.h"
|
||||||
#include "../largest.h"
|
#include "largest.h"
|
||||||
#include "../utility.h"
|
#include "utility.h"
|
||||||
#include "../placement_new.h"
|
#include "placement_new.h"
|
||||||
#include "../exception.h"
|
#include "exception.h"
|
||||||
#include "../error_handler.h"
|
#include "error_handler.h"
|
||||||
#include "../file_error_numbers.h"
|
#include "file_error_numbers.h"
|
||||||
|
|
||||||
namespace etl
|
namespace etl
|
||||||
{
|
{
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
/// The base class for array_wrapper exceptions.
|
/// The base class for array_wrapper exceptions.
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
class mem_cast_exception : public exception
|
class mem_cast_exception : public etl::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ namespace etl
|
|||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
/// The exception thrown when the buffer pointer alignment is not compatible.
|
/// The exception thrown when the buffer pointer alignment is not compatible.
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
class mem_cast_alignment_exception : public mem_cast_exception
|
class mem_cast_alignment_exception : public etl::mem_cast_exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ namespace etl
|
|||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
/// The exception thrown when the pointer is null.
|
/// The exception thrown when the pointer is null.
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
class mem_cast_nullptr_exception : public mem_cast_exception
|
class mem_cast_nullptr_exception : public etl::mem_cast_exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -151,6 +151,7 @@ target_sources(t98 PRIVATE etl_profile.h
|
|||||||
../map.h.t.cpp
|
../map.h.t.cpp
|
||||||
../math_constants.h.t.cpp
|
../math_constants.h.t.cpp
|
||||||
../mean.h.t.cpp
|
../mean.h.t.cpp
|
||||||
|
../mem_cast.h.t.cpp
|
||||||
../memory.h.t.cpp
|
../memory.h.t.cpp
|
||||||
../memory_model.h.t.cpp
|
../memory_model.h.t.cpp
|
||||||
../message.h.t.cpp
|
../message.h.t.cpp
|
||||||
|
|||||||
@ -151,6 +151,7 @@ target_sources(t11 PRIVATE etl_profile.h
|
|||||||
../map.h.t.cpp
|
../map.h.t.cpp
|
||||||
../math_constants.h.t.cpp
|
../math_constants.h.t.cpp
|
||||||
../mean.h.t.cpp
|
../mean.h.t.cpp
|
||||||
|
../mem_cast.h.t.cpp
|
||||||
../memory.h.t.cpp
|
../memory.h.t.cpp
|
||||||
../memory_model.h.t.cpp
|
../memory_model.h.t.cpp
|
||||||
../message.h.t.cpp
|
../message.h.t.cpp
|
||||||
|
|||||||
@ -151,6 +151,7 @@ target_sources(t14 PRIVATE etl_profile.h
|
|||||||
../map.h.t.cpp
|
../map.h.t.cpp
|
||||||
../math_constants.h.t.cpp
|
../math_constants.h.t.cpp
|
||||||
../mean.h.t.cpp
|
../mean.h.t.cpp
|
||||||
|
../mem_cast.h.t.cpp
|
||||||
../memory.h.t.cpp
|
../memory.h.t.cpp
|
||||||
../memory_model.h.t.cpp
|
../memory_model.h.t.cpp
|
||||||
../message.h.t.cpp
|
../message.h.t.cpp
|
||||||
|
|||||||
@ -151,6 +151,7 @@ target_sources(t17 PRIVATE etl_profile.h
|
|||||||
../map.h.t.cpp
|
../map.h.t.cpp
|
||||||
../math_constants.h.t.cpp
|
../math_constants.h.t.cpp
|
||||||
../mean.h.t.cpp
|
../mean.h.t.cpp
|
||||||
|
../mem_cast.h.t.cpp
|
||||||
../memory.h.t.cpp
|
../memory.h.t.cpp
|
||||||
../memory_model.h.t.cpp
|
../memory_model.h.t.cpp
|
||||||
../message.h.t.cpp
|
../message.h.t.cpp
|
||||||
|
|||||||
29
test/sanity-check/mem_cast.h.t.cpp
Normal file
29
test/sanity-check/mem_cast.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) 2021 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/mem_cast.h>
|
||||||
@ -28,7 +28,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "unit_test_framework.h"
|
#include "unit_test_framework.h"
|
||||||
|
|
||||||
#include "etl/experimental/mem_cast.h"
|
#include "etl/mem_cast.h"
|
||||||
#include "etl/largest.h"
|
#include "etl/largest.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|||||||
@ -28,7 +28,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "unit_test_framework.h"
|
#include "unit_test_framework.h"
|
||||||
|
|
||||||
#include "etl/experimental/mem_cast.h"
|
#include "etl/mem_cast.h"
|
||||||
#include "etl/largest.h"
|
#include "etl/largest.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|||||||
@ -3231,6 +3231,14 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNoSTLForceNoAdvanced|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNoSTLForceNoAdvanced|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\sanity-check\mem_cast.h.t.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNoSTL|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug LLVM|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugLLVMNoSTL|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug64|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC No Checks|Win32'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\sanity-check\message.h.t.cpp">
|
<ClCompile Include="..\sanity-check\message.h.t.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNoSTL|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNoSTL|Win32'">true</ExcludedFromBuild>
|
||||||
|
|||||||
@ -1111,7 +1111,7 @@
|
|||||||
<Filter>ETL\Private</Filter>
|
<Filter>ETL\Private</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\include\etl\experimental\mem_cast.h">
|
<ClInclude Include="..\..\include\etl\experimental\mem_cast.h">
|
||||||
<Filter>ETL\Experimental</Filter>
|
<Filter>ETL\Utilities</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -2540,6 +2540,9 @@
|
|||||||
<ClCompile Include="..\test_mem_cast_ptr.cpp">
|
<ClCompile Include="..\test_mem_cast_ptr.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\sanity-check\mem_cast.h.t.cpp">
|
||||||
|
<Filter>Source Files\Sanity Checks</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\library.properties">
|
<None Include="..\..\library.properties">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user