Merge remote-tracking branch 'origin/feature/no_stl' into development

# Conflicts:
#	include/etl/private/ivectorpointer.h
#	test/test_vector_pointer.cpp
This commit is contained in:
John Wellbelove 2018-07-22 20:51:03 +01:00
parent 5652c029a8
commit 3fdf3e6b1a
106 changed files with 4113 additions and 273 deletions

View File

@ -36,11 +36,11 @@ SOFTWARE.
/// Additional new variants of certain algorithms.
///\ingroup utilities
#include <algorithm>
#include <iterator>
#include <utility>
#include <functional>
#include <iterator>
#include "stl/algorithm.h"
#include "stl/utility.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include <stdint.h>
#include "platform.h"
@ -1113,6 +1113,39 @@ namespace etl
return std::pair<TDestinationTrue, TDestinationFalse>(destination_true, destination_false);
}
//***************************************************************************
/// Sorts the elements using shell sort.
/// Uses users defined comparison.
///\ingroup algorithm
//***************************************************************************
template <typename TIterator, typename TCompare = std::less<typename std::iterator_traits<TIterator>::value_type> >
void sort(TIterator first, TIterator last, TCompare compare = TCompare())
{
typedef typename std::iterator_traits<TIterator>::difference_type difference_t;
difference_t n = std::distance(first, last);
for (difference_t i = n / 2; i > 0; i /= 2)
{
for (difference_t j = i; j < n; ++j)
{
for (difference_t k = j - i; k >= 0; k -= i)
{
TIterator itr1 = first;
TIterator itr2 = first;
std::advance(itr1, k);
std::advance(itr2, k + i);
if (compare(*itr2, *itr1))
{
std::iter_swap(itr1, itr2);
}
}
}
}
}
}
#endif

View File

@ -31,12 +31,14 @@ SOFTWARE.
#ifndef ETL_ARRAY_INCLUDED
#define ETL_ARRAY_INCLUDED
#include <iterator>
#include <functional>
#include <algorithm>
#include <stddef.h>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "exception.h"
#include "type_traits.h"
#include "parameter_type.h"
@ -97,8 +99,8 @@ namespace etl
};
typedef T value_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
@ -569,7 +571,7 @@ namespace etl
///\param rhs The second array.
///\return <b>true</b> if the arrays are equal, otherwise <b>false</b>
//*************************************************************************
template <typename T, std::size_t SIZE>
template <typename T, size_t SIZE>
bool operator ==(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
{
return std::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin());
@ -581,7 +583,7 @@ namespace etl
///\param rhs The second array.
///\return <b>true</b> if the arrays are not equal, otherwise <b>false</b>
//*************************************************************************
template <typename T, std::size_t SIZE>
template <typename T, size_t SIZE>
bool operator !=(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
{
return !(lhs == rhs);
@ -593,7 +595,7 @@ namespace etl
///\param rhs The second array.
///\return <b>true</b> if the first array is lexicographically less than the second, otherwise <b>false</b>
//*************************************************************************
template <typename T, std::size_t SIZE>
template <typename T, size_t SIZE>
bool operator <(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
{
return std::lexicographical_compare(lhs.cbegin(),
@ -608,7 +610,7 @@ namespace etl
///\param rhs The second array.
///\return <b>true</b> if the first array is lexicographically less than or equal to the second, otherwise <b>false</b>
//*************************************************************************
template <typename T, std::size_t SIZE>
template <typename T, size_t SIZE>
bool operator <=(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
{
return !(lhs > rhs);
@ -619,7 +621,7 @@ namespace etl
///\param lhs The first array.
///\param rhs The second array.
///\return <b>true</b> if the first array is lexicographically greater than the second, otherwise <b>false</b>
template <typename T, std::size_t SIZE>
template <typename T, size_t SIZE>
//*************************************************************************
bool operator >(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
{
@ -632,7 +634,7 @@ namespace etl
///\param rhs The second array.
///\return <b>true</b> if the first array is lexicographically greater than or equal to the second, otherwise <b>false</b>
//*************************************************************************
template <typename T, std::size_t SIZE>
template <typename T, size_t SIZE>
bool operator >=(const etl::array<T, SIZE>& lhs, const etl::array<T, SIZE>& rhs)
{
return !(lhs < rhs);
@ -646,7 +648,7 @@ namespace etl
///\param a The array.
///\return A reference to the element
//*************************************************************************
template <std::size_t I, typename T, std::size_t MAXN>
template <size_t I, typename T, size_t MAXN>
inline T& get(array<T, MAXN>& a)
{
ETL_STATIC_ASSERT(I < MAXN, "Index out of bounds");
@ -661,7 +663,7 @@ namespace etl
///\param a The array.
///\return A const reference to the element
//*************************************************************************
template <std::size_t I, typename T, std::size_t MAXN>
template <size_t I, typename T, size_t MAXN>
inline const T& get(const array<T, MAXN>& a)
{
ETL_STATIC_ASSERT(I < MAXN, "Index out of bounds");

View File

@ -38,8 +38,9 @@ SOFTWARE.
#include "exception.h"
#include "nullptr.h"
#include "hash.h"
#include "algorithm.h"
#include <algorithm>
#include "stl/algorithm.h"
///\defgroup array array
/// A wrapper for arrays
@ -100,7 +101,7 @@ namespace etl
public:
typedef T value_type;
typedef std::size_t size_type;
typedef size_t size_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
@ -494,7 +495,7 @@ namespace etl
public:
typedef T value_type;
typedef std::size_t size_type;
typedef size_t size_type;
typedef const T& const_reference;
typedef const T* const_pointer;
typedef const T* const_iterator;

View File

@ -39,7 +39,7 @@ SOFTWARE.
#include "container.h"
#include "parameter_type.h"
#include <algorithm>
#include "algorithm.h"
///\defgroup array array
/// A wrapper for arrays
@ -80,13 +80,13 @@ namespace etl
//***************************************************************************
/// Array wrapper.
//***************************************************************************
template <typename T, std::size_t SIZE_, T(&ARRAY_)[SIZE_]>
template <typename T, size_t SIZE_, T(&ARRAY_)[SIZE_]>
class array_wrapper
{
public:
typedef T value_type;
typedef std::size_t size_type;
typedef size_t size_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
@ -330,7 +330,7 @@ namespace etl
//*************************************************************************
/// Equality for array wrappers.
//*************************************************************************
template <typename TL, typename TR, std::size_t SIZEL, std::size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator == (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
@ -340,7 +340,7 @@ namespace etl
//*************************************************************************
/// Inequality for array wrapper.
//*************************************************************************
template <typename TL, typename TR, std::size_t SIZEL, std::size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator != (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
@ -350,7 +350,7 @@ namespace etl
//*************************************************************************
/// Less-than for array wrapper.
//*************************************************************************
template <typename TL, typename TR, std::size_t SIZEL, std::size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator < (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
@ -360,7 +360,7 @@ namespace etl
//*************************************************************************
/// Greater-than for array wrapper.
//*************************************************************************
template <typename TL, typename TR, std::size_t SIZEL, std::size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator > (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
@ -370,7 +370,7 @@ namespace etl
//*************************************************************************
/// Less-than-equal for array wrapper.
//*************************************************************************
template <typename TL, typename TR, std::size_t SIZEL, std::size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator <= (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
@ -380,7 +380,7 @@ namespace etl
//*************************************************************************
/// Greater-than-equal for array wrapper.
//*************************************************************************
template <typename TL, typename TR, std::size_t SIZEL, std::size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
template <typename TL, typename TR, size_t SIZEL, size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
bool operator >= (const etl::array_wrapper<TL, SIZEL, ARRAYL>& lhs,
const etl::array_wrapper<TR, SIZER, ARRAYR>& rhs)
{
@ -391,7 +391,7 @@ namespace etl
/// Hash function.
//*************************************************************************
#if ETL_8BIT_SUPPORT
template <typename T, std::size_t SIZE, T(&ARRAY)[SIZE]>
template <typename T, size_t SIZE, T(&ARRAY)[SIZE]>
struct hash<etl::array_wrapper<T, SIZE, ARRAY> >
{
size_t operator()(const etl::array_wrapper<T, SIZE, ARRAY>& aw) const
@ -406,7 +406,7 @@ namespace etl
//*************************************************************************
/// Swap.
//*************************************************************************
template <typename T, std::size_t SIZE, T(&ARRAYL)[SIZE], T(&ARRAYR)[SIZE]>
template <typename T, size_t SIZE, T(&ARRAYL)[SIZE], T(&ARRAYR)[SIZE]>
void swap(etl::array_wrapper<T, SIZE, ARRAYL>& lhs,
etl::array_wrapper<T, SIZE, ARRAYR>& rhs)
{

View File

@ -31,7 +31,7 @@ SOFTWARE.
#include "platform.h"
#if ETL_CPP11_SUPPORTED == 1
#if ETL_CPP11_SUPPORTED == 1 && !defined(ETL_NO_STL)
#include "atomic/atomic_std.h"
#define ETL_HAS_ATOMIC 1
#elif defined(ETL_COMPILER_ARM)

View File

@ -507,23 +507,23 @@ namespace etl
}
// Add
T* operator +=(std::ptrdiff_t v)
T* operator +=(ptrdiff_t v)
{
return fetch_add(v) + v;
}
T* operator +=(std::ptrdiff_t v) volatile
T* operator +=(ptrdiff_t v) volatile
{
return fetch_add(v) + v;
}
// Subtract
T* operator -=(std::ptrdiff_t v)
T* operator -=(ptrdiff_t v)
{
return fetch_sub(v) - v;
}
T* operator -=(std::ptrdiff_t v) volatile
T* operator -=(ptrdiff_t v) volatile
{
return fetch_sub(v) - v;
}
@ -573,23 +573,23 @@ namespace etl
}
// Fetch add
T* fetch_add(std::ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
T* fetch_add(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
{
return __sync_fetch_and_add(&value, v);
}
T* fetch_add(std::ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
T* fetch_add(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
{
return __sync_fetch_and_add(&value, v);
}
// Fetch subtract
T* fetch_sub(std::ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
T* fetch_sub(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
{
return __sync_fetch_and_sub(&value, v);
}
T* fetch_sub(std::ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
T* fetch_sub(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
{
return __sync_fetch_and_sub(&value, v);
}

View File

@ -407,23 +407,23 @@ namespace etl
}
// Add
T* operator +=(std::ptrdiff_t v)
T* operator +=(ptrdiff_t v)
{
return value += v;
}
T* operator +=(std::ptrdiff_t v) volatile
T* operator +=(ptrdiff_t v) volatile
{
return value += v;
}
// Subtract
T* operator -=(std::ptrdiff_t v)
T* operator -=(ptrdiff_t v)
{
return value -= v;
}
T* operator -=(std::ptrdiff_t v) volatile
T* operator -=(ptrdiff_t v) volatile
{
return value -= v;
}
@ -473,23 +473,23 @@ namespace etl
}
// Fetch add
T* fetch_add(std::ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
T* fetch_add(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
{
return value.fetch_add(v, order);
}
T* fetch_add(std::ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
T* fetch_add(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
{
return value.fetch_add(v, order);
}
// Fetch subtract
T* fetch_sub(std::ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
T* fetch_sub(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
{
return value.fetch_sub(v, order);
}
T* fetch_sub(std::ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
T* fetch_sub(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
{
return value.fetch_sub(v, order);
}

View File

@ -33,12 +33,14 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <iterator>
#include <algorithm>
#include <functional>
#include <string.h>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "char_traits.h"
#include "container.h"
#include "alignment.h"

View File

@ -35,8 +35,6 @@ SOFTWARE.
/// Binary utilities
///\ingroup utilities
#include <limits>
#include "platform.h"
#include "type_traits.h"
#include "integral_limits.h"
@ -47,6 +45,8 @@ SOFTWARE.
#include "exception.h"
#include "error_handler.h"
#include "stl/limits.h"
#undef ETL_FILE
#define ETL_FILE "50"

View File

@ -31,13 +31,15 @@ SOFTWARE.
#ifndef ETL_BITSET_INCLUDED
#define ETL_BITSET_INCLUDED
#include <algorithm>
#include <iterator>
#include <string.h>
#include <stddef.h>
#include <stdint.h>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "integral_limits.h"
#include "algorithm.h"
#include "nullptr.h"

View File

@ -30,7 +30,7 @@ SOFTWARE.
#define ETL_CALLBACK_TIMER_INCLUDED
#include <stdint.h>
#include <algorithm>
#include "algorithm.h"
#include "platform.h"
#include "nullptr.h"

View File

@ -31,12 +31,13 @@ SOFTWARE.
#ifndef ETL_CHAR_TRAITS_INCLUDED
#define ETL_CHAR_TRAITS_INCLUDED
#include <algorithm>
#include "platform.h"
#include "stdint.h"
#include "algorithm.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
//*****************************************************************************
///\defgroup char_traits char_traits
/// Character traits

View File

@ -31,11 +31,11 @@ SOFTWARE.
#ifndef ETL_COMPARE_INCLUDED
#define ETL_COMPARE_INCLUDED
#include <functional>
#include "platform.h"
#include "parameter_type.h"
#include "stl/functional.h"
//*****************************************************************************
///\defgroup compare compare
/// Comparisons only using less than operator

View File

@ -32,10 +32,11 @@ SOFTWARE.
#define ETL_CONTAINER_INCLUDED
#include <stddef.h>
#include <iterator>
#include "platform.h"
#include "stl/iterator.h"
///\defgroup container container
///\ingroup utilities

View File

@ -32,11 +32,12 @@ SOFTWARE.
#define ETL_CRC16_INCLUDED
#include <stdint.h>
#include <iterator>
#include "platform.h"
#include "frame_check_sequence.h"
#include "stl/iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif

View File

@ -32,11 +32,12 @@ SOFTWARE.
#define ETL_CRC16_CCITT_INCLUDED
#include <stdint.h>
#include <iterator>
#include "platform.h"
#include "frame_check_sequence.h"
#include "stl/iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif

View File

@ -32,11 +32,12 @@ SOFTWARE.
#define ETL_CRC16_KERMIT_INCLUDED
#include <stdint.h>
#include <iterator>
#include "platform.h"
#include "frame_check_sequence.h"
#include "stl/iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif

View File

@ -32,11 +32,12 @@ SOFTWARE.
#define ETL_CRC32_INCLUDED
#include <stdint.h>
#include <iterator>
#include "platform.h"
#include "frame_check_sequence.h"
#include "stl/iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif

View File

@ -32,11 +32,12 @@ SOFTWARE.
#define ETL_CRC32_C_INCLUDED
#include <stdint.h>
#include <iterator>
#include "platform.h"
#include "frame_check_sequence.h"
#include "stl/iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif

View File

@ -32,11 +32,12 @@ SOFTWARE.
#define ETL_CRC64_ECMA_INCLUDED
#include <stdint.h>
#include <iterator>
#include "platform.h"
#include "frame_check_sequence.h"
#include "stl/iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif

View File

@ -32,11 +32,13 @@ SOFTWARE.
#define ETL_CRC8_CCITT_INCLUDED
#include <stdint.h>
#include <iterator>
#include "platform.h"
#include "frame_check_sequence.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "basic_string.h"
#include "hash.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -141,7 +141,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -37,14 +37,14 @@ SOFTWARE.
/// Provides a value that cycles between two limits.
/// \ingroup utilities
#include <algorithm>
#include "platform.h"
#include "static_assert.h"
#include "exception.h"
#include "static_assert.h"
#include "type_traits.h"
#include "stl/algorithm.h"
namespace etl
{
//***************************************************************************

View File

@ -33,10 +33,12 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <iterator>
#include <algorithm>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "container.h"
#include "alignment.h"
#include "array.h"
@ -48,7 +50,7 @@ SOFTWARE.
#include "type_traits.h"
#include "parameter_type.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -2066,7 +2068,7 @@ namespace etl
this->assign(n, value);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -31,10 +31,10 @@ SOFTWARE.
#ifndef ETL_FIXED_ITERATOR_INCLUDED
#define ETL_FIXED_ITERATOR_INCLUDED
#include <iterator>
#include "platform.h"
#include "stl/iterator.h"
///\defgroup iterator Iterator types
namespace etl

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "reference_flat_map.h"
#include "pool.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -854,7 +854,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "reference_flat_multimap.h"
#include "pool.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -735,7 +735,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "reference_flat_multiset.h"
#include "pool.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -694,7 +694,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "reference_flat_set.h"
#include "pool.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -760,7 +760,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -31,12 +31,14 @@ SOFTWARE.
#ifndef ETL_FORWARD_LIST_INCLUDED
#define ETL_FORWARD_LIST_INCLUDED
#include <iterator>
#include <algorithm>
#include <functional>
#include <stddef.h>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "pool.h"
#include "container.h"
#include "exception.h"
@ -46,7 +48,7 @@ SOFTWARE.
#include "type_traits.h"
#include "parameter_type.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -1415,7 +1417,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -32,9 +32,11 @@ SOFTWARE.
#define ETL_IHASH_INCLUDED
#include <stdint.h>
#include <utility>
#include "platform.h"
#include "stl/utility.h"
#include "exception.h"
#include "error_handler.h"

View File

@ -33,11 +33,12 @@ SOFTWARE.
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "private/minmax_push.h"
#include <iterator>
#include <algorithm>
#include <functional>
#include <stddef.h>
#include "platform.h"

View File

@ -32,7 +32,6 @@ SOFTWARE.
#define ETL_INTRUSIVE_LINKS_INCLUDED
#include <assert.h>
#include <utility>
#include "platform.h"
#include "nullptr.h"
@ -40,6 +39,8 @@ SOFTWARE.
#include "exception.h"
#include "error_handler.h"
#include "stl/utility.h"
#undef ETL_FILE
#define ETL_FILE "22"

View File

@ -35,9 +35,6 @@ SOFTWARE.
#include "private/minmax_push.h"
#include <iterator>
#include <algorithm>
#include <functional>
#include <stddef.h>
#include "platform.h"
@ -49,6 +46,10 @@ SOFTWARE.
#include "static_assert.h"
#include "algorithm.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#undef ETL_FILE
#define ETL_FILE "21"

View File

@ -36,11 +36,12 @@ SOFTWARE.
///\ingroup utilities
#include <stdint.h>
#include <iterator>
#include "platform.h"
#include "nullptr.h"
#include "stl/iterator.h"
namespace etl
{
//***************************************************************************

View File

@ -31,9 +31,10 @@ SOFTWARE.
#ifndef ETL_ITERATOR_INCLUDED
#define ETL_ITERATOR_INCLUDED
#include <iterator>
#include "platform.h"
#include "stl/iterator.h"
#include "type_traits.h"
///\defgroup iterator iterator

View File

@ -32,7 +32,6 @@ SOFTWARE.
#define ETL_JENKINS_INCLUDED
#include <stdint.h>
#include <iterator>
#include "platform.h"
#include "static_assert.h"
@ -41,6 +40,8 @@ SOFTWARE.
#include "ihash.h"
#include "frame_check_sequence.h"
#include "stl/iterator.h"
#if defined(ETL_COMPILER_KEIL)
#pragma diag_suppress 1300
#endif

View File

@ -31,12 +31,14 @@ SOFTWARE.
#ifndef ETL_LIST_INCLUDED
#define ETL_LIST_INCLUDED
#include <iterator>
#include <algorithm>
#include <functional>
#include <stddef.h>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "container.h"
#include "pool.h"
#include "exception.h"
@ -47,7 +49,7 @@ SOFTWARE.
#include "parameter_type.h"
#include "algorithm.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -1655,7 +1657,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -32,12 +32,13 @@ SOFTWARE.
#define ETL_MAP_INCLUDED
#include <stddef.h>
#include <iterator>
#include <functional>
#include <iterator>
#include <algorithm>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "container.h"
#include "pool.h"
#include "exception.h"
@ -47,7 +48,7 @@ SOFTWARE.
#include "type_traits.h"
#include "parameter_type.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -2063,7 +2064,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Constructor, from an initializer_list.
//*************************************************************************

View File

@ -31,12 +31,13 @@ SOFTWARE.
#ifndef ETL_MEMORY_INCLUDED
#define ETL_MEMORY_INCLUDED
#include <iterator>
#include <algorithm>
#include "algorithm.h"
#include "platform.h"
#include "type_traits.h"
#include "stl/iterator.h"
///\defgroup memory memory
///\ingroup etl
namespace etl

View File

@ -30,7 +30,7 @@ SOFTWARE.
#define ETL_MESSAGE_BUS_
#include <stdint.h>
#include <algorithm>
#include "algorithm.h"
#include "platform.h"
#include "algorithm.h"

View File

@ -30,7 +30,7 @@ SOFTWARE.
#define ETL_MESSAGE_TIMER_INCLUDED
#include <stdint.h>
#include <algorithm>
#include "algorithm.h"
#include "platform.h"
#include "nullptr.h"

View File

@ -32,11 +32,13 @@ SOFTWARE.
#define ETL_MULTIMAP_INCLUDED
#include <stddef.h>
#include <iterator>
#include <algorithm>
#include <functional>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "container.h"
#include "pool.h"
#include "exception.h"
@ -46,7 +48,7 @@ SOFTWARE.
#include "type_traits.h"
#include "parameter_type.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -1948,7 +1950,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Constructor, from an initializer_list.
//*************************************************************************

View File

@ -32,11 +32,13 @@ SOFTWARE.
#define ETL_MULTISET_INCLUDED
#include <stddef.h>
#include <iterator>
#include <algorithm>
#include <functional>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "parameter_type.h"
#include "container.h"
#include "pool.h"
@ -46,7 +48,7 @@ SOFTWARE.
#include "nullptr.h"
#include "type_traits.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -1928,7 +1930,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Constructor, from an initializer_list.
//*************************************************************************

View File

@ -31,7 +31,7 @@ SOFTWARE.
#include "platform.h"
#if ETL_CPP11_SUPPORTED == 1
#if ETL_CPP11_SUPPORTED == 1 && !defined(ETL_NO_STL)
#include "mutex/mutex_std.h"
#define ETL_HAS_MUTEX 1
#elif defined(ETL_COMPILER_ARM)

View File

@ -51,7 +51,7 @@ SOFTWARE.
///\ingroup patterns
//*****************************************************************************
#include <algorithm>
#include "algorithm.h"
#include "platform.h"
#include "vector.h"

View File

@ -29,6 +29,7 @@ SOFTWARE.
******************************************************************************/
#include <stdint.h>
#include <limits.h>
#ifndef ETL_PLATFORM_INCLUDED
#define ETL_PLATFORM_INCLUDED

View File

@ -32,6 +32,10 @@ SOFTWARE.
#define ETL_POOL_INCLUDED
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "error_handler.h"
#include "alignment.h"
#include "array.h"
@ -40,9 +44,7 @@ SOFTWARE.
#include "nullptr.h"
#include "alignment.h"
#include "static_assert.h"
#include <iterator>
#include <algorithm>
#include "algorithm.h"
#undef ETL_FILE
#define ETL_FILE "11"
@ -134,7 +136,7 @@ namespace etl
return reinterpret_cast<T*>(allocate_item());
}
#if !ETL_CPP11_SUPPORTED || ETL_POOL_CPP03_CODE || defined(ETL_STLPORT)
#if !ETL_CPP11_SUPPORTED || ETL_POOL_CPP03_CODE || defined(ETL_STLPORT) || defined(ETL_NO_STL)
//*************************************************************************
/// Allocate storage for an object from the pool and create default.
/// If asserts or exceptions are enabled and there are no more free items an
@ -499,7 +501,7 @@ namespace etl
return ipool::allocate<U>();
}
#if !ETL_CPP11_SUPPORTED || ETL_POOL_CPP03_CODE || defined(ETL_STLPORT)
#if !ETL_CPP11_SUPPORTED || ETL_POOL_CPP03_CODE || defined(ETL_STLPORT) || defined(ETL_NO_STL)
//*************************************************************************
/// Allocate storage for an object from the pool and create with default.
/// If asserts or exceptions are enabled and there are no more free items an
@ -650,7 +652,7 @@ namespace etl
return base_t::template allocate<U>();
}
#if !ETL_CPP11_SUPPORTED || ETL_POOL_CPP03_CODE || defined(ETL_STLPORT)
#if !ETL_CPP11_SUPPORTED || ETL_POOL_CPP03_CODE || defined(ETL_STLPORT) || defined(ETL_NO_STL)
//*************************************************************************
/// Allocate storage for an object from the pool and create with default.
/// If asserts or exceptions are enabled and there are no more free items an

View File

@ -32,10 +32,12 @@ SOFTWARE.
#define ETL_PRIORITY_QUEUE_INCLUDED
#include <stddef.h>
#include <functional>
#include <algorithm>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/functional.h"
#include "container.h"
#include "vector.h"
#include "type_traits.h"

View File

@ -33,9 +33,6 @@ SOFTWARE.
#define ETL_IN_PVOIDVECTOR
#include <iterator>
#include <algorithm>
#include <functional>
#include <stddef.h>
#include "../platform.h"
@ -44,6 +41,9 @@ SOFTWARE.
#include "../type_traits.h"
#include "../error_handler.h"
#include "../stl/functional.h"
#include "../stl/iterator.h"
#ifdef ETL_COMPILER_GCC
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif

View File

@ -35,8 +35,6 @@ SOFTWARE.
// Arduino
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_ARM
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GCC

View File

@ -35,8 +35,6 @@ SOFTWARE.
// ARM Compiler Version 5
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_ARM
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_ARM

View File

@ -7,7 +7,7 @@ Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2017 jwellbelove, scott-eddy
Copyright(c) 2018 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
@ -27,34 +27,23 @@ 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_PROFILE_H__
#define __ETL_PROFILE_H__
#ifdef PROFILE_MSVC
#include "msvc_x86.h"
#elif PROFILE_GCC_GENERIC
#include "gcc_generic.h"
#elif PROFILE_GCC_LINUX_X86
#include "gcc_linux_x86.h"
#elif PROFILE_GCC_WINDOWS_X86
#include "gcc_windows_x86.h"
#elif PROFILE_ARM_V5_GENERIC
#include "armv5.h"
#elif PROFILE_ARM_V6_GENERIC
#include "armv6.h"
#elif PROFILE_ARDUINO
#include "arduino_arm.h"
#elif PROFILE_TICC
#include "ticc.h"
#elif PROFILE_CPP03_GENERIC
#include "cpp03.h"
#elif PROFILE_CPP11_GENERIC
#include "cpp11.h"
#elif PROFILE_CPP14_GENERIC
#include "cpp14.h"
#elif PROFILE_CUSTOM
#include "custom_profile.h"
#else
#error Must provide a profile header file when buiding ETL. See https://www.etlcpp.com/setup.html
#endif
#endif // __ETL_PROFILE_H_
#ifndef ETL_ARMV5_NO_STL_INCLUDED
#define ETL_ARMV5_NO_STL_INCLUDED
//*****************************************************************************
// ARM Compiler Version 5
//*****************************************************************************
#define ETL_TARGET_DEVICE_ARM
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_ARM
#define ETL_CPP11_SUPPORTED 0
#define ETL_CPP14_SUPPORTED 0
#define ETL_CPP17_SUPPORTED 0
#define ETL_NO_NULLPTR_SUPPORT 1
#define ETL_NO_LARGE_CHAR_SUPPORT 1
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED 0
#define ETL_NO_STL
#endif

View File

@ -35,8 +35,6 @@ SOFTWARE.
// ARM Compiler Version 6
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_ARM
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_LLVM

View File

@ -0,0 +1,49 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_ARMV6_NO_STL_INCLUDED
#define ETL_ARMV6_NO_STL_INCLUDED
//*****************************************************************************
// ARM Compiler Version 6
//*****************************************************************************
#define ETL_TARGET_DEVICE_ARM
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_LLVM
#define ETL_CPP11_SUPPORTED 1
#define ETL_CPP14_SUPPORTED 0
#define ETL_CPP17_SUPPORTED 0
#define ETL_NO_NULLPTR_SUPPORT 0
#define ETL_NO_LARGE_CHAR_SUPPORT 0
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED 1
#define ETL_NO_STL
#endif

View File

@ -35,8 +35,6 @@ SOFTWARE.
// Generic C++03
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GENERIC

View File

@ -0,0 +1,49 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_CPP03_NO_STL_INCLUDED
#define ETL_CPP03_NO_STL_INCLUDED
//*****************************************************************************
// Generic C++03
//*****************************************************************************
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GENERIC
#define ETL_CPP11_SUPPORTED 0
#define ETL_CPP14_SUPPORTED 0
#define ETL_CPP17_SUPPORTED 0
#define ETL_NO_NULLPTR_SUPPORT 1
#define ETL_NO_LARGE_CHAR_SUPPORT 1
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED 0
#define ETL_NO_STL
#endif

View File

@ -35,8 +35,6 @@ SOFTWARE.
// Generic C++11
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GENERIC

View File

@ -0,0 +1,49 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_CPP11_NO_STL_INCLUDED
#define ETL_CPP11_NO_STL_INCLUDED
//*****************************************************************************
// Generic C++11
//*****************************************************************************
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GENERIC
#define ETL_CPP11_SUPPORTED 1
#define ETL_CPP14_SUPPORTED 0
#define ETL_CPP17_SUPPORTED 0
#define ETL_NO_NULLPTR_SUPPORT 0
#define ETL_NO_LARGE_CHAR_SUPPORT 0
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED 0
#define ETL_NO_STL
#endif

View File

@ -35,8 +35,6 @@ SOFTWARE.
// Generic C++14
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GENERIC

View File

@ -0,0 +1,49 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2017 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_CPP14_NO_STL_INCLUDED
#define ETL_CPP14_NO_STL_INCLUDED
//*****************************************************************************
// Generic C++14
//*****************************************************************************
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GENERIC
#define ETL_CPP11_SUPPORTED 1
#define ETL_CPP14_SUPPORTED 1
#define ETL_CPP17_SUPPORTED 0
#define ETL_NO_NULLPTR_SUPPORT 0
#define ETL_NO_LARGE_CHAR_SUPPORT 0
#define ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED 0
#define ETL_NO_STL
#endif

View File

@ -28,15 +28,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_GCC_INCLUDED
#define ETL_GCC_INCLUDED
#ifndef ETL_GCC_GENERIC_INCLUDED
#define ETL_GCC_GENERIC_INCLUDED
//*****************************************************************************
// GCC
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GCC

View File

@ -28,15 +28,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_GCC_INCLUDED
#define ETL_GCC_INCLUDED
#ifndef ETL_GCC_LINUX_X86_INCLUDED
#define ETL_GCC_LINUX_X86_INCLUDED
//*****************************************************************************
// GCC
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_X86
#define ETL_TARGET_OS_LINUX
#define ETL_COMPILER_GCC

View File

@ -28,15 +28,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_GCC_INCLUDED
#define ETL_GCC_INCLUDED
#ifndef ETL_GCC_WINDOWS_X86_INCLUDED
#define ETL_GCC_WINDOWS_X86_INCLUDED
//*****************************************************************************
// GCC
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_X86
#define ETL_TARGET_OS_WINDOWS
#define ETL_COMPILER_GCC

View File

@ -28,15 +28,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_MSVC_INCLUDED
#define ETL_MSVC_INCLUDED
#ifndef ETL_MSVC_X86_INCLUDED
#define ETL_MSVC_X86_INCLUDED
//*****************************************************************************
// Microsoft Visual Studio
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_X86
#define ETL_TARGET_OS_WINDOWS
#define ETL_COMPILER_MICROSOFT

View File

@ -28,15 +28,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_GCC_INCLUDED
#define ETL_GCC_INCLUDED
#ifndef ETL_SEGGER_GCC_INCLUDED
#define ETL_SEGGER_GCC_INCLUDED
//*****************************************************************************
// GCC
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_GCC

View File

@ -35,8 +35,6 @@ SOFTWARE.
// Texas Instruments Code Composer
//*****************************************************************************
#include <limits.h>
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_COMPILER_TI

View File

@ -31,13 +31,15 @@ SOFTWARE.
#ifndef ETL_REFERENCE_FLAT_MULTISET_INCLUDED
#define ETL_REFERENCE_FLAT_MULTISET_INCLUDED
#include <iterator>
#include <algorithm>
#include <functional>
#include <utility>
#include <stddef.h>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "type_traits.h"
#include "vector.h"
#include "pool.h"

View File

@ -31,13 +31,15 @@ SOFTWARE.
#ifndef ETL_REFERENCE_FLAT_SET_INCLUDED
#define ETL_REFERENCE_FLAT_SET_INCLUDED
#include <iterator>
#include <algorithm>
#include <functional>
#include <utility>
#include <stddef.h>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "type_traits.h"
#include "pool.h"
#include "error_handler.h"

View File

@ -32,9 +32,6 @@ SOFTWARE.
#define ETL_SET_INCLUDED
#include <stddef.h>
#include <iterator>
#include <algorithm>
#include <functional>
#include "platform.h"
#include "container.h"
@ -46,7 +43,11 @@ SOFTWARE.
#include "type_traits.h"
#include "parameter_type.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -1986,7 +1987,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Constructor, from an initializer_list.
//*************************************************************************

View File

@ -33,9 +33,11 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include "platform.h"
#include "stl/algorithm.h"
#include "container.h"
#include "alignment.h"
#include "array.h"

View File

@ -0,0 +1,42 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_STL_ALGORITHM_INCLUDED
#define ETL_STL_ALGORITHM_INCLUDED
#include "../platform.h"
#if defined(ETL_NO_STL)
#include "alternate/algorithm.h"
#else
#include <algorithm>
#endif
#endif

View File

@ -0,0 +1,626 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_STL_ALTERNATE_ALGORITHM_INCLUDED
#define ETL_STL_ALTERNATE_ALGORITHM_INCLUDED
#include "../../platform.h"
#include <string.h>
#include "../../type_traits.h"
#include "iterator.h"
#include "functional.h"
#if defined(ETL_IN_UNIT_TEST)
#define ETLSTD etlstd
namespace etlstd
#else
#define ETLSTD std
namespace std
#endif
{
//***************************************************************************
// distance
template <typename TIterator>
typename etl::enable_if<!etl::is_same<typename std::iterator_traits<TIterator>::iterator_category, std::random_access_iterator_tag>::value,
typename std::iterator_traits<TIterator>::difference_type>::type
distance(TIterator first, TIterator last)
{
typename std::iterator_traits<TIterator>::difference_type count = 0;
while (first != last)
{
++count;
++first;
}
return count;
}
template <typename TIterator>
typename etl::enable_if<etl::is_same<typename std::iterator_traits<TIterator>::iterator_category, std::random_access_iterator_tag>::value,
typename std::iterator_traits<TIterator>::difference_type>::type
distance(TIterator first, TIterator last)
{
return last - first;
}
//***************************************************************************
// advance
template <typename TIterator, typename TDistance>
typename etl::enable_if<!etl::is_same<typename std::iterator_traits<TIterator>::iterator_tag, std::random_access_iterator_tag>::value, void>::type
advance(TIterator itr, TDistance distance)
{
while (distance-- != 0)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
typename etl::enable_if<etl::is_same<typename std::iterator_traits<TIterator>::iterator_tag, std::random_access_iterator_tag>::value, void>::type
advance(TIterator itr, TDistance distance)
{
return itr += distance;
}
//***************************************************************************
// copy
// Pointer
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<etl::is_pointer<TIterator1>::value &&
etl::is_pointer<TIterator2>::value &&
etl::is_pod<typename std::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy(TIterator1 sb, TIterator1 se, TIterator2 db)
{
typedef typename std::iterator_traits<TIterator1>::value_type value_t;
return TIterator2(memcpy(db, sb, sizeof(value_t) * (se - sb)));
}
// Other iterator
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<!etl::is_pointer<TIterator1>::value ||
!etl::is_pointer<TIterator2>::value ||
!etl::is_pod<typename std::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy(TIterator1 sb, TIterator1 se, TIterator2 db)
{
while (sb != se)
{
*db++ = *sb++;
}
return db;
}
//***************************************************************************
// copy_n
// Pointer
template <typename TIterator1, typename TSize, typename TIterator2>
typename etl::enable_if<etl::is_pointer<TIterator1>::value &&
etl::is_pointer<TIterator2>::value &&
etl::is_pod<typename std::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy_n(TIterator1 sb, TSize count, TIterator2 db)
{
typedef typename std::iterator_traits<TIterator1>::value_type value_t;
return TIterator2(memcpy(db, sb, sizeof(value_t) * count));
}
// Other iterator
template <typename TIterator1, typename TSize, typename TIterator2>
typename etl::enable_if<!etl::is_pointer<TIterator1>::value ||
!etl::is_pointer<TIterator2>::value ||
!etl::is_pod<typename std::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy_n(TIterator1 sb, TSize count, TIterator2 db)
{
while (count != 0)
{
*db++ = *sb++;
--count;
}
return db;
}
//***************************************************************************
// copy_backward
// Pointer
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<etl::is_pointer<TIterator1>::value &&
etl::is_pointer<TIterator2>::value &&
etl::is_pod<typename std::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de)
{
typedef typename std::iterator_traits<TIterator1>::value_type value_t;
const size_t length = (se - sb);
return TIterator2(memmove(de - length, sb, sizeof(value_t) * length));
}
// Other iterator
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<!etl::is_pointer<TIterator1>::value ||
!etl::is_pointer<TIterator2>::value ||
!etl::is_pod<typename std::iterator_traits<TIterator1>::value_type>::value, TIterator2>::type
copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de)
{
while (se != sb)
{
*(--de) = *(--se);
}
return de;
}
//***************************************************************************
// lower_bound
template<typename TIterator, typename TValue, typename TCompare>
TIterator lower_bound(TIterator first, TIterator last, const TValue& value, TCompare compare)
{
typedef typename std::iterator_traits<TIterator>::difference_type difference_t;
difference_t count = std::distance(first, last);
while (count > 0)
{
TIterator itr = first;
difference_t step = count / 2;
std::advance(itr, step);
if (compare(*itr, value))
{
first = ++itr;
count -= step + 1;
}
else
{
count = step;
}
}
return first;
}
template<typename TIterator, typename TValue>
TIterator lower_bound(TIterator first, TIterator last, const TValue& value)
{
typedef std::less<typename std::iterator_traits<TIterator>::value_type> compare;
return ETLSTD::lower_bound(first, last, value, compare());
}
//***************************************************************************
// upper_bound
template<typename TIterator, typename TValue, typename TCompare>
TIterator upper_bound(TIterator first, TIterator last, const TValue& value, TCompare compare)
{
typedef typename std::iterator_traits<TIterator>::difference_type difference_t;
difference_t count = std::distance(first, last);
while (count > 0)
{
TIterator itr = first;
difference_t step = count / 2;
std::advance(itr, step);
if (!compare(value, *itr))
{
first = ++itr;
count -= step + 1;
}
else
{
count = step;
}
}
return first;
}
template<typename TIterator, typename TValue>
TIterator upper_bound(TIterator first, TIterator last, const TValue& value)
{
typedef std::less<typename std::iterator_traits<TIterator>::value_type> compare;
return ETLSTD::upper_bound(first, last, value, compare());
}
//***************************************************************************
// equal_range
template<typename TIterator, typename TValue, typename TCompare>
std::pair<TIterator, TIterator> equal_range(TIterator first, TIterator last, const TValue& value, TCompare compare)
{
return std::make_pair(ETLSTD::lower_bound(first, last, value, compare),
ETLSTD::upper_bound(first, last, value, compare));
}
template<typename TIterator, typename TValue>
std::pair<TIterator, TIterator> equal_range(TIterator first, TIterator last, const TValue& value)
{
typedef std::less<typename std::iterator_traits<TIterator>::value_type> compare;
return std::make_pair(ETLSTD::lower_bound(first, last, value, compare()),
ETLSTD::upper_bound(first, last, value, compare()));
}
//***************************************************************************
// fill
template<typename TIterator, typename TValue>
typename etl::enable_if<!(etl::is_same<char, TValue>::value || etl::is_same<unsigned char, TValue>::value) || !etl::is_pointer<TIterator>::value, void>::type
fill(TIterator first, TIterator last, const TValue& value)
{
while (first != last)
{
*first++ = value;
}
}
template<typename TIterator, typename TValue>
typename etl::enable_if<(etl::is_same<char, TValue>::value || etl::is_same<unsigned char, TValue>::value) && etl::is_pointer<TIterator>::value, void>::type
fill(TIterator first, TIterator last, const TValue& value)
{
memset(first, value, last - first);
}
//***************************************************************************
// swap
template <typename T>
void swap(T& a, T& b)
{
T c = a;
a = b;
b = c;
}
//***************************************************************************
// iter_swap
template <typename TIterator1, typename TIterator2>
void iter_swap(TIterator1 a, TIterator2 b)
{
typename std::iterator_traits<TIterator1>::value_type c = *a;
*a = *b;
*b = c;
}
//***************************************************************************
// equal
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<!etl::is_pointer<TIterator1>::value || !etl::is_pointer<TIterator2>::value || !etl::is_pod<typename std::iterator_traits<TIterator1>::value_type>::value, bool>::type
equal(TIterator1 first1, TIterator1 last1, TIterator2 first2)
{
while (first1 != last1)
{
if (*first1++ != *first2++)
{
return false;
}
}
return true;
}
template <typename TIterator1, typename TIterator2>
typename etl::enable_if<etl::is_pointer<TIterator1>::value && etl::is_pointer<TIterator2>::value && etl::is_pod<typename std::iterator_traits<TIterator1>::value_type>::value, bool>::type
equal(TIterator1 first1, TIterator1 last1, TIterator2 first2)
{
typedef typename std::iterator_traits<TIterator1>::value_type value_t;
return (memcmp(first1, first2, sizeof(value_t) * (last1 - last1)) == 0);
}
//***************************************************************************
// lexicographical_compare
template <typename TIterator1, typename TIterator2, typename TCompare>
bool lexicographical_compare(TIterator1 first1, TIterator1 last1,
TIterator2 first2, TIterator2 last2,
TCompare compare)
{
while ((first1 != last1) && (first2 != last2))
{
if (compare(*first1, *first2))
{
return true;
}
if (compare(*first2, *first1))
{
return false;
}
++first1;
++first2;
}
return (first1 == last1) && (first2 != last2);
}
//***************************************************************************
// lexicographical_compare
template <typename TIterator1, typename TIterator2>
bool lexicographical_compare(TIterator1 first1, TIterator1 last1,
TIterator2 first2, TIterator2 last2)
{
typedef std::less<typename std::iterator_traits<TIterator1>::value_type> compare;
return ETLSTD::lexicographical_compare(first1, last1, first2, last2, compare());
}
//***************************************************************************
// min
template <typename T, typename TCompare>
const T& min(const T& a, const T& b, TCompare compare)
{
return (compare(a, b)) ? a : b;
}
template <typename T>
const T& min(const T& a, const T& b)
{
typedef std::less<T> compare;
return ETLSTD::min(a, b, compare());
}
//***************************************************************************
// max
template <typename T, typename TCompare>
const T& max(const T& a, const T& b, TCompare compare)
{
return (compare(a, b)) ? b : a;
}
template <typename T>
const T& max(const T& a, const T& b)
{
typedef std::less<T> compare;
return ETLSTD::max(a, b, compare());
}
//***************************************************************************
// Heap
namespace private_heap
{
// Push Heap Helper
template <typename TIterator, typename TDistance, typename TValue, typename TCompare>
void push_heap(TIterator first, TDistance value_index, TDistance top_index, TValue value, TCompare compare)
{
TDistance parent = (value_index - 1) / 2;
while ((value_index > top_index) && compare(first[parent], value))
{
first[value_index] = first[parent];
value_index = parent;
parent = (value_index - 1) / 2;
}
first[value_index] = value;
}
// Adjust Heap Helper
template <typename TIterator, typename TDistance, typename TValue, typename TCompare>
void adjust_heap(TIterator first, TDistance value_index, TDistance length, TValue value, TCompare compare)
{
TDistance top_index = value_index;
TDistance child2nd = (2 * value_index) + 2;
while (child2nd < length)
{
if (compare(first[child2nd], first[child2nd - 1]))
{
child2nd--;
}
first[value_index] = first[child2nd];
value_index = child2nd;
child2nd = 2 * (child2nd + 1);
}
if (child2nd == length)
{
first[value_index] = first[child2nd - 1];
value_index = child2nd - 1;
}
push_heap(first, value_index, top_index, value, compare);
}
// Is Heap Helper
template <typename TIterator, typename TDistance, typename TCompare>
bool is_heap(const TIterator first, const TDistance n, TCompare compare)
{
TDistance parent = 0;
for (TDistance child = 1; child < n; ++child)
{
if (compare(first[parent], first[child]))
{
return false;
}
if ((child & 1) == 0)
{
++parent;
}
}
return true;
}
}
// Pop Heap
template <typename TIterator, typename TCompare>
void pop_heap(TIterator first, TIterator last, TCompare compare)
{
typedef typename std::iterator_traits<TIterator>::value_type value_t;
typedef typename std::iterator_traits<TIterator>::difference_type distance_t;
value_t value = last[-1];
last[-1] = first[0];
private_heap::adjust_heap(first, distance_t(0), distance_t(last - first - 1), value, compare);
}
// Pop Heap
template <typename TIterator>
void pop_heap(TIterator first, TIterator last)
{
typedef std::less<typename std::iterator_traits<TIterator>::value_type> compare;
ETLSTD::pop_heap(first, last, compare());
}
// Push Heap
template <typename TIterator, typename TCompare>
void push_heap(TIterator first, TIterator last, TCompare compare)
{
typedef typename std::iterator_traits<TIterator>::difference_type difference_t;
typedef typename std::iterator_traits<TIterator>::value_type value_t;
private_heap::push_heap(first, difference_t(last - first - 1), difference_t(0), value_t(*(last - 1)), compare);
}
// Push Heap
template <typename TIterator>
void push_heap(TIterator first, TIterator last)
{
typedef std::less<typename std::iterator_traits<TIterator>::value_type> compare;
ETLSTD::push_heap(first, last, compare());
}
// Make Heap
template <typename TIterator, typename TCompare>
void make_heap(TIterator first, TIterator last, TCompare compare)
{
typedef typename std::iterator_traits<TIterator>::difference_type difference_t;
if ((last - first) < 2)
{
return;
}
difference_t length = last - first;
difference_t parent = (length - 2) / 2;
while (true)
{
private_heap::adjust_heap(first, parent, length, *(first + parent), compare);
if (parent == 0)
{
return;
}
--parent;
}
}
// Make Heap
template <typename TIterator>
void make_heap(TIterator first, TIterator last)
{
typedef std::less<typename std::iterator_traits<TIterator>::value_type> compare;
ETLSTD::make_heap(first, last, compare());
}
// Is Heap
template <typename TIterator>
bool is_heap(TIterator first, TIterator last)
{
typedef std::less<typename std::iterator_traits<TIterator>::value_type> compare;
return private_heap::is_heap(first, last - first, compare());
}
// Is Heap
template <typename TIterator, typename TCompare>
bool is_heap(TIterator first, TIterator last, TCompare compare)
{
return private_heap::is_heap(first, last - first, compare);
}
// Search
template<typename TIterator1, typename TIterator2, typename TCompare>
TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last, TCompare compare)
{
if (search_first == search_last)
{
return first;
}
while (first != last)
{
TIterator1 itr1 = first;
TIterator2 itr2 = search_first;
while (compare(*itr1,*itr2))
{
if (itr2 == search_last)
{
return first;
}
if (itr1 == last)
{
return last;
}
++itr1;
++itr2;
}
++first;
}
return last;
}
// Search
template<typename TIterator1, class TIterator2>
TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last)
{
typedef std::equal_to<typename std::iterator_traits<TIterator1>::value_type> compare;
return ETLSTD::search(first, last, search_first, search_last, compare());
}
}
#endif

View File

@ -0,0 +1,54 @@
#ifndef ETL_STL_ALTERNATE_FUNCTIONAL_INCLUDED
#define ETL_STL_ALTERNATE_FUNCTIONAL_INCLUDED
#include "../../platform.h"
#if defined(ETL_IN_UNIT_TEST)
namespace etlstd
#else
namespace std
#endif
{
//***************************************************************************
template <typename T = void>
struct less
{
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs < rhs;
}
};
//***************************************************************************
template <typename T = void>
struct greater
{
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs > rhs;
}
};
//***************************************************************************
template <typename T = void>
struct equal_to
{
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs == rhs;
}
};
//***************************************************************************
template <typename T = void>
struct not_equal_to
{
ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const
{
return lhs != rhs;
}
};
}
#endif

View File

@ -0,0 +1,347 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_STL_ALTERNATE_ITERATOR_INCLUDED
#define ETL_STL_ALTERNATE_ITERATOR_INCLUDED
#include "../../platform.h"
#include <string.h>
#include "../../type_traits.h"
#if defined(ETL_IN_UNIT_TEST)
namespace etlstd
#else
namespace std
#endif
{
//***************************************************************************
// iterator
template <typename TCategory, typename T, typename TDistance = ptrdiff_t, typename TPointer = T* , typename TReference = T&>
struct iterator
{
typedef T value_type;
typedef TDistance difference_type;
typedef TPointer pointer;
typedef TReference reference;
typedef TCategory iterator_category;
};
//***************************************************************************
// iterator tags
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
//***************************************************************************
// iterator_traits
template <typename TIterator>
struct iterator_traits
{
typedef typename TIterator::difference_type difference_type;
typedef typename TIterator::value_type value_type;
typedef typename TIterator::pointer pointer;
typedef typename TIterator::reference reference;
typedef typename TIterator::iterator_category iterator_category;
};
template <typename T>
struct iterator_traits<T*>
{
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T& reference;
typedef random_access_iterator_tag iterator_category ;
};
template <typename T>
struct iterator_traits<const T*>
{
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef T& reference;
typedef random_access_iterator_tag iterator_category ;
};
//***************************************************************************
// advance
template <typename TIterator, typename TDistance>
typename etl::enable_if<etl::is_same<typename iterator_traits<TIterator>::iterator_catagory, input_iterator_tag>::value, void>::type
advance(TIterator& itr, TDistance n)
{
while (n--)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
typename etl::enable_if<etl::is_same<typename iterator_traits<TIterator>::iterator_catagory, output_iterator_tag>::value, void>::type
advance(TIterator& itr, TDistance n)
{
while (n--)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
typename etl::enable_if<etl::is_same<typename iterator_traits<TIterator>::iterator_catagory, forward_iterator_tag>::value, void>::type
advance(TIterator& itr, TDistance n)
{
while (n--)
{
++itr;
}
}
template <typename TIterator, typename TDistance>
typename etl::enable_if<etl::is_same<typename iterator_traits<TIterator>::iterator_catagory, bidirectional_iterator_tag>::value, void>::type
advance(TIterator& itr, TDistance n)
{
if (n > 0)
{
while (n--)
{
++itr;
}
}
else
{
while (n--)
{
--itr;
}
}
}
template <typename TIterator, typename TDistance>
typename etl::enable_if<etl::is_same<typename iterator_traits<TIterator>::iterator_catagory, random_access_iterator_tag>::value, void>::type
advance(TIterator& itr, TDistance n)
{
itr += n;
}
//***************************************************************************
// distance
template<typename TIterator>
typename etl::enable_if<!etl::is_same<typename iterator_traits<TIterator>::iterator_catagory, random_access_iterator_tag>::value,
typename iterator_traits<TIterator>::difference_type>::type
distance(TIterator first, TIterator last)
{
typename iterator_traits<TIterator>::difference_type d = 0;
while (first != last)
{
++d;
}
return d;
}
template<typename TIterator>
typename etl::enable_if<etl::is_same<typename iterator_traits<TIterator>::iterator_catagory, random_access_iterator_tag>::value,
typename iterator_traits<TIterator>::difference_type>::type
distance(TIterator first, TIterator last)
{
return last - first;
}
//***************************************************************************
// reverse_iterator
template <typename TIterator>
struct reverse_iterator
{
public:
typedef typename iterator_traits<TIterator>::difference_type difference_type;
typedef typename iterator_traits<TIterator>::value_type value_type;
typedef typename iterator_traits<TIterator>::pointer pointer;
typedef typename iterator_traits<TIterator>::reference reference;
typedef typename iterator_traits<TIterator>::iterator_category iterator_category;
reverse_iterator()
{
}
explicit reverse_iterator(TIterator itr) : current(itr)
{
}
reverse_iterator(const reverse_iterator<TIterator>& itr)
: current(itr.current)
{
}
template <typename UITerator>
reverse_iterator(const reverse_iterator<UITerator>& itr)
: current(itr.base())
{
}
reverse_iterator<TIterator>& operator = (const reverse_iterator<TIterator>& itr)
{
current = itr.base();
return *this;
}
template <typename UITerator>
reverse_iterator<TIterator>& operator = (const reverse_iterator<UITerator>& itr)
{
current = itr.base();
return *this;
}
TIterator base() const
{
return current;
}
ETL_CONSTEXPR reference operator *() const
{
TIterator temp = current;
--temp;
return *temp;
}
ETL_CONSTEXPR pointer operator ->() const
{
TIterator temp = current;
--temp;
return &(*temp);
}
ETL_CONSTEXPR reverse_iterator<TIterator>& operator ++()
{
--current;
return *this;
}
ETL_CONSTEXPR reverse_iterator<TIterator> operator ++(int)
{
reverse_iterator<TIterator> temp = *this;
--current;
return temp;
}
ETL_CONSTEXPR reverse_iterator<TIterator>& operator --()
{
++current;
return *this;
}
ETL_CONSTEXPR reverse_iterator<TIterator> operator --(int)
{
reverse_iterator<TIterator> temp = *this;
++current;
return temp;
}
ETL_CONSTEXPR reverse_iterator<TIterator> operator +(difference_type n) const
{
return reverse_iterator<TIterator>(current - n);
}
ETL_CONSTEXPR reverse_iterator<TIterator>& operator +=(difference_type n)
{
current -= n;
return *this;
}
ETL_CONSTEXPR reverse_iterator<TIterator> operator -(difference_type n) const
{
return reverse_iterator<TIterator>(current + n);
}
ETL_CONSTEXPR reverse_iterator<TIterator>& operator -=(difference_type n)
{
current += n;
return *this;
}
ETL_CONSTEXPR reference operator [](difference_type n) const
{
return *(*this + n);
}
protected:
TIterator current;
};
template <class TIterator>
inline ETL_CONSTEXPR bool operator <(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return rhs.base() < lhs.base();
}
template <class TIterator>
inline ETL_CONSTEXPR bool operator !=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return !(lhs == rhs);
}
template <class TIterator>
inline ETL_CONSTEXPR bool operator >(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return rhs < lhs;
}
template <class TIterator>
inline ETL_CONSTEXPR bool operator <=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return !(rhs < lhs);
}
template <class TIterator>
inline ETL_CONSTEXPR bool operator >=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return !(lhs < rhs);
}
template <class TIterator>
inline ETL_CONSTEXPR typename reverse_iterator<TIterator>::difference_type operator -(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
{
return rhs.base() - lhs.base();
}
template <class TIterator, class TDifference>
inline ETL_CONSTEXPR reverse_iterator<TIterator> operator +(TDifference n, const reverse_iterator<TIterator>& itr)
{
return itr.operator +(n);
}
}
#endif

View File

@ -0,0 +1,533 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_STL_ALTERNATE_LIMITS_INCLUDED
#define ETL_STL_ALTERNATE_LIMITS_INCLUDED
#include "../../platform.h"
#include "../../type_traits.h"
#include "../../char_traits.h"
#include <limits.h>
#include <stdint.h>
#include <float.h>
#define ETL_LOG2(x) (((x) * 301) / 1000)
#if defined(ETL_IN_UNIT_TEST)
#define ETLSTD etlstd
namespace etlstd
#else
#define ETLSTD std
namespace std
#endif
{
template<class T> class numeric_limits;
enum float_round_style
{
round_indeterminate = -1,
round_toward_zero = 0,
round_to_nearest = 1,
round_toward_infinity = 2,
round_toward_neg_infinity = 3,
};
enum float_denorm_style
{
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
};
//***************************************************************************
// Base for integral types.
template <typename T>
class etl_integral_type
{
public:
static const bool is_specialized;
static const int max_digits10;
static const bool is_integer;
static const bool is_exact;
static const int radix;
static ETL_CONSTEXPR T epsilon() { return 0; }
static ETL_CONSTEXPR T round_error() { return 0; }
static const int digits;
static const int digits10;
static const bool is_signed;
static const int min_exponent;
static const int min_exponent10;
static const int max_exponent;
static const int max_exponent10;
static const bool has_infinity;
static const bool has_quiet_NaN;
static const bool has_signaling_NaN;
static const float_denorm_style has_denorm;
static const bool has_denorm_loss;
static ETL_CONSTEXPR T infinity() { return 0; }
static ETL_CONSTEXPR T quiet_NaN() { return 0; }
static ETL_CONSTEXPR T signaling_NaN() { return 0; }
static ETL_CONSTEXPR T denorm_min() { return 0; }
static const bool is_iec559;
static const bool is_bounded;
static const bool is_modulo;
static const bool traps;
static const bool tinyness_before;
static const float_round_style round_style;
};
template <typename T> const bool etl_integral_type<T>::is_specialized = true;
template <typename T> const int etl_integral_type<T>::digits = (CHAR_BIT * sizeof(T)) - (etl::is_signed<T>::value ? 1 : 0);
template <typename T> const int etl_integral_type<T>::digits10 = ETL_LOG2(digits);;
template <typename T> const int etl_integral_type<T>::max_digits10 = 0;
template <typename T> const bool etl_integral_type<T>::is_signed = etl::is_signed<T>::value;
template <typename T> const bool etl_integral_type<T>::is_integer = true;
template <typename T> const bool etl_integral_type<T>::is_exact = true;
template <typename T> const int etl_integral_type<T>::radix = 2;
template <typename T> const int etl_integral_type<T>::min_exponent = 0;
template <typename T> const int etl_integral_type<T>::min_exponent10 = 0;
template <typename T> const int etl_integral_type<T>::max_exponent = 0;
template <typename T> const int etl_integral_type<T>::max_exponent10 = 0;
template <typename T> const bool etl_integral_type<T>::has_infinity = false;
template <typename T> const bool etl_integral_type<T>::has_quiet_NaN = false;
template <typename T> const bool etl_integral_type<T>::has_signaling_NaN = false;
template <typename T> const float_denorm_style etl_integral_type<T>::has_denorm = denorm_absent;
template <typename T> const bool etl_integral_type<T>::has_denorm_loss = false;
template <typename T> const bool etl_integral_type<T>::is_iec559 = false;
template <typename T> const bool etl_integral_type<T>::is_bounded = true;
template <typename T> const bool etl_integral_type<T>::is_modulo = etl::is_unsigned<T>::value;
template <typename T> const bool etl_integral_type<T>::traps = false;
template <typename T> const bool etl_integral_type<T>::tinyness_before = false;
template <typename T> const float_round_style etl_integral_type<T>::round_style = round_toward_zero;
//***************************************************************************
// Base for floating point types.
template <typename T>
class etl_floating_point_type
{
public:
static const bool is_specialized;
static const bool is_signed;
static const bool is_integer;
static const bool is_exact;
static const int radix;
static const bool has_infinity;
static const bool has_quiet_NaN;
static const bool has_signaling_NaN;
static const float_denorm_style has_denorm;
static const bool has_denorm_loss;
static const bool is_iec559;
static const bool is_bounded;
static const bool is_modulo;
static ETL_CONSTEXPR T round_error() { return T(0.5); }
static ETL_CONSTEXPR T infinity() { return 0; }
static ETL_CONSTEXPR T quiet_NaN() { return 0; }
static ETL_CONSTEXPR T signaling_NaN() { return 0; }
static const bool traps;
static const bool tinyness_before;
static const float_round_style round_style;
};
template <typename T> const bool etl_floating_point_type<T>::is_specialized = true;
template <typename T> const bool etl_floating_point_type<T>::is_signed = true;
template <typename T> const bool etl_floating_point_type<T>::is_integer = false;
template <typename T> const bool etl_floating_point_type<T>::is_exact = false;
template <typename T> const int etl_floating_point_type<T>::radix = 2;
template <typename T> const bool etl_floating_point_type<T>::has_infinity = false;
template <typename T> const bool etl_floating_point_type<T>::has_quiet_NaN = false;
template <typename T> const bool etl_floating_point_type<T>::has_signaling_NaN = false;
template <typename T> const float_denorm_style etl_floating_point_type<T>::has_denorm = denorm_present;
template <typename T> const bool etl_floating_point_type<T>::has_denorm_loss = true;
template <typename T> const bool etl_floating_point_type<T>::is_iec559 = true;
template <typename T> const bool etl_floating_point_type<T>::is_bounded = true;
template <typename T> const bool etl_floating_point_type<T>::is_modulo = false;
template <typename T> const bool etl_floating_point_type<T>::traps = false;
template <typename T> const bool etl_floating_point_type<T>::tinyness_before = true;
template <typename T> const float_round_style etl_floating_point_type<T>::round_style = round_to_nearest;
//***************************************************************************
// Default
template<class T>
class numeric_limits;
//***************************************************************************
// bool
template<>
class numeric_limits<bool>
{
public:
static const bool is_specialized;
static ETL_CONSTEXPR bool min() { return false; }
static ETL_CONSTEXPR bool max() { return true; }
static ETL_CONSTEXPR bool lowest() { return false; }
static const int digits;
static const int digits10;
static const int max_digits10;
static const bool is_signed;
static const bool is_integer;
static const bool is_exact;
static const int radix;
static const bool epsilon() { return 0; }
static const bool round_error() { return 0; }
static const int min_exponent;
static const int min_exponent10;
static const int max_exponent;
static const int max_exponent10;
static const bool has_infinity;
static const bool has_quiet_NaN;
static const bool has_signaling_NaN;
static const float_denorm_style has_denorm;
static const bool has_denorm_loss;
static ETL_CONSTEXPR bool infinity() { return 0; }
static ETL_CONSTEXPR bool quiet_NaN() { return 0; }
static ETL_CONSTEXPR bool signaling_NaN() { return 0; }
static ETL_CONSTEXPR bool denorm_min() { return 0; }
static const bool is_iec559;
static const bool is_bounded;
static const bool is_modulo;
static const bool traps;
static const bool tinyness_before;
static const float_round_style round_style;
};
const bool numeric_limits<bool>::is_specialized = true;
const int numeric_limits<bool>::digits = 1;
const int numeric_limits<bool>::digits10 = 0;
const int numeric_limits<bool>::max_digits10 = 0;
const bool numeric_limits<bool>::is_signed = false;
const bool numeric_limits<bool>::is_integer = true;
const bool numeric_limits<bool>::is_exact = true;
const int numeric_limits<bool>::radix = 2;
const int numeric_limits<bool>::min_exponent = 0;
const int numeric_limits<bool>::min_exponent10 = 0;
const int numeric_limits<bool>::max_exponent = 0;
const int numeric_limits<bool>::max_exponent10 = 0;
const bool numeric_limits<bool>::has_infinity = false;
const bool numeric_limits<bool>::has_quiet_NaN = false;
const bool numeric_limits<bool>::has_signaling_NaN = false;
const float_denorm_style numeric_limits<bool>::has_denorm = denorm_absent;
const bool numeric_limits<bool>::has_denorm_loss = false;
const bool numeric_limits<bool>::is_iec559 = false;
const bool numeric_limits<bool>::is_bounded = true;
const bool numeric_limits<bool>::is_modulo = false;
const bool numeric_limits<bool>::traps = false;
const bool numeric_limits<bool>::tinyness_before = false;
const float_round_style numeric_limits<bool>::round_style = round_toward_zero;
//***************************************************************************
// char
template<>
class numeric_limits<char> : public etl_integral_type<char>
{
public:
static ETL_CONSTEXPR char min() { return CHAR_MIN; }
static ETL_CONSTEXPR char max() { return CHAR_MAX; }
static ETL_CONSTEXPR char lowest() { return CHAR_MIN; }
};
//***************************************************************************
// unsigned char
template<>
class numeric_limits<unsigned char> : public etl_integral_type<unsigned char>
{
public:
static ETL_CONSTEXPR unsigned char min() { return 0; }
static ETL_CONSTEXPR unsigned char max() { return UCHAR_MAX; }
static ETL_CONSTEXPR unsigned char lowest() { return 0; }
};
//***************************************************************************
// signed char
template<>
class numeric_limits<signed char> : public etl_integral_type<signed char>
{
public:
static ETL_CONSTEXPR signed char min() { return SCHAR_MIN; }
static ETL_CONSTEXPR signed char max() { return SCHAR_MAX; }
static ETL_CONSTEXPR signed char lowest() { return SCHAR_MIN; }
};
//***************************************************************************
// char16_t
template<>
class numeric_limits<char16_t> : public etl_integral_type<char16_t>
{
public:
static ETL_CONSTEXPR char16_t min() { return 0; }
static ETL_CONSTEXPR char16_t max() { return UINT_LEAST16_MAX; }
static ETL_CONSTEXPR char16_t lowest() { return 0; }
};
//***************************************************************************
// char32_t
template<>
class numeric_limits<char32_t> : public etl_integral_type<char32_t>
{
public:
static ETL_CONSTEXPR char32_t min() { return 0; }
static ETL_CONSTEXPR char32_t max() { return UINT_LEAST32_MAX; }
static ETL_CONSTEXPR char32_t lowest() { return 0; }
};
//***************************************************************************
// wchar_t
template<>
class numeric_limits<wchar_t> : public etl_integral_type<wchar_t>
{
public:
static ETL_CONSTEXPR wchar_t min() { return WCHAR_MIN; }
static ETL_CONSTEXPR wchar_t max() { return WCHAR_MAX; }
static ETL_CONSTEXPR wchar_t lowest() { return WCHAR_MIN; }
};
//***************************************************************************
// short
template<>
class numeric_limits<short> : public etl_integral_type<short>
{
public:
static ETL_CONSTEXPR short min() { return SHRT_MIN; }
static ETL_CONSTEXPR short max() { return SHRT_MAX; }
static ETL_CONSTEXPR short lowest() { return SHRT_MIN; }
};
//***************************************************************************
// unsigned short
template<>
class numeric_limits<unsigned short> : public etl_integral_type<unsigned short>
{
public:
static ETL_CONSTEXPR unsigned short min() { return 0; }
static ETL_CONSTEXPR unsigned short max() { return USHRT_MAX; }
static ETL_CONSTEXPR unsigned short lowest() { return 0; }
};
//***************************************************************************
// int
template<>
class numeric_limits<int> : public etl_integral_type<int>
{
public:
static ETL_CONSTEXPR int min() { return INT_MIN; }
static ETL_CONSTEXPR int max() { return INT_MAX; }
static ETL_CONSTEXPR int lowest() { return INT_MIN; }
};
//***************************************************************************
// unsigned int
template<>
class numeric_limits<unsigned int> : public etl_integral_type<unsigned int>
{
public:
static ETL_CONSTEXPR unsigned int min() { return 0; }
static ETL_CONSTEXPR unsigned int max() { return UINT_MAX; }
static ETL_CONSTEXPR unsigned int lowest() { return 0; }
};
//***************************************************************************
// long
template<>
class numeric_limits<long> : public etl_integral_type<long>
{
public:
static ETL_CONSTEXPR long min() { return LONG_MIN; }
static ETL_CONSTEXPR long max() { return LONG_MAX; }
static ETL_CONSTEXPR long lowest() { return LONG_MIN; }
};
//***************************************************************************
// unsigned long
template<>
class numeric_limits<unsigned long> : public etl_integral_type<unsigned long>
{
public:
static ETL_CONSTEXPR unsigned long min() { return 0; }
static ETL_CONSTEXPR unsigned long max() { return ULONG_MAX; }
static ETL_CONSTEXPR unsigned long lowest() { return 0; }
};
//***************************************************************************
// long long
template<>
class numeric_limits<long long> : public etl_integral_type<long long>
{
public:
static ETL_CONSTEXPR long long min() { return LLONG_MIN; }
static ETL_CONSTEXPR long long max() { return LLONG_MAX; }
static ETL_CONSTEXPR long long lowest() { return LLONG_MIN; }
};
//***************************************************************************
// unsigned long long
template<>
class numeric_limits<unsigned long long> : public etl_integral_type<unsigned long long>
{
public:
static ETL_CONSTEXPR unsigned long long min() { return 0; }
static ETL_CONSTEXPR unsigned long long max() { return ULLONG_MAX; }
static ETL_CONSTEXPR unsigned long long lowest() { return 0; }
};
//***************************************************************************
// float
template<>
class numeric_limits<float> : public etl_floating_point_type<float>
{
public:
static ETL_CONSTEXPR float min() { return FLT_MIN; }
static ETL_CONSTEXPR float max() { return FLT_MAX; }
static ETL_CONSTEXPR float lowest() { return -FLT_MAX; }
static ETL_CONSTEXPR float epsilon() { return FLT_EPSILON; }
static ETL_CONSTEXPR float denorm_min() { return FLT_MIN; }
static const int digits;
static const int digits10;
static const int max_digits10;
static const int min_exponent;
static const int min_exponent10;
static const int max_exponent;
static const int max_exponent10;
};
const int numeric_limits<float>::digits = FLT_MANT_DIG;
const int numeric_limits<float>::max_digits10 = ETL_LOG2(FLT_MANT_DIG) + 2;
const int numeric_limits<float>::digits10 = FLT_DIG;
const int numeric_limits<float>::min_exponent = FLT_MIN_EXP;
const int numeric_limits<float>::min_exponent10 = FLT_MIN_10_EXP;
const int numeric_limits<float>::max_exponent = FLT_MAX_EXP;
const int numeric_limits<float>::max_exponent10 = FLT_MAX_10_EXP;
//***************************************************************************
// double
template<>
class numeric_limits<double> : public etl_floating_point_type<double>
{
public:
static ETL_CONSTEXPR double min() { return DBL_MIN; }
static ETL_CONSTEXPR double max() { return DBL_MAX; }
static ETL_CONSTEXPR double lowest() { return -DBL_MAX; }
static ETL_CONSTEXPR double epsilon() { return DBL_EPSILON; }
static ETL_CONSTEXPR double denorm_min() { return DBL_MIN; }
static const int digits;
static const int digits10;
static const int max_digits10;
static const int min_exponent;
static const int min_exponent10;
static const int max_exponent;
static const int max_exponent10;
};
const int numeric_limits<double>::digits = DBL_MANT_DIG;
const int numeric_limits<double>::max_digits10 = ETL_LOG2(DBL_MANT_DIG) + 2;
const int numeric_limits<double>::digits10 = DBL_DIG;
const int numeric_limits<double>::min_exponent = DBL_MIN_EXP;
const int numeric_limits<double>::min_exponent10 = DBL_MIN_10_EXP;
const int numeric_limits<double>::max_exponent = DBL_MAX_EXP;
const int numeric_limits<double>::max_exponent10 = DBL_MAX_10_EXP;
//***************************************************************************
// long double
template<>
class numeric_limits<long double> : public etl_floating_point_type<long double>
{
public:
static ETL_CONSTEXPR long double min() { return LDBL_MIN; }
static ETL_CONSTEXPR long double max() { return LDBL_MAX; }
static ETL_CONSTEXPR long double lowest() { return -LDBL_MAX; }
static ETL_CONSTEXPR long double epsilon() { return LDBL_EPSILON; }
static ETL_CONSTEXPR long double denorm_min() { return LDBL_MIN; }
static const int digits;
static const int digits10;
static const int max_digits10;
static const int min_exponent;
static const int min_exponent10;
static const int max_exponent;
static const int max_exponent10;
};
const int numeric_limits<long double>::digits = LDBL_MANT_DIG;
const int numeric_limits<long double>::max_digits10 = ETL_LOG2(LDBL_MANT_DIG) + 2;
const int numeric_limits<long double>::digits10 = LDBL_DIG;
const int numeric_limits<long double>::min_exponent = LDBL_MIN_EXP;
const int numeric_limits<long double>::min_exponent10 = LDBL_MIN_10_EXP;
const int numeric_limits<long double>::max_exponent = LDBL_MAX_EXP;
const int numeric_limits<long double>::max_exponent10 = LDBL_MAX_10_EXP;
}
#endif

View File

@ -0,0 +1,140 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_STL_ALTERNATE_UTILITY_INCLUDED
#define ETL_STL_ALTERNATE_UTILITY_INCLUDED
#include "../../platform.h"
#include "algorithm.h"
#if defined(ETL_IN_UNIT_TEST)
#define ETLSTD etlstd
namespace etlstd
#else
#define ETLSTD std
namespace std
#endif
{
//******************************************************************************
template <typename T1, typename T2>
struct pair
{
typedef T1 first_type;
typedef T2 second_type;
T1 first;
T2 second;
pair()
: first(T1()),
second(T2())
{
}
pair(const T1& a, const T2& b)
: first(a),
second(b)
{
}
template <typename U1, typename U2>
pair(const pair<U1, U2>& other)
: first(other.first),
second(other.second)
{
}
pair(const pair<T1, T2>& other)
: first(other.first),
second(other.second)
{
}
void swap(pair<T1, T2>& other)
{
ETLSTD::swap(first, other.first);
ETLSTD::swap(second, other.second);
}
};
//******************************************************************************
template <typename T1, typename T2>
inline pair<T1, T2> make_pair(T1 a, T2 b)
{
return pair<T1, T2>(a, b);
}
//******************************************************************************
template <typename T1, typename T2>
inline void swap(pair<T1, T2>& a, pair<T1, T2>& b)
{
a.swap(b);
}
//******************************************************************************
template <typename T1, typename T2>
inline bool operator ==(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return (a.first == b.first) && (a.second == b.second);
}
template <typename T1, typename T2>
inline bool operator !=(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return !(a == b);
}
template <typename T1, typename T2>
inline bool operator <(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return (a.first < b.first) ||
(!(b.first < a.first) && (a.second < b.second));
}
template <typename T1, typename T2>
inline bool operator >(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return (b < a);
}
template <typename T1, typename T2>
inline bool operator <=(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return !(b < a);
}
template <typename T1, typename T2>
inline bool operator >=(const pair<T1, T2>& a, const pair<T1, T2>& b)
{
return !(a < b);
}
}
#endif

View File

@ -0,0 +1,13 @@
#ifndef ETL_STL_FUNCTIONAL_INCLUDED
#define ETL_STL_FUNCTIONAL_INCLUDED
#include "../platform.h"
#if defined(ETL_NO_STL)
#include "alternate/functional.h"
#else
#include <functional>
#endif
#endif

View File

@ -0,0 +1,43 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_STL_ITERATOR_INCLUDED
#define ETL_STL_ITERATOR_INCLUDED
#include "../platform.h"
#if defined(ETL_NO_STL)
#include "alternate/iterator.h"
#else
#include <iterator>
#endif
#endif

42
include/etl/stl/limits.h Normal file
View File

@ -0,0 +1,42 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_STL_LIMITS_INCLUDED
#define ETL_STL_LIMITS_INCLUDED
#include "../platform.h"
#if defined(ETL_NO_STL)
#include "alternate/limits.h"
#else
#include <limits>
#endif
#endif

42
include/etl/stl/utility.h Normal file
View File

@ -0,0 +1,42 @@
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2018 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_STL_UTILITY_INCLUDED
#define ETL_STL_UTILITY_INCLUDED
#include "../platform.h"
#if defined(ETL_NO_STL)
#include "alternate/utility.h"
#else
#include <utility>
#endif
#endif

View File

@ -40,7 +40,7 @@ SOFTWARE.
#include "integral_limits.h"
#include "hash.h"
#include <algorithm>
#include "algorithm.h"
///\defgroup array array
/// A wrapper for arrays
@ -104,7 +104,7 @@ namespace etl
typedef T value_type;
typedef TTraits traits_type;
typedef std::size_t size_type;
typedef size_t size_type;
typedef const T& const_reference;
typedef const T* const_pointer;
typedef const T* const_iterator;

View File

@ -60,7 +60,7 @@ SOFTWARE.
#include "nullptr.h"
#include "static_assert.h"
#if (ETL_CPP11_SUPPORTED)
#if (ETL_CPP11_SUPPORTED) && !defined(ETL_NO_STL)
#include <type_traits>
#endif
@ -269,14 +269,14 @@ namespace etl
/// is_pod
/// For C++03, only fundamental and pointers types are recognised.
///\ingroup type_traits
#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO) && !defined(ETL_STLPORT)) && !defined(ETL_IN_UNIT_TEST)
#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO) && !defined(ETL_STLPORT)) && !defined(ETL_IN_UNIT_TEST) && !defined(ETL_NO_STL)
// For compilers that support C++11
template <typename T> struct is_pod : std::is_pod<T> {};
#else
template <typename T> struct is_pod : etl::integral_constant<bool, etl::is_fundamental<T>::value || etl::is_pointer<T>::value> {};
#endif
#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_STLPORT) && !defined(ETL_IN_UNIT_TEST)
#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_STLPORT) && !defined(ETL_IN_UNIT_TEST) && !defined(ETL_NO_STL)
/// is_trivially_constructible
///\ingroup type_traits
template <typename T> struct is_trivially_constructible : std::is_trivially_constructible<T> {};

View File

@ -72,7 +72,7 @@ cog.outl("//********************************************************************
#include "nullptr.h"
#include "static_assert.h"
#if (ETL_CPP11_SUPPORTED)
#if (ETL_CPP11_SUPPORTED) && !defined(ETL_NO_STL)
#include <type_traits>
#endif
@ -281,14 +281,14 @@ namespace etl
/// is_pod
/// For C++03, only fundamental and pointers types are recognised.
///\ingroup type_traits
#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO) && !defined(ETL_STLPORT)) && !defined(ETL_IN_UNIT_TEST)
#if (ETL_CPP11_SUPPORTED && !defined(ARDUINO) && !defined(ETL_STLPORT)) && !defined(ETL_IN_UNIT_TEST) && !defined(ETL_NO_STL)
// For compilers that support C++11
template <typename T> struct is_pod : std::is_pod<T> {};
#else
template <typename T> struct is_pod : etl::integral_constant<bool, etl::is_fundamental<T>::value || etl::is_pointer<T>::value> {};
#endif
#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_STLPORT) && !defined(ETL_IN_UNIT_TEST)
#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_STLPORT) && !defined(ETL_IN_UNIT_TEST) && !defined(ETL_NO_STL)
/// is_trivially_constructible
///\ingroup type_traits
template <typename T> struct is_trivially_constructible : std::is_trivially_constructible<T> {};

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "basic_string.h"
#include "hash.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -145,7 +145,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "basic_string.h"
#include "hash.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -145,7 +145,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -32,13 +32,14 @@ SOFTWARE.
#define ETL_UNORDERED_MAP_INCLUDED
#include <stddef.h>
#include <iterator>
#include <functional>
#include <algorithm>
#include <functional>
#include <utility>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "container.h"
#include "pool.h"
#include "array.h"

View File

@ -32,13 +32,14 @@ SOFTWARE.
#define ETL_UNORDERED_MULTIMAP_INCLUDED
#include <stddef.h>
#include <iterator>
#include <functional>
#include <algorithm>
#include <functional>
#include <utility>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "container.h"
#include "pool.h"
#include "vector.h"

View File

@ -32,13 +32,14 @@ SOFTWARE.
#define ETL_UNORDERED_MULTISET_INCLUDED
#include <stddef.h>
#include <iterator>
#include <functional>
#include <iterator>
#include <algorithm>
#include <utility>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "container.h"
#include "pool.h"
#include "vector.h"

View File

@ -32,13 +32,14 @@ SOFTWARE.
#define ETL_UNORDERED_SET_INCLUDED
#include <stddef.h>
#include <iterator>
#include <functional>
#include <algorithm>
#include <functional>
#include <utility>
#include "platform.h"
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#include "stl/utility.h"
#include "container.h"
#include "pool.h"
#include "vector.h"

View File

@ -52,9 +52,11 @@ SOFTWARE.
#define ETL_VARIANT_POOL_INCLUDED
#include <stdint.h>
#include <utility>
#include "platform.h"
#include "stl/utility.h"
#include "error_handler.h"
#include "exception.h"
#include "largest.h"
@ -133,7 +135,7 @@ namespace etl
{
}
#if !ETL_CPP11_SUPPORTED || defined(ETL_STLPORT)
#if !ETL_CPP11_SUPPORTED || defined(ETL_STLPORT) || defined(ETL_NO_STL)
//*************************************************************************
/// Creates the object. Default constructor.
//*************************************************************************

View File

@ -64,7 +64,6 @@ cog.outl("//********************************************************************
#define ETL_VARIANT_POOL_INCLUDED
#include <stdint.h>
#include <utility>
#include "platform.h"
#include "error_handler.h"
@ -74,7 +73,9 @@ cog.outl("//********************************************************************
#include "alignment.h"
#include "static_assert.h"
#include "type_lookup.h"
#include <pool.h>
#include "pool.h"
#include "stl/utility.h"
#undef ETL_FILE
#define ETL_FILE "40"

View File

@ -35,9 +35,6 @@ SOFTWARE.
#include <stddef.h>
#include <stdint.h>
#include <iterator>
#include <algorithm>
#include <functional>
#include <stddef.h>
#include "platform.h"
@ -53,7 +50,11 @@ SOFTWARE.
#include "debug_count.h"
#include "private/vector_base.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#include "stl/algorithm.h"
#include "stl/iterator.h"
#include "stl/functional.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -1067,7 +1068,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Constructor, from an initializer_list.
//*************************************************************************
@ -1183,7 +1184,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Constructor, from an initializer_list.
//*************************************************************************

View File

@ -35,7 +35,7 @@ SOFTWARE.
#include "basic_string.h"
#include "hash.h"
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
#include <initializer_list>
#endif
@ -146,7 +146,7 @@ namespace etl
this->assign(first, last);
}
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT)
#if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL)
//*************************************************************************
/// Construct from initializer_list.
//*************************************************************************

View File

@ -132,7 +132,7 @@ if (WIN32)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
list(APPEND TEST_SOURCE_FILES "test_atomic_gcc.cpp")
list(APPEND TEST_SOURCE_FILES "test_atomic_gcc_sync.cpp")
endif()
add_executable(etl_tests
${TEST_SOURCE_FILES}

View File

@ -279,6 +279,16 @@
<Unit filename="../../include/etl/sqrt.h" />
<Unit filename="../../include/etl/stack.h" />
<Unit filename="../../include/etl/static_assert.h" />
<Unit filename="../../include/etl/stl/algorithm.h" />
<Unit filename="../../include/etl/stl/alternate/algorithm.h" />
<Unit filename="../../include/etl/stl/alternate/functional.h" />
<Unit filename="../../include/etl/stl/alternate/iterator.h" />
<Unit filename="../../include/etl/stl/alternate/limits.h" />
<Unit filename="../../include/etl/stl/alternate/utility.h" />
<Unit filename="../../include/etl/stl/functional.h" />
<Unit filename="../../include/etl/stl/iterator.h" />
<Unit filename="../../include/etl/stl/limits.h" />
<Unit filename="../../include/etl/stl/utility.h" />
<Unit filename="../../include/etl/string_view.h" />
<Unit filename="../../include/etl/task.h" />
<Unit filename="../../include/etl/temp.h" />
@ -383,6 +393,10 @@
<Unit filename="../test_multimap.cpp" />
<Unit filename="../test_multiset.cpp" />
<Unit filename="../test_murmur3.cpp" />
<Unit filename="../test_no_stl_algorithm.cpp" />
<Unit filename="../test_no_stl_functional.cpp" />
<Unit filename="../test_no_stl_limits.cpp" />
<Unit filename="../test_no_stl_utility.cpp" />
<Unit filename="../test_numeric.cpp" />
<Unit filename="../test_observer.cpp" />
<Unit filename="../test_optional.cpp" />

View File

@ -74,6 +74,8 @@ SOFTWARE.
//#define ETL_MESSAGES_ARE_VIRTUAL
//#define ETL_POLYMORPHIC_MESSAGES
//#define ETL_NO_STL
#ifdef _MSC_VER
#include "profiles/msvc_x86.h"
#else

View File

@ -867,5 +867,47 @@ namespace
is_same = std::equal(std::begin(output_false), std::end(output_false), std::begin(compare_false));
CHECK(is_same);
}
//=========================================================================
TEST(sort_default)
{
std::vector<int> data(100, 0);
std::iota(data.begin(), data.end(), 1);
for (int i = 0; i < 100; ++i)
{
std::random_shuffle(data.begin(), data.end());
std::vector<int> data1 = data;
std::vector<int> data2 = data;
std::sort(data1.begin(), data1.end());
etl::sort(data2.begin(), data2.end());
bool is_same = std::equal(data1.begin(), data1.end(), data2.begin());
CHECK(is_same);
}
}
//=========================================================================
TEST(sort_greater)
{
std::vector<int> data(100, 0);
std::iota(data.begin(), data.end(), 1);
for (int i = 0; i < 100; ++i)
{
std::random_shuffle(data.begin(), data.end());
std::vector<int> data1 = data;
std::vector<int> data2 = data;
std::sort(data1.begin(), data1.end(), std::greater<int>());
etl::sort(data2.begin(), data2.end(), std::greater<int>());
bool is_same = std::equal(data1.begin(), data1.end(), data2.begin());
CHECK(is_same);
}
}
};
}

View File

@ -230,7 +230,7 @@ namespace
std::atomic<int*> compare(&data[0]);
etl::atomic<int*> test(&data[0]);
CHECK_EQUAL((int*)compare.fetch_add(std::ptrdiff_t(10)), (int*)test.fetch_add(std::ptrdiff_t(10)));
CHECK_EQUAL((int*)compare.fetch_add(ptrdiff_t(10)), (int*)test.fetch_add(ptrdiff_t(10)));
}
//=========================================================================
@ -338,7 +338,7 @@ namespace
std::atomic<int*> compare(&data[0]);
etl::atomic<int*> test(&data[0]);
CHECK_EQUAL((int*)compare.fetch_add(std::ptrdiff_t(10)), (int*)test.fetch_add(std::ptrdiff_t(10)));
CHECK_EQUAL((int*)compare.fetch_add(ptrdiff_t(10)), (int*)test.fetch_add(ptrdiff_t(10)));
}
//=========================================================================

View File

@ -182,7 +182,7 @@ namespace
typedef etl::largest<Start, Stop, SetSpeed, Stopped, Recursive> Largest_t;
typedef etl::packet<etl::imessage, Largest_t::size, Largest_t::alignment> Packet_t;
etl::queue<Packet_t, 2> messageQueue;
int startCount;
@ -531,7 +531,7 @@ namespace
// Send Start event.
motorControl.receive(nmr, Recursive());
CHECK_EQUAL(1, motorControl.messageQueue.size());
CHECK_EQUAL(1U, motorControl.messageQueue.size());
// Send the queued message.
motorControl.receive(nmr, motorControl.messageQueue.front().get());

Some files were not shown because too many files have changed in this diff Show More