First code, no unit tests

This commit is contained in:
John Wellbelove 2019-04-20 11:14:24 +01:00
parent cf02ec64c7
commit 2b5fe55540
3 changed files with 79 additions and 0 deletions

75
include/etl/multi_array.h Normal file
View File

@ -0,0 +1,75 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2019 jwellbelove
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_MULTI_ARRAY_INCLUDED
#define ETL_MULTI_ARRAY_INCLUDED
#include "platform.h"
#include "array.h"
///\defgroup multi_array multi_array
/// A multi dimentional array.
///\ingroup containers
namespace etl
{
#if ETL_CPP11_SUPPORTED
namespace private_multi_array
{
template <class T, size_t D1, size_t... Dx>
struct multi_array_t
{
using ArrayX = typename multi_array_t<T, Dx...>::type;
using type = etl::array<ArrayX, D1>;
};
template <class T, size_t D1>
struct multi_array_t<T, D1>
{
using type = etl::array<T, D1>;
};
}
template <class T, size_t D1, size_t... Dx>
using multi_array = private_multi_array::multi_array_t<T, D1, Dx...>;
template <typename T, size_t D1, size_t D2>
using array2d = etl::multi_array<T, D1, D2>;
template <typename T, size_t D1, size_t D2, size_t D3>
using array3d = etl::multi_array<T, D1, D2, D3>;
#endif
}
#endif

View File

@ -379,6 +379,7 @@
<ClInclude Include="..\..\include\etl\callback_service.h" />
<ClInclude Include="..\..\include\etl\largest_generator.h" />
<ClInclude Include="..\..\include\etl\absolute.h" />
<ClInclude Include="..\..\include\etl\multi_array.h" />
<ClInclude Include="..\..\include\etl\negative.h" />
<ClInclude Include="..\..\include\etl\private\to_string_helper.h" />
<ClInclude Include="..\..\include\etl\queue_spsc_locked.h" />

View File

@ -765,6 +765,9 @@
<ClInclude Include="..\..\include\etl\wformat_spec.h">
<Filter>ETL\Utilities</Filter>
</ClInclude>
<ClInclude Include="..\..\include\etl\multi_array.h">
<Filter>ETL\Containers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\main.cpp">