From fc5055700333c7bf980d663f8e8d28595e04ad15 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 4 Jan 2020 11:20:29 +0000 Subject: [PATCH 1/6] Work in progress --- include/etl/absolute.h | 4 +- include/etl/algorithm.h | 2429 +++++++++++++---- include/etl/alignment.h | 22 +- include/etl/array.h | 52 +- include/etl/array_view.h | 24 +- include/etl/array_wrapper.h | 20 +- include/etl/atomic/atomic_gcc_sync.h | 2 +- include/etl/atomic/atomic_llvm_sync.h | 2 +- include/etl/basic_string.h | 126 +- include/etl/binary.h | 52 +- include/etl/bit_stream.h | 37 +- include/etl/bitset.h | 22 +- include/etl/bloom_filter.h | 8 +- include/etl/char_traits.h | 15 +- include/etl/compare.h | 5 +- include/etl/container.h | 41 +- include/etl/cstring.h | 2 +- include/etl/cumulative_moving_average.h | 12 +- include/etl/cyclic_value.h | 24 +- include/etl/deque.h | 154 +- include/etl/fixed_iterator.h | 18 +- include/etl/flat_map.h | 20 +- include/etl/flat_multimap.h | 20 +- include/etl/flat_multiset.h | 22 +- include/etl/flat_set.h | 18 +- include/etl/forward_list.h | 49 +- include/etl/frame_check_sequence.h | 8 +- include/etl/functional.h | 126 +- include/etl/ihash.h | 2 +- include/etl/indirect_vector.h | 43 +- include/etl/integral_limits.h | 26 +- include/etl/intrusive_forward_list.h | 22 +- include/etl/intrusive_links.h | 100 +- include/etl/intrusive_list.h | 22 +- include/etl/io_port.h | 20 +- include/etl/iterator.h | 426 ++- include/etl/jenkins.h | 2 +- include/etl/largest.h | 36 +- include/etl/largest_generator.h | 36 +- include/etl/{stl/alternate => }/limits.h | 53 +- include/etl/list.h | 73 +- include/etl/map.h | 27 +- include/etl/memory.h | 1192 +++++--- include/etl/message_bus.h | 38 +- include/etl/multimap.h | 27 +- include/etl/multiset.h | 24 +- include/etl/murmur3.h | 6 +- include/etl/negative.h | 4 +- include/etl/observer.h | 12 +- include/etl/optional.h | 4 +- include/etl/packet.h | 8 +- include/etl/parameter_type.h | 2 +- include/etl/pearson.h | 4 +- include/etl/platform.h | 5 + include/etl/pool.h | 48 +- include/etl/priority_queue.h | 30 +- include/etl/private/choose_namespace.h | 18 +- include/etl/private/choose_pair_types.h | 46 - include/etl/private/choose_tag_types.h | 52 - include/etl/private/crc16_poly_0x1021_.h | 3 +- include/etl/private/crc16_poly_0x8005.h | 3 +- include/etl/private/crc32_poly_0x04c11db7.h | 3 +- include/etl/private/crc32_poly_0x1edc6f41.h | 3 +- .../private/crc64_poly_0x42f0e1eba9ea3693.h | 3 +- include/etl/private/crc8_poly_0x07.h | 3 +- include/etl/private/ivectorpointer.h | 20 +- include/etl/private/pvoidvector.h | 36 +- include/etl/private/to_string_helper.h | 81 +- include/etl/queue.h | 4 +- include/etl/queue_mpmc_mutex.h | 8 +- include/etl/queue_spsc_atomic.h | 4 +- include/etl/queue_spsc_isr.h | 10 +- include/etl/queue_spsc_locked.h | 10 +- include/etl/reference_flat_map.h | 38 +- include/etl/reference_flat_multimap.h | 40 +- include/etl/reference_flat_multiset.h | 48 +- include/etl/reference_flat_set.h | 42 +- include/etl/scaled_rounding.h | 18 +- include/etl/scheduler.h | 8 +- include/etl/set.h | 27 +- include/etl/smallest.h | 12 +- include/etl/smallest_generator.h | 12 +- include/etl/sqrt.h | 2 +- include/etl/stack.h | 8 +- include/etl/state_chart.h | 12 +- include/etl/stl/algorithm.h | 46 - include/etl/stl/alternate/algorithm.h | 870 ------ include/etl/stl/alternate/functional.h | 137 - include/etl/stl/alternate/iterator.h | 394 --- include/etl/stl/alternate/utility.h | 163 -- include/etl/stl/functional.h | 17 - include/etl/stl/iterator.h | 47 - include/etl/stl/limits.h | 46 - include/etl/stl/utility.h | 46 - include/etl/string_view.h | 48 +- include/etl/type_lookup.h | 104 +- include/etl/type_lookup_generator.h | 10 +- include/etl/type_select.h | 272 +- include/etl/type_select_generator.h | 8 +- include/etl/type_traits.h | 1254 +++++++-- include/etl/type_traits_generator.h | 1210 ++++++-- include/etl/u16string.h | 2 +- include/etl/u32string.h | 2 +- include/etl/unordered_map.h | 24 +- include/etl/unordered_multimap.h | 24 +- include/etl/unordered_multiset.h | 24 +- include/etl/unordered_set.h | 24 +- include/etl/utility.h | 124 +- include/etl/variant.h | 18 +- include/etl/variant_pool.h | 66 +- include/etl/variant_pool_generator.h | 8 +- include/etl/vector.h | 88 +- include/etl/wstring.h | 2 +- test/codeblocks/ETL.cbp | 1 - test/no_stl_test_iterators.h | 6 +- test/test_algorithm.cpp | 74 +- test/test_alignment.cpp | 8 +- test/test_binary.cpp | 130 +- test/test_constant.cpp | 6 +- test/test_iterator.cpp | 10 +- test/test_largest.cpp | 56 +- test/test_no_stl_algorithm.cpp | 27 +- test/test_no_stl_functional.cpp | 27 +- test/test_no_stl_iterator.cpp | 79 +- test/test_no_stl_limits.cpp | 1227 +++++---- test/test_no_stl_utility.cpp | 36 +- test/test_parameter_type.cpp | 6 +- test/test_priority_queue.cpp | 4 +- test/test_smallest.cpp | 104 +- test/test_type_lookup.cpp | 102 +- test/test_type_select.cpp | 100 +- test/test_type_traits.cpp | 936 ++++--- test/test_variant.cpp | 8 +- test/vs2017/etl.vcxproj | 11 +- test/vs2017/etl.vcxproj.filters | 48 +- 135 files changed, 8256 insertions(+), 6028 deletions(-) rename include/etl/{stl/alternate => }/limits.h (92%) delete mode 100644 include/etl/private/choose_pair_types.h delete mode 100644 include/etl/private/choose_tag_types.h delete mode 100644 include/etl/stl/algorithm.h delete mode 100644 include/etl/stl/alternate/algorithm.h delete mode 100644 include/etl/stl/alternate/functional.h delete mode 100644 include/etl/stl/alternate/iterator.h delete mode 100644 include/etl/stl/alternate/utility.h delete mode 100644 include/etl/stl/functional.h delete mode 100644 include/etl/stl/iterator.h delete mode 100644 include/etl/stl/limits.h delete mode 100644 include/etl/stl/utility.h diff --git a/include/etl/absolute.h b/include/etl/absolute.h index 165dba9c..ba7f69ea 100644 --- a/include/etl/absolute.h +++ b/include/etl/absolute.h @@ -39,7 +39,7 @@ namespace etl // For signed types. //*************************************************************************** template - typename etl::enable_if::value, T>::type + typename etlstd::enable_if::value, T>::type absolute(T value) { return (value < T(0)) ? -value : value; @@ -49,7 +49,7 @@ namespace etl // For unsigned types. //*************************************************************************** template - typename etl::enable_if::value, T>::type + typename etlstd::enable_if::value, T>::type absolute(T value) { return value; diff --git a/include/etl/algorithm.h b/include/etl/algorithm.h index 690a802b..f37e9eef 100644 --- a/include/etl/algorithm.h +++ b/include/etl/algorithm.h @@ -32,34 +32,1261 @@ SOFTWARE. #define ETL_ALGORITHM_INCLUDED ///\defgroup algorithm algorithm -/// Reverse engineered algorithms from C++ 0x11 +/// Including reverse engineered algorithms from C++ 0x11, 0x14, 0x17 /// Additional new variants of certain algorithms. ///\ingroup utilities -#include "stl/algorithm.h" -#include "stl/utility.h" -#include "stl/iterator.h" -#include "stl/functional.h" - #include #include "platform.h" -#include "iterator.h" #include "type_traits.h" #include "container.h" +#include "iterator.h" +#include "functional.h" +#include "utility.h" -namespace etl +#if !defined(ETL_NO_STL) + #include + #include + #include + #include +#endif + +//***************************************************************************** +// Algorithms defined by the ETL +//***************************************************************************** +#undef ETL_ALGORITHM + +namespace etlstd { +#if defined(ETL_NO_STL) + //*************************************************************************** + // swap +#if ETL_CPP11_SUPPORTED + template + void swap(T& a, T& b) + { + T temp(etlstd::move(a)); + a = etlstd::move(b); + b = etlstd::move(temp); + } +#else + template + void swap(T& a, T& b) + { + T temp(a); + a = b; + b = temp; + } +#endif +#else + //*************************************************************************** + // swap + template + void swap(T& a, T& b) + { + using std::swap; + swap(a, b); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // iter_swap + template + void iter_swap(TIterator1 a, TIterator2 b) + { + typename etlstd::iterator_traits::value_type c = *a; + *a = *b; + *b = c; + } +#else + //*************************************************************************** + // iter_swap + template + void iter_swap(TIterator1 a, TIterator2 b) + { + std::iter_swap(a, b); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // swap_ranges + template + TIterator2 swap_ranges(T1terator1 first1, + T1terator1 last1, + TIterator2 first2) + { + while (first1 != last1) + { + iter_swap(first1++, first2++); + } + + return first2; + } +#else + //*************************************************************************** + // swap_ranges + template + TIterator2 swap_ranges(T1terator1 first1, + T1terator1 last1, + TIterator2 first2) + { + return std::swap_ranges(first1, last1, first2); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // copy + // Pointer + template + typename etlstd::enable_if::value && + etlstd::is_pointer::value && + etlstd::is_pod::value_type>::value, TIterator2>::type + copy(TIterator1 sb, TIterator1 se, TIterator2 db) + { + typedef typename etlstd::iterator_traits::value_type value_t; + typedef typename etlstd::iterator_traits::difference_type difference_t; + + difference_t count = (se - sb); + + return TIterator2(memmove(db, sb, sizeof(value_t) * count)) + count; + } + + // Other iterator + template + typename etlstd::enable_if::value || + !etlstd::is_pointer::value || + !etlstd::is_pod::value_type>::value, TIterator2>::type + copy(TIterator1 sb, TIterator1 se, TIterator2 db) + { + while (sb != se) + { + *db++ = *sb++; + } + + return db; + } +#else + //*************************************************************************** + // copy + template + TIterator2 copy(TIterator1 sb, TIterator1 se, TIterator2 db) + { + return std::copy(sb, se, db); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // reverse_copy + template + TIterator2 reverse_copy(TIterator1 sb, TIterator1 se, TIterator2 db) + { + while (sb != se) + { + *(db++) = *(--se); + } + + return db; + } +#else + //*************************************************************************** + // reverse_copy + template + TIterator2 reverse_copy(TIterator1 sb, TIterator1 se, TIterator2 db) + { + return std::reverse_copy(sb, se, db); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + // copy_n + // Pointer + template + typename etlstd::enable_if::value && + etlstd::is_pointer::value && + etlstd::is_pod::value_type>::value, TIterator2>::type + copy_n(TIterator1 sb, TSize count, TIterator2 db) + { + typedef typename etlstd::iterator_traits::value_type value_t; + + return TIterator2(memmove(db, sb, sizeof(value_t) * count)) + count; + } + + // Other iterator + template + typename etlstd::enable_if::value || + !etlstd::is_pointer::value || + !etlstd::is_pod::value_type>::value, TIterator2>::type + copy_n(TIterator1 sb, TSize count, TIterator2 db) + { + while (count != 0) + { + *db++ = *sb++; + --count; + } + + return db; + } +#else + //*************************************************************************** + /// copy_n + ///\ingroup algorithm + /// + //*************************************************************************** + template + TOutputIterator copy_n(TInputIterator i_begin, + TSize n, + TOutputIterator o_begin) + { + return std::copy_n(i_begin, n, o_begin); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // copy_backward + // Pointer + template + typename etlstd::enable_if::value && + etlstd::is_pointer::value && + etlstd::is_pod::value_type>::value, TIterator2>::type + copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de) + { + typedef typename etlstd::iterator_traits::value_type value_t; + + const size_t length = (se - sb); + + return TIterator2(memmove(de - length, sb, sizeof(value_t) * length)); + } + + // Other iterator + template + typename etlstd::enable_if::value || + !etlstd::is_pointer::value || + !etlstd::is_pod::value_type>::value, TIterator2>::type + copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de) + { + while (se != sb) + { + *(--de) = *(--se); + } + + return de; + } +#else + //*************************************************************************** + // copy_backward + template + TIterator2 copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de) + { + return std::copy_backward(sb, se, de); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // move + template + TIterator2 move(TIterator1 sb, TIterator1 se, TIterator2 db) + { + while (sb != se) + { + *db++ = etlstd::move(*sb++); + } + + return db; + } +#else + //*************************************************************************** + // move + template + TIterator2 move(TIterator1 sb, TIterator1 se, TIterator2 db) + { + return std::move(sb, se, db); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // move_backward + template + TIterator2 move_backward(TIterator1 sb, TIterator1 se, TIterator2 de) + { + while (sb != se) + { + *(--de) = etlstd::move(*(--se)); + } + + return de; + } +#else + //*************************************************************************** + // move_backward + template + TIterator2 move_backward(TIterator1 sb, TIterator1 se, TIterator2 de) + { + return std::move_backward(sb, se, de); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // reverse + // Pointers + template + typename etlstd::enable_if::value, void>::type + reverse(TIterator b, TIterator e) + { + if (b != e) + { + while (b < --e) + { + etl::iter_swap(b, e); + ++b; + } + } + } + + // Other + template + typename etlstd::enable_if::value, void>::type + reverse(TIterator b, TIterator e) + { + while ((b != e) && (b != --e)) + { + etl::iter_swap(b++, e); + } + } +#else + //*************************************************************************** + // reverse + template + void reverse(TIterator b, TIterator e) + { + std::reverse(b, e); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // lower_bound + template + TIterator lower_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) + { + typedef typename etlstd::iterator_traits::difference_type difference_t; + + difference_t count = etlstd::distance(first, last); + + while (count > 0) + { + TIterator itr = first; + difference_t step = count / 2; + + etlstd::advance(itr, step); + + if (compare(*itr, value)) + { + first = ++itr; + count -= step + 1; + } + else + { + count = step; + } + } + + return first; + } + + template + TIterator lower_bound(TIterator first, TIterator last, const TValue& value) + { + typedef etlstd::less::value_type> compare; + + return etlstd::lower_bound(first, last, value, compare()); + } +#else + //*************************************************************************** + // lower_bound + template + TIterator lower_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) + { + return std::lower_bound(first, last, value, compare); + } + + template + TIterator lower_bound(TIterator first, TIterator last, const TValue& value) + { + return std::lower_bound(first, last, value); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // upper_bound + template + TIterator upper_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) + { + typedef typename etlstd::iterator_traits::difference_type difference_t; + + difference_t count = etlstd::distance(first, last); + + while (count > 0) + { + TIterator itr = first; + difference_t step = count / 2; + + etlstd::advance(itr, step); + + if (!compare(value, *itr)) + { + first = ++itr; + count -= step + 1; + } + else + { + count = step; + } + } + + return first; + } + + template + TIterator upper_bound(TIterator first, TIterator last, const TValue& value) + { + typedef etlstd::less::value_type> compare; + + return etl::upper_bound(first, last, value, compare()); + } +#else + //*************************************************************************** + // upper_bound + template + TIterator upper_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) + { + return std::upper_bound(first, last, value, compare); + } + + template + TIterator upper_bound(TIterator first, TIterator last, const TValue& value) + { + return std::upper_bound(first, last, value); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // equal_range + template + ETL_OR_STD::pair equal_range(TIterator first, TIterator last, const TValue& value, TCompare compare) + { + return ETL_OR_STD::make_pair(etlstd::lower_bound(first, last, value, compare), + etlstd::upper_bound(first, last, value, compare)); + } + + template + ETL_OR_STD::pair equal_range(TIterator first, TIterator last, const TValue& value) + { + typedef etlstd::less::value_type> compare; + + return ETL_OR_STD::make_pair(etlstd::lower_bound(first, last, value, compare()), + etlstd::upper_bound(first, last, value, compare())); + } +#else + //*************************************************************************** + // equal_range + template + std::pair equal_range(TIterator first, TIterator last, const TValue& value, TCompare compare) + { + return std::equal_range(first, last, value, compare); + } + + template + std::pair equal_range(TIterator first, TIterator last, const TValue& value) + { + return std::equal_range(first, last, value); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // find_if + template + TIterator find_if(TIterator first, TIterator last, TUnaryPredicate predicate) + { + while (first != last) + { + if (predicate(*first)) + { + return first; + } + + ++first; + } + + return last; + } +#else + //*************************************************************************** + // find_if + template + TIterator find_if(TIterator first, TIterator last, TUnaryPredicate predicate) + { + return std::find_if(first, last, predicate); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // find + template + TIterator find(TIterator first, TIterator last, const T& value) + { + while (first != last) + { + if (*first == value) + { + return first; + } + + ++first; + } + + return last; + } +#else + //*************************************************************************** + // find + template + TIterator find(TIterator first, TIterator last, const T& value) + { + return std::find(first, last, value); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // fill + template + typename etlstd::enable_if::value || etlstd::is_same::value) || !etlstd::is_pointer::value, void>::type + fill(TIterator first, TIterator last, const TValue& value) + { + while (first != last) + { + *first++ = value; + } + } + + template + typename etlstd::enable_if<(etlstd::is_same::value || etlstd::is_same::value) && etlstd::is_pointer::value, void>::type + fill(TIterator first, TIterator last, const TValue& value) + { + memset(first, value, last - first); + } +#else + //*************************************************************************** + // fill + template + void fill(TIterator first, TIterator last, const TValue& value) + { + std::fill(first, last, value); + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // fill_n + template + typename etlstd::enable_if::value || etlstd::is_same::value) || !etlstd::is_pointer::value, TIterator>::type + fill_n(TIterator first, TSize count, const TValue& value) + { + for (TSize i = 0; i < count; ++i) + { + *first++ = value; + } + + return first; + } + + template + typename etlstd::enable_if<(etlstd::is_same::value || etlstd::is_same::value) && etlstd::is_pointer::value, void>::type + fill_n(TIterator first, TSize count, const TValue& value) + { + memset(first, value, count); + } +#else + //*************************************************************************** + // fill_n + template + TIterator fill_n(TIterator first, TSize count, const TValue& value) + { + return std::fill_n(first, count, value);; + } +#endif + +#if defined(ETL_NO_STL) + //*************************************************************************** + // count + template + typename etlstd::iterator_traits::difference_type count(TIterator first, TIterator last, const T& value) + { + typename iterator_traits::difference_type n = 0; + + while (first != last) + { + if (*first == value) + { + ++n; + } + + ++first; + } + + return n; + } +#else + //*************************************************************************** + // count + template + typename std::iterator_traits::difference_type count(TIterator first, TIterator last, const T& value) + { + return std::count(first, last, value); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // count_if + template + typename etlstd::iterator_traits::difference_type count_if(TIterator first, TIterator last, TUnaryPredicate predicate) + { + typename iterator_traits::difference_type n = 0; + + while (first != last) + { + if (predicate(*first)) + { + ++n; + } + + ++first; + } + + return n; + } +#else + //*************************************************************************** + // count_if + template + typename std::iterator_traits::difference_type count_if(TIterator first, TIterator last, TUnaryPredicate predicate) + { + return std::count_if(first, last, predicate); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // equal + template + typename etlstd::enable_if::value || !etlstd::is_pointer::value || !etlstd::is_pod::value_type>::value, bool>::type + equal(TIterator1 first1, TIterator1 last1, TIterator2 first2) + { + while (first1 != last1) + { + if (*first1++ != *first2++) + { + return false; + } + } + + return true; + } + + template + typename etlstd::enable_if::value && etlstd::is_pointer::value && etlstd::is_pod::value_type>::value, bool>::type + equal(TIterator1 first1, TIterator1 last1, TIterator2 first2) + { + typedef typename etlstd::iterator_traits::value_type value_t; + + return (memcmp(first1, first2, sizeof(value_t) * (last1 - first1)) == 0); + } +#else + //*************************************************************************** + // equal + template + bool equal(TIterator1 first1, TIterator1 last1, TIterator2 first2) + { + return std::equal(first1, last1, first2); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // lexicographical_compare + template + 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 + bool lexicographical_compare(TIterator1 first1, TIterator1 last1, + TIterator2 first2, TIterator2 last2) + { + typedef etlstd::less::value_type> compare; + + return etl::lexicographical_compare(first1, last1, first2, last2, compare()); + } +#else + //*************************************************************************** + // lexicographical_compare + template + bool lexicographical_compare(TIterator1 first1, TIterator1 last1, + TIterator2 first2, TIterator2 last2, + TCompare compare) + { + return std::lexicographical_compare(first1, last1, first2, last2, compare); + } + + //*************************************************************************** + // lexicographical_compare + template + bool lexicographical_compare(TIterator1 first1, TIterator1 last1, + TIterator2 first2, TIterator2 last2) + { + return std::lexicographical_compare(first1, last1, first2, last2); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // min + template + ETL_CONSTEXPR const T& min(const T& a, const T& b, TCompare compare) + { + return (compare(a, b)) ? a : b; + } + + template + ETL_CONSTEXPR const T& min(const T& a, const T& b) + { + typedef etlstd::less compare; + + return etl::min(a, b, compare()); + } +#else + //*************************************************************************** + // min + template + ETL_CONSTEXPR const T& min(const T& a, const T& b, TCompare compare) + { + return std::min(a, b, compare); + } + + template + ETL_CONSTEXPR const T& min(const T& a, const T& b) + { + return std::min(a, b); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // max + template + ETL_CONSTEXPR const T& max(const T& a, const T& b, TCompare compare) + { + return (compare(a, b)) ? b : a; + } + + template + ETL_CONSTEXPR const T& max(const T& a, const T& b) + { + typedef etlstd::less compare; + + return etl::max(a, b, compare()); + } +#else + //*************************************************************************** + // max + template + ETL_CONSTEXPR const T& max(const T& a, const T& b, TCompare compare) + { + return std::max(a, b, compare); + } + + template + ETL_CONSTEXPR const T& max(const T& a, const T& b) + { + return std::max(a, b); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // transform + template + TIteratorOut transform(TIteratorIn first1, TIteratorIn last1, TIteratorOut d_first, TUnaryOperation unary_operation) + { + while (first1 != last1) + { + *d_first++ = unary_operation(*first1++); + } + + return d_first; + } + + template + TIteratorOut transform(TIteratorIn1 first1, TIteratorIn1 last1, TIteratorIn2 first2, TIteratorOut d_first, TBinaryOperation binary_operation) + { + while (first1 != last1) + { + *d_first++ = binary_operation(*first1++, *first2++); + } + + return d_first; + } +#else + //*************************************************************************** + // transform + template + TIteratorOut transform(TIteratorIn first1, TIteratorIn last1, TIteratorOut d_first, TUnaryOperation unary_operation) + { + return std::transform(first1, last1, d_first, unary_operation);; + } + + template + TIteratorOut transform(TIteratorIn1 first1, TIteratorIn1 last1, TIteratorIn2 first2, TIteratorOut d_first, TBinaryOperation binary_operation) + { + return std::transform(first1, last1, first2, d_first, binary_operation); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // Heap + namespace private_heap + { + // Push Heap Helper + template + 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 + 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 + 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 + void pop_heap(TIterator first, TIterator last, TCompare compare) + { + typedef typename etlstd::iterator_traits::value_type value_t; + typedef typename etlstd::iterator_traits::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 + void pop_heap(TIterator first, TIterator last) + { + typedef etlstd::less::value_type> compare; + + etl::pop_heap(first, last, compare()); + } + + // Push Heap + template + void push_heap(TIterator first, TIterator last, TCompare compare) + { + typedef typename etlstd::iterator_traits::difference_type difference_t; + typedef typename etlstd::iterator_traits::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 + void push_heap(TIterator first, TIterator last) + { + typedef etlstd::less::value_type> compare; + + etl::push_heap(first, last, compare()); + } + + // Make Heap + template + void make_heap(TIterator first, TIterator last, TCompare compare) + { + typedef typename etlstd::iterator_traits::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 + void make_heap(TIterator first, TIterator last) + { + typedef etlstd::less::value_type> compare; + + etl::make_heap(first, last, compare()); + } + + // Is Heap + template + bool is_heap(TIterator first, TIterator last) + { + typedef etlstd::less::value_type> compare; + + return private_heap::is_heap(first, last - first, compare()); + } + + // Is Heap + template + bool is_heap(TIterator first, TIterator last, TCompare compare) + { + return private_heap::is_heap(first, last - first, compare); + } +#else + //*************************************************************************** + // Heap + // Pop Heap + template + void pop_heap(TIterator first, TIterator last, TCompare compare) + { + std::pop_heap(first, last, compare); + } + + // Pop Heap + template + void pop_heap(TIterator first, TIterator last) + { + std::pop_heap(first, last); + } + + // Push Heap + template + void push_heap(TIterator first, TIterator last, TCompare compare) + { + std::push_heap(first, last, compare); + } + + // Push Heap + template + void push_heap(TIterator first, TIterator last) + { + std::push_heap(first, last); + } + + // Make Heap + template + void make_heap(TIterator first, TIterator last, TCompare compare) + { + std::make_heap(first, last, compare); + } + + // Make Heap + template + void make_heap(TIterator first, TIterator last) + { + std::make_heap(first, last); + } + + // Is Heap + template + bool is_heap(TIterator first, TIterator last) + { + return std::is_heap(first, last); + } + + // Is Heap + template + bool is_heap(TIterator first, TIterator last, TCompare compare) + { + return std::is_heap(first, last, compare); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // Search + template + TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last, TCompare compare) + { + while (true) + { + TIterator1 itr = first; + TIterator2 search_itr = search_first; + + while (true) + { + if (search_itr == search_last) + { + return first; + } + + if (itr == last) + { + return last; + } + + if (!compare(*itr, *search_itr)) + { + break; + } + + ++itr; + ++search_itr; + } + + ++first; + } + } + + // Search + template + TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last) + { + typedef etl::equal_to::value_type> compare; + + return etl::search(first, last, search_first, search_last, compare()); + } +#else + //*************************************************************************** + // Search + template + TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last, TCompare compare) + { + return std::search(first, last, search_first, search_last, compare); + } + + // Search + template + TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last) + { + return std::search(first, last, search_first, search_last); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // Rotate + template + TIterator rotate(TIterator first, TIterator middle, TIterator last) + { +#if defined(ETL_NO_STL) + using etlstd::swap; +#else + using std::swap; +#endif + + TIterator next = middle; + + while (first != next) + { + swap(*first++, *next++); + + if (next == last) + { + next = middle; + } + else if (first == middle) + { + middle = next; + } + } + + return first; + } +#else + //*************************************************************************** + // Rotate + template + TIterator rotate(TIterator first, TIterator middle, TIterator last) + { + return std::rotate(first, middle, last); + } +#endif + +#if defined (ETL_NO_STL) + //*************************************************************************** + // find_end + // Predicate + template + TIterator1 find_end(TIterator1 b, TIterator1 e, + TIterator2 sb, TIterator2 se, + TPredicate predicate) + { + if (sb == se) + { + return e; + } + + TIterator1 result = e; + + while (true) + { + TIterator1 new_result = etl::search(b, e, sb, se, predicate); + + if (new_result == e) + { + break; + } + else + { + result = new_result; + b = result; + ++b; + } + } + return result; + } + + // Default + template + TIterator1 find_end(TIterator1 b, TIterator1 e, + TIterator2 sb, TIterator2 se) + { + typedef etl::equal_to::value_type> predicate; + + return find_end(b, e, sb, se, predicate()); + } +#else + //*************************************************************************** + // find_end + // Predicate + template + TIterator1 find_end(TIterator1 b, TIterator1 e, + TIterator2 sb, TIterator2 se, + TPredicate predicate) + { + return std::find_end(b, e, sb, se, predicate); + } + + // Default + template + TIterator1 find_end(TIterator1 b, TIterator1 e, + TIterator2 sb, TIterator2 se) + { + return std::find_end(b, e, sb, se); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED //*************************************************************************** /// Finds the greatest and the smallest element in the range (begin, end).
/// ///\ingroup algorithm //*************************************************************************** - template - ETL_PAIR minmax_element(TIterator begin, - TIterator end, - TCompare compare) + template + ETL_OR_STD::pair minmax_element(TIterator begin, + TIterator end, + TCompare compare) { TIterator minimum = begin; TIterator maximum = begin; @@ -79,7 +1306,7 @@ namespace etl ++begin; } - return ETL_PAIR(minimum, maximum); + return ETL_OR_STD::pair(minimum, maximum); } //*************************************************************************** @@ -88,24 +1315,52 @@ namespace etl /// //*************************************************************************** template - ETL_PAIR minmax_element(TIterator begin, - TIterator end) + ETL_OR_STD::pair minmax_element(TIterator begin, + TIterator end) { - typedef typename ETL_STD::iterator_traits::value_type value_t; + typedef typename etlstd::iterator_traits::value_type value_t; - return etl::minmax_element(begin, end, ETL_STD::less()); + return etlstd::minmax_element(begin, end, etlstd::less()); + } +#else + //*************************************************************************** +/// Finds the greatest and the smallest element in the range (begin, end).
+/// +///\ingroup algorithm +//*************************************************************************** + template + std::pair minmax_element(TIterator begin, + TIterator end, + TCompare compare) + { + return std::minmax_element(begin, end, compare); } + + //*************************************************************************** + /// minmax_element + ///\ingroup algorithm + /// + //*************************************************************************** + template + std::pair minmax_element(TIterator begin, + TIterator end) + { + return std::minmax_element(begin, end); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED //*************************************************************************** /// minmax ///\ingroup algorithm /// //*************************************************************************** template - ETL_PAIR minmax(const T& a, - const T& b) + ETL_OR_STD::pair minmax(const T& a, + const T& b) { - return (b < a) ? ETL_PAIR(b, a) : ETL_PAIR(a, b); + return (b < a) ? ETL_OR_STD::pair(b, a) : ETL_OR_STD::pair(a, b); } //*************************************************************************** @@ -114,14 +1369,41 @@ namespace etl /// //*************************************************************************** template - ETL_PAIR minmax(const T& a, - const T& b, - TCompare compare) + typename TCompare> + ETL_OR_STD::pair minmax(const T& a, + const T& b, + TCompare compare) { - return compare(b, a) ? ETL_PAIR(b, a) : ETL_PAIR(a, b); + return compare(b, a) ? ETL_OR_STD::pair(b, a) : ETL_OR_STD::pair(a, b); + } +#else + //*************************************************************************** + /// minmax + ///\ingroup algorithm + /// + //*************************************************************************** + template + std::pair minmax(const T& a, + const T& b) + { + return std::minmax(a, b); } + //*************************************************************************** + /// minmax + ///\ingroup algorithm + /// + //*************************************************************************** + template + std::pair minmax(const T& a, + const T& b, + TCompare compare) + { + return std::minmax(a, b, compare); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED //*************************************************************************** /// is_sorted_until ///\ingroup algorithm @@ -155,10 +1437,10 @@ namespace etl /// //*************************************************************************** template - TIterator is_sorted_until(TIterator begin, - TIterator end, - TCompare compare) + typename TCompare> + TIterator is_sorted_until(TIterator begin, + TIterator end, + TCompare compare) { if (begin != end) { @@ -177,7 +1459,34 @@ namespace etl return end; } +#else + //*************************************************************************** + /// is_sorted_until + ///\ingroup algorithm + /// + //*************************************************************************** + template + TIterator is_sorted_until(TIterator begin, + TIterator end) + { + return std::is_sorted_until(begin, end); + } + //*************************************************************************** + /// is_sorted_until + ///\ingroup algorithm + /// + //*************************************************************************** + template + TIterator is_sorted_until(TIterator begin, + TIterator end, + TCompare compare) + { + return std::is_sorted_until(begin, end, compare); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED //*************************************************************************** /// is_sorted ///\ingroup algorithm @@ -187,7 +1496,7 @@ namespace etl bool is_sorted(TIterator begin, TIterator end) { - return etl::is_sorted_until(begin, end) == end; + return etlstd::is_sorted_until(begin, end) == end; } //*************************************************************************** @@ -196,17 +1505,525 @@ namespace etl /// //*************************************************************************** template + typename TCompare> + bool is_sorted(TIterator begin, + TIterator end, + TCompare compare) + { + return etlstd::is_sorted_until(begin, end, compare) == end; + } +#else + //*************************************************************************** + /// is_sorted + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_sorted(TIterator begin, + TIterator end) + { + return std::is_sorted(begin, end); + } + + //*************************************************************************** + /// is_sorted + ///\ingroup algorithm + /// + //*************************************************************************** + template bool is_sorted(TIterator begin, TIterator end, TCompare compare) { - return etl::is_sorted_until(begin, end, compare) == end; + return std::is_sorted(begin, end, compare); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + /// find_if_not + ///\ingroup algorithm + /// + //*************************************************************************** + template + TIterator find_if_not(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + while (begin != end) + { + if (!predicate(*begin)) + { + return begin; + } + + ++begin; + } + + return end; + } +#else + //*************************************************************************** + /// find_if_not + ///\ingroup algorithm + /// + //*************************************************************************** + template + TIterator find_if_not(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + return std::find_if_not(begin, end, predicate); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + /// is_permutation + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_permutation(TIterator1 begin1, + TIterator1 end1, + TIterator2 begin2) + { + if (begin1 != end1) + { + TIterator2 end2 = begin2; + + etlstd::advance(end2, etlstd::distance(begin1, end1)); + + for (TIterator1 i = begin1; i != end1; ++i) + { + if (i == etlstd::find(begin1, i, *i)) + { + size_t n = etlstd::count(begin2, end2, *i); + + if (n == 0 || size_t(etlstd::count(i, end1, *i)) != n) + { + return false; + } + } + } + } + + return true; } //*************************************************************************** - /// copy - /// A form of copy where the smallest of the two ranges is used. + /// is_permutation + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_permutation(TIterator1 begin1, + TIterator1 end1, + TIterator2 begin2, + TBinaryPredicate predicate) + { + if (begin1 != end1) + { + TIterator2 end2 = begin2; + + etlstd::advance(end2, etlstd::distance(begin1, end1)); + + for (TIterator1 i = begin1; i != end1; ++i) + { + if (i == etlstd::find_if(begin1, i, etlstd::bind1st(predicate, *i))) + { + size_t n = etlstd::count(begin2, end2, *i); + + if (n == 0 || size_t(etlstd::count(i, end1, *i)) != n) + { + return false; + } + } + } + } + + return true; + } + + //*************************************************************************** + /// is_permutation + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_permutation(TIterator1 begin1, + TIterator1 end1, + TIterator2 begin2, + TIterator2 end2) + { + if (begin1 != end1) + { + for (TIterator1 i = begin1; i != end1; ++i) + { + if (i == etlstd::find(begin1, i, *i)) + { + size_t n = etlstd::count(begin2, end2, *i); + + if (n == 0 || size_t(etlstd::count(i, end1, *i)) != n) + { + return false; + } + } + } + } + + return true; + } + + //*************************************************************************** + /// is_permutation + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_permutation(TIterator1 begin1, + TIterator1 end1, + TIterator2 begin2, + TIterator2 end2, + TBinaryPredicate predicate) + { + if (begin1 != end1) + { + for (TIterator1 i = begin1; i != end1; ++i) + { + if (i == etlstd::find_if(begin1, i, etlstd::bind1st(predicate, *i))) + { + size_t n = etlstd::count(begin2, end2, *i); + + if (n == 0 || size_t(etlstd::count(i, end1, *i)) != n) + { + return false; + } + } + } + } + + return true; + } +#else + //*************************************************************************** + /// is_permutation + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_permutation(TIterator1 begin1, + TIterator1 end1, + TIterator2 begin2) + { + return std::is_permutation(begin1, end1, begin2); + } + + //*************************************************************************** + /// is_permutation + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_permutation(TIterator1 begin1, + TIterator1 end1, + TIterator2 begin2, + TBinaryPredicate predicate) + { + return std::is_permutation(begin1, end1, begin2, predicate); + } + + //*************************************************************************** + /// is_permutation + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_permutation(TIterator1 begin1, + TIterator1 end1, + TIterator2 begin2, + TIterator2 end2) + { + return std::is_permutation(begin1, end1, begin2, end2); + } + + //*************************************************************************** + /// is_permutation + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_permutation(TIterator1 begin1, + TIterator1 end1, + TIterator2 begin2, + TIterator2 end2, + TBinaryPredicate predicate) + { + return std::is_permutation(begin1, end1, begin2, end2, predicate); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + /// is_partitioned + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_partitioned(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + while (begin != end) + { + if (!predicate(*begin++)) + { + break; + } + } + + while (begin != end) + { + if (predicate(*begin++)) + { + return false; + } + } + + return true; + } +#else + //*************************************************************************** + /// is_partitioned + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool is_partitioned(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + return std::is_partitioned(begin, end, predicate); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + /// partition_point + /// + ///\ingroup algorithm + //*************************************************************************** + template + TIterator partition_point(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + while (begin != end) + { + if (!predicate(*begin)) + { + return begin; + } + + ++begin; + } + + return begin; + } +#else + //*************************************************************************** + /// partition_point + /// + ///\ingroup algorithm + //*************************************************************************** + template + TIterator partition_point(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + return std::partition_point(begin, end, predicate); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + /// Copies the elements from the range (begin, end) to two different ranges + /// depending on the value returned by the predicate.
+ /// + ///\ingroup algorithm + //*************************************************************************** + template + ETL_OR_STD::pair partition_copy(TSource begin, + TSource end, + TDestinationTrue destination_true, + TDestinationFalse destination_false, + TUnaryPredicate predicate) + { + while (begin != end) + { + if (predicate(*begin)) + { + *destination_true++ = *begin++; + } + else + { + *destination_false++ = *begin++; + } + } + + return ETL_OR_STD::pair(destination_true, destination_false); + } +#else + //*************************************************************************** + /// Copies the elements from the range (begin, end) to two different ranges + /// depending on the value returned by the predicate.
+ /// + ///\ingroup algorithm + //*************************************************************************** + template + std::pair partition_copy(TSource begin, + TSource end, + TDestinationTrue destination_true, + TDestinationFalse destination_false, + TUnaryPredicate predicate) + { + return std::partition_copy(begin, end, destination_true, destination_false, predicate); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + /// copy_if + ///\ingroup algorithm + /// + //*************************************************************************** + template + TOutputIterator copy_if(TIterator begin, + TIterator end, + TOutputIterator out, + TUnaryPredicate predicate) + { + while (begin != end) + { + if (predicate(*begin)) + { + *out++ = *begin; + } + + ++begin; + } + + return out; + } +#else + //*************************************************************************** + /// copy_if + ///\ingroup algorithm + /// + //*************************************************************************** + template + TOutputIterator copy_if(TIterator begin, + TIterator end, + TOutputIterator out, + TUnaryPredicate predicate) + { + return std::copy_if(begin, end, out, predicate); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + /// all_of + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool all_of(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + return etlstd::find_if_not(begin, end, predicate) == end; + } +#else + //*************************************************************************** + /// all_of + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool all_of(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + return std::all_of(begin, end, predicate); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + /// any_of + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool any_of(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + return etlstd::find_if(begin, end, predicate) != end; + } +#else + //*************************************************************************** + /// any_of + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool any_of(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + return std::any_of(begin, end, predicate); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + //*************************************************************************** + /// none_of + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool none_of(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + return etlstd::find_if(begin, end, predicate) == end; + } +#else + //*************************************************************************** + /// none_of + ///\ingroup algorithm + /// + //*************************************************************************** + template + bool none_of(TIterator begin, + TIterator end, + TUnaryPredicate predicate) + { + return std::none_of(begin, end, predicate); + } +#endif +} + +//***************************************************************************** +// ETL extensions to the STL algorithms. +//***************************************************************************** +namespace etl +{ + //*************************************************************************** + /// copy_s + /// A safer form of copy where the smallest of the two ranges is used. /// There is currently no STL equivalent. /// Specialisation for random access iterators. ///\param i_begin Beginning of the input range. @@ -217,23 +2034,23 @@ namespace etl //*************************************************************************** template - typename etl::enable_if::value && - etl::is_random_iterator::value, TOutputIterator>::type + typename etlstd::enable_if::value && + etl::is_random_iterator::value, TOutputIterator>::type copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TOutputIterator o_end) { - size_t s_size = ETL_STD::distance(i_begin, i_end); - size_t d_size = ETL_STD::distance(o_begin, o_end); + size_t s_size = etlstd::distance(i_begin, i_end); + size_t d_size = etlstd::distance(o_begin, o_end); size_t size = (s_size < d_size) ? s_size : d_size; - return ETL_STD::copy(i_begin, i_begin + size, o_begin); + return etlstd::copy(i_begin, i_begin + size, o_begin); } //*************************************************************************** /// copy - /// A form of copy where the smallest of the two ranges is used. + /// A safer form of copy where the smallest of the two ranges is used. /// There is currently no STL equivalent. /// Specialisation for non random access iterators. ///\param i_begin Beginning of the input range. @@ -244,8 +2061,8 @@ namespace etl //*************************************************************************** template - typename etl::enable_if::value || - !etl::is_random_iterator::value, TOutputIterator>::type + typename etlstd::enable_if::value || + !etl::is_random_iterator::value, TOutputIterator>::type copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, @@ -259,46 +2076,9 @@ namespace etl return o_begin; } - //*************************************************************************** - /// copy_n (Random input iterators) - ///\ingroup algorithm - /// - //*************************************************************************** - template - typename etl::enable_if::value, TOutputIterator>::type - copy_n(TInputIterator i_begin, - TSize n, - TOutputIterator o_begin) - { - return ETL_STD::copy(i_begin, i_begin + n, o_begin); - } - - //*************************************************************************** - /// copy_n (Non-random input iterators) - ///\ingroup algorithm - /// - //*************************************************************************** - template - typename etl::enable_if::value, TOutputIterator>::type - copy_n(TInputIterator i_begin, - TSize n, - TOutputIterator o_begin) - { - while (n-- > 0) - { - *o_begin++ = *i_begin++; - } - - return o_begin; - } - //*************************************************************************** /// copy_n - /// A form of copy_n where the smallest of the two ranges is used. + /// A safer form of copy_n where the smallest of the two ranges is used. ///\ingroup algorithm //*************************************************************************** template - //*************************************************************************** - template - TOutputIterator copy_if(TIterator begin, - TIterator end, - TOutputIterator out, - TUnaryPredicate predicate) - { - while (begin != end) - { - if (predicate(*begin)) - { - *out++ = *begin; - } - - ++begin; - } - - return out; - } - - //*************************************************************************** - /// copy_if - /// A form of copy_if where it terminates when the first end iterator is reached. + /// A safer form of copy_if where it terminates when the first end iterator is reached. /// There is currently no STL equivelent. ///\ingroup algorithm //*************************************************************************** @@ -375,10 +2129,10 @@ namespace etl typename TOutputIterator, typename TUnaryPredicate> TOutputIterator copy_if(TInputIterator i_begin, - TInputIterator i_end, - TOutputIterator o_begin, - TOutputIterator o_end, - TUnaryPredicate predicate) + TInputIterator i_end, + TOutputIterator o_begin, + TOutputIterator o_end, + TUnaryPredicate predicate) { while ((i_begin != i_end) && (o_begin != o_end)) { @@ -427,11 +2181,11 @@ namespace etl //*************************************************************************** template - TIterator binary_find(TIterator begin, - TIterator end, - const TValue& value) + TIterator binary_find(TIterator begin, + TIterator end, + const TValue& value) { - TIterator it = ETL_STD::lower_bound(begin, end, value); + TIterator it = etlstd::lower_bound(begin, end, value); if ((it == end) || (*it != value)) { @@ -450,13 +2204,13 @@ namespace etl typename TValue, typename TBinaryPredicate, typename TBinaryEquality> - TIterator binary_find(TIterator begin, - TIterator end, - const TValue& value, - TBinaryPredicate predicate, - TBinaryEquality equality) + TIterator binary_find(TIterator begin, + TIterator end, + const TValue& value, + TBinaryPredicate predicate, + TBinaryEquality equality) { - TIterator it = ETL_STD::lower_bound(begin, end, value, predicate); + TIterator it = etlstd::lower_bound(begin, end, value, predicate); if ((it == end) || !equality(*it, value)) { @@ -466,299 +2220,6 @@ namespace etl return it; } - //*************************************************************************** - /// find_if_not - ///\ingroup algorithm - /// - //*************************************************************************** - template - TIterator find_if_not(TIterator begin, - TIterator end, - TUnaryPredicate predicate) - { - while (begin != end) - { - if (!predicate(*begin)) - { - return begin; - } - - ++begin; - } - - return end; - } - - //*************************************************************************** - /// all_of - ///\ingroup algorithm - /// - //*************************************************************************** - template - bool all_of(TIterator begin, - TIterator end, - TUnaryPredicate predicate) - { - return etl::find_if_not(begin, end, predicate) == end; - } - - //*************************************************************************** - /// any_of - ///\ingroup algorithm - /// - //*************************************************************************** - template - bool any_of(TIterator begin, - TIterator end, - TUnaryPredicate predicate) - { - return ETL_STD::find_if(begin, end, predicate) != end; - } - - //*************************************************************************** - /// none_of - ///\ingroup algorithm - /// - //*************************************************************************** - template - bool none_of(TIterator begin, - TIterator end, - TUnaryPredicate predicate) - { - return ETL_STD::find_if(begin, end, predicate) == end; - } - - //*************************************************************************** - /// is_permutation - ///\ingroup algorithm - /// - //*************************************************************************** - template - bool is_permutation(TIterator1 begin1, - TIterator1 end1, - TIterator2 begin2) - { - if (begin1 != end1) - { - TIterator2 end2 = begin2; - - ETL_STD::advance(end2, ETL_STD::distance(begin1, end1)); - - for (TIterator1 i = begin1; i != end1; ++i) - { - if (i == ETL_STD::find(begin1, i, *i)) - { - size_t n = ETL_STD::count(begin2, end2, *i); - - if (n == 0 || size_t(ETL_STD::count(i, end1, *i)) != n) - { - return false; - } - } - } - } - - return true; - } - - //*************************************************************************** - /// is_permutation - ///\ingroup algorithm - /// - //*************************************************************************** - template - bool is_permutation(TIterator1 begin1, - TIterator1 end1, - TIterator2 begin2, - TIterator2 end2) - { - if (begin1 != end1) - { - for (TIterator1 i = begin1; i != end1; ++i) - { - if (i == ETL_STD::find(begin1, i, *i)) - { - size_t n = ETL_STD::count(begin2, end2, *i); - - if (n == 0 || size_t(ETL_STD::count(i, end1, *i)) != n) - { - return false; - } - } - } - } - - return true; - } - - //*************************************************************************** - /// is_permutation - ///\ingroup algorithm - /// - //*************************************************************************** - template - bool is_permutation(TIterator1 begin1, - TIterator1 end1, - TIterator2 begin2, - TBinaryPredicate predicate) - { - if (begin1 != end1) - { - TIterator2 end2 = begin2; - - ETL_STD::advance(end2, ETL_STD::distance(begin1, end1)); - - for (TIterator1 i = begin1; i != end1; ++i) - { -#if ETL_CPP11_SUPPORTED && !defined(ETL_NO_STL) - if (i == std::find_if(begin1, i, std::bind(predicate, *i, std::placeholders::_1))) -#else - if (i == ETL_STD::find_if(begin1, i, ETL_STD::bind1st(predicate, *i))) -#endif - { - size_t n = ETL_STD::count(begin2, end2, *i); - - if (n == 0 || size_t(ETL_STD::count(i, end1, *i)) != n) - { - return false; - } - } - } - } - - return true; - } - - //*************************************************************************** - /// is_permutation - ///\ingroup algorithm - /// - //*************************************************************************** - template - bool is_permutation(TIterator1 begin1, - TIterator1 end1, - TIterator2 begin2, - TIterator2 end2, - TBinaryPredicate predicate) - { - if (begin1 != end1) - { - for (TIterator1 i = begin1; i != end1; ++i) - { -#if ETL_CPP11_SUPPORTED && !defined(ETL_NO_STL) - if (i == std::find_if(begin1, i, std::bind(predicate, *i, std::placeholders::_1))) -#else - if (i == ETL_STD::find_if(begin1, i, ETL_STD::bind1st(predicate, *i))) -#endif - { - size_t n = ETL_STD::count(begin2, end2, *i); - - if (n == 0 || size_t(ETL_STD::count(i, end1, *i)) != n) - { - return false; - } - } - } - } - - return true; - } - - //*************************************************************************** - /// is_partitioned - ///\ingroup algorithm - /// - //*************************************************************************** - template - bool is_partitioned(TIterator begin, - TIterator end, - TUnaryPredicate predicate) - { - while (begin != end) - { - if (!predicate(*begin++)) - { - break; - } - } - - while (begin != end) - { - if (predicate(*begin++)) - { - return false; - } - } - - return true; - } - - //*************************************************************************** - /// partition_point - /// - ///\ingroup algorithm - //*************************************************************************** - template - TIterator partition_point(TIterator begin, - TIterator end, - TUnaryPredicate predicate) - { - while (begin != end) - { - if (!predicate(*begin)) - { - return begin; - } - - ++begin; - } - - return begin; - } - - //*************************************************************************** - /// Copies the elements from the range (begin, end) to two different ranges - /// depending on the value returned by the predicate.
- /// - ///\ingroup algorithm - //*************************************************************************** - template - ETL_PAIR partition_copy(TSource begin, - TSource end, - TDestinationTrue destination_true, - TDestinationFalse destination_false, - TUnaryPredicate predicate) - { - while (begin != end) - { - if (predicate(*begin)) - { - *destination_true++ = *begin++; - } - else - { - *destination_false++ = *begin++; - } - } - - return ETL_PAIR(destination_true, destination_false); - } - //*************************************************************************** /// Like std::for_each but applies a predicate before calling the function. ///\ingroup algorithm @@ -830,24 +2291,26 @@ namespace etl } //*************************************************************************** - /// A form of std::transform where the transform returns when the first range - /// end is reached. + /// A safer form of std::transform where the transform returns when the first + /// range end is reached. /// There is currently no STL equivalent. ///\ingroup algorithm //*************************************************************************** template - void transform(TInputIterator i_begin, - TInputIterator i_end, - TOutputIterator o_begin, - TOutputIterator o_end, - TUnaryFunction function) + TOutputIterator transform(TInputIterator i_begin, + TInputIterator i_end, + TOutputIterator o_begin, + TOutputIterator o_end, + TUnaryFunction function) { while ((i_begin != i_end) && (o_begin != o_end)) { *o_begin++ = function(*i_begin++); } + + return o_begin; } //*************************************************************************** @@ -860,13 +2323,15 @@ namespace etl typename TSize, typename TOutputIterator, typename TUnaryFunction> - typename etl::enable_if::value, void>::type - transform_n(TInputIterator i_begin, - TSize n, - TOutputIterator o_begin, - TUnaryFunction function) + void transform_n(TInputIterator i_begin, + TSize n, + TOutputIterator o_begin, + TUnaryFunction function) { - ETL_STD::transform(i_begin, i_begin + n, o_begin, function); + TInputIterator i_end(i_begin); + etlstd::advance(i_end, n); + + etlstd::transform(i_begin, i_end, o_begin, function); } //*************************************************************************** @@ -880,64 +2345,16 @@ namespace etl typename TSize, typename TOutputIterator, typename TBinaryFunction> - typename etl::enable_if::value && - etl::is_random_iterator::value, void>::type - transform_n(TInputIterator1 i_begin1, - TInputIterator2 i_begin2, - TSize n, - TOutputIterator o_begin, - TBinaryFunction function) + void transform_n(TInputIterator1 i_begin1, + TInputIterator2 i_begin2, + TSize n, + TOutputIterator o_begin, + TBinaryFunction function) { - ETL_STD::transform(i_begin1, i_begin1 + n, i_begin2, o_begin, function); - } + TInputIterator i_end1(i_begin1); + etlstd::advance(i_end1, n); - //*************************************************************************** - /// Transform 'n' items. - /// Non-random iterators. - /// There is currently no STL equivalent. - ///\ingroup algorithm - //*************************************************************************** - template - typename etl::enable_if::value, void>::type - transform_n(TInputIterator i_begin, - TSize n, - TOutputIterator o_begin, - TUnaryFunction function) - { - while (n > 0) - { - *o_begin++ = function(*i_begin++); - --n; - } - } - - //*************************************************************************** - /// Transform 'n' items from two ranges. - /// Non-random iterators. - /// There is currently no STL equivalent. - ///\ingroup algorithm - //*************************************************************************** - template - typename etl::enable_if::value || - !etl::is_random_iterator::value, void>::type - transform_n(TInputIterator1 i_begin1, - TInputIterator2 i_begin2, - TSize n, - TOutputIterator o_begin, - TBinaryFunction function) - { - while (n > 0) - { - *o_begin++ = function(*i_begin1++, *i_begin2++); - --n; - } + etlstd::transform(i_begin1, i_end1, i_begin2, o_begin, function); } //*************************************************************************** @@ -1064,13 +2481,13 @@ namespace etl template - ETL_PAIR partition_transform(TSource begin, - TSource end, - TDestinationTrue destination_true, - TDestinationFalse destination_false, - TUnaryFunctionTrue function_true, - TUnaryFunctionFalse function_false, - TUnaryPredicate predicate) + ETL_OR_STD::pair partition_transform(TSource begin, + TSource end, + TDestinationTrue destination_true, + TDestinationFalse destination_false, + TUnaryFunctionTrue function_true, + TUnaryFunctionFalse function_false, + TUnaryPredicate predicate) { while (begin != end) { @@ -1084,7 +2501,7 @@ namespace etl } } - return ETL_PAIR(destination_true, destination_false); + return ETL_OR_STD::pair(destination_true, destination_false); } //*************************************************************************** @@ -1099,7 +2516,7 @@ namespace etl typename TBinaryFunctionTrue, typename TBinaryFunctionFalse, typename TBinaryPredicate> - ETL_PAIR partition_transform(TSource1 begin1, + ETL_OR_STD::pair partition_transform(TSource1 begin1, TSource1 end1, TSource2 begin2, TDestinationTrue destination_true, @@ -1120,7 +2537,7 @@ namespace etl } } - return ETL_PAIR(destination_true, destination_false); + return ETL_OR_STD::pair(destination_true, destination_false); } //*************************************************************************** @@ -1136,9 +2553,9 @@ namespace etl return; } - typedef typename ETL_STD::iterator_traits::difference_type difference_t; + typedef typename etlstd::iterator_traits::difference_type difference_t; - difference_t n = ETL_STD::distance(first, last); + difference_t n = etlstd::distance(first, last); for (difference_t i = n / 2; i > 0; i /= 2) { @@ -1149,12 +2566,12 @@ namespace etl TIterator itr1 = first; TIterator itr2 = first; - ETL_STD::advance(itr1, k); - ETL_STD::advance(itr2, k + i); + etlstd::advance(itr1, k); + etlstd::advance(itr2, k + i); if (compare(*itr2, *itr1)) { - ETL_STD::iter_swap(itr1, itr2); + etlstd::iter_swap(itr1, itr2); } } } @@ -1168,7 +2585,7 @@ namespace etl template void shell_sort(TIterator first, TIterator last) { - etl::shell_sort(first, last, ETL_STD::less::value_type>()); + etl::shell_sort(first, last, etlstd::less::value_type>()); } //*************************************************************************** @@ -1181,7 +2598,7 @@ namespace etl { for (TIterator itr = first; itr != last; ++itr) { - ETL_STD::rotate(ETL_STD::upper_bound(first, itr, *itr, compare), itr, etl::next(itr)); + etlstd::rotate(etlstd::upper_bound(first, itr, *itr, compare), itr, etlstd::next(itr)); } } @@ -1192,7 +2609,7 @@ namespace etl template void insertion_sort(TIterator first, TIterator last) { - etl::insertion_sort(first, last, ETL_STD::less::value_type>()); + etl::insertion_sort(first, last, etlstd::less::value_type>()); } //*************************************************************************** @@ -1213,7 +2630,7 @@ namespace etl template void sort(TIterator first, TIterator last) { - etl::shell_sort(first, last, ETL_STD::less::value_type>()); + etl::shell_sort(first, last, etlstd::less::value_type>()); } //*************************************************************************** @@ -1236,10 +2653,9 @@ namespace etl template void stable_sort(TIterator first, TIterator last) { - etl::insertion_sort(first, last, ETL_STD::less::value_type>()); + etl::insertion_sort(first, last, etlstd::less::value_type>()); } -#if ETL_CPP11_SUPPORTED //*************************************************************************** /// Returns the maximum value. //*************************************************************************** @@ -1363,7 +2779,6 @@ namespace etl { return multimin_iter_compare(compare, t, multimin_iter_compare(compare, tx...)); } -#endif } #endif diff --git a/include/etl/alignment.h b/include/etl/alignment.h index b2e53866..0a0f2d91 100644 --- a/include/etl/alignment.h +++ b/include/etl/alignment.h @@ -66,7 +66,7 @@ namespace etl { public: - typedef typename type_with_alignment_matcher::value, ALIGNMENT, T2, T3, T4, T5, T6, T7, T8, void>::type type; + typedef typename type_with_alignment_matcher::value, ALIGNMENT, T2, T3, T4, T5, T6, T7, T8, void>::type type; }; // Non-matching alignment, none left. @@ -86,7 +86,7 @@ namespace etl { public: - typedef typename type_with_alignment_matcher::value, ALIGNMENT, T1, T2, T3, T4, T5, T6, T7, T8>::type type; + typedef typename type_with_alignment_matcher::value, ALIGNMENT, T1, T2, T3, T4, T5, T6, T7, T8>::type type; }; } @@ -116,7 +116,7 @@ namespace etl template operator T& () { - ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); T* t = *this; return *t; } @@ -125,7 +125,7 @@ namespace etl template operator const T& () const { - ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); const T* t = *this; return *t; } @@ -134,7 +134,7 @@ namespace etl template operator T* () { - ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); return reinterpret_cast(data); } @@ -142,7 +142,7 @@ namespace etl template operator const T* () const { - ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); return reinterpret_cast(data); } @@ -150,7 +150,7 @@ namespace etl template T& get_reference() { - ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); T* t = *this; return *t; } @@ -159,7 +159,7 @@ namespace etl template const T& get_reference() const { - ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); const T* t = *this; return *t; } @@ -168,7 +168,7 @@ namespace etl template T* get_address() { - ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); return reinterpret_cast(data); } @@ -176,7 +176,7 @@ namespace etl template const T* get_address() const { - ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); return reinterpret_cast(data); } @@ -197,7 +197,7 @@ namespace etl ///\ingroup alignment //*************************************************************************** template - struct aligned_storage_as : public etl::aligned_storage::value> + struct aligned_storage_as : public etl::aligned_storage::value> { }; } diff --git a/include/etl/array.h b/include/etl/array.h index 748bfef4..a9205464 100644 --- a/include/etl/array.h +++ b/include/etl/array.h @@ -35,9 +35,9 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #include "exception.h" #include "type_traits.h" @@ -107,8 +107,8 @@ namespace etl typedef const T* const_pointer; typedef T* iterator; typedef const T* const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; //************************************************************************* // Element access @@ -342,7 +342,7 @@ namespace etl //************************************************************************* void fill(parameter_t value) { - ETL_STD::fill(begin(), end(), value); + etlstd::fill(begin(), end(), value); } //************************************************************************* @@ -351,9 +351,15 @@ namespace etl //************************************************************************* void swap(array& other) { +#if defined(ETL_NO_STL) + using etlstd::swap; +#else + using std::swap; +#endif + for (size_t i = 0; i < SIZE; ++i) { - ETL_STD::swap(_buffer[i], other._buffer[i]); + swap(_buffer[i], other._buffer[i]); } } @@ -367,7 +373,7 @@ namespace etl template void assign(TIterator first, const TIterator last) { - etl::copy(first, last, begin(), end()); + etlstd::copy(first, last, begin(), end()); } //************************************************************************* @@ -381,10 +387,10 @@ namespace etl void assign(TIterator first, const TIterator last, parameter_t value) { // Copy from the range. - iterator p = etl::copy(first, last, begin(), end()); + iterator p = etlstd::copy(first, last, begin(), end()); // Default initialise any that are left. - ETL_STD::fill(p, end(), value); + etlstd::fill(p, end(), value); } //************************************************************************* @@ -406,7 +412,7 @@ namespace etl { iterator p = const_cast(position); - ETL_STD::copy_backward(p, end() - 1, end()); + etlstd::copy_backward(p, end() - 1, end()); *p = value; return p; @@ -436,18 +442,18 @@ namespace etl iterator p = const_cast(position); iterator result(p); - size_t source_size = ETL_STD::distance(first, last); - size_t destination_space = ETL_STD::distance(position, cend()); + size_t source_size = etlstd::distance(first, last); + size_t destination_space = etlstd::distance(position, cend()); // Do we need to move anything? if (source_size < destination_space) { - size_t length = SIZE - (ETL_STD::distance(begin(), p) + source_size); - ETL_STD::copy_backward(p, p + length, end()); + size_t length = SIZE - (etlstd::distance(begin(), p) + source_size); + etlstd::copy_backward(p, p + length, end()); } // Copy from the range. - etl::copy(first, last, p, end()); + etlstd::copy(first, last, p, end()); return result; } @@ -470,7 +476,7 @@ namespace etl iterator erase(const_iterator position) { iterator p = const_cast(position); - ETL_STD::copy(p + 1, end(), p); + etlstd::copy(p + 1, end(), p); return p; } @@ -495,7 +501,7 @@ namespace etl iterator erase(const_iterator first, const_iterator last) { iterator p = const_cast(first); - ETL_STD::copy(last, cend(), p); + etlstd::copy(last, cend(), p); return p; } @@ -518,7 +524,7 @@ namespace etl { iterator p = const_cast(position); - ETL_STD::copy(p + 1, end(), p); + etlstd::copy(p + 1, end(), p); back() = value; return p; @@ -544,8 +550,8 @@ namespace etl { iterator p = const_cast(first); - p = ETL_STD::copy(last, cend(), p); - ETL_STD::fill(p, end(), value); + p = etlstd::copy(last, cend(), p); + etlstd::fill(p, end(), value); return const_cast(first); } @@ -574,7 +580,7 @@ namespace etl template bool operator ==(const etl::array& lhs, const etl::array& rhs) { - return ETL_STD::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin()); + return etlstd::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin()); } //************************************************************************* @@ -598,7 +604,7 @@ namespace etl template bool operator <(const etl::array& lhs, const etl::array& rhs) { - return ETL_STD::lexicographical_compare(lhs.cbegin(), + return etlstd::lexicographical_compare(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend()); diff --git a/include/etl/array_view.h b/include/etl/array_view.h index 1187e531..48242b41 100644 --- a/include/etl/array_view.h +++ b/include/etl/array_view.h @@ -40,7 +40,7 @@ SOFTWARE. #include "hash.h" #include "algorithm.h" -#include "stl/algorithm.h" +#include "algorithm.h" ///\defgroup array array /// A wrapper for arrays @@ -108,8 +108,8 @@ namespace etl typedef const T* const_pointer; typedef T* iterator; typedef const T* const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; //************************************************************************* /// Default constructor. @@ -137,7 +137,7 @@ namespace etl template ETL_CONSTEXPR array_view(const TIterator begin_, const TIterator end_) : mbegin(etl::addressof(*begin_)), - mend(etl::addressof(*begin_) + ETL_STD::distance(begin_, end_)) + mend(etl::addressof(*begin_) + etlstd::distance(begin_, end_)) { } @@ -356,7 +356,7 @@ namespace etl void assign(const TIterator begin_, const TIterator end_) { mbegin = etl::addressof(*begin_); - mend = etl::addressof(*begin_) + ETL_STD::distance(begin_, end_); + mend = etl::addressof(*begin_) + etlstd::distance(begin_, end_); } //************************************************************************* @@ -411,8 +411,14 @@ namespace etl //************************************************************************* void swap(array_view& other) { - ETL_STD::swap(mbegin, other.mbegin); - ETL_STD::swap(mend, other.mend); +#if defined(ETL_NO_STL) + using etlstd::swap; +#else + using std::swap; +#endif + + swap(mbegin, other.mbegin); + swap(mend, other.mend); } //************************************************************************* @@ -437,7 +443,7 @@ namespace etl friend bool operator == (const array_view& lhs, const array_view& rhs) { return (lhs.size() == rhs.size()) && - ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -453,7 +459,7 @@ namespace etl //************************************************************************* friend bool operator < (const array_view& lhs, const array_view& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/array_wrapper.h b/include/etl/array_wrapper.h index ab64120c..2f784563 100644 --- a/include/etl/array_wrapper.h +++ b/include/etl/array_wrapper.h @@ -93,8 +93,8 @@ namespace etl typedef const T* const_pointer; typedef T* iterator; typedef const T* const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef typename etl::parameter_type::type parameter_t; @@ -310,19 +310,25 @@ namespace etl //************************************************************************* void fill(parameter_t value) { - ETL_STD::fill(begin(), end(), value); + etlstd::fill(begin(), end(), value); } //************************************************************************* /// Swaps the contents of arrays. //************************************************************************* template - typename etl::enable_if::value, void>::type + typename etlstd::enable_if::value, void>::type swap(etl::array_wrapper& other) { +#if defined(ETL_NO_STL) + using etlstd::swap; +#else + using std::swap; +#endif + for (size_t i = 0; i < SIZE; ++i) { - ETL_STD::swap(ARRAY_[i], other.begin()[i]); + swap(ARRAY_[i], other.begin()[i]); } } }; @@ -334,7 +340,7 @@ namespace etl bool operator == (const etl::array_wrapper& lhs, const etl::array_wrapper& rhs) { - return (SIZEL == SIZER) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (SIZEL == SIZER) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -354,7 +360,7 @@ namespace etl bool operator < (const etl::array_wrapper& lhs, const etl::array_wrapper& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/atomic/atomic_gcc_sync.h b/include/etl/atomic/atomic_gcc_sync.h index e2d51cd9..70ba31e7 100644 --- a/include/etl/atomic/atomic_gcc_sync.h +++ b/include/etl/atomic/atomic_gcc_sync.h @@ -66,7 +66,7 @@ namespace etl { public: - ETL_STATIC_ASSERT(etl::is_integral::value, "Only integral types are supported"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Only integral types are supported"); atomic() : value(0) diff --git a/include/etl/atomic/atomic_llvm_sync.h b/include/etl/atomic/atomic_llvm_sync.h index 50e0be01..bf32ba5c 100644 --- a/include/etl/atomic/atomic_llvm_sync.h +++ b/include/etl/atomic/atomic_llvm_sync.h @@ -59,7 +59,7 @@ SOFTWARE. // { // public: // -// ETL_STATIC_ASSERT(etl::is_integral::value, "Only integral types are supported"); +// ETL_STATIC_ASSERT(etlstd::is_integral::value, "Only integral types are supported"); // // atomic() // : value(0) diff --git a/include/etl/basic_string.h b/include/etl/basic_string.h index bacb384c..04a7fc0c 100644 --- a/include/etl/basic_string.h +++ b/include/etl/basic_string.h @@ -37,9 +37,9 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #include "char_traits.h" #include "container.h" @@ -282,11 +282,11 @@ namespace etl typedef const T* const_pointer; typedef T* iterator; typedef const T* const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the string. @@ -418,12 +418,12 @@ namespace etl is_truncated = true; } - new_size = ETL_STD::min(new_size, CAPACITY); + new_size = etlstd::min(new_size, CAPACITY); // Size up? if (new_size > current_size) { - ETL_STD::fill(p_buffer + current_size, p_buffer + new_size, value); + etlstd::fill(p_buffer + current_size, p_buffer + new_size, value); } current_size = new_size; @@ -596,7 +596,7 @@ namespace etl is_truncated = (length_ > CAPACITY); - length_ = ETL_STD::min(length_, CAPACITY); + length_ = etlstd::min(length_, CAPACITY); etl::copy_n(other, length_, begin()); @@ -615,7 +615,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(string_iterator)); #endif @@ -643,9 +643,9 @@ namespace etl is_truncated = (n > CAPACITY); - n = ETL_STD::min(n, CAPACITY); + n = etlstd::min(n, CAPACITY); - ETL_STD::fill_n(begin(), n, value); + etlstd::fill_n(begin(), n, value); current_size = n; p_buffer[current_size] = 0; } @@ -780,7 +780,7 @@ namespace etl { // Insert in the middle. ++current_size; - ETL_STD::copy_backward(insert_position, end() - 1, end()); + etlstd::copy_backward(insert_position, end() - 1, end()); *insert_position = value; } else @@ -796,7 +796,7 @@ namespace etl if (position != end()) { // Insert in the middle. - ETL_STD::copy_backward(insert_position, end() - 1, end()); + etlstd::copy_backward(insert_position, end() - 1, end()); *insert_position = value; } @@ -823,7 +823,7 @@ namespace etl // Quick hack, as iterators are pointers. iterator insert_position = const_cast(position); - const size_t start = ETL_STD::distance(cbegin(), position); + const size_t start = etlstd::distance(cbegin(), position); // No effect. if (start >= CAPACITY) @@ -841,7 +841,7 @@ namespace etl } current_size = CAPACITY; - ETL_STD::fill(insert_position, end(), value); + etlstd::fill(insert_position, end(), value); } else { @@ -850,7 +850,7 @@ namespace etl const size_t to_position = start + shift_amount; const size_t remaining_characters = current_size - start; const size_t max_shift_characters = CAPACITY - start - shift_amount; - const size_t characters_to_shift = ETL_STD::min(max_shift_characters, remaining_characters); + const size_t characters_to_shift = etlstd::min(max_shift_characters, remaining_characters); // Will the string truncate? if ((start + shift_amount + remaining_characters) > CAPACITY) @@ -863,8 +863,8 @@ namespace etl current_size += shift_amount; } - ETL_STD::copy_backward(insert_position, insert_position + characters_to_shift, begin() + to_position + characters_to_shift); - ETL_STD::fill(insert_position, insert_position + shift_amount, value); + etlstd::copy_backward(insert_position, insert_position + characters_to_shift, begin() + to_position + characters_to_shift); + etlstd::fill(insert_position, insert_position + shift_amount, value); } p_buffer[current_size] = 0; @@ -885,8 +885,8 @@ namespace etl return; } - const size_t start = ETL_STD::distance(begin(), position); - const size_t n = ETL_STD::distance(first, last); + const size_t start = etlstd::distance(begin(), position); + const size_t n = etlstd::distance(first, last); // No effect. if (start >= CAPACITY) @@ -917,7 +917,7 @@ namespace etl const size_t to_position = start + shift_amount; const size_t remaining_characters = current_size - start; const size_t max_shift_characters = CAPACITY - start - shift_amount; - const size_t characters_to_shift = ETL_STD::min(max_shift_characters, remaining_characters); + const size_t characters_to_shift = etlstd::min(max_shift_characters, remaining_characters); // Will the string truncate? if ((start + shift_amount + remaining_characters) > CAPACITY) @@ -930,7 +930,7 @@ namespace etl current_size += shift_amount; } - ETL_STD::copy_backward(position, position + characters_to_shift, begin() + to_position + characters_to_shift); + etlstd::copy_backward(position, position + characters_to_shift, begin() + to_position + characters_to_shift); while (first != last) { @@ -1037,7 +1037,7 @@ namespace etl etl::ibasic_string& erase(size_t position, size_t length_ = npos) { // Limit the length. - length_ = ETL_STD::min(length_, size() - position); + length_ = etlstd::min(length_, size() - position); erase(begin() + position, begin() + position + length_); @@ -1051,7 +1051,7 @@ namespace etl //********************************************************************* iterator erase(iterator i_element) { - ETL_STD::copy(i_element + 1, end(), i_element); + etlstd::copy(i_element + 1, end(), i_element); p_buffer[--current_size] = 0; return i_element; @@ -1067,8 +1067,8 @@ namespace etl //********************************************************************* iterator erase(iterator first, iterator last) { - ETL_STD::copy(last, end(), first); - size_t n_delete = ETL_STD::distance(first, last); + etlstd::copy(last, end(), first); + size_t n_delete = etlstd::distance(first, last); current_size -= n_delete; p_buffer[current_size] = 0; @@ -1098,7 +1098,7 @@ namespace etl is_truncated = true; } - size_t endpos = ETL_STD::min(pos + len, size()); + size_t endpos = etlstd::min(pos + len, size()); for (size_t i = pos; i < endpos; ++i) { @@ -1120,7 +1120,7 @@ namespace etl return npos; } - const_iterator iposition = ETL_STD::search(begin() + pos, end(), str.begin(), str.end()); + const_iterator iposition = etlstd::search(begin() + pos, end(), str.begin(), str.end()); if (iposition == end()) { @@ -1128,7 +1128,7 @@ namespace etl } else { - return ETL_STD::distance(begin(), iposition); + return etlstd::distance(begin(), iposition); } } @@ -1146,7 +1146,7 @@ namespace etl } #endif - const_iterator iposition = ETL_STD::search(begin() + pos, end(), s, s + etl::strlen(s)); + const_iterator iposition = etlstd::search(begin() + pos, end(), s, s + etl::strlen(s)); if (iposition == end()) { @@ -1154,7 +1154,7 @@ namespace etl } else { - return ETL_STD::distance(begin(), iposition); + return etlstd::distance(begin(), iposition); } } @@ -1173,7 +1173,7 @@ namespace etl } #endif - const_iterator iposition = ETL_STD::search(begin() + pos, end(), s, s + n); + const_iterator iposition = etlstd::search(begin() + pos, end(), s, s + n); if (iposition == end()) { @@ -1181,7 +1181,7 @@ namespace etl } else { - return ETL_STD::distance(begin(), iposition); + return etlstd::distance(begin(), iposition); } } @@ -1192,11 +1192,11 @@ namespace etl //********************************************************************* size_t find(T c, size_t position = 0) const { - const_iterator i = ETL_STD::find(begin() + position, end(), c); + const_iterator i = etlstd::find(begin() + position, end(), c); if (i != end()) { - return ETL_STD::distance(begin(), i); + return etlstd::distance(begin(), i); } else { @@ -1223,7 +1223,7 @@ namespace etl position = size() - position; - const_reverse_iterator iposition = ETL_STD::search(rbegin() + position, rend(), str.rbegin(), str.rend()); + const_reverse_iterator iposition = etlstd::search(rbegin() + position, rend(), str.rbegin(), str.rend()); if (iposition == rend()) { @@ -1231,7 +1231,7 @@ namespace etl } else { - return size() - str.size() - ETL_STD::distance(rbegin(), iposition); + return size() - str.size() - etlstd::distance(rbegin(), iposition); } } @@ -1259,7 +1259,7 @@ namespace etl const_reverse_iterator srbegin(s + len); const_reverse_iterator srend(s); - const_reverse_iterator iposition = ETL_STD::search(rbegin() + position, rend(), srbegin, srend); + const_reverse_iterator iposition = etlstd::search(rbegin() + position, rend(), srbegin, srend); if (iposition == rend()) { @@ -1267,7 +1267,7 @@ namespace etl } else { - return size() - len - ETL_STD::distance(rbegin(), iposition); + return size() - len - etlstd::distance(rbegin(), iposition); } } @@ -1293,7 +1293,7 @@ namespace etl const_reverse_iterator srbegin(s + length_); const_reverse_iterator srend(s); - const_reverse_iterator iposition = ETL_STD::search(rbegin() + position, rend(), srbegin, srend); + const_reverse_iterator iposition = etlstd::search(rbegin() + position, rend(), srbegin, srend); if (iposition == rend()) { @@ -1301,7 +1301,7 @@ namespace etl } else { - return size() - length_ - ETL_STD::distance(rbegin(), iposition); + return size() - length_ - etlstd::distance(rbegin(), iposition); } } @@ -1319,11 +1319,11 @@ namespace etl position = size() - position; - const_reverse_iterator i = ETL_STD::find(rbegin() + position, rend(), c); + const_reverse_iterator i = etlstd::find(rbegin() + position, rend(), c); if (i != rend()) { - return size() - ETL_STD::distance(rbegin(), i) - 1; + return size() - etlstd::distance(rbegin(), i) - 1; } else { @@ -1342,7 +1342,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = ETL_STD::min(length_, size() - position); + length_ = etlstd::min(length_, size() - position); // Erase the bit we want to replace. erase(position, length_); @@ -1388,8 +1388,8 @@ namespace etl ETL_ASSERT(subposition <= str.size(), ETL_ERROR(string_out_of_bounds)); // Limit the lengths. - length_ = ETL_STD::min(length_, size() - position); - sublength = ETL_STD::min(sublength, str.size() - subposition); + length_ = etlstd::min(length_, size() - position); + sublength = etlstd::min(sublength, str.size() - subposition); // Erase the bit we want to replace. erase(position, length_); @@ -1413,7 +1413,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = ETL_STD::min(length_, size() - position); + length_ = etlstd::min(length_, size() - position); // Erase the bit we want to replace. erase(position, length_); @@ -1450,7 +1450,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = ETL_STD::min(length_, size() - position); + length_ = etlstd::min(length_, size() - position); // Erase the bit we want to replace. erase(position, length_); @@ -1487,7 +1487,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = ETL_STD::min(length_, size() - position); + length_ = etlstd::min(length_, size() - position); // Erase the bit we want to replace. erase(position, length_); @@ -1554,7 +1554,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = ETL_STD::min(length_, size() - position); + length_ = etlstd::min(length_, size() - position); return compare(p_buffer + position, p_buffer + position + length_, @@ -1571,8 +1571,8 @@ namespace etl ETL_ASSERT(subposition <= str.size(), ETL_ERROR(string_out_of_bounds)); // Limit the lengths. - length_ = ETL_STD::min(length_, size() - position); - sublength = ETL_STD::min(sublength, str.size() - subposition); + length_ = etlstd::min(length_, size() - position); + sublength = etlstd::min(sublength, str.size() - subposition); return compare(p_buffer + position, p_buffer + position + length_, @@ -1712,7 +1712,7 @@ namespace etl return npos; } - position = ETL_STD::min(position, size() - 1); + position = etlstd::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -1745,7 +1745,7 @@ namespace etl return npos; } - position = ETL_STD::min(position, size() - 1); + position = etlstd::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -1869,7 +1869,7 @@ namespace etl return npos; } - position = ETL_STD::min(position, size() - 1); + position = etlstd::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -1907,7 +1907,7 @@ namespace etl return npos; } - position = ETL_STD::min(position, size() - 1); + position = etlstd::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -2106,7 +2106,7 @@ namespace etl template bool operator ==(const etl::ibasic_string& lhs, const etl::ibasic_string& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2119,7 +2119,7 @@ namespace etl template bool operator ==(const etl::ibasic_string& lhs, const T* rhs) { - return (lhs.size() == etl::strlen(rhs)) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs); + return (lhs.size() == etl::strlen(rhs)) && etlstd::equal(lhs.begin(), lhs.end(), rhs); } //*************************************************************************** @@ -2132,7 +2132,7 @@ namespace etl template bool operator ==(const T* lhs, const etl::ibasic_string& rhs) { - return (rhs.size() == etl::strlen(lhs)) && ETL_STD::equal(rhs.begin(), rhs.end(), lhs); + return (rhs.size() == etl::strlen(lhs)) && etlstd::equal(rhs.begin(), rhs.end(), lhs); } @@ -2185,7 +2185,7 @@ namespace etl template bool operator <(const etl::ibasic_string& lhs, const etl::ibasic_string& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //*************************************************************************** @@ -2198,7 +2198,7 @@ namespace etl template bool operator <(const etl::ibasic_string& lhs, const T* rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs, rhs + etl::strlen(rhs)); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs, rhs + etl::strlen(rhs)); } //*************************************************************************** @@ -2211,7 +2211,7 @@ namespace etl template bool operator <(const T* lhs, const etl::ibasic_string& rhs) { - return ETL_STD::lexicographical_compare(lhs, lhs + etl::strlen(lhs), rhs.begin(), rhs.end()); + return etlstd::lexicographical_compare(lhs, lhs + etl::strlen(lhs), rhs.begin(), rhs.end()); } diff --git a/include/etl/binary.h b/include/etl/binary.h index 104f75e6..ff12ef7e 100644 --- a/include/etl/binary.h +++ b/include/etl/binary.h @@ -45,7 +45,7 @@ SOFTWARE. #include "exception.h" #include "error_handler.h" -#include "stl/limits.h" +#include "limits.h" #undef ETL_FILE #define ETL_FILE "50" @@ -110,7 +110,7 @@ namespace etl template T rotate_left(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); const size_t SHIFT = etl::integral_limits::type>::bits - 1; @@ -124,7 +124,7 @@ namespace etl template T rotate_left(T value, size_t distance) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); const size_t BITS = etl::integral_limits::type>::bits; distance %= BITS; @@ -140,7 +140,7 @@ namespace etl template T rotate_right(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); const size_t SHIFT = etl::integral_limits::type>::bits - 1; @@ -154,7 +154,7 @@ namespace etl template T rotate_right(T value, size_t distance) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); const size_t BITS = etl::integral_limits::type>::bits; distance %= BITS; @@ -171,7 +171,7 @@ namespace etl template T rotate(T value, typename etl::make_signed::type distance) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); T result; @@ -194,7 +194,7 @@ namespace etl template T binary_to_gray(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); return (value >> 1) ^ value; } @@ -235,10 +235,10 @@ namespace etl template TReturn sign_extend(TValue value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); - ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); - ETL_STATIC_ASSERT(etl::is_signed::value, "TReturn not a signed type"); - ETL_STATIC_ASSERT(NBITS <= ETL_STD::numeric_limits::digits, "NBITS too large for return type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "TValue not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "TReturn not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_signed::value, "TReturn not a signed type"); + ETL_STATIC_ASSERT(NBITS <= etlstd::numeric_limits::digits, "NBITS too large for return type"); struct S { @@ -257,11 +257,11 @@ namespace etl template TReturn sign_extend(TValue value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); - ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); - ETL_STATIC_ASSERT(etl::is_signed::value, "TReturn not a signed type"); - ETL_STATIC_ASSERT(NBITS <= ETL_STD::numeric_limits::digits, "NBITS too large for return type"); - ETL_STATIC_ASSERT(SHIFT <= ETL_STD::numeric_limits::digits, "SHIFT too large"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "TValue not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "TReturn not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_signed::value, "TReturn not a signed type"); + ETL_STATIC_ASSERT(NBITS <= etlstd::numeric_limits::digits, "NBITS too large for return type"); + ETL_STATIC_ASSERT(SHIFT <= etlstd::numeric_limits::digits, "SHIFT too large"); struct S { @@ -279,11 +279,11 @@ namespace etl template TReturn sign_extend(TValue value, const size_t NBITS) { - ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); - ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); - ETL_STATIC_ASSERT(etl::is_signed::value, "TReturn not a signed type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "TValue not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "TReturn not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_signed::value, "TReturn not a signed type"); - ETL_ASSERT((NBITS <= ETL_STD::numeric_limits::digits), ETL_ERROR(binary_out_of_range)); + ETL_ASSERT((NBITS <= etlstd::numeric_limits::digits), ETL_ERROR(binary_out_of_range)); TReturn mask = TReturn(1) << (NBITS - 1); value = value & static_cast((TReturn(1) << NBITS) - 1); @@ -300,11 +300,11 @@ namespace etl template TReturn sign_extend(TValue value, const size_t NBITS, const size_t SHIFT) { - ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); - ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); - ETL_STATIC_ASSERT(etl::is_signed::value, "TReturn not a signed type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "TValue not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "TReturn not an integral type"); + ETL_STATIC_ASSERT(etlstd::is_signed::value, "TReturn not a signed type"); - ETL_ASSERT((NBITS <= ETL_STD::numeric_limits::digits), ETL_ERROR(binary_out_of_range)); + ETL_ASSERT((NBITS <= etlstd::numeric_limits::digits), ETL_ERROR(binary_out_of_range)); TReturn mask = TReturn(1) << (NBITS - 1); value = (value >> SHIFT) & static_cast((TReturn(1) << NBITS) - 1); @@ -1207,7 +1207,7 @@ namespace etl ///\ingroup binary //*************************************************************************** template - typename etl::enable_if::value, bool>::type + typename etlstd::enable_if::value, bool>::type is_odd(const T value) { return ((static_cast::type>(value) & 1U) != 0U); @@ -1218,7 +1218,7 @@ namespace etl ///\ingroup binary //*************************************************************************** template - typename etl::enable_if::value, bool>::type + typename etlstd::enable_if::value, bool>::type is_even(const T value) { return ((static_cast::type>(value) & 1U) == 0U); diff --git a/include/etl/bit_stream.h b/include/etl/bit_stream.h index 36a2c0b0..44acb860 100644 --- a/include/etl/bit_stream.h +++ b/include/etl/bit_stream.h @@ -35,9 +35,8 @@ SOFTWARE. #include "etl/endianness.h" #include "etl/integral_limits.h" #include "etl/binary.h" - -#include "etl/stl/algorithm.h" -#include "etl/stl/iterator.h" +#include "etl/algorithm.h" +#include "etl/iterator.h" #include "private/minmax_push.h" @@ -68,7 +67,7 @@ namespace etl //*************************************************************************** bit_stream(char* begin_, char* end_) : pdata(reinterpret_cast(begin_)), - length(ETL_STD::distance(begin_, end_)) + length(etlstd::distance(begin_, end_)) { restart(); } @@ -78,7 +77,7 @@ namespace etl //*************************************************************************** bit_stream(unsigned char* begin_, unsigned char* end_) : pdata(begin_), - length(ETL_STD::distance(begin_, end_)) + length(etlstd::distance(begin_, end_)) { restart(); } @@ -128,7 +127,7 @@ namespace etl //*************************************************************************** void set_stream(char* begin_, char* end_) { - set_stream(begin_, ETL_STD::distance(begin_, end_)); + set_stream(begin_, etlstd::distance(begin_, end_)); } //*************************************************************************** @@ -136,7 +135,7 @@ namespace etl //*************************************************************************** void set_stream(unsigned char* begin_, unsigned char* end_) { - set_stream(begin_, ETL_STD::distance(begin_, end_)); + set_stream(begin_, etlstd::distance(begin_, end_)); } //*************************************************************************** @@ -181,7 +180,7 @@ namespace etl /// For integral types //*************************************************************************** template - typename etl::enable_if::value, bool>::type + typename etlstd::enable_if::value, bool>::type put(T value, uint_least8_t width = CHAR_BIT * sizeof(T)) { return put_integral(static_cast(value), width); @@ -207,7 +206,7 @@ namespace etl /// For floating point types //*************************************************************************** template - typename etl::enable_if::value, bool>::type + typename etlstd::enable_if::value, bool>::type put(T value) { bool success = true; @@ -250,7 +249,7 @@ namespace etl /// For integral types //*************************************************************************** template - typename etl::enable_if::value, bool>::type + typename etlstd::enable_if::value, bool>::type get(T& value, uint_least8_t width = CHAR_BIT * sizeof(T)) { bool success = false; @@ -266,7 +265,7 @@ namespace etl // Get the bits from the stream. while (width != 0) { - unsigned char mask_width = static_cast(ETL_STD::min(width, bits_in_byte)); + unsigned char mask_width = static_cast(etlstd::min(width, bits_in_byte)); unsigned char chunk = get_chunk(mask_width); width -= mask_width; @@ -278,7 +277,7 @@ namespace etl } // Sign extend if signed type and not already full bit width. - if (etl::is_signed::value && (bits != (CHAR_BIT * sizeof(T)))) + if (etlstd::is_signed::value && (bits != (CHAR_BIT * sizeof(T)))) { typedef typename etl::make_signed::type ST; value = etl::sign_extend(value, bits); @@ -291,7 +290,7 @@ namespace etl /// For floating point types //*************************************************************************** template - typename etl::enable_if::value, bool>::type + typename etlstd::enable_if::value, bool>::type get(T& value) { bool success = false; @@ -379,7 +378,7 @@ namespace etl // Send the bits to the stream. while (width != 0) { - unsigned char mask_width = static_cast(ETL_STD::min(width, bits_in_byte)); + unsigned char mask_width = static_cast(etlstd::min(width, bits_in_byte)); width -= mask_width; uint32_t mask = ((uint32_t(1U) << mask_width) - 1U) << width; @@ -412,7 +411,7 @@ namespace etl // Send the bits to the stream. while (width != 0) { - unsigned char mask_width = static_cast(ETL_STD::min(width, bits_in_byte)); + unsigned char mask_width = static_cast(etlstd::min(width, bits_in_byte)); width -= mask_width; uint64_t mask = ((uint64_t(1U) << mask_width) - 1U) << width; @@ -495,11 +494,11 @@ namespace etl // Network to host. if (etl::endianness::value() == etl::endian::little) { - ETL_STD::reverse_copy(data, data + sizeof(T), temp); + etlstd::reverse_copy(data, data + sizeof(T), temp); } else { - ETL_STD::copy(data, data + sizeof(T), temp); + etlstd::copy(data, data + sizeof(T), temp); } value = *reinterpret_cast(temp); @@ -516,11 +515,11 @@ namespace etl // Host to network. if (etl::endianness::value() == etl::endian::little) { - ETL_STD::reverse_copy(pf, pf + sizeof(T), data); + etlstd::reverse_copy(pf, pf + sizeof(T), data); } else { - ETL_STD::copy(pf, pf + sizeof(T), data); + etlstd::copy(pf, pf + sizeof(T), data); } } diff --git a/include/etl/bitset.h b/include/etl/bitset.h index 89fdd9b9..f68a16e4 100644 --- a/include/etl/bitset.h +++ b/include/etl/bitset.h @@ -37,8 +37,8 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" +#include "algorithm.h" +#include "iterator.h" #include "integral_limits.h" #include "algorithm.h" @@ -312,7 +312,7 @@ namespace etl { reset(); - size_t i = ETL_STD::min(NBITS, etl::strlen(text)); + size_t i = etlstd::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -329,7 +329,7 @@ namespace etl { reset(); - size_t i = ETL_STD::min(NBITS, etl::strlen(text)); + size_t i = etlstd::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -346,7 +346,7 @@ namespace etl { reset(); - size_t i = ETL_STD::min(NBITS, etl::strlen(text)); + size_t i = etlstd::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -363,7 +363,7 @@ namespace etl { reset(); - size_t i = ETL_STD::min(NBITS, etl::strlen(text)); + size_t i = etlstd::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -380,7 +380,7 @@ namespace etl { reset(); - size_t i = ETL_STD::min(NBITS, etl::strlen(text)); + size_t i = etlstd::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -394,7 +394,7 @@ namespace etl /// Put to a value. //************************************************************************* template - typename etl::enable_if::value, T>::type + typename etlstd::enable_if::value, T>::type value() const { T v = T(0); @@ -746,7 +746,7 @@ namespace etl //************************************************************************* void swap(ibitset& other) { - ETL_STD::swap_ranges(pdata, pdata + SIZE, other.pdata); + etl::swap_ranges(pdata, pdata + SIZE, other.pdata); } protected: @@ -818,7 +818,7 @@ namespace etl //************************************************************************* static bool is_equal(const ibitset& lhs, const ibitset&rhs) { - return ETL_STD::equal(lhs.pdata, lhs.pdata + lhs.SIZE, rhs.pdata); + return etlstd::equal(lhs.pdata, lhs.pdata + lhs.SIZE, rhs.pdata); } element_t TOP_MASK; @@ -976,7 +976,7 @@ namespace etl /// Put to a value. //************************************************************************* template - typename etl::enable_if::value, T>::type + typename etlstd::enable_if::value, T>::type value() const { ETL_STATIC_ASSERT((sizeof(T) * CHAR_BIT) >= (ARRAY_SIZE * BITS_PER_ELEMENT), "Type too small"); diff --git a/include/etl/bloom_filter.h b/include/etl/bloom_filter.h index 0ec97c38..dc498d15 100644 --- a/include/etl/bloom_filter.h +++ b/include/etl/bloom_filter.h @@ -104,12 +104,12 @@ namespace etl { flags.set(get_hash(key)); - if (!etl::is_same::value) + if (!etlstd::is_same::value) { flags.set(get_hash(key)); } - if (!etl::is_same::value) + if (!etlstd::is_same::value) { flags.set(get_hash(key)); } @@ -127,13 +127,13 @@ namespace etl bool exists3 = true; // Do we have a second hash? - if (!etl::is_same::value) + if (!etlstd::is_same::value) { exists2 = flags[get_hash(key)]; } // Do we have a third hash? - if (!etl::is_same::value) + if (!etlstd::is_same::value) { exists3 = flags[get_hash(key)]; } diff --git a/include/etl/char_traits.h b/include/etl/char_traits.h index d0004d9b..cdbfe298 100644 --- a/include/etl/char_traits.h +++ b/include/etl/char_traits.h @@ -31,12 +31,11 @@ SOFTWARE. #ifndef ETL_CHAR_TRAITS_INCLUDED #define ETL_CHAR_TRAITS_INCLUDED -#include "platform.h" -#include "stdint.h" -#include "algorithm.h" +#include -#include "stl/algorithm.h" -#include "stl/iterator.h" +#include "platform.h" +#include "algorithm.h" +#include "iterator.h" //***************************************************************************** ///\defgroup char_traits char_traits @@ -141,7 +140,7 @@ namespace etl { if (p != 0) { - ETL_STD::fill_n(p, n, c); + etlstd::fill_n(p, n, c); } return p; @@ -156,9 +155,9 @@ namespace etl } else { - etl::copy_n(ETL_STD::reverse_iterator(src + count), + etl::copy_n(ETL_OR_STD::reverse_iterator(src + count), count, - ETL_STD::reverse_iterator(dest + count)); + ETL_OR_STD::reverse_iterator(dest + count)); } return dest; diff --git a/include/etl/compare.h b/include/etl/compare.h index 3fbb3e9f..fc23c418 100644 --- a/include/etl/compare.h +++ b/include/etl/compare.h @@ -33,8 +33,7 @@ SOFTWARE. #include "platform.h" #include "parameter_type.h" - -#include "stl/functional.h" +#include "functional.h" //***************************************************************************** ///\defgroup compare compare @@ -48,7 +47,7 @@ namespace etl /// Defines <=, >, >= interms of < /// Default //*************************************************************************** - template > + template > struct compare { typedef typename etl::parameter_type::type first_argument_type; diff --git a/include/etl/container.h b/include/etl/container.h index dfadbb53..572a6286 100644 --- a/include/etl/container.h +++ b/include/etl/container.h @@ -34,8 +34,7 @@ SOFTWARE. #include #include "platform.h" - -#include "stl/iterator.h" +#include "iterator.h" ///\defgroup container container ///\ingroup utilities @@ -177,9 +176,9 @@ namespace etl ///\ingroup container //***************************************************************************** template - ETL_CONSTEXPR ETL_STD::reverse_iterator rbegin(const TValue(&data)[ARRAY_SIZE]) + ETL_OR_STD::reverse_iterator rbegin(const TValue(&data)[ARRAY_SIZE]) { - return ETL_STD::reverse_iterator(&data[ARRAY_SIZE]); + return ETL_OR_STD::reverse_iterator(&data[ARRAY_SIZE]); } //***************************************************************************** @@ -187,9 +186,9 @@ namespace etl ///\ingroup container //***************************************************************************** template - ETL_CONSTEXPR ETL_STD::reverse_iterator crbegin(const TValue(&data)[ARRAY_SIZE]) + ETL_CONSTEXPR ETL_OR_STD::reverse_iterator crbegin(const TValue(&data)[ARRAY_SIZE]) { - return ETL_STD::reverse_iterator(&data[ARRAY_SIZE]); + return ETL_OR_STD::reverse_iterator(&data[ARRAY_SIZE]); } //***************************************************************************** @@ -227,9 +226,9 @@ namespace etl ///\ingroup container //***************************************************************************** template - ETL_CONSTEXPR ETL_STD::reverse_iterator rend(const TValue(&data)[ARRAY_SIZE]) + ETL_CONSTEXPR ETL_OR_STD::reverse_iterator rend(const TValue(&data)[ARRAY_SIZE]) { - return ETL_STD::reverse_iterator(&data[0]); + return ETL_OR_STD::reverse_iterator(&data[0]); } //***************************************************************************** @@ -237,31 +236,9 @@ namespace etl ///\ingroup container //***************************************************************************** template - ETL_CONSTEXPR ETL_STD::reverse_iterator crend(const TValue(&data)[ARRAY_SIZE]) + ETL_CONSTEXPR ETL_OR_STD::reverse_iterator crend(const TValue(&data)[ARRAY_SIZE]) { - return ETL_STD::reverse_iterator(&data[0]); - } - - //***************************************************************************** - /// Get the next iterator. - ///\ingroup container - //***************************************************************************** - template - TIterator next(TIterator iterator, ptrdiff_t n = 1) - { - ETL_STD::advance(iterator, n); - return iterator; - } - - //***************************************************************************** - /// Get the previous iterator. - ///\ingroup container - //***************************************************************************** - template - TIterator prev(TIterator iterator, ptrdiff_t n = 1) - { - ETL_STD::advance(iterator, -n); - return iterator; + return ETL_OR_STD::reverse_iterator(&data[0]); } ///************************************************************************** diff --git a/include/etl/cstring.h b/include/etl/cstring.h index 958279ab..9479f394 100644 --- a/include/etl/cstring.h +++ b/include/etl/cstring.h @@ -191,7 +191,7 @@ namespace etl { ETL_ASSERT(position < this->size(), ETL_ERROR(string_out_of_bounds)); - length_ = ETL_STD::min(length_, this->size() - position); + length_ = etlstd::min(length_, this->size() - position); new_string.assign(buffer + position, buffer + position + length_); } diff --git a/include/etl/cumulative_moving_average.h b/include/etl/cumulative_moving_average.h index 1480152d..eedb774e 100644 --- a/include/etl/cumulative_moving_average.h +++ b/include/etl/cumulative_moving_average.h @@ -44,8 +44,8 @@ namespace etl template ::value, - const bool IsFloat = etl::is_floating_point::value> + const bool IsIntegral = etlstd::is_integral::value, + const bool IsFloat = etlstd::is_floating_point::value> class cumulative_moving_average; //*************************************************************************** @@ -58,8 +58,8 @@ namespace etl template class cumulative_moving_average { - typedef typename etl::conditional::value, int32_t, uint32_t>::type scale_t; - typedef typename etl::conditional::value, int32_t, uint32_t>::type sample_t; + typedef typename etlstd::conditional::value, int32_t, uint32_t>::type scale_t; + typedef typename etlstd::conditional::value, int32_t, uint32_t>::type sample_t; static const sample_t SAMPLES = static_cast(SAMPLE_SIZE_); static const scale_t SCALE = static_cast(SCALING_); @@ -121,8 +121,8 @@ namespace etl template class cumulative_moving_average { - typedef typename etl::conditional::value, int32_t, uint32_t>::type scale_t; - typedef typename etl::conditional::value, int32_t, uint32_t>::type sample_t; + typedef typename etlstd::conditional::value, int32_t, uint32_t>::type scale_t; + typedef typename etlstd::conditional::value, int32_t, uint32_t>::type sample_t; static const scale_t SCALE = static_cast(SCALING_); diff --git a/include/etl/cyclic_value.h b/include/etl/cyclic_value.h index dadcb277..b4173bc6 100644 --- a/include/etl/cyclic_value.h +++ b/include/etl/cyclic_value.h @@ -43,7 +43,7 @@ SOFTWARE. #include "static_assert.h" #include "type_traits.h" -#include "stl/algorithm.h" +#include "algorithm.h" namespace etl { @@ -257,7 +257,13 @@ namespace etl //************************************************************************* void swap(cyclic_value& other) { - ETL_STD::swap(value, other.value); +#if defined(ETL_NO_STL) + using etlstd::swap; +#else + using std::swap; +#endif + + swap(value, other.value); } //************************************************************************* @@ -298,7 +304,7 @@ namespace etl ///\ingroup cyclic_value //*************************************************************************** template - class cyclic_value::type> + class cyclic_value::type> { public: @@ -531,9 +537,15 @@ namespace etl //************************************************************************* void swap(cyclic_value& other) { - ETL_STD::swap(first_value, other.first_value); - ETL_STD::swap(last_value, other.last_value); - ETL_STD::swap(value, other.value); +#if defined(ETL_NO_STL) + using etlstd::swap; +#else + using std::swap; +#endif + + swap(first_value, other.first_value); + swap(last_value, other.last_value); + swap(value, other.value); } //************************************************************************* diff --git a/include/etl/deque.h b/include/etl/deque.h index 8f340ec0..94bddb7e 100644 --- a/include/etl/deque.h +++ b/include/etl/deque.h @@ -38,9 +38,9 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/utility.h" +#include "algorithm.h" +#include "iterator.h" +#include "utility.h" #include "container.h" #include "alignment.h" @@ -239,7 +239,7 @@ namespace etl #endif typedef T* pointer; typedef const T* const_pointer; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -247,7 +247,7 @@ namespace etl /// Test for an iterator. //************************************************************************* template - struct is_iterator : public etl::integral_constant::value && !etl::is_floating_point::value> + struct is_iterator : public etl::integral_constant::value && !etlstd::is_floating_point::value> { }; @@ -256,7 +256,7 @@ namespace etl //************************************************************************* /// Iterator //************************************************************************* - struct iterator : public etl::iterator + struct iterator : public etl::iterator { friend class ideque; @@ -421,7 +421,13 @@ namespace etl //*************************************************** void swap(iterator& other) { - ETL_STD::swap(index, other.index); +#if defined(ETL_NO_STL) + using etlstd::swap; +#else + using std::swap; +#endif + + swap(index, other.index); } private: @@ -442,7 +448,7 @@ namespace etl //************************************************************************* /// Const Iterator //************************************************************************* - struct const_iterator : public etl::iterator + struct const_iterator : public etl::iterator { friend class ideque; @@ -603,7 +609,7 @@ namespace etl //*************************************************** void swap(const_iterator& other) { - ETL_STD::swap(index, other.index); + swap(index, other.index); } private: @@ -634,14 +640,14 @@ namespace etl pointer p_buffer; }; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; //************************************************************************* /// Assigns a range to the deque. //************************************************************************* template - typename etl::enable_if::value, void>::type + typename etlstd::enable_if::value, void>::type assign(TIterator range_begin, TIterator range_end) { initialise(); @@ -893,13 +899,13 @@ namespace etl else { // Are we closer to the front? - if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1)) + if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - ETL_STD::copy(_begin + 1, position, _begin); + etlstd::copy(_begin + 1, position, _begin); // Write the new value. *--position = value; @@ -910,7 +916,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - ETL_STD::copy_backward(position, _end - 2, _end - 1); + etlstd::copy_backward(position, _end - 2, _end - 1); // Write the new value. *position = value; @@ -935,38 +941,38 @@ namespace etl if (insert_position == begin()) { - create_element_front(ETL_STD::move(value)); + create_element_front(etlstd::move(value)); position = _begin; } else if (insert_position == end()) { - create_element_back(ETL_STD::move(value)); + create_element_back(etlstd::move(value)); position = _end - 1; } else { // Are we closer to the front? - if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1)) + if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) { // Construct the _begin. - create_element_front(ETL_STD::move(*_begin)); + create_element_front(etlstd::move(*_begin)); // Move the values. - ETL_STD::move(_begin + 1, position, _begin); + etlstd::move(_begin + 1, position, _begin); // Write the new value. - *--position = ETL_STD::move(value); + *--position = etlstd::move(value); } else { // Construct the _end. - create_element_back(ETL_STD::move(*(_end - 1))); + create_element_back(etlstd::move(*(_end - 1))); // Move the values. - ETL_STD::move_backward(position, _end - 2, _end - 1); + etlstd::move_backward(position, _end - 2, _end - 1); // Write the new value. - *position = ETL_STD::move(value); + *position = etlstd::move(value); } } @@ -1008,13 +1014,13 @@ namespace etl else { // Are we closer to the front? - if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1)) + if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - ETL_STD::copy(_begin + 1, position, _begin); + etlstd::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1027,7 +1033,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - ETL_STD::copy_backward(position, _end - 2, _end - 1); + etlstd::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1035,7 +1041,7 @@ namespace etl } } - ::new (p) T(ETL_STD::forward(args)...); + ::new (p) T(etlstd::forward(args)...); return position; } @@ -1075,13 +1081,13 @@ namespace etl else { // Are we closer to the front? - if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1)) + if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - ETL_STD::copy(_begin + 1, position, _begin); + etlstd::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1094,7 +1100,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - ETL_STD::copy_backward(position, _end - 2, _end - 1); + etlstd::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1140,13 +1146,13 @@ namespace etl else { // Are we closer to the front? - if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1)) + if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - ETL_STD::copy(_begin + 1, position, _begin); + etlstd::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1159,7 +1165,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - ETL_STD::copy_backward(position, _end - 2, _end - 1); + etlstd::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1205,13 +1211,13 @@ namespace etl else { // Are we closer to the front? - if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1)) + if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - ETL_STD::copy(_begin + 1, position, _begin); + etlstd::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1224,7 +1230,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - ETL_STD::copy_backward(position, _end - 2, _end - 1); + etlstd::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1270,13 +1276,13 @@ namespace etl else { // Are we closer to the front? - if (ETL_STD::distance(_begin, position) < ETL_STD::distance(position, _end - 1)) + if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - ETL_STD::copy(_begin + 1, position, _begin); + etlstd::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1289,7 +1295,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - ETL_STD::copy_backward(position, _end - 2, _end - 1); + etlstd::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1343,8 +1349,8 @@ namespace etl if (distance(_begin, insert_position) <= difference_type(current_size / 2)) { size_t n_insert = n; - size_t n_move = ETL_STD::distance(begin(), position); - size_t n_create_copy = ETL_STD::min(n_insert, n_move); + size_t n_move = etlstd::distance(begin(), position); + size_t n_create_copy = etlstd::min(n_insert, n_move); size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0; size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0; size_t n_copy_old = n_move - n_create_copy; @@ -1372,15 +1378,15 @@ namespace etl // Copy new. to = position - n_create_copy; - ETL_STD::fill_n(to, n_copy_new, value); + etlstd::fill_n(to, n_copy_new, value); position = _begin + n_move; } else { size_t n_insert = n; - size_t n_move = ETL_STD::distance(position, end()); - size_t n_create_copy = ETL_STD::min(n_insert, n_move); + size_t n_move = etlstd::distance(position, end()); + size_t n_create_copy = etlstd::min(n_insert, n_move); size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0; size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0; size_t n_copy_old = n_move - n_create_copy; @@ -1400,10 +1406,10 @@ namespace etl } // Copy old. - ETL_STD::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old); + etlstd::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old); // Copy new. - ETL_STD::fill_n(position, n_copy_new, value); + etlstd::fill_n(position, n_copy_new, value); } } @@ -1423,7 +1429,7 @@ namespace etl { iterator position; - difference_type n = ETL_STD::distance(range_begin, range_end); + difference_type n = etlstd::distance(range_begin, range_end); ETL_ASSERT((current_size + n) <= CAPACITY, ETL_ERROR(deque_full)); @@ -1451,8 +1457,8 @@ namespace etl if (distance(_begin, insert_position) < difference_type(current_size / 2)) { size_t n_insert = n; - size_t n_move = ETL_STD::distance(begin(), position); - size_t n_create_copy = ETL_STD::min(n_insert, n_move); + size_t n_move = etlstd::distance(begin(), position); + size_t n_create_copy = etlstd::min(n_insert, n_move); size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0; size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0; size_t n_copy_old = n_move - n_create_copy; @@ -1482,8 +1488,8 @@ namespace etl else { size_t n_insert = n; - size_t n_move = ETL_STD::distance(position, end()); - size_t n_create_copy = ETL_STD::min(n_insert, n_move); + size_t n_move = etlstd::distance(position, end()); + size_t n_create_copy = etlstd::min(n_insert, n_move); size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0; size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0; size_t n_copy_old = n_move - n_create_copy; @@ -1504,7 +1510,7 @@ namespace etl } // Copy old. - ETL_STD::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old); + etlstd::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old); // Copy new. item = range_begin; @@ -1541,13 +1547,13 @@ namespace etl // Are we closer to the front? if (distance(_begin, position) < difference_type(current_size / 2)) { - ETL_STD::copy_backward(_begin, position, position + 1); + etlstd::copy_backward(_begin, position, position + 1); destroy_element_front(); ++position; } else { - ETL_STD::copy(position + 1, _end, position); + etlstd::copy(position + 1, _end, position); destroy_element_back(); } } @@ -1568,7 +1574,7 @@ namespace etl ETL_ASSERT((distance(range_begin) <= difference_type(current_size)) && (distance(range_end) <= difference_type(current_size)), ETL_ERROR(deque_out_of_bounds)); // How many to erase? - size_t length = ETL_STD::distance(range_begin, range_end); + size_t length = etlstd::distance(range_begin, range_end); // At the beginning? if (position == _begin) @@ -1597,7 +1603,7 @@ namespace etl if (distance(_begin, position) < difference_type(current_size / 2)) { // Move the items. - ETL_STD::copy_backward(_begin, position, position + length); + etlstd::copy_backward(_begin, position, position + length); for (size_t i = 0; i < length; ++i) { @@ -1610,7 +1616,7 @@ namespace etl // Must be closer to the back. { // Move the items. - ETL_STD::copy(position + length, _end, position); + etlstd::copy(position + length, _end, position); for (size_t i = 0; i < length; ++i) { @@ -1646,7 +1652,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(deque_full)); #endif - create_element_back(ETL_STD::move(item)); + create_element_back(etlstd::move(item)); } #endif @@ -1662,7 +1668,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(deque_full)); #endif - ::new (&(*_end)) T(ETL_STD::forward(args)...); + ::new (&(*_end)) T(etlstd::forward(args)...); ++_end; ++current_size; ETL_INCREMENT_DEBUG_COUNT @@ -1774,7 +1780,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(deque_full)); #endif - create_element_front(ETL_STD::move(item)); + create_element_front(etlstd::move(item)); } #endif @@ -1791,7 +1797,7 @@ namespace etl #endif --_begin; - ::new (&(*_begin)) T(ETL_STD::forward(args)...); + ::new (&(*_begin)) T(etlstd::forward(args)...); ++current_size; ETL_INCREMENT_DEBUG_COUNT } @@ -1965,7 +1971,7 @@ namespace etl iterator itr = rhs.begin(); while (itr != rhs.end()) { - push_back(ETL_STD::move(*itr)); + push_back(etlstd::move(*itr)); ++itr; } @@ -2117,7 +2123,7 @@ namespace etl void create_element_front(rvalue_reference value) { --_begin; - ::new (&(*_begin)) T(ETL_STD::move(value)); + ::new (&(*_begin)) T(etlstd::move(value)); ++current_size; ETL_INCREMENT_DEBUG_COUNT } @@ -2127,7 +2133,7 @@ namespace etl //********************************************************************* void create_element_back(rvalue_reference value) { - ::new (&(*_end)) T(ETL_STD::move(value)); + ::new (&(*_end)) T(etlstd::move(value)); ++_end; ++current_size; ETL_INCREMENT_DEBUG_COUNT @@ -2233,7 +2239,7 @@ namespace etl typedef T& reference; typedef const T& const_reference; typedef size_t size_type; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; //************************************************************************* /// Default constructor. @@ -2278,7 +2284,7 @@ namespace etl typename etl::ideque::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -2342,7 +2348,7 @@ namespace etl typename etl::ideque::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -2371,7 +2377,7 @@ namespace etl private: /// The uninitialised buffer of T used in the deque. - typename etl::aligned_storage::value>::type buffer[BUFFER_SIZE]; + typename etl::aligned_storage::value>::type buffer[BUFFER_SIZE]; }; //*************************************************************************** @@ -2384,7 +2390,7 @@ namespace etl template bool operator ==(const etl::ideque& lhs, const etl::ideque& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2410,10 +2416,10 @@ namespace etl template bool operator <(const etl::ideque& lhs, const etl::ideque& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), - lhs.end(), - rhs.begin(), - rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), + lhs.end(), + rhs.begin(), + rhs.end()); } //*************************************************************************** diff --git a/include/etl/fixed_iterator.h b/include/etl/fixed_iterator.h index 877babb6..8fdaf77e 100644 --- a/include/etl/fixed_iterator.h +++ b/include/etl/fixed_iterator.h @@ -34,7 +34,7 @@ SOFTWARE. #include "platform.h" #include "iterator.h" -#include "stl/iterator.h" +#include "iterator.h" ///\defgroup iterator Iterator types @@ -45,7 +45,7 @@ namespace etl /// This can be useful when using STL algorithms to interact with fixed memory locations such as registers. ///\ingroup iterator template - class fixed_iterator : etl::iterator::iterator_category, typename ETL_STD::iterator_traits::value_type> + class fixed_iterator : etl::iterator::iterator_category, typename etlstd::iterator_traits::value_type> { public: @@ -100,7 +100,7 @@ namespace etl //*************************************************************************** /// Dereference operator. //*************************************************************************** - typename ETL_STD::iterator_traits::value_type operator *() + typename etlstd::iterator_traits::value_type operator *() { return *it; } @@ -108,7 +108,7 @@ namespace etl //*************************************************************************** /// Dereference operator. //*************************************************************************** - const typename ETL_STD::iterator_traits::value_type operator *() const + const typename etlstd::iterator_traits::value_type operator *() const { return *it; } @@ -140,7 +140,7 @@ namespace etl //*************************************************************************** /// += operator. //*************************************************************************** - fixed_iterator& operator +=(typename ETL_STD::iterator_traits::difference_type /*offset*/) + fixed_iterator& operator +=(typename etlstd::iterator_traits::difference_type /*offset*/) { return *this; } @@ -148,7 +148,7 @@ namespace etl //*************************************************************************** /// -= operator. //*************************************************************************** - fixed_iterator& operator -=(typename ETL_STD::iterator_traits::difference_type /*offset*/) + fixed_iterator& operator -=(typename etlstd::iterator_traits::difference_type /*offset*/) { return *this; } @@ -181,7 +181,7 @@ namespace etl //***************************************************************************** template etl::fixed_iterator& operator +(etl::fixed_iterator& lhs, - typename ETL_STD::iterator_traits::difference_type /*rhs*/) + typename etlstd::iterator_traits::difference_type /*rhs*/) { return lhs; } @@ -191,7 +191,7 @@ namespace etl //***************************************************************************** template etl::fixed_iterator& operator -(etl::fixed_iterator& lhs, - typename ETL_STD::iterator_traits::difference_type /*rhs*/) + typename etlstd::iterator_traits::difference_type /*rhs*/) { return lhs; } @@ -200,7 +200,7 @@ namespace etl /// - fixed_iterator operator. //***************************************************************************** template - typename ETL_STD::iterator_traits::difference_type operator -(etl::fixed_iterator& lhs, + typename etlstd::iterator_traits::difference_type operator -(etl::fixed_iterator& lhs, etl::fixed_iterator& rhs) { return TIterator(lhs) - TIterator(rhs); diff --git a/include/etl/flat_map.h b/include/etl/flat_map.h index 8375e9a9..1ba17f4b 100644 --- a/include/etl/flat_map.h +++ b/include/etl/flat_map.h @@ -40,7 +40,7 @@ SOFTWARE. #if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL) #include #endif -#include "stl/utility.h" +#include "utility.h" #undef ETL_FILE #define ETL_FILE "2" @@ -60,7 +60,7 @@ namespace etl /// Can be used as a reference type for all flat_maps containing a specific type. ///\ingroup flat_map //*************************************************************************** - template > + template > class iflat_map : private etl::ireference_flat_map { private: @@ -85,9 +85,9 @@ namespace etl typedef typename refmap_t::iterator iterator; typedef typename refmap_t::const_iterator const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -268,7 +268,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_map_full)); #endif @@ -352,7 +352,7 @@ namespace etl // Create it. value_type* pvalue = storage.allocate(); ::new ((void*)etl::addressof(pvalue->first)) key_type(key); - ::new ((void*)etl::addressof(pvalue->second)) mapped_type(ETL_STD::forward(args)...); + ::new ((void*)etl::addressof(pvalue->second)) mapped_type(etlstd::forward(args)...); iterator i_element = lower_bound(key); @@ -793,7 +793,7 @@ namespace etl template bool operator ==(const etl::iflat_map& lhs, const etl::iflat_map& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -813,11 +813,11 @@ namespace etl /// A flat_map implementation that uses a fixed size buffer. ///\tparam TKey The key type. ///\tparam TValue The value type. - ///\tparam TCompare The type to compare keys. Default = ETL_STD::less + ///\tparam TCompare The type to compare keys. Default = etlstd::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup flat_map //*************************************************************************** - template > + template > class flat_map : public etl::iflat_map { public: diff --git a/include/etl/flat_multimap.h b/include/etl/flat_multimap.h index 0069ea92..fcdfd017 100644 --- a/include/etl/flat_multimap.h +++ b/include/etl/flat_multimap.h @@ -59,7 +59,7 @@ namespace etl /// Can be used as a reference type for all flat_multimaps containing a specific type. ///\ingroup flat_multimap //*************************************************************************** - template > + template > class iflat_multimap : public etl::ireference_flat_multimap { public: @@ -86,9 +86,9 @@ namespace etl typedef typename refmap_t::iterator iterator; typedef typename refmap_t::const_iterator const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -237,7 +237,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multimap_full)); #endif @@ -334,7 +334,7 @@ namespace etl // Create it. value_type* pvalue = storage.allocate(); ::new ((void*)etl::addressof(pvalue->first)) key_type(key); - ::new ((void*)etl::addressof(pvalue->second)) mapped_type(ETL_STD::forward(args)...); + ::new ((void*)etl::addressof(pvalue->second)) mapped_type(etlstd::forward(args)...); iterator i_element = lower_bound(key); ETL_INCREMENT_DEBUG_COUNT @@ -431,7 +431,7 @@ namespace etl } else { - size_t d = ETL_STD::distance(range.first, range.second); + size_t d = etlstd::distance(range.first, range.second); erase(range.first, range.second); return d; } @@ -700,7 +700,7 @@ namespace etl template bool operator ==(const etl::iflat_multimap& lhs, const etl::iflat_multimap& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -720,11 +720,11 @@ namespace etl /// A flat_multimap implementation that uses a fixed size buffer. ///\tparam TKey The key type. ///\tparam TValue The value type. - ///\tparam TCompare The type to compare keys. Default = ETL_STD::less + ///\tparam TCompare The type to compare keys. Default = etlstd::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup flat_multimap //*************************************************************************** - template > + template > class flat_multimap : public etl::iflat_multimap { public: diff --git a/include/etl/flat_multiset.h b/include/etl/flat_multiset.h index 931f61c6..0014d1e2 100644 --- a/include/etl/flat_multiset.h +++ b/include/etl/flat_multiset.h @@ -57,7 +57,7 @@ namespace etl /// Can be used as a reference type for all flat_multisets containing a specific type. ///\ingroup flat_multiset //*************************************************************************** - template > + template > class iflat_multiset : private etl::ireference_flat_multiset { private: @@ -80,9 +80,9 @@ namespace etl typedef typename refset_t::iterator iterator; typedef typename refset_t::const_iterator const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -209,7 +209,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multiset_full)); #endif @@ -232,7 +232,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full)); - iterator i_element = ETL_STD::lower_bound(begin(), end(), value, compare); + iterator i_element = etlstd::lower_bound(begin(), end(), value, compare); value_type* pvalue = storage.allocate(); ::new (pvalue) value_type(value); @@ -289,7 +289,7 @@ namespace etl // Create it. value_type* pvalue = storage.allocate(); - ::new (pvalue) value_type(ETL_STD::forward(args)...); + ::new (pvalue) value_type(etlstd::forward(args)...); iterator i_element = lower_bound(*pvalue); @@ -385,7 +385,7 @@ namespace etl } else { - size_t d = ETL_STD::distance(range.first, range.second); + size_t d = etlstd::distance(range.first, range.second); erase(range.first, range.second); return d; } @@ -656,7 +656,7 @@ namespace etl template bool operator ==(const etl::iflat_multiset& lhs, const etl::iflat_multiset& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -675,11 +675,11 @@ namespace etl //*************************************************************************** /// A flat_multiset implementation that uses a fixed size buffer. ///\tparam T The value type. - ///\tparam TCompare The type to compare keys. Default = ETL_STD::less + ///\tparam TCompare The type to compare keys. Default = etlstd::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup flat_multiset //*************************************************************************** - template > + template > class flat_multiset : public etl::iflat_multiset { public: diff --git a/include/etl/flat_set.h b/include/etl/flat_set.h index 9b0e2d76..6884e410 100644 --- a/include/etl/flat_set.h +++ b/include/etl/flat_set.h @@ -59,7 +59,7 @@ namespace etl /// Can be used as a reference type for all flat_sets containing a specific type. ///\ingroup flat_set //*************************************************************************** - template > + template > class iflat_set : private etl::ireference_flat_set { private: @@ -82,9 +82,9 @@ namespace etl typedef typename refset_t::iterator iterator; typedef typename refset_t::const_iterator const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -211,7 +211,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_set_full)); #endif @@ -296,7 +296,7 @@ namespace etl // Create it. value_type* pvalue = storage.allocate(); - ::new (pvalue) value_type(ETL_STD::forward(args)...); + ::new (pvalue) value_type(etlstd::forward(args)...); iterator i_element = lower_bound(*pvalue); @@ -739,7 +739,7 @@ namespace etl template bool operator ==(const etl::iflat_set& lhs, const etl::iflat_set& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -758,11 +758,11 @@ namespace etl //*************************************************************************** /// A flat_set implementation that uses a fixed size buffer. ///\tparam T The value type. - ///\tparam TCompare The type to compare keys. Default = ETL_STD::less + ///\tparam TCompare The type to compare keys. Default = etlstd::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup flat_set //*************************************************************************** - template > + template > class flat_set : public etl::iflat_set { public: diff --git a/include/etl/forward_list.h b/include/etl/forward_list.h index 76e03ac8..7cabec02 100644 --- a/include/etl/forward_list.h +++ b/include/etl/forward_list.h @@ -37,10 +37,10 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" -#include "stl/utility.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" +#include "utility.h" #include "pool.h" #include "container.h" @@ -404,7 +404,7 @@ namespace etl //************************************************************************* /// iterator. //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -492,7 +492,7 @@ namespace etl //************************************************************************* /// const_iterator //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -572,7 +572,7 @@ namespace etl const node_t* p_node; }; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; //************************************************************************* /// Gets the beginning of the forward_list. @@ -671,7 +671,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(forward_list_iterator)); #endif @@ -735,7 +735,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(forward_list_full)); #endif - data_node_t& data_node = allocate_data_node(ETL_STD::move(value)); + data_node_t& data_node = allocate_data_node(etlstd::move(value)); insert_node_after(start_node, data_node); } #endif @@ -751,7 +751,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(forward_list_full)); #endif data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(ETL_STD::forward(args)...); + ::new (&(p_data_node->value)) T(etlstd::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node_after(start_node, *p_data_node); } @@ -907,7 +907,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(forward_list_full)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(ETL_STD::forward(args)...); + ::new (&(p_data_node->value)) T(etlstd::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node_after(*position.p_node, *p_data_node); @@ -1001,7 +1001,7 @@ namespace etl void insert_after(iterator position, TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT((d + size()) <= MAX_SIZE, ETL_ERROR(forward_list_full)); #endif @@ -1141,7 +1141,7 @@ namespace etl //************************************************************************* void unique() { - unique(ETL_STD::equal_to()); + unique(etlstd::equal_to()); } //************************************************************************* @@ -1182,7 +1182,7 @@ namespace etl //************************************************************************* void sort() { - sort(ETL_STD::less()); + sort(etlstd::less()); } //************************************************************************* @@ -1386,7 +1386,7 @@ namespace etl //************************************************************************* iforward_list& operator = (iforward_list&& rhs) { - move_container(ETL_STD::move(rhs)); + move_container(etlstd::move(rhs)); return *this; } @@ -1460,7 +1460,7 @@ namespace etl data_node_t& allocate_data_node(rvalue_reference value) { data_node_t* p_node = p_node_pool->allocate(); - ::new (&(p_node->value)) T(ETL_STD::move(value)); + ::new (&(p_node->value)) T(etlstd::move(value)); ETL_INCREMENT_DEBUG_COUNT return *p_node; @@ -1487,7 +1487,7 @@ namespace etl { ETL_ASSERT(!full(), ETL_ERROR(forward_list_full)); - data_node_t& data_node = this->allocate_data_node(ETL_STD::move(*first++)); + data_node_t& data_node = this->allocate_data_node(etlstd::move(*first++)); join(p_last_node, &data_node); data_node.next = nullptr; p_last_node = &data_node; @@ -1633,7 +1633,7 @@ namespace etl forward_list(forward_list&& other) : etl::iforward_list(node_pool, MAX_SIZE, false) { - this->move_container(ETL_STD::move(other)); + this->move_container(etlstd::move(other)); } #endif @@ -1686,7 +1686,7 @@ namespace etl forward_list& operator = (forward_list&& rhs) { - this->move_container(ETL_STD::move(rhs)); + this->move_container(etlstd::move(rhs)); return *this; } @@ -1774,7 +1774,7 @@ namespace etl typename etl::iforward_list::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -1831,7 +1831,7 @@ namespace etl //************************************************************************* forward_list& operator = (forward_list&& rhs) { - this->move_container(ETL_STD::move(rhs)); + this->move_container(etlstd::move(rhs)); return *this; } @@ -1862,7 +1862,7 @@ namespace etl bool operator ==(const etl::iforward_list& lhs, const etl::iforward_list& rhs) { return (lhs.size() == rhs.size()) && - ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -1887,10 +1887,7 @@ namespace etl template bool operator <(const etl::iforward_list& lhs, const etl::iforward_list& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), - lhs.end(), - rhs.begin(), - rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/frame_check_sequence.h b/include/etl/frame_check_sequence.h index a1ed9028..7873d4e2 100644 --- a/include/etl/frame_check_sequence.h +++ b/include/etl/frame_check_sequence.h @@ -34,7 +34,7 @@ SOFTWARE. #include "type_traits.h" #include "binary.h" -#include "stl/iterator.h" +#include "iterator.h" ETL_STATIC_ASSERT(ETL_8BIT_SUPPORT, "This file does not currently support targets with no 8bit type"); @@ -56,7 +56,7 @@ namespace etl typedef TPolicy policy_type; typedef typename policy_type::value_type value_type; - ETL_STATIC_ASSERT(etl::is_unsigned::value, "Signed frame check type not supported"); + ETL_STATIC_ASSERT(etlstd::is_unsigned::value, "Signed frame check type not supported"); //************************************************************************* /// Default constructor. @@ -74,7 +74,7 @@ namespace etl template frame_check_sequence(TIterator begin, const TIterator end) { - ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits::value_type) == 1, "Type not supported"); + ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Type not supported"); reset(); add(begin, end); @@ -96,7 +96,7 @@ namespace etl template void add(TIterator begin, const TIterator end) { - ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits::value_type) == 1, "Type not supported"); + ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Type not supported"); while (begin != end) { diff --git a/include/etl/functional.h b/include/etl/functional.h index 68300759..46f1f5ac 100644 --- a/include/etl/functional.h +++ b/include/etl/functional.h @@ -39,7 +39,7 @@ SOFTWARE. ///\defgroup reference_wrapper reference_wrapper ///\ingroup functional -namespace etl +namespace etlstd { //*************************************************************************** /// A definition of reference_wrapper for those that don't have C++ 0x11 support. @@ -105,6 +105,130 @@ namespace etl { return reference_wrapper(t.get()); } + + //*************************************************************************** + template + struct less + { + ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const + { + return lhs < rhs; + } + }; + + //*************************************************************************** + template + struct greater + { + ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const + { + return lhs > rhs; + } + }; + + //*************************************************************************** + template + struct equal_to + { + ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const + { + return lhs == rhs; + } + }; + + //*************************************************************************** + template + struct not_equal_to + { + ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const + { + return lhs != rhs; + } + }; + + //*************************************************************************** + + template + struct unary_function + { + typedef TArgumentType argument_type; + typedef TResultType result_type; + }; + + //*************************************************************************** + + template + struct binary_function + { + typedef TFirstArgumentType first_argument_type; + typedef TSecondArgumentType second_argument_type; + typedef TResultType result_type; + }; + + //*************************************************************************** + + template + class binder1st : public etlstd::unary_function + { + protected: + + TFunction operation; + typename TFunction::first_argument_type value; + + public: + + binder1st(const TFunction& f, const typename TFunction::first_argument_type& v) + : operation(f), value(v) + { + } + + typename TFunction::result_type operator()(typename TFunction::second_argument_type& x) const + { + return operation(value, x); + } + + typename TFunction::result_type operator()(const typename TFunction::second_argument_type& x) const + { + return operation(value, x); + } + }; + + template + binder1st bind1st(const F& f, const T& x) + { + return binder1st(f, x); + } + + //*************************************************************************** + + template + class binder2nd : public etlstd::unary_function + { + protected: + TFunction operation; + typename TFunction::second_argument_type value; + public: + binder2nd(const TFunction& f, const typename TFunction::second_argument_type& v) + : operation(f), value(v) + { + } + + typename TFunction::result_type operator()(typename TFunction::first_argument_type& x) const + { + return operation(x, value); + } + + typename TFunction::result_type operator()(const typename TFunction::first_argument_type& x) const + { + return operation(x, value); + } + }; + + template + binder2nd bind2nd(const F& f, const T& x) + { + return binder2nd(f, x); + } } #endif diff --git a/include/etl/ihash.h b/include/etl/ihash.h index 18d11bca..22160f91 100644 --- a/include/etl/ihash.h +++ b/include/etl/ihash.h @@ -35,7 +35,7 @@ SOFTWARE. #include "platform.h" -#include "stl/utility.h" +#include "utility.h" #include "exception.h" #include "error_handler.h" diff --git a/include/etl/indirect_vector.h b/include/etl/indirect_vector.h index 238030be..68e820bc 100644 --- a/include/etl/indirect_vector.h +++ b/include/etl/indirect_vector.h @@ -35,9 +35,8 @@ SOFTWARE. #include "vector.h" #include "pool.h" #include "iterator.h" - -#include "stl/iterator.h" -#include "stl/functional.h" +#include "iterator.h" +#include "functional.h" #if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL) #include @@ -183,7 +182,7 @@ namespace etl //************************************************************************* /// iterator. //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -329,7 +328,7 @@ namespace etl //************************************************************************* /// const_iterator. //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -459,8 +458,8 @@ namespace etl indirect_const_iterator lookup_itr; }; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; protected: @@ -717,10 +716,10 @@ namespace etl template void assign(TIterator first, TIterator last) { - ETL_STATIC_ASSERT((etl::is_same::type, typename etl::remove_cv::value_type>::type>::value), "Iterator type does not match container type"); + ETL_STATIC_ASSERT((etlstd::is_same::type, typename etlstd::remove_cv::value_type>::type>::value), "Iterator type does not match container type"); #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(static_cast(d) <= capacity(), ETL_ERROR(vector_full)); #endif @@ -786,7 +785,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(size() != capacity(), ETL_ERROR(vector_full)); #endif - T* p = storage.create(ETL_STD::move(value)); + T* p = storage.create(etlstd::move(value)); lookup.push_back(p); } #endif @@ -800,7 +799,7 @@ namespace etl template void emplace_back(Args && ... args) { - T* p = storage.create(ETL_STD::forward(args)...); + T* p = storage.create(etlstd::forward(args)...); lookup.push_back(p); } #else @@ -892,7 +891,7 @@ namespace etl { ETL_ASSERT(size() + 1 <= capacity(), ETL_ERROR(vector_full)); - T* p = storage.create(T(ETL_STD::move(value))); + T* p = storage.create(T(etlstd::move(value))); position = iterator(lookup.insert(position.lookup_itr, p)); return position; @@ -908,7 +907,7 @@ namespace etl { ETL_ASSERT(!full(), ETL_ERROR(vector_full)); - T* p = storage.create(T(ETL_STD::forward(args)...)); + T* p = storage.create(T(etlstd::forward(args)...)); position = iterator(lookup.insert(position.lookup_itr, p)); return position; @@ -991,7 +990,7 @@ namespace etl template void insert(iterator position, TIterator first, TIterator last) { - size_t count = size_t(ETL_STD::distance(first, last)); + size_t count = size_t(etlstd::distance(first, last)); ETL_ASSERT((size() + count) <= capacity(), ETL_ERROR(vector_full)); @@ -1067,7 +1066,7 @@ namespace etl iterator itr = rhs.begin(); while (itr != rhs.end()) { - push_back(ETL_STD::move(*itr)); + push_back(etlstd::move(*itr)); ++itr; } @@ -1172,7 +1171,7 @@ namespace etl while (itr != other.end()) { - push_back(ETL_STD::move(*itr)); + push_back(etlstd::move(*itr)); ++itr; } @@ -1213,7 +1212,7 @@ namespace etl template bool operator ==(const etl::iindirect_vector& lhs, const etl::iindirect_vector& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1239,7 +1238,7 @@ namespace etl template bool operator <(const etl::iindirect_vector& lhs, const etl::iindirect_vector& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //*************************************************************************** @@ -1376,7 +1375,7 @@ namespace etl indirect_vector(indirect_vector&& other) : etl::iindirect_vector(lookup_vector, storage_pool) { - this->move_container(ETL_STD::move(other)); + this->move_container(etlstd::move(other)); } //************************************************************************* @@ -1384,7 +1383,7 @@ namespace etl //************************************************************************* indirect_vector& operator = (indirect_vector&& rhs) { - this->move_container(ETL_STD::move(rhs)); + this->move_container(etlstd::move(rhs)); return *this; } @@ -1504,7 +1503,7 @@ namespace etl : etl::iindirect_vector(lookup_, pool_) { ETL_ASSERT(lookup_.capacity() <= pool_.capacity(), ETL_ERROR(indirect_vector_buffer_missmatch)); - this->move_container(ETL_STD::move(other)); + this->move_container(etlstd::move(other)); } //************************************************************************* @@ -1512,7 +1511,7 @@ namespace etl //************************************************************************* indirect_vector& operator = (indirect_vector&& rhs) { - this->move_container(ETL_STD::move(rhs)); + this->move_container(etlstd::move(rhs)); return *this; } diff --git a/include/etl/integral_limits.h b/include/etl/integral_limits.h index 2c95c0a3..4d06c57b 100644 --- a/include/etl/integral_limits.h +++ b/include/etl/integral_limits.h @@ -74,7 +74,7 @@ namespace etl static const signed char min = SCHAR_MIN; static const signed char max = SCHAR_MAX; static const int bits = CHAR_BIT; - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; //*************************************************************************** @@ -86,7 +86,7 @@ namespace etl static const unsigned char min = 0; static const unsigned char max = UCHAR_MAX; static const int bits = CHAR_BIT; - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; //*************************************************************************** @@ -95,10 +95,10 @@ namespace etl template <> struct integral_limits { - static const char min = (etl::is_signed::value) ? SCHAR_MIN : 0; - static const char max = (etl::is_signed::value) ? SCHAR_MAX : char(UCHAR_MAX); + static const char min = (etlstd::is_signed::value) ? SCHAR_MIN : 0; + static const char max = (etlstd::is_signed::value) ? SCHAR_MAX : char(UCHAR_MAX); static const int bits = CHAR_BIT; - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; //*************************************************************************** @@ -110,7 +110,7 @@ namespace etl static const short min = SHRT_MIN; static const short max = SHRT_MAX; static const int bits = CHAR_BIT * (sizeof(short) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; //*************************************************************************** @@ -122,7 +122,7 @@ namespace etl static const unsigned short min = 0; static const unsigned short max = USHRT_MAX; static const int bits = CHAR_BIT * (sizeof(unsigned short) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; //*************************************************************************** @@ -134,7 +134,7 @@ namespace etl static const int min = INT_MIN; static const int max = INT_MAX; static const int bits = CHAR_BIT * (sizeof(int) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; //*************************************************************************** @@ -146,7 +146,7 @@ namespace etl static const unsigned int min = 0; static const unsigned int max = UINT_MAX; static const int bits = CHAR_BIT * (sizeof(unsigned int) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; //*************************************************************************** @@ -158,7 +158,7 @@ namespace etl static const long min = LONG_MIN; static const long max = LONG_MAX; static const int bits = CHAR_BIT * (sizeof(long) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; //*************************************************************************** @@ -170,7 +170,7 @@ namespace etl static const unsigned long min = 0; static const unsigned long max = ULONG_MAX; static const int bits = CHAR_BIT * (sizeof(unsigned long) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; #ifndef LLONG_MAX @@ -194,7 +194,7 @@ namespace etl static const long long min = LLONG_MIN; static const long long max = LLONG_MAX; static const int bits = CHAR_BIT * (sizeof(long long) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; //*************************************************************************** @@ -206,7 +206,7 @@ namespace etl static const unsigned long long min = 0; static const unsigned long long max = ULLONG_MAX; static const int bits = CHAR_BIT * (sizeof(unsigned long long) / sizeof(char)); - static const bool is_signed = etl::is_signed::value; + static const bool is_signed = etlstd::is_signed::value; }; } diff --git a/include/etl/intrusive_forward_list.h b/include/etl/intrusive_forward_list.h index 879865f5..253abba2 100644 --- a/include/etl/intrusive_forward_list.h +++ b/include/etl/intrusive_forward_list.h @@ -33,9 +33,9 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #include "private/minmax_push.h" @@ -153,7 +153,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - intmax_t d = ETL_STD::distance(first, last); + intmax_t d = etlstd::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(intrusive_forward_list_iterator_exception)); #endif @@ -328,7 +328,7 @@ namespace etl //************************************************************************* /// iterator. //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -418,7 +418,7 @@ namespace etl //************************************************************************* /// const_iterator //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -495,7 +495,7 @@ namespace etl const value_type* p_value; }; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. @@ -651,7 +651,7 @@ namespace etl { if (first != end() && (first != last)) { - this->current_size -= ETL_STD::distance(first, last) - 1; + this->current_size -= etlstd::distance(first, last) - 1; link_type* p_first = first.p_value; link_type* p_last = last.p_value; @@ -712,7 +712,7 @@ namespace etl //************************************************************************* void sort() { - sort(ETL_STD::less()); + sort(etlstd::less()); } //************************************************************************* @@ -958,7 +958,7 @@ namespace etl { if (&other != this) { - size_t n = ETL_STD::distance(begin_, end_) - 1; + size_t n = etlstd::distance(begin_, end_) - 1; this->current_size += n; other.current_size -= n; } @@ -987,7 +987,7 @@ namespace etl //************************************************************************* void merge(list_type& other) { - merge(other, ETL_STD::less()); + merge(other, etlstd::less()); } //************************************************************************* diff --git a/include/etl/intrusive_links.h b/include/etl/intrusive_links.h index d018f4e8..1a652f56 100644 --- a/include/etl/intrusive_links.h +++ b/include/etl/intrusive_links.h @@ -39,8 +39,8 @@ SOFTWARE. #include "exception.h" #include "error_handler.h" -#include "stl/utility.h" -#include "stl/algorithm.h" +#include "utility.h" +#include "algorithm.h" #undef ETL_FILE #define ETL_FILE "22" @@ -110,7 +110,7 @@ namespace etl // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link(TLink& lhs, TLink& rhs) { lhs.etl_next = &rhs; @@ -118,7 +118,7 @@ namespace etl // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& rhs) { rhs.etl_next = lhs.etl_next; @@ -127,7 +127,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link(TLink* lhs, TLink* rhs) { if (lhs != nullptr) @@ -138,7 +138,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink* lhs, TLink* rhs) { if (lhs != nullptr) @@ -154,7 +154,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link(TLink& lhs, TLink* rhs) { lhs.etl_next = rhs; @@ -162,7 +162,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink& lhs, TLink* rhs) { if (rhs != nullptr) @@ -175,7 +175,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -186,7 +186,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -198,7 +198,7 @@ namespace etl // Reference, Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& first, TLink& last) { last.etl_next = lhs.etl_next; @@ -207,7 +207,7 @@ namespace etl // Pointer, Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& first, TLink& last) { if (lhs != nullptr) @@ -223,7 +223,7 @@ namespace etl // Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type unlink_after(TLink& node) { if (node.etl_next != nullptr) @@ -235,7 +235,7 @@ namespace etl // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type unlink_after(TLink& before, TLink& last) { before.etl_next = last.etl_next; @@ -265,7 +265,13 @@ namespace etl void reverse() { - ETL_STD::swap(etl_previous, etl_next); +#if defined(ETL_NO_STL) + using etlstd::swap; +#else + using std::swap; +#endif + + swap(etl_previous, etl_next); } bidirectional_link* etl_previous; @@ -289,7 +295,7 @@ namespace etl // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link(TLink& lhs, TLink& rhs) { lhs.etl_next = &rhs; @@ -298,7 +304,7 @@ namespace etl // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& rhs) { rhs.etl_next = lhs.etl_next; @@ -314,7 +320,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link(TLink* lhs, TLink* rhs) { if (lhs != nullptr) @@ -330,7 +336,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink* lhs, TLink* rhs) { if (rhs != nullptr) @@ -356,7 +362,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link(TLink& lhs, TLink* rhs) { lhs.etl_next = rhs; @@ -369,7 +375,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink& lhs, TLink* rhs) { if (rhs != nullptr) @@ -388,7 +394,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -401,7 +407,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -424,7 +430,7 @@ namespace etl // Reference, Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& first, TLink& last) { last.etl_next = lhs.etl_next; @@ -440,7 +446,7 @@ namespace etl // Pointer, Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& first, TLink& last) { if (lhs != nullptr) @@ -467,7 +473,7 @@ namespace etl // Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type unlink(TLink& node) { node.unlink(); @@ -475,7 +481,7 @@ namespace etl // Reference Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type unlink(TLink& first, TLink& last) { if (&first == &last) @@ -526,7 +532,7 @@ namespace etl // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_left(TLink& parent, TLink& leaf) { parent.etl_left = &leaf; @@ -534,7 +540,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_right(TLink& parent, TLink& leaf) { parent.etl_right = &leaf; @@ -543,7 +549,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_left(TLink* parent, TLink* leaf) { if (parent != nullptr) @@ -558,7 +564,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_right(TLink* parent, TLink* leaf) { if (parent != nullptr) @@ -574,7 +580,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_left(TLink& parent, TLink* leaf) { parent.etl_left = leaf; @@ -586,7 +592,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_right(TLink& parent, TLink* leaf) { parent.etl_right = leaf; @@ -599,7 +605,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_left(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -611,7 +617,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_right(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -624,7 +630,7 @@ namespace etl // Reference, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate_left(TLink& parent, TLink& leaf) { parent.etl_right = leaf.etl_left; @@ -640,7 +646,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate_right(TLink& parent, TLink& leaf) { parent.etl_left = leaf.etl_right; @@ -657,7 +663,7 @@ namespace etl // Pointer, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate_left(TLink* parent, TLink* leaf) { if ((parent != nullptr) && (leaf != nullptr)) @@ -667,7 +673,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate_right(TLink* parent, TLink* leaf) { if ((parent != nullptr) && (leaf != nullptr)) @@ -678,7 +684,7 @@ namespace etl // Reference, Pointer template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate_left(TLink& parent, TLink* leaf) { if (leaf != nullptr) @@ -688,7 +694,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate_right(TLink& parent, TLink* leaf) { if (leaf != nullptr) @@ -699,7 +705,7 @@ namespace etl // Pointer, Reference template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate_left(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -709,7 +715,7 @@ namespace etl } template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate_right(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -721,7 +727,7 @@ namespace etl // Reference, Reference /// Automatically detects whether a left or right rotate is expected. template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate(TLink& parent, TLink& leaf) { if (parent.etl_left == &leaf) @@ -737,7 +743,7 @@ namespace etl // Pointer, Pointer /// Automatically detects whether a left or right rotate is expected. template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate(TLink* parent, TLink* leaf) { if ((parent != nullptr) && (leaf != nullptr)) @@ -756,7 +762,7 @@ namespace etl // Reference, Pointer /// Automatically detects whether a left or right rotate is expected. template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate(TLink& parent, TLink* leaf) { if (leaf != nullptr) @@ -775,7 +781,7 @@ namespace etl // Pointer, Reference /// Automatically detects whether a left or right rotate is expected. template - typename etl::enable_if >::value, void>::type + typename etlstd::enable_if >::value, void>::type link_rotate(TLink* parent, TLink& leaf) { if (parent != nullptr) diff --git a/include/etl/intrusive_list.h b/include/etl/intrusive_list.h index 059bb121..ddc691ce 100644 --- a/include/etl/intrusive_list.h +++ b/include/etl/intrusive_list.h @@ -47,9 +47,9 @@ SOFTWARE. #include "algorithm.h" #include "iterator.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #undef ETL_FILE #define ETL_FILE "21" @@ -133,7 +133,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - intmax_t d = ETL_STD::distance(first, last); + intmax_t d = etlstd::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(intrusive_list_iterator_exception)); #endif @@ -383,7 +383,7 @@ namespace etl //************************************************************************* /// iterator. //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -488,7 +488,7 @@ namespace etl //************************************************************************* /// const_iterator //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -580,7 +580,7 @@ namespace etl const value_type* p_value; }; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. @@ -734,7 +734,7 @@ namespace etl // Join the ends. etl::link(p_first->etl_previous, p_last); - this->current_size -= ETL_STD::distance(first, last); + this->current_size -= etlstd::distance(first, last); if (p_last == &this->terminal_link) { @@ -781,7 +781,7 @@ namespace etl //************************************************************************* void sort() { - sort(ETL_STD::less()); + sort(etlstd::less()); } //************************************************************************* @@ -1013,7 +1013,7 @@ namespace etl { if (&other != this) { - size_t n = ETL_STD::distance(begin_, end_); + size_t n = etlstd::distance(begin_, end_); this->current_size += n; other.current_size -= n; } @@ -1036,7 +1036,7 @@ namespace etl //************************************************************************* void merge(list_type& other) { - merge(other, ETL_STD::less()); + merge(other, etlstd::less()); } //************************************************************************* diff --git a/include/etl/io_port.h b/include/etl/io_port.h index 713c0047..09366c34 100644 --- a/include/etl/io_port.h +++ b/include/etl/io_port.h @@ -41,7 +41,7 @@ SOFTWARE. #include "nullptr.h" #include "iterator.h" -#include "stl/iterator.h" +#include "iterator.h" namespace etl { @@ -49,7 +49,7 @@ namespace etl /// Read write port. //*************************************************************************** template - class io_port_rw : public etl::iterator + class io_port_rw : public etl::iterator { public: @@ -129,7 +129,7 @@ namespace etl /// Read only port. //*************************************************************************** template - class io_port_ro : public etl::iterator + class io_port_ro : public etl::iterator { public: @@ -193,7 +193,7 @@ namespace etl /// Write only port. //*************************************************************************** template - class io_port_wo : public etl::iterator + class io_port_wo : public etl::iterator { public: @@ -257,7 +257,7 @@ namespace etl /// Write only port with shadow register. //*************************************************************************** template - class io_port_wos : public etl::iterator + class io_port_wos : public etl::iterator { public: @@ -336,7 +336,7 @@ namespace etl /// Specialisation for dynamic addresses. //*************************************************************************** template - class io_port_rw : public etl::iterator + class io_port_rw : public etl::iterator { public: @@ -447,7 +447,7 @@ namespace etl /// Specialisation for dynamic addresses. //*************************************************************************** template - class io_port_ro : public etl::iterator + class io_port_ro : public etl::iterator { public: @@ -536,7 +536,7 @@ namespace etl /// Specialisation for dynamic addresses. //*************************************************************************** template - class io_port_wo : public etl::iterator + class io_port_wo : public etl::iterator { public: @@ -631,7 +631,7 @@ namespace etl /// Specialisation for dynamic addresses. //*************************************************************************** template - class io_port_wos : public etl::iterator + class io_port_wos : public etl::iterator { public: @@ -640,7 +640,7 @@ namespace etl typedef volatile T& reference; typedef volatile const T& const_reference; - class iterator : public etl::iterator + class iterator : public etl::iterator { typedef io_port_wos iop_t; diff --git a/include/etl/iterator.h b/include/etl/iterator.h index d4ff0321..4f7665c2 100644 --- a/include/etl/iterator.h +++ b/include/etl/iterator.h @@ -32,16 +32,387 @@ SOFTWARE. #define ETL_ITERATOR_INCLUDED #include "platform.h" - -#include "stl/iterator.h" - #include "type_traits.h" +#if !defined(ETL_NO_STL) + #include +#endif + ///\defgroup iterator iterator ///\ingroup utilities -namespace etl +namespace etlstd { + //*************************************************************************** + // 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 + struct iterator_traits + { + typedef typename TIterator::iterator_category iterator_category; + typedef typename TIterator::value_type value_type; + typedef typename TIterator::difference_type difference_type; + typedef typename TIterator::pointer pointer; + typedef typename TIterator::reference reference; + }; + + template + struct iterator_traits + { + typedef ETL_OR_STD::random_access_iterator_tag iterator_category; + typedef T value_type; + typedef ptrdiff_t difference_type; + typedef T* pointer; + typedef T& reference; + }; + + template + struct iterator_traits + { + typedef ETL_OR_STD::random_access_iterator_tag iterator_category; + typedef T value_type; + typedef ptrdiff_t difference_type; + typedef const T* pointer; + typedef const T& reference; + }; + + //*************************************************************************** + // advance +#if defined(ETL_NO_STL) + + template + ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OR_STD::output_iterator_tag) + { + while (n--) + { + ++itr; + } + } + + template + ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OR_STD::forward_iterator_tag) + { + while (n--) + { + ++itr; + } + } + + template + ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OR_STD::bidirectional_iterator_tag) + { + if (n > 0) + { + while (n--) + { + ++itr; + } + } + else + { + while (n++) + { + --itr; + } + } + } + + template + ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OR_STD::random_access_iterator_tag) + { + itr += n; + } + + template + ETL_CONSTEXPR17 void advance(TIterator& itr, TDistance n) + { + typedef typename etlstd::iterator_traits::iterator_category tag; + + advance_helper(itr, n, tag()); + } + +#else + + template + ETL_CONSTEXPR17 void advance(TIterator& itr, TDistance n) + { + std::advance(itr, n); + } + +#endif + + //*************************************************************************** + // distance +#if defined(ETL_NO_STL) + template + ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::input_iterator_tag) + { + typename etlstd::iterator_traits::difference_type d = 0; + + while (first != last) + { + ++d; + ++first; + } + + return d; + } + + template + ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::forward_iterator_tag) + { + typename etlstd::iterator_traits::difference_type d = 0; + + while (first != last) + { + ++d; + ++first; + } + + return d; + } + + template + ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::bidirectional_iterator_tag) + { + typename etlstd::iterator_traits::difference_type d = 0; + + while (first != last) + { + ++d; + ++first; + } + + return d; + } + + template + ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::random_access_iterator_tag) + { + return last - first; + } + + template + ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance(TIterator first, TIterator last) + { + typedef typename etlstd::iterator_traits::iterator_category tag; + + return distance_helper(first, last, tag()); + } + +#else + + template + ETL_CONSTEXPR17 typename std::iterator_traits::difference_type distance(TIterator first, TIterator last) + { + return std::distance(first, last); + } + +#endif + + //*************************************************************************** + // Previous + template + ETL_CONSTEXPR17 TIterator prev(TIterator itr, typename etlstd::iterator_traits::difference_type n = 1) + { +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + etlstd::advance(itr, -n); +#else + std::advance(itr, -n); +#endif + return itr; + } + + //*************************************************************************** + // Next + template + ETL_CONSTEXPR17 TIterator next(TIterator itr, typename etlstd::iterator_traits::difference_type n = 1) + { +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + etlstd::advance(itr, n); +#else + std::advance(itr, n); +#endif + return itr; + } + + //*************************************************************************** + // reverse_iterator + template + class reverse_iterator + { + public: + + typedef typename iterator_traits::iterator_category iterator_category; + typedef typename iterator_traits::value_type value_type; + typedef typename iterator_traits::difference_type difference_type; + typedef typename iterator_traits::pointer pointer; + typedef typename iterator_traits::reference reference; + + typedef TIterator iterator_type; + + ETL_CONSTEXPR17 reverse_iterator() + : current() + { + } + + ETL_CONSTEXPR17 explicit reverse_iterator(TIterator itr) + : current(itr) + { + } + + template + ETL_CONSTEXPR17 reverse_iterator(const reverse_iterator& other) + : current(other.base()) + { + } + + template + ETL_CONSTEXPR17 reverse_iterator& operator=(const reverse_iterator& other) + { + current = other.base(); + + return (*this); + } + + ETL_CONSTEXPR17 TIterator base() const + { + return current; + } + + ETL_NODISCARD ETL_CONSTEXPR17 reference operator*() const + { + TIterator temp = current; + + return *(--temp); + } + + ETL_NODISCARD ETL_CONSTEXPR17 pointer operator->() const + { + TIterator temp = current; + + return &(*--temp); + } + + ETL_CONSTEXPR17 reverse_iterator& operator++() + { + --current; + + return *this; + } + + ETL_CONSTEXPR17 reverse_iterator operator++(int) + { + reverse_iterator temp = *this; + --current; + + return temp; + } + + ETL_CONSTEXPR17 reverse_iterator& operator--() + { + ++current; + + return (*this); + } + + ETL_CONSTEXPR17 reverse_iterator operator--(int) + { + reverse_iterator temp = *this; + ++current; + + return temp; + } + + ETL_CONSTEXPR17 reverse_iterator& operator+=(const difference_type offset) + { + current -= offset; + + return (*this); + } + + ETL_CONSTEXPR17 reverse_iterator& operator-=(const difference_type offset) + { + current += offset; + + return (*this); + } + + ETL_NODISCARD ETL_CONSTEXPR17 reverse_iterator operator+(const difference_type offset) const + { + return reverse_iterator(current - offset); + } + + ETL_NODISCARD ETL_CONSTEXPR17 reverse_iterator operator-(const difference_type offset) const + { + return (reverse_iterator(current + offset)); + } + + ETL_NODISCARD ETL_CONSTEXPR17 reference operator[](const difference_type offset) const + { + return (*(*this + offset)); + } + + protected: + + TIterator current; + }; + + template + inline ETL_CONSTEXPR17 bool operator ==(const reverse_iterator& lhs, const reverse_iterator& rhs) + { + return lhs.base() == rhs.base(); + } + + template + inline ETL_CONSTEXPR17 bool operator !=(const reverse_iterator& lhs, const reverse_iterator& rhs) + { + return !(lhs == rhs); + } + + template + inline ETL_CONSTEXPR17 bool operator <(const reverse_iterator& lhs, const reverse_iterator& rhs) + { + return rhs.base() < lhs.base(); + } + + template + inline ETL_CONSTEXPR17 bool operator >(const reverse_iterator& lhs, const reverse_iterator& rhs) + { + return rhs < lhs; + } + + template + inline ETL_CONSTEXPR17 bool operator <=(const reverse_iterator& lhs, const reverse_iterator& rhs) + { + return !(rhs < lhs); + } + + template + inline ETL_CONSTEXPR17 bool operator >=(const reverse_iterator& lhs, const reverse_iterator& rhs) + { + return !(lhs < rhs); + } + + template + inline ETL_CONSTEXPR17 typename reverse_iterator::difference_type operator -(const reverse_iterator& lhs, const reverse_iterator& rhs) + { + return rhs.base() - lhs.base(); + } + + template + inline ETL_CONSTEXPR17 reverse_iterator operator +(TDifference n, const reverse_iterator& itr) + { + return itr.operator +(n); + } + //*************************************************************************** /// iterator //*************************************************************************** @@ -55,78 +426,81 @@ namespace etl typedef TCategory iterator_category; }; +} + +namespace etl +{ //*************************************************************************** - // Helper templates. - //*************************************************************************** +// Helper templates. +//*************************************************************************** template struct is_input_iterator { - static const bool value = etl::is_same::iterator_category, ETL_INPUT_ITERATOR_TAG>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::input_iterator_tag>::value; }; template struct is_output_iterator { - static const bool value = etl::is_same::iterator_category, ETL_OUTPUT_ITERATOR_TAG>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::output_iterator_tag>::value; }; template struct is_forward_iterator { - static const bool value = etl::is_same::iterator_category, ETL_FORWARD_ITERATOR_TAG>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::forward_iterator_tag>::value; }; template struct is_bidirectional_iterator { - static const bool value = etl::is_same::iterator_category, ETL_BIDIRECTIONAL_ITERATOR_TAG>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::bidirectional_iterator_tag>::value; }; template struct is_random_iterator { - static const bool value = etl::is_same::iterator_category, ETL_RANDOM_ACCESS_ITERATOR_TAG>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::random_access_iterator_tag>::value; }; template struct is_input_iterator_concept { - static const bool value = etl::is_input_iterator::value || - etl::is_forward_iterator::value || - etl::is_bidirectional_iterator::value || - etl::is_random_iterator::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_input_iterator::value || + etl::is_forward_iterator::value || + etl::is_bidirectional_iterator::value || + etl::is_random_iterator::value; }; template struct is_output_iterator_concept { - static const bool value = etl::is_output_iterator::value || - etl::is_forward_iterator::value || - etl::is_bidirectional_iterator::value || - etl::is_random_iterator::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_output_iterator::value || + etl::is_forward_iterator::value || + etl::is_bidirectional_iterator::value || + etl::is_random_iterator::value; }; template struct is_forward_iterator_concept { - static const bool value = etl::is_forward_iterator::value || - etl::is_bidirectional_iterator::value || - etl::is_random_iterator::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_forward_iterator::value || + etl::is_bidirectional_iterator::value || + etl::is_random_iterator::value; }; template struct is_bidirectional_iterator_concept { - static const bool value = etl::is_bidirectional_iterator::value || - etl::is_random_iterator::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_bidirectional_iterator::value || + etl::is_random_iterator::value; }; template struct is_random_iterator_concept { - static const bool value = etl::is_random_iterator::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_random_iterator::value; }; - } #endif diff --git a/include/etl/jenkins.h b/include/etl/jenkins.h index 8c075a22..ef96c0c1 100644 --- a/include/etl/jenkins.h +++ b/include/etl/jenkins.h @@ -40,7 +40,7 @@ SOFTWARE. #include "ihash.h" #include "frame_check_sequence.h" -#include "stl/iterator.h" +#include "iterator.h" #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 1300 diff --git a/include/etl/largest.h b/include/etl/largest.h index 556db65b..0ebdc414 100644 --- a/include/etl/largest.h +++ b/include/etl/largest.h @@ -82,15 +82,15 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - using type = typename etl::conditional<(etl::size_of() > etl::size_of()), // Boolean - T1, // TrueType - largest_other> // FalseType - ::type; // The largest type of the two. + using type = typename etlstd::conditional<(etl::size_of::value > etl::size_of::value), // Boolean + T1, // TrueType + largest_other> // FalseType + ::type; // The largest type of the two. // The size of the largest type. enum { - size = etl::size_of() + size = etl::size_of::value }; }; @@ -106,7 +106,7 @@ namespace etl enum { - size = etl::size_of() + size = etl::size_of::value }; }; #else @@ -128,7 +128,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - typedef typename etl::conditional<(sizeof(T1) > sizeof(largest_other)), // Boolean + typedef typename etlstd::conditional<(sizeof(T1) > sizeof(largest_other)), // Boolean T1, // TrueType largest_other> // FalseType ::type type; // The largest type of the two. @@ -170,7 +170,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - using type = typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean + using type = typename etlstd::conditional<(etlstd::alignment_of::value > etlstd::alignment_of::value), // Boolean T1, // TrueType largest_other> // FalseType ::type; // The largest type of the two. @@ -178,7 +178,7 @@ namespace etl // The largest alignment. enum { - value = etl::alignment_of::value + value = etlstd::alignment_of::value }; }; @@ -192,7 +192,7 @@ namespace etl enum { - value = etl::alignment_of::value + value = etlstd::alignment_of::value }; }; #else @@ -213,7 +213,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - typedef typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean + typedef typename etlstd::conditional<(etlstd::alignment_of::value > etlstd::alignment_of::value), // Boolean T1, // TrueType largest_other> // FalseType ::type type; // The largest type of the two. @@ -221,7 +221,7 @@ namespace etl // The largest alignment. enum { - value = etl::alignment_of::value + value = etlstd::alignment_of::value }; }; @@ -236,7 +236,7 @@ namespace etl enum { - value = etl::alignment_of::value + value = etlstd::alignment_of::value }; }; #endif @@ -249,7 +249,7 @@ namespace etl template struct larger_int_type { - ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_int_for_bits::type>::bits + 1>::type type; }; @@ -262,7 +262,7 @@ namespace etl template struct larger_uint_type { - ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_uint_for_bits::type>::bits + 1>::type type; }; @@ -273,13 +273,13 @@ namespace etl /// The returned type will be of the same sign. ///\ingroup largest //*************************************************************************** - template ::value> + template ::value> struct larger_type; template struct larger_type { - ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_uint_for_bits::bits + 1>::type type; }; @@ -287,7 +287,7 @@ namespace etl template struct larger_type { - ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_int_for_bits::bits + 1>::type type; }; diff --git a/include/etl/largest_generator.h b/include/etl/largest_generator.h index 0dd78c85..bfe55b50 100644 --- a/include/etl/largest_generator.h +++ b/include/etl/largest_generator.h @@ -94,15 +94,15 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - using type = typename etl::conditional<(etl::size_of() > etl::size_of()), // Boolean - T1, // TrueType - largest_other> // FalseType - ::type; // The largest type of the two. + using type = typename etlstd::conditional<(etl::size_of::value > etl::size_of::value), // Boolean + T1, // TrueType + largest_other> // FalseType + ::type; // The largest type of the two. // The size of the largest type. enum { - size = etl::size_of() + size = etl::size_of::value }; }; @@ -118,7 +118,7 @@ namespace etl enum { - size = etl::size_of() + size = etl::size_of::value }; }; #else @@ -151,7 +151,7 @@ namespace etl cog.outl("") cog.outl(" // Set 'type' to be the largest of the first parameter and any of the others.") cog.outl(" // This is recursive.") - cog.outl(" typedef typename etl::conditional<(sizeof(T1) > sizeof(largest_other)), // Boolean") + cog.outl(" typedef typename etlstd::conditional<(sizeof(T1) > sizeof(largest_other)), // Boolean") cog.outl(" T1, // TrueType") cog.outl(" largest_other> // FalseType") cog.outl(" ::type type; // The largest type of the two.") @@ -200,7 +200,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - using type = typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean + using type = typename etlstd::conditional<(etlstd::alignment_of::value > etlstd::alignment_of::value), // Boolean T1, // TrueType largest_other> // FalseType ::type; // The largest type of the two. @@ -208,7 +208,7 @@ namespace etl // The largest alignment. enum { - value = etl::alignment_of::value + value = etlstd::alignment_of::value }; }; @@ -222,7 +222,7 @@ namespace etl enum { - value = etl::alignment_of::value + value = etlstd::alignment_of::value }; }; #else @@ -254,7 +254,7 @@ namespace etl cog.outl("") cog.outl(" // Set 'type' to be the largest of the first parameter and any of the others.") cog.outl(" // This is recursive.") - cog.outl(" typedef typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean") + cog.outl(" typedef typename etlstd::conditional<(etlstd::alignment_of::value > etlstd::alignment_of::value), // Boolean") cog.outl(" T1, // TrueType") cog.outl(" largest_other> // FalseType") cog.outl(" ::type type; // The largest type of the two.") @@ -262,7 +262,7 @@ namespace etl cog.outl(" // The largest alignment.") cog.outl(" enum") cog.outl(" {") - cog.outl(" value = etl::alignment_of::value") + cog.outl(" value = etlstd::alignment_of::value") cog.outl(" };") cog.outl("};") cog.outl("") @@ -282,7 +282,7 @@ namespace etl cog.outl("") cog.outl(" enum") cog.outl(" {") - cog.outl(" value = etl::alignment_of::value") + cog.outl(" value = etlstd::alignment_of::value") cog.outl(" };") cog.outl("};") ]]]*/ @@ -297,7 +297,7 @@ namespace etl template struct larger_int_type { - ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_int_for_bits::type>::bits + 1>::type type; }; @@ -310,7 +310,7 @@ namespace etl template struct larger_uint_type { - ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_uint_for_bits::type>::bits + 1>::type type; }; @@ -321,13 +321,13 @@ namespace etl /// The returned type will be of the same sign. ///\ingroup largest //*************************************************************************** - template ::value> + template ::value> struct larger_type; template struct larger_type { - ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_uint_for_bits::bits + 1>::type type; }; @@ -335,7 +335,7 @@ namespace etl template struct larger_type { - ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_int_for_bits::bits + 1>::type type; }; diff --git a/include/etl/stl/alternate/limits.h b/include/etl/limits.h similarity index 92% rename from include/etl/stl/alternate/limits.h rename to include/etl/limits.h index 2b73be81..c8ad62c9 100644 --- a/include/etl/stl/alternate/limits.h +++ b/include/etl/limits.h @@ -28,21 +28,19 @@ 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 +#ifndef ETL_LIMITS_INCLUDED +#define ETL_LIMITS_INCLUDED -#include "../../platform.h" -#include "../../type_traits.h" -#include "../../char_traits.h" -#include "../../integral_limits.h" - -#include "../../private/choose_tag_types.h" -#include "../../private/choose_pair_types.h" +#include "platform.h" +#include "type_traits.h" +#include "char_traits.h" +#include "integral_limits.h" #include #include #include +#if defined(ETL_NO_STL) #define ETL_LOG2(x) (((x) * 301) / 1000) namespace etlstd @@ -82,10 +80,10 @@ namespace etlstd static ETL_CONSTEXPR T epsilon() { return 0; } static ETL_CONSTEXPR T round_error() { return 0; } - static ETL_CONST_OR_CONSTEXPR int digits = (CHAR_BIT * sizeof(T)) - (etl::is_signed::value ? 1 : 0); + static ETL_CONST_OR_CONSTEXPR int digits = (CHAR_BIT * sizeof(T)) - (etlstd::is_signed::value ? 1 : 0); static ETL_CONST_OR_CONSTEXPR int digits10 = ETL_LOG2(digits); - static ETL_CONST_OR_CONSTEXPR bool is_signed = etl::is_signed::value; + static ETL_CONST_OR_CONSTEXPR bool is_signed = etlstd::is_signed::value; static ETL_CONST_OR_CONSTEXPR int min_exponent = 0; static ETL_CONST_OR_CONSTEXPR int min_exponent10 = 0; @@ -105,7 +103,7 @@ namespace etlstd static ETL_CONST_OR_CONSTEXPR bool is_iec559 = false; static ETL_CONST_OR_CONSTEXPR bool is_bounded = true; - static ETL_CONST_OR_CONSTEXPR bool is_modulo = etl::is_unsigned::value; + static ETL_CONST_OR_CONSTEXPR bool is_modulo = etlstd::is_unsigned::value; static ETL_CONST_OR_CONSTEXPR bool traps = false; static ETL_CONST_OR_CONSTEXPR bool tinyness_before = false; @@ -257,6 +255,7 @@ namespace etlstd 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; } + static ETL_CONST_OR_CONSTEXPR bool is_modulo = true; }; //*************************************************************************** @@ -269,6 +268,7 @@ namespace etlstd 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; } + static ETL_CONST_OR_CONSTEXPR bool is_modulo = true; }; #endif @@ -450,4 +450,33 @@ namespace etlstd }; } +#else + +#include + +namespace etlstd +{ + enum float_round_style + { + round_indeterminate = std::float_round_style::round_indeterminate, + round_toward_zero = std::float_round_style::round_toward_zero, + round_to_nearest = std::float_round_style::round_to_nearest, + round_toward_infinity = std::float_round_style::round_toward_infinity, + round_toward_neg_infinity = std::float_round_style::round_toward_neg_infinity, + }; + + enum float_denorm_style + { + denorm_indeterminate = std::float_denorm_style::denorm_indeterminate, + denorm_absent = std::float_denorm_style::denorm_absent, + denorm_present = std::float_denorm_style::denorm_present + }; + + template + class numeric_limits : public std::numeric_limits + { + }; +} +#endif + #endif diff --git a/include/etl/list.h b/include/etl/list.h index d86b6dce..2147daa8 100644 --- a/include/etl/list.h +++ b/include/etl/list.h @@ -37,9 +37,9 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #include "container.h" #include "pool.h" @@ -182,7 +182,7 @@ namespace etl //*********************************************************************** inline void reverse() { - ETL_STD::swap(previous, next); + swap(previous, next); } node_t* previous; @@ -482,7 +482,7 @@ namespace etl //************************************************************************* /// iterator. //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -583,7 +583,7 @@ namespace etl //************************************************************************* /// const_iterator //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -676,10 +676,10 @@ namespace etl const node_t* p_node; }; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; //************************************************************************* /// Gets the beginning of the list. @@ -810,7 +810,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(list_iterator)); ETL_ASSERT(size_t(d) <= MAX_SIZE, ETL_ERROR(list_full)); #endif @@ -866,7 +866,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(list_full)); #endif - insert_node(get_head(), allocate_data_node(ETL_STD::move(value))); + insert_node(get_head(), allocate_data_node(etlstd::move(value))); } #endif @@ -883,7 +883,7 @@ namespace etl ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(ETL_STD::forward(args)...); + ::new (&(p_data_node->value)) T(etlstd::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node(get_head(), *p_data_node); } @@ -989,7 +989,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(list_full)); #endif - insert_node(terminal_node, allocate_data_node(ETL_STD::move(value))); + insert_node(terminal_node, allocate_data_node(etlstd::move(value))); } #endif @@ -1006,7 +1006,7 @@ namespace etl ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(ETL_STD::forward(args)...); + ::new (&(p_data_node->value)) T(etlstd::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node(terminal_node, *p_data_node); } @@ -1101,7 +1101,7 @@ namespace etl { ETL_ASSERT(!full(), ETL_ERROR(list_full)); - data_node_t& data_node = allocate_data_node(ETL_STD::move(value)); + data_node_t& data_node = allocate_data_node(etlstd::move(value)); insert_node(*position.p_node, data_node); return iterator(data_node); @@ -1119,7 +1119,7 @@ namespace etl ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(ETL_STD::forward(args)...); + ::new (&(p_data_node->value)) T(etlstd::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node(*position.p_node, *p_data_node); @@ -1269,7 +1269,7 @@ namespace etl else if (n < size()) { iterator i_start = end(); - ETL_STD::advance(i_start, -difference_type(size() - n)); + etlstd::advance(i_start, -difference_type(size() - n)); erase(i_start, end()); } // Larger? @@ -1334,7 +1334,7 @@ namespace etl //************************************************************************* void unique() { - unique(ETL_STD::equal_to()); + unique(etlstd::equal_to()); } //************************************************************************* @@ -1390,7 +1390,7 @@ namespace etl typename ilist::iterator itr = other.begin(); while (itr != other.end()) { - to = insert(to, ETL_STD::move(*itr++)); + to = insert(to, etlstd::move(*itr++)); } other.erase(other.begin(), other.end()); @@ -1430,7 +1430,7 @@ namespace etl else { // From another list. - insert(to, ETL_STD::move(*from)); + insert(to, etlstd::move(*from)); other.erase(from); } } @@ -1471,7 +1471,7 @@ namespace etl ilist::iterator itr = first; while (itr != last) { - to = insert(to, ETL_STD::move(*itr++)); + to = insert(to, etlstd::move(*itr++)); ++to; } @@ -1485,7 +1485,7 @@ namespace etl //************************************************************************* void merge(ilist& other) { - merge(other, ETL_STD::less()); + merge(other, etlstd::less()); } //************************************************************************* @@ -1542,7 +1542,7 @@ namespace etl //************************************************************************* void merge(ilist&& other) { - merge(ETL_STD::move(other), ETL_STD::less()); + merge(etlstd::move(other), etlstd::less()); } //************************************************************************* @@ -1577,7 +1577,7 @@ namespace etl { while ((other_begin != other_end) && (compare(*other_begin, *this_begin))) { - insert(this_begin, ETL_STD::move(*other_begin)); + insert(this_begin, etlstd::move(*other_begin)); ++other_begin; } } @@ -1588,7 +1588,7 @@ namespace etl { while (other_begin != other_end) { - insert(this_end, ETL_STD::move(*other_begin++)); + insert(this_end, etlstd::move(*other_begin++)); } } @@ -1603,7 +1603,7 @@ namespace etl //************************************************************************* void sort() { - sort(ETL_STD::less()); + sort(etlstd::less()); } //************************************************************************* @@ -1765,7 +1765,7 @@ namespace etl iterator itr = rhs.begin(); while (itr != rhs.end()) { - push_back(ETL_STD::move(*itr)); + push_back(etlstd::move(*itr)); ++itr; } @@ -1917,7 +1917,7 @@ namespace etl ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(ETL_STD::move(value)); + ::new (&(p_data_node->value)) T(etlstd::move(value)); ETL_INCREMENT_DEBUG_COUNT return *p_data_node; @@ -2033,7 +2033,7 @@ namespace etl typename etl::ilist::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -2089,7 +2089,7 @@ namespace etl typename etl::ilist::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -2191,7 +2191,7 @@ namespace etl typename etl::ilist::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -2214,7 +2214,7 @@ namespace etl //************************************************************************* /// Construct from initializer_list. //************************************************************************* - list(ETL_STD::initializer_list init, etl::ipool& node_pool) + list(std::initializer_list init, etl::ipool& node_pool) : ilist(node_pool, node_pool.max_size(), true) { this->assign(init.begin(), init.end()); @@ -2247,7 +2247,7 @@ namespace etl typename etl::ilist::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -2282,7 +2282,7 @@ namespace etl template bool operator ==(const etl::ilist& lhs, const etl::ilist& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -2307,10 +2307,7 @@ namespace etl template bool operator <(const etl::ilist& lhs, const etl::ilist& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), - lhs.end(), - rhs.begin(), - rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/map.h b/include/etl/map.h index 79a11f7e..e1630b26 100755 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -37,9 +37,9 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #include "container.h" #include "pool.h" @@ -462,7 +462,7 @@ namespace etl /// A templated base for all etl::map types. ///\ingroup map //*************************************************************************** - template > + template > class imap : public etl::map_base { public: @@ -575,7 +575,7 @@ namespace etl //************************************************************************* /// iterator. //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -696,7 +696,7 @@ namespace etl //************************************************************************* /// const_iterator //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -804,10 +804,10 @@ namespace etl friend class const_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; //************************************************************************* /// Gets the beginning of the map. @@ -2042,7 +2042,7 @@ namespace etl //************************************************************************* /// A templated map implementation that uses a fixed size buffer. //************************************************************************* - template > + template > class map : public etl::imap { public: @@ -2129,7 +2129,7 @@ namespace etl template bool operator ==(const etl::imap& lhs, const etl::imap& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2155,10 +2155,7 @@ namespace etl template bool operator <(const etl::imap& lhs, const etl::imap& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), - lhs.end(), - rhs.begin(), - rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/memory.h b/include/etl/memory.h index 8e6ff921..53623b2b 100644 --- a/include/etl/memory.h +++ b/include/etl/memory.h @@ -35,7 +35,7 @@ SOFTWARE. #include "algorithm.h" #include "type_traits.h" -#include "stl/iterator.h" +#include "iterator.h" #include @@ -43,42 +43,55 @@ SOFTWARE. #include +#if !defined(ETL_NO_STL) + #include +#endif + ///\defgroup memory memory -///\ingroup etl -namespace etl +///\ingroup etlstd + +namespace etlstd { //***************************************************************************** /// Gets the address of an object. + /// https://en.cppreference.com/w/cpp/memory/addressof ///\ingroup memory //***************************************************************************** template T* addressof(T& t) { - return reinterpret_cast(&const_cast(reinterpret_cast(t))); +#if ETL_CPP11_SUPPORTED + return std::addressof(t); +#else + return reinterpret_cast(&const_cast(reinterpret_cast(t))); +#endif } +#if defined(ETL_NO_STL) //***************************************************************************** /// Fills uninitialised memory range with a value. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value) { - ETL_STD::fill(o_begin, o_end, value); + etlstd::fill(o_begin, o_end, value); return o_end; } //***************************************************************************** /// Fills uninitialised memory range with a value. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value) { - typedef typename ETL_STD::iterator_traits::value_type value_type; + typedef typename etlstd::iterator_traits::value_type value_type; while (o_begin != o_end) { @@ -92,15 +105,16 @@ namespace etl //***************************************************************************** /// Fills uninitialised memory range with a value. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) { - count += int32_t(ETL_STD::distance(o_begin, o_end)); + count += int32_t(etlstd::distance(o_begin, o_end)); - ETL_STD::fill(o_begin, o_end, value); + etlstd::fill(o_begin, o_end, value); return o_end; } @@ -108,62 +122,126 @@ namespace etl //***************************************************************************** /// Fills uninitialised memory range with a value. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) { - count += int32_t(ETL_STD::distance(o_begin, o_end)); + count += int32_t(etlstd::distance(o_begin, o_end)); - etl::uninitialized_fill(o_begin, o_end, value); + etlstd::uninitialized_fill(o_begin, o_end, value); + + return o_end; + } +#else + //***************************************************************************** + /// Fills uninitialised memory range with a value. + /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill + ///\ingroup memory + //***************************************************************************** + template + TOutputIterator uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value) + { + std::uninitialized_fill(o_begin, o_end, value); return o_end; } + //***************************************************************************** + /// Fills uninitialised memory range with a value. + /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill + ///\ingroup memory + //***************************************************************************** + template + TOutputIterator uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) + { + count += int32_t(etlstd::distance(o_begin, o_end)); + + std::uninitialized_fill(o_begin, o_end, value); + + return o_end; + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED //***************************************************************************** /// Fills uninitialised memory with N values. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill_n ///\ingroup memory //***************************************************************************** template - TOutputIterator uninitialized_fill_n(TOutputIterator o_begin, TSize n, const T& value) + TOutputIterator uninitialized_fill_n(TOutputIterator o_begin, TSize n, const T& value) { - return etl::uninitialized_fill(o_begin, o_begin + n, value); + return etlstd::uninitialized_fill(o_begin, o_begin + n, value); } //***************************************************************************** /// Fills uninitialised memory with N values. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill_n ///\ingroup memory //***************************************************************************** template - TOutputIterator uninitialized_fill_n(TOutputIterator o_begin, TSize n, const T& value, TCounter& count) + TOutputIterator uninitialized_fill_n(TOutputIterator o_begin, TSize n, const T& value, TCounter& count) { count += n; - return etl::uninitialized_fill(o_begin, o_begin + n, value); + return etlstd::uninitialized_fill(o_begin, o_begin + n, value); + } +#else + //***************************************************************************** + /// Fills uninitialised memory with N values. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill_n + ///\ingroup memory + //***************************************************************************** + template + TOutputIterator uninitialized_fill_n(TOutputIterator o_begin, TSize n, const T& value) + { + return std::uninitialized_fill_n(o_begin, n, value); + } + + //***************************************************************************** + /// Fills uninitialised memory with N values. + /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_fill_n + ///\ingroup memory + //***************************************************************************** + template + TOutputIterator uninitialized_fill_n(TOutputIterator o_begin, TSize n, const T& value, TCounter& count) + { + count += n; + + return std::uninitialized_fill_n(o_begin, n, value); + } +#endif + +#if defined(ETL_NO_STL) + //***************************************************************************** + /// Copies a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy + ///\ingroup memory + //***************************************************************************** + template + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin) + { + return etlstd::copy(i_begin, i_end, o_begin); } //***************************************************************************** /// Copies a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin) { - return ETL_STD::copy(i_begin, i_end, o_begin); - } - - //***************************************************************************** - /// Copies a range of objects to uninitialised memory. - ///\ingroup memory - //***************************************************************************** - template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin) - { - typedef typename ETL_STD::iterator_traits::value_type value_type; + typedef typename etlstd::iterator_traits::value_type value_type; TOutputIterator o_end = o_begin; @@ -180,14 +258,15 @@ namespace etl //***************************************************************************** /// Copies a range of objects to uninitialised memory. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count) { - TOutputIterator o_end = ETL_STD::copy(i_begin, i_end, o_begin); - count += int32_t(ETL_STD::distance(o_begin, o_end)); + TOutputIterator o_end = etlstd::copy(i_begin, i_end, o_begin); + count += int32_t(etlstd::distance(o_begin, o_end)); return o_end; } @@ -195,105 +274,120 @@ namespace etl //***************************************************************************** /// Copies a range of objects to uninitialised memory. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count) { - TOutputIterator o_end = etl::uninitialized_copy(i_begin, i_end, o_begin); + TOutputIterator o_end = etlstd::uninitialized_copy(i_begin, i_end, o_begin); - count += int32_t(ETL_STD::distance(o_begin, o_end)); + count += int32_t(etlstd::distance(o_begin, o_end)); return o_end; } +#else + //***************************************************************************** + /// Copies a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy + ///\ingroup memory + //***************************************************************************** + template + TOutputIterator uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin) + { + return std::uninitialized_copy(i_begin, i_end, o_begin); + } + //***************************************************************************** + /// Copies a range of objects to uninitialised memory. + /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy + ///\ingroup memory + //***************************************************************************** + template + TOutputIterator uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count) + { + return std::uninitialized_copy(i_begin, i_end, o_begin); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED //***************************************************************************** /// Copies N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy_n ///\ingroup memory //***************************************************************************** template - TOutputIterator uninitialized_copy_n(TInputIterator i_begin, TSize n, TOutputIterator o_begin) + TOutputIterator uninitialized_copy_n(TInputIterator i_begin, TSize n, TOutputIterator o_begin) { - return etl::uninitialized_copy(i_begin, i_begin + n, o_begin); + return etlstd::uninitialized_copy(i_begin, i_begin + n, o_begin); } //***************************************************************************** /// Copies N objects to uninitialised memory. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy_n ///\ingroup memory //***************************************************************************** template - TOutputIterator uninitialized_copy_n(TInputIterator i_begin, TSize n, TOutputIterator o_begin, TCounter& count) + TOutputIterator uninitialized_copy_n(TInputIterator i_begin, TSize n, TOutputIterator o_begin, TCounter& count) { count += n; - return etl::uninitialized_copy(i_begin, i_begin + n, o_begin); + return etlstd::uninitialized_copy(i_begin, i_begin + n, o_begin); + } +#else + //***************************************************************************** + /// Copies N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy_n + ///\ingroup memory + //***************************************************************************** + template + TOutputIterator uninitialized_copy_n(TInputIterator i_begin, TSize n, TOutputIterator o_begin) + { + return std::uninitialized_copy_n(i_begin, n, o_begin); } //***************************************************************************** - /// Default contruct an item at address p. + /// Copies N objects to uninitialised memory. + /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_copy_n ///\ingroup memory //***************************************************************************** - template - typename etl::enable_if::value, void>::type - create_default_at(T* /*p*/) + template + TOutputIterator uninitialized_copy_n(TInputIterator i_begin, TSize n, TOutputIterator o_begin, TCounter& count) { - } + count += n; - //***************************************************************************** - /// Default contruct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - typename etl::enable_if::value, void>::type - create_default_at(T* /*p*/, TCounter& count) - { - ++count; - } + return std::uninitialized_copy_n(i_begin, n, o_begin); +} +#endif +#if defined(ETL_NO_STL) || !ETL_CPP17_SUPPORTED //***************************************************************************** - /// Default contruct an item at address p. + /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct ///\ingroup memory //***************************************************************************** - template - typename etl::enable_if::value, void>::type - create_default_at(T* p) + template + typename etlstd::enable_if::value_type>::value, void>::type + uninitialized_default_construct(TOutputIterator /*o_begin*/, TOutputIterator /*o_end*/) { - ::new (p) T; - } - - //***************************************************************************** - /// Default contruct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - typename etl::enable_if::value, void>::type - create_default_at(T* p, TCounter& count) - { - ::new (p) T; - ++count; + // Do nothing } //***************************************************************************** /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, void>::type - uninitialized_default_construct(TOutputIterator /*o_begin*/, TOutputIterator /*o_end*/) + typename etlstd::enable_if::value_type>::value, void>::type + uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end) { - } - //***************************************************************************** - /// Default initialises a range of objects to uninitialised memory. - ///\ingroup memory - //***************************************************************************** - template - typename etl::enable_if::value_type>::value, void>::type - uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end) - { - typedef typename ETL_STD::iterator_traits::value_type value_type; + typedef typename etlstd::iterator_traits::value_type value_type; while (o_begin != o_end) { @@ -304,66 +398,99 @@ namespace etl //***************************************************************************** /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct /// Debug counter version. ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, void>::type - uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) + typename etlstd::enable_if::value_type>::value, void>::type + uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count = int32_t(ETL_STD::distance(o_begin, o_end)); + count = int32_t(etlstd::distance(o_begin, o_end)); } //***************************************************************************** /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct /// Debug counter version. ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, void>::type - uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) + typename etlstd::enable_if::value_type>::value, void>::type + uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count += int32_t(ETL_STD::distance(o_begin, o_end)); + count += int32_t(etlstd::distance(o_begin, o_end)); - etl::uninitialized_default_construct(o_begin, o_end); + etlstd::uninitialized_default_construct(o_begin, o_end); + } +#else + //***************************************************************************** + /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct + ///\ingroup memory + //***************************************************************************** + template + typename etlstd::enable_if::value_type>::value, void>::type + uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end) + { + std::uninitialized_default_construct(o_begin, o_end); + } + + //***************************************************************************** + /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct + /// Debug counter version. + ///\ingroup memory + //***************************************************************************** + template + typename etlstd::enable_if::value_type>::value, void>::type + uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) + { + count = int32_t(etlstd::distance(o_begin, o_end)); + + std::uninitialized_default_construct(o_begin, o_end); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP17_SUPPORTED + //***************************************************************************** + /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct_n + ///\ingroup memory + //***************************************************************************** + template + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_default_construct_n(TOutputIterator o_begin, TSize n) + { + TOutputIterator o_end = o_begin + n; + return o_end; } //***************************************************************************** /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct_n ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_default_construct_n(TOutputIterator o_begin, TSize n) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_default_construct_n(TOutputIterator o_begin, TSize n) { TOutputIterator o_end = o_begin + n; + etlstd::uninitialized_default_construct(o_begin, o_end); + return o_end; } //***************************************************************************** /// Default initialises N objects to uninitialised memory. - ///\ingroup memory - //***************************************************************************** - template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_default_construct_n(TOutputIterator o_begin, TSize n) - { - TOutputIterator o_end = o_begin + n; - - etl::uninitialized_default_construct(o_begin, o_end); - - return o_end; - } - - //***************************************************************************** - /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct_n /// Debug counter version. ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_default_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_default_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) { TOutputIterator o_end = o_begin + n; @@ -374,193 +501,77 @@ namespace etl //***************************************************************************** /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct_n /// Debug counter version. ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_default_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_default_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) { TOutputIterator o_end = o_begin + n; - etl::uninitialized_default_construct(o_begin, o_end); + etlstd::uninitialized_default_construct(o_begin, o_end); count += n; return o_end; } - +#else //***************************************************************************** - /// Value construct an item at address p. + /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct_n ///\ingroup memory //***************************************************************************** - template - void create_value_at(T* p) + template + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_default_construct_n(TOutputIterator o_begin, TSize n) { - ::new (p) T(); + return std::uninitialized_default_construct_n(o_begin, n); } - //***************************************************************************** - /// Value construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - void create_value_at(T* p, TCounter& count) - { - ::new (p) T(); - ++count; - } //***************************************************************************** - /// Copy construct an item at address p. + /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct_n + /// Debug counter version. ///\ingroup memory //***************************************************************************** - template - void create_copy_at(T* p, const T& value) + template + typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + uninitialized_default_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) { - ::new (p) T(value); - } + count += n; -#if ETL_CPP11_SUPPORTED - //***************************************************************************** - /// Copy construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - void create_copy_at(T* p, T&& value) - { - ::new (p) T(ETL_STD::move(value)); + return std::uninitialized_default_construct_n(o_begin, n); } #endif +#if defined(ETL_NO_STL) || !ETL_CPP17_SUPPORTED //***************************************************************************** - /// Copy construct an item at address p. + /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_value_construct ///\ingroup memory //***************************************************************************** - template - void create_copy_at(T* p, const T& value, TCounter& count) + template + typename etlstd::enable_if::value_type>::value, void>::type + uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end) { - ::new (p) T(value); - ++count; - } + typedef typename etlstd::iterator_traits::value_type value_type; - //***************************************************************************** - /// Construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - T& make_default_at(T* p) - { - ::new (p) T(); - return *reinterpret_cast(p); - } - - //***************************************************************************** - /// Construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - T& make_default_at(T* p, TCounter& count) - { - ::new (p) T(); - ++count; - return *reinterpret_cast(p); - } - - //***************************************************************************** - /// Construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - T& make_copy_at(T* p, const T& other) - { - ::new (p) T(other); - return *reinterpret_cast(p); - } - -#if ETL_CPP11_SUPPORTED - //***************************************************************************** - /// Construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - T& make_copy_at(T* p, T&& other) - { - ::new (p) T(ETL_STD::move(other)); - return *reinterpret_cast(p); - } -#endif - - //***************************************************************************** - /// Construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - T& make_copy_at(T* p, const T& other, TCounter& count) - { - ::new (p) T(other); - ++count; - return *reinterpret_cast(p); - } - - //***************************************************************************** - /// Construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - T& make_value_at(T* p, const TParameter& value) - { - ::new (p) T(value); - return *reinterpret_cast(p); - } - -#if ETL_CPP11_SUPPORTED - //***************************************************************************** - /// Construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - T& make_value_at(T* p, TParameter&& value) - { - ::new (p) T(ETL_STD::move(value)); - return *reinterpret_cast(p); - } -#endif - - //***************************************************************************** - /// Construct an item at address p. - ///\ingroup memory - //***************************************************************************** - template - T& make_value_at(T* p, const TParameter& value, TCounter& count) - { - ::new (p) T(value); - ++count; - return *reinterpret_cast(p); + etlstd::fill(o_begin, o_end, value_type()); } //***************************************************************************** /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_value_construct ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, void>::type - uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end) + typename etlstd::enable_if::value_type>::value, void>::type + uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end) { - typedef typename ETL_STD::iterator_traits::value_type value_type; - - ETL_STD::fill(o_begin, o_end, value_type()); - } - - //***************************************************************************** - /// Default initialises a range of objects to uninitialised memory. - ///\ingroup memory - //***************************************************************************** - template - typename etl::enable_if::value_type>::value, void>::type - uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end) - { - typedef typename ETL_STD::iterator_traits::value_type value_type; + typedef typename etlstd::iterator_traits::value_type value_type; while (o_begin != o_end) { @@ -571,19 +582,49 @@ namespace etl //***************************************************************************** /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_value_construct /// Debug counter version. ///\ingroup memory //***************************************************************************** template void uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count += int32_t(ETL_STD::distance(o_begin, o_end)); + count += int32_t(etlstd::distance(o_begin, o_end)); - etl::uninitialized_value_construct(o_begin, o_end); + etlstd::uninitialized_value_construct(o_begin, o_end); + } +#else + //***************************************************************************** + /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_value_construct + ///\ingroup memory + //***************************************************************************** + template + void uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end) + { + std::uninitialized_value_construct(o_begin, o_end); } + //***************************************************************************** + /// Default initialises a range of objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_value_construct + /// Debug counter version. + ///\ingroup memory + //***************************************************************************** + template + void uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) + { + count += int32_t(etlstd::distance(o_begin, o_end)); + + std::uninitialized_value_construct(o_begin, o_end); + } + +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP17_SUPPORTED //***************************************************************************** /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_value_construct_n ///\ingroup memory //***************************************************************************** template @@ -591,13 +632,14 @@ namespace etl { TOutputIterator o_end = o_begin + n; - etl::uninitialized_value_construct(o_begin, o_end); + etlstd::uninitialized_value_construct(o_begin, o_end); return o_end; } //***************************************************************************** /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_value_construct_n /// Debug counter version. ///\ingroup memory //***************************************************************************** @@ -606,30 +648,59 @@ namespace etl { TOutputIterator o_end = o_begin + n; - etl::uninitialized_value_construct(o_begin, o_end); + etlstd::uninitialized_value_construct(o_begin, o_end); count += n; return o_end; } +#else + //***************************************************************************** + /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_value_construct_n + ///\ingroup memory + //***************************************************************************** + template + TOutputIterator uninitialized_value_construct_n(TOutputIterator o_begin, TSize n) + { + return std::uninitialized_value_construct_n(o_begin, n); + } + //***************************************************************************** + /// Default initialises N objects to uninitialised memory. + /// https://en.cppreference.com/w/cpp/memory/uninitialized_value_construct_n + /// Debug counter version. + ///\ingroup memory + //***************************************************************************** + template + TOutputIterator uninitialized_value_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) + { + count += n; + + return std::uninitialized_value_construct_n(o_begin, n); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP17_SUPPORTED //***************************************************************************** /// Destroys an item at address p. + /// https://en.cppreference.com/w/cpp/memory/destroy_at ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value, void>::type - destroy_at(T* /*p*/) + typename etlstd::enable_if::value, void>::type + destroy_at(T* /*p*/) { } //***************************************************************************** /// Destroys an item at address p. + /// https://en.cppreference.com/w/cpp/memory/destroy_at ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value, void>::type - destroy_at(T* p) + typename etlstd::enable_if::value, void>::type + destroy_at(T* p) { p->~T(); } @@ -637,11 +708,12 @@ namespace etl //***************************************************************************** /// Destroys an item at address p. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/destroy_at ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value, void>::type - destroy_at(T* /*p*/, TCounter& count) + typename etlstd::enable_if::value, void>::type + destroy_at(T* /*p*/, TCounter& count) { --count; } @@ -649,37 +721,66 @@ namespace etl //***************************************************************************** /// Destroys an item at address p. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/destroy_at ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value, void>::type - destroy_at(T* p, TCounter& count) + typename etlstd::enable_if::value, void>::type + destroy_at(T* p, TCounter& count) { p->~T(); --count; } +#else + //***************************************************************************** + /// Destroys an item at address p. + /// https://en.cppreference.com/w/cpp/memory/destroy_at + ///\ingroup memory + //***************************************************************************** + template + void destroy_at(T* p) + { + std::destroy_at(p); + } + //***************************************************************************** + /// Destroys an item at address p. + /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/destroy_at + ///\ingroup memory + //***************************************************************************** + template + void destroy_at(T* /*p*/, TCounter& count) + { + --count; + std::destroy_at(p); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP17_SUPPORTED //***************************************************************************** /// Destroys a range of items. + /// https://en.cppreference.com/w/cpp/memory/destroy ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, void>::type - destroy(TIterator /*i_begin*/, TIterator /*i_end*/) + typename etlstd::enable_if::value_type>::value, void>::type + destroy(TIterator /*i_begin*/, TIterator /*i_end*/) { } //***************************************************************************** /// Destroys a range of items. + /// https://en.cppreference.com/w/cpp/memory/destroy ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, void>::type - destroy(TIterator i_begin, TIterator i_end) + typename etlstd::enable_if::value_type>::value, void>::type + destroy(TIterator i_begin, TIterator i_end) { while (i_begin != i_end) { - etl::destroy_at(etl::addressof(*i_begin)); + etlstd::destroy_at(etl::addressof(*i_begin)); ++i_begin; } } @@ -687,51 +788,82 @@ namespace etl //***************************************************************************** /// Destroys a range of items. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/destroy ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, void>::type - destroy(TIterator i_begin, TIterator i_end, TCounter& count) + typename etlstd::enable_if::value_type>::value, void>::type + destroy(TIterator i_begin, TIterator i_end, TCounter& count) { - count -= int32_t(ETL_STD::distance(i_begin, i_end)); + count -= int32_t(etlstd::distance(i_begin, i_end)); } //***************************************************************************** /// Destroys a range of items. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/destroy ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, void>::type - destroy(TIterator i_begin, TIterator i_end, TCounter& count) + typename etlstd::enable_if::value_type>::value, void>::type + destroy(TIterator i_begin, TIterator i_end, TCounter& count) { - count -= int32_t(ETL_STD::distance(i_begin, i_end)); + count -= int32_t(etlstd::distance(i_begin, i_end)); while (i_begin != i_end) { - etl::destroy_at(etl::addressof(*i_begin)); + etlstd::destroy_at(etl::addressof(*i_begin)); ++i_begin; } } +#else + //***************************************************************************** + /// Destroys a range of items. + /// https://en.cppreference.com/w/cpp/memory/destroy + ///\ingroup memory + //***************************************************************************** + template + void destroy(TIterator i_begin, TIterator i_end) + { + std::destroy(i_begin, i_end); + } + //***************************************************************************** + /// Destroys a range of items. + /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/destroy + ///\ingroup memory + //***************************************************************************** + template + void destroy(TIterator i_begin, TIterator i_end, TCounter& count) + { + count -= int32_t(etlstd::distance(i_begin, i_end)); + + std::destroy(i_begin, i_end); + } +#endif + +#if defined(ETL_NO_STL) || !ETL_CPP17_SUPPORTED //***************************************************************************** /// Destroys a number of items. + /// https://en.cppreference.com/w/cpp/memory/destroy_n ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TIterator>::type - destroy_n(TIterator i_begin, TSize n) + typename etlstd::enable_if::value_type>::value, TIterator>::type + destroy_n(TIterator i_begin, TSize n) { return i_begin + n; } //***************************************************************************** /// Destroys a number of items. + /// https://en.cppreference.com/w/cpp/memory/destroy_n ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TIterator>::type - destroy_n(TIterator i_begin, TSize n) + typename etlstd::enable_if::value_type>::value, TIterator>::type + destroy_n(TIterator i_begin, TSize n) { while (n > 0) { @@ -746,11 +878,12 @@ namespace etl //***************************************************************************** /// Destroys a number of items. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/destroy_n ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TIterator>::type - destroy_n(TIterator i_begin, TSize n, TCounter& count) + typename etlstd::enable_if::value_type>::value, TIterator>::type + destroy_n(TIterator i_begin, TSize n, TCounter& count) { count -= n; return i_begin + n; @@ -759,11 +892,12 @@ namespace etl //***************************************************************************** /// Destroys a number of items. /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/destroy_n ///\ingroup memory //***************************************************************************** template - typename etl::enable_if::value_type>::value, TIterator>::type - destroy_n(TIterator i_begin, TSize n, TCounter& count) + typename etlstd::enable_if::value_type>::value, TIterator>::type + destroy_n(TIterator i_begin, TSize n, TCounter& count) { count -= n; @@ -776,45 +910,37 @@ namespace etl return i_begin; } - +#else //***************************************************************************** - /// Copy constructs a derived class to an address. - ///\tparam T The derived type. + /// Destroys a number of items. + /// https://en.cppreference.com/w/cpp/memory/destroy_n ///\ingroup memory //***************************************************************************** - template - struct create_copy + template + TIterator destroy_n(TIterator i_begin, TSize n) { - void create_copy_at(void* p) - { - new (p) T(static_cast(*this)); - } + return std::destroy_n(i_begin, n); + } - template - void create_copy_at(void* p, TCounter& count) - { - new (p) T(static_cast(*this)); - ++count; - } + //***************************************************************************** + /// Destroys a number of items. + /// Debug counter version. + /// https://en.cppreference.com/w/cpp/memory/destroy_n + ///\ingroup memory + //***************************************************************************** + template + TIterator destroy_n(TIterator i_begin, TSize n, TCounter& count) + { + count -= n; - T& make_copy_at(void* p) - { - new (p) T(static_cast(*this)); - return *reinterpret_cast(p); - } - - template - T& make_copy_at(void* p, TCounter& count) - { - new (p) T(static_cast(*this)); - ++count; - return *reinterpret_cast(p); - } - }; + return std::destroy_n(i_begin, n); + } +#endif //***************************************************************************** /// Default deleter. ///\tparam T The pointed to type type. + /// https://en.cppreference.com/w/cpp/memory/default_delete ///\ingroup memory //***************************************************************************** template @@ -829,6 +955,7 @@ namespace etl //***************************************************************************** /// Default deleter for arrays. ///\tparam T The pointed to type type. + /// https://en.cppreference.com/w/cpp/memory/default_delete ///\ingroup memory //***************************************************************************** template @@ -844,126 +971,127 @@ namespace etl //***************************************************************************** /// Unique pointer. ///\tparam T The pointed to type type. + /// https://en.cppreference.com/w/cpp/memory/unique_ptr ///\ingroup memory //***************************************************************************** - template > + template > class unique_ptr { public: - typedef T element_type; - typedef T* pointer; - typedef T& reference; + typedef T element_type; + typedef T* pointer; + typedef T& reference; - ETL_CONSTEXPR unique_ptr() - : p(nullptr) - { - } + ETL_CONSTEXPR unique_ptr() + : p(nullptr) + { + } - ETL_CONSTEXPR explicit unique_ptr (pointer p_) - : p(p_) - { - } + ETL_CONSTEXPR explicit unique_ptr(pointer p_) + : p(p_) + { + } #if ETL_CPP11_SUPPORTED - unique_ptr (unique_ptr&& p_) - : p(p_.release()) - { - } + unique_ptr(unique_ptr&& p_) + : p(p_.release()) + { + } #endif - ~unique_ptr() - { - deleter(p); - } + ~unique_ptr() + { + deleter(p); + } - ETL_CONSTEXPR pointer get() const - { - return p; - } + ETL_CONSTEXPR pointer get() const + { + return p; + } - TDeleter& get_deleter() - { - return deleter; - } + TDeleter& get_deleter() + { + return deleter; + } - const TDeleter& get_deleter() const - { - return deleter; - } + const TDeleter& get_deleter() const + { + return deleter; + } - pointer release() - { - pointer value = p; - p = nullptr; + pointer release() + { + pointer value = p; + p = nullptr; - return value; - } + return value; + } - void reset(pointer p_ = pointer()) - { - assert(p_ != p); + void reset(pointer p_ = pointer()) + { + assert(p_ != p); - pointer value = p; - p = p_; - deleter(value); - } + pointer value = p; + p = p_; + deleter(value); + } - void swap(unique_ptr& value) - { - ETL_STD::swap(p, value.p); - } + void swap(unique_ptr& value) + { + swap(p, value.p); + } - ETL_CONSTEXPR operator bool() const - { - return (p != nullptr); - } + ETL_CONSTEXPR operator bool() const + { + return (p != nullptr); + } - unique_ptr& operator =(pointer p_) - { - reset(p_); + unique_ptr& operator =(pointer p_) + { + reset(p_); - return *this; - } + return *this; + } #if ETL_CPP11_SUPPORTED - unique_ptr& operator =(unique_ptr&& p_) - { - reset(p_.release()); + unique_ptr& operator =(unique_ptr&& p_) + { + reset(p_.release()); - return *this; - } + return *this; + } #endif - ETL_CONSTEXPR reference operator *() const - { - return *get(); - } + ETL_CONSTEXPR reference operator *() const + { + return *get(); + } - ETL_CONSTEXPR pointer operator ->() const - { - return get(); - } + ETL_CONSTEXPR pointer operator ->() const + { + return get(); + } - ETL_CONSTEXPR reference operator [](size_t i) const - { - return get()[i]; - } + ETL_CONSTEXPR reference operator [](size_t i) const + { + return get()[i]; + } - ETL_CONSTEXPR bool operator== (const pointer p_) const - { - return p == p_; - } + ETL_CONSTEXPR bool operator== (const pointer p_) const + { + return p == p_; + } - ETL_CONSTEXPR bool operator== (const unique_ptr& p_) const - { - return p == p_.p; - } + ETL_CONSTEXPR bool operator== (const unique_ptr& p_) const + { + return p == p_.p; + } - ETL_CONSTEXPR bool operator< (const unique_ptr& p_) const - { - return p < p_.p; - } + ETL_CONSTEXPR bool operator< (const unique_ptr& p_) const + { + return p < p_.p; + } private: @@ -979,6 +1107,7 @@ namespace etl //***************************************************************************** /// Unique pointer for arrays. ///\tparam T The pointed to type type. + /// https://en.cppreference.com/w/cpp/memory/unique_ptr ///\ingroup memory //***************************************************************************** template @@ -1045,7 +1174,7 @@ namespace etl void swap(unique_ptr& v) { - ETL_STD::swap(p, v.p); + swap(p, v.p); } ETL_CONSTEXPR operator bool() const @@ -1109,6 +1238,237 @@ namespace etl pointer p; }; +} + +namespace etl +{ + //***************************************************************************** + /// Default contruct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + typename etlstd::enable_if::value, void>::type + create_default_at(T* /*p*/) + { + } + + //***************************************************************************** + /// Default contruct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + typename etlstd::enable_if::value, void>::type + create_default_at(T* /*p*/, TCounter& count) + { + ++count; + } + + //***************************************************************************** + /// Default contruct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + typename etlstd::enable_if::value, void>::type + create_default_at(T* p) + { + ::new (p) T; + } + + //***************************************************************************** + /// Default contruct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + typename etlstd::enable_if::value, void>::type + create_default_at(T* p, TCounter& count) + { + ::new (p) T; + ++count; + } + + //***************************************************************************** + /// Value construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + void create_value_at(T* p) + { + ::new (p) T(); + } + + //***************************************************************************** + /// Value construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + void create_value_at(T* p, TCounter& count) + { + ::new (p) T(); + ++count; + } + + //***************************************************************************** + /// Copy construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + void create_copy_at(T* p, const T& value) + { + ::new (p) T(value); + } + +#if ETL_CPP11_SUPPORTED + //***************************************************************************** + /// Copy construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + void create_copy_at(T* p, T&& value) + { + ::new (p) T(etlstd::move(value)); + } +#endif + + //***************************************************************************** + /// Copy construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + void create_copy_at(T* p, const T& value, TCounter& count) + { + ::new (p) T(value); + ++count; + } + + //***************************************************************************** + /// Construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + T& make_default_at(T* p) + { + ::new (p) T(); + return *reinterpret_cast(p); + } + + //***************************************************************************** + /// Construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + T& make_default_at(T* p, TCounter& count) + { + ::new (p) T(); + ++count; + return *reinterpret_cast(p); + } + + //***************************************************************************** + /// Construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + T& make_copy_at(T* p, const T& other) + { + ::new (p) T(other); + return *reinterpret_cast(p); + } + +#if ETL_CPP11_SUPPORTED + //***************************************************************************** + /// Construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + T& make_copy_at(T* p, T&& other) + { + ::new (p) T(etlstd::move(other)); + return *reinterpret_cast(p); + } +#endif + + //***************************************************************************** + /// Construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + T& make_copy_at(T* p, const T& other, TCounter& count) + { + ::new (p) T(other); + ++count; + return *reinterpret_cast(p); + } + + //***************************************************************************** + /// Construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + T& make_value_at(T* p, const TParameter& value) + { + ::new (p) T(value); + return *reinterpret_cast(p); + } + +#if ETL_CPP11_SUPPORTED + //***************************************************************************** + /// Construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + T& make_value_at(T* p, TParameter&& value) + { + ::new (p) T(etlstd::move(value)); + return *reinterpret_cast(p); + } +#endif + + //***************************************************************************** + /// Construct an item at address p. + ///\ingroup memory + //***************************************************************************** + template + T& make_value_at(T* p, const TParameter& value, TCounter& count) + { + ::new (p) T(value); + ++count; + return *reinterpret_cast(p); + } + + //***************************************************************************** + /// Copy constructs a derived class to an address. + ///\tparam T The derived type. + ///\ingroup memory + //***************************************************************************** + template + struct create_copy + { + void create_copy_at(void* p) + { + new (p) T(static_cast(*this)); + } + + template + void create_copy_at(void* p, TCounter& count) + { + new (p) T(static_cast(*this)); + ++count; + } + + T& make_copy_at(void* p) + { + new (p) T(static_cast(*this)); + return *reinterpret_cast(p); + } + + template + T& make_copy_at(void* p, TCounter& count) + { + new (p) T(static_cast(*this)); + ++count; + return *reinterpret_cast(p); + } + }; //***************************************************************************** /// A low level function that clears an object's memory to zero. @@ -1159,7 +1519,7 @@ namespace etl template void memory_clear_range(volatile T* begin, volatile T* end) { - const size_t n = static_cast(ETL_STD::distance(begin, end)); + const size_t n = static_cast(etlstd::distance(begin, end)); memory_clear_range(begin, n); } @@ -1217,7 +1577,7 @@ namespace etl template void memory_set_range(volatile T* begin, volatile T* end, const char value) { - const size_t n = static_cast(ETL_STD::distance(begin, end)); + const size_t n = static_cast(etlstd::distance(begin, end)); memory_set_range(begin, n, value); } diff --git a/include/etl/message_bus.h b/include/etl/message_bus.h index 2844feea..cda5bef6 100644 --- a/include/etl/message_bus.h +++ b/include/etl/message_bus.h @@ -102,10 +102,10 @@ namespace etl if (ok) { - router_list_t::iterator irouter = ETL_STD::upper_bound(router_list.begin(), - router_list.end(), - router.get_message_router_id(), - compare_router_id()); + router_list_t::iterator irouter = etlstd::upper_bound(router_list.begin(), + router_list.end(), + router.get_message_router_id(), + compare_router_id()); router_list.insert(irouter, &router); } @@ -125,10 +125,10 @@ namespace etl } else { - ETL_PAIR range = ETL_STD::equal_range(router_list.begin(), - router_list.end(), - id, - compare_router_id()); + ETL_PAIR range = etlstd::equal_range(router_list.begin(), + router_list.end(), + id, + compare_router_id()); router_list.erase(range.first, range.second); } @@ -137,9 +137,9 @@ namespace etl //******************************************* void unsubscribe(etl::imessage_router& router) { - router_list_t::iterator irouter = ETL_STD::find(router_list.begin(), - router_list.end(), - &router); + router_list_t::iterator irouter = etlstd::find(router_list.begin(), + router_list.end(), + &router); if (irouter != router_list.end()) { @@ -212,10 +212,10 @@ namespace etl router_list_t::iterator irouter = router_list.begin(); // Find routers with the id. - ETL_PAIR range = ETL_STD::equal_range(router_list.begin(), - router_list.end(), - destination_router_id, - compare_router_id()); + ETL_PAIR range = etlstd::equal_range(router_list.begin(), + router_list.end(), + destination_router_id, + compare_router_id()); // Call all of them. while (range.first != range.second) @@ -230,10 +230,10 @@ namespace etl // Do any message buses. // These are always at the end of the list. - irouter = ETL_STD::lower_bound(router_list.begin(), - router_list.end(), - etl::imessage_bus::MESSAGE_BUS, - compare_router_id()); + irouter = etlstd::lower_bound(router_list.begin(), + router_list.end(), + etl::imessage_bus::MESSAGE_BUS, + compare_router_id()); while (irouter != router_list.end()) { diff --git a/include/etl/multimap.h b/include/etl/multimap.h index 34e11f60..371a1639 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -37,9 +37,9 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #include "container.h" #include "pool.h" @@ -624,7 +624,7 @@ namespace etl /// A templated base for all etl::multimap types. ///\ingroup map //*************************************************************************** - template > + template > class imultimap : public etl::multimap_base { public: @@ -733,7 +733,7 @@ namespace etl //************************************************************************* /// iterator. //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -853,7 +853,7 @@ namespace etl //************************************************************************* /// const_iterator //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -960,10 +960,10 @@ namespace etl }; friend class const_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; //************************************************************************* /// Gets the beginning of the multimap. @@ -1931,7 +1931,7 @@ namespace etl //************************************************************************* /// A templated multimap implementation that uses a fixed size buffer. //************************************************************************* - template > + template > class multimap : public etl::imultimap { public: @@ -2018,7 +2018,7 @@ namespace etl template bool operator ==(const etl::imultimap& lhs, const etl::imultimap& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2044,10 +2044,7 @@ namespace etl template bool operator <(const etl::imultimap& lhs, const etl::imultimap& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), - lhs.end(), - rhs.begin(), - rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/multiset.h b/include/etl/multiset.h index 6e03ce4b..958affdc 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -37,9 +37,9 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #include "parameter_type.h" #include "container.h" @@ -623,7 +623,7 @@ namespace etl /// A templated base for all etl::multiset types. ///\ingroup set //*************************************************************************** - template > + template > class imultiset : public etl::multiset_base { public: @@ -713,7 +713,7 @@ namespace etl //************************************************************************* /// iterator. //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -818,7 +818,7 @@ namespace etl //************************************************************************* /// const_iterator //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -925,10 +925,10 @@ namespace etl }; friend class const_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; //************************************************************************* /// Gets the beginning of the multiset. @@ -1895,7 +1895,7 @@ namespace etl //************************************************************************* /// A templated multiset implementation that uses a fixed size buffer. //************************************************************************* - template > + template > class multiset : public etl::imultiset { public: @@ -1982,7 +1982,7 @@ namespace etl template bool operator ==(const etl::imultiset& lhs, const etl::imultiset& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && ETL_OR_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2008,7 +2008,7 @@ namespace etl template bool operator <(const etl::imultiset& lhs, const etl::imultiset& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), + return ETL_OR_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); diff --git a/include/etl/murmur3.h b/include/etl/murmur3.h index 5d54f47b..6b869c7b 100644 --- a/include/etl/murmur3.h +++ b/include/etl/murmur3.h @@ -57,7 +57,7 @@ namespace etl { public: - ETL_STATIC_ASSERT((etl::is_same::value || etl::is_same::value), "Only 32 & 64 bit types supported"); + ETL_STATIC_ASSERT((etlstd::is_same::value || etlstd::is_same::value), "Only 32 & 64 bit types supported"); typedef THash value_type; @@ -81,7 +81,7 @@ namespace etl murmur3(TIterator begin, const TIterator end, value_type seed_ = 0) : seed(seed_) { - ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits::value_type) == 1, "Incompatible type"); + ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Incompatible type"); reset(); while (begin != end) @@ -119,7 +119,7 @@ namespace etl template void add(TIterator begin, const TIterator end) { - ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits::value_type) == 1, "Incompatible type"); + ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Incompatible type"); ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised)); while (begin != end) diff --git a/include/etl/negative.h b/include/etl/negative.h index 7b2a6b33..eecf73a8 100644 --- a/include/etl/negative.h +++ b/include/etl/negative.h @@ -39,7 +39,7 @@ namespace etl // For signed types. //*************************************************************************** template - typename etl::enable_if::value, bool>::type + typename etlstd::enable_if::value, bool>::type is_negative(const T value) { return (value < T(0)); @@ -49,7 +49,7 @@ namespace etl // For unsigned types. //*************************************************************************** template - typename etl::enable_if::value, T>::type + typename etlstd::enable_if::value, T>::type is_negative(const T) { return false; diff --git a/include/etl/observer.h b/include/etl/observer.h index 9de10a64..9441f07c 100644 --- a/include/etl/observer.h +++ b/include/etl/observer.h @@ -115,9 +115,9 @@ namespace etl void add_observer(TObserver& observer) { // See if we already have it in our list. - typename Observer_List::const_iterator i_observer = ETL_STD::find(observer_list.begin(), - observer_list.end(), - &observer); + typename Observer_List::const_iterator i_observer = etlstd::find(observer_list.begin(), + observer_list.end(), + &observer); // Not there? if (i_observer == observer_list.end()) @@ -138,9 +138,9 @@ namespace etl bool remove_observer(TObserver& observer) { // See if we have it in our list. - typename Observer_List::iterator i_observer = ETL_STD::find(observer_list.begin(), - observer_list.end(), - &observer); + typename Observer_List::iterator i_observer = etlstd::find(observer_list.begin(), + observer_list.end(), + &observer); // Found it? if (i_observer != observer_list.end()) diff --git a/include/etl/optional.h b/include/etl/optional.h index b03636f9..dc2d5b58 100644 --- a/include/etl/optional.h +++ b/include/etl/optional.h @@ -39,7 +39,7 @@ SOFTWARE. #include "exception.h" #include "error_handler.h" -#include "stl/utility.h" +#include "utility.h" namespace etl { @@ -343,7 +343,7 @@ namespace etl storage.template get_reference().~T(); } - ::new (storage.template get_address()) T(ETL_STD::forward(args)...); + ::new (storage.template get_address()) T(ETL_OR_STD::forward(args)...); valid = true; } #else diff --git a/include/etl/packet.h b/include/etl/packet.h index 35390315..b25e55fe 100644 --- a/include/etl/packet.h +++ b/include/etl/packet.h @@ -64,9 +64,9 @@ namespace etl template explicit packet(const T& value) { - ETL_STATIC_ASSERT((etl::is_base_of::value), "Unsupported type"); + ETL_STATIC_ASSERT((etlstd::is_base_of::value), "Unsupported type"); ETL_STATIC_ASSERT(sizeof(T) <= SIZE, "Unsupported size"); - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Unsupported alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Unsupported alignment"); ::new (static_cast(data)) T(value); } @@ -86,9 +86,9 @@ namespace etl template packet& operator =(const T& value) { - ETL_STATIC_ASSERT((etl::is_base_of::value), "Unsupported type"); + ETL_STATIC_ASSERT((etlstd::is_base_of::value), "Unsupported type"); ETL_STATIC_ASSERT(sizeof(T) <= SIZE, "Unsupported size"); - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Unsupported alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Unsupported alignment"); static_cast(data)->~TBase(); ::new (static_cast(data)) T(value); diff --git a/include/etl/parameter_type.h b/include/etl/parameter_type.h index 019daaea..d0694544 100644 --- a/include/etl/parameter_type.h +++ b/include/etl/parameter_type.h @@ -43,7 +43,7 @@ namespace etl struct parameter_type { /// By default fundamental and pointer types are passed by value. - typedef typename etl::conditional::value || is_pointer::value, + typedef typename etlstd::conditional::value || is_pointer::value, T, const T&>::type type; }; diff --git a/include/etl/pearson.h b/include/etl/pearson.h index ab06cfa0..eebcec57 100644 --- a/include/etl/pearson.h +++ b/include/etl/pearson.h @@ -81,7 +81,7 @@ namespace etl pearson(TIterator begin, const TIterator end) : first(true) { - ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits::value_type) == 1, "Type not supported"); + ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Type not supported"); reset(); add(begin, end); @@ -103,7 +103,7 @@ namespace etl template void add(TIterator begin, const TIterator end) { - ETL_STATIC_ASSERT(sizeof(typename ETL_STD::iterator_traits::value_type) == 1, "Type not supported"); + ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Type not supported"); while (begin != end) { diff --git a/include/etl/platform.h b/include/etl/platform.h index c2e9cd14..5df07d4f 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -102,4 +102,9 @@ SOFTWARE. #define ETL_EXPLICIT_STRING_FROM_CHAR #endif +// Sort out names for STL/No STL options. +#include "private/choose_namespace.h" +#include "private/choose_tag_types.h" +#include "private/choose_pair_types.h" + #endif diff --git a/include/etl/pool.h b/include/etl/pool.h index a70d4b6d..232f504a 100644 --- a/include/etl/pool.h +++ b/include/etl/pool.h @@ -35,8 +35,8 @@ SOFTWARE. #include -#include "stl/algorithm.h" -#include "stl/iterator.h" +#include "algorithm.h" +#include "iterator.h" #include "error_handler.h" #include "alignment.h" @@ -224,7 +224,7 @@ namespace etl if (p) { - ::new (p) T(ETL_STD::forward(args)...); + ::new (p) T(etlstd::forward(args)...); } return p; @@ -492,7 +492,7 @@ namespace etl template U* allocate() { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::allocate(); } @@ -506,7 +506,7 @@ namespace etl template U* create() { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(); } @@ -519,7 +519,7 @@ namespace etl template U* create(const T1& value1) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(value1); } @@ -532,7 +532,7 @@ namespace etl template U* create(const T1& value1, const T2& value2) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(value1, value2); } @@ -545,7 +545,7 @@ namespace etl template U* create(const T1& value1, const T2& value2, const T3& value3) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(value1, value2, value3); } @@ -558,7 +558,7 @@ namespace etl template U* create(const T1& value1, const T2& value2, const T3& value3, const T4& value4) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(value1, value2, value3, value4); } @@ -569,9 +569,9 @@ namespace etl template U* create(Args&&... args) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); - return ipool::create(ETL_STD::forward(args)...); + return ipool::create(etlstd::forward(args)...); } #endif @@ -583,7 +583,7 @@ namespace etl template void destroy(const void* const p_object) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); reinterpret_cast((const_cast(p_object)))->~U(); ipool::release(p_object); @@ -600,7 +600,7 @@ namespace etl }; ///< The memory for the pool of objects. - typename etl::aligned_storage::value>::type buffer[SIZE]; + typename etl::aligned_storage::value>::type buffer[SIZE]; static const uint32_t ELEMENT_SIZE = sizeof(Element); @@ -614,11 +614,11 @@ namespace etl ///\ingroup pool //************************************************************************* template - class pool : public etl::generic_pool::value, SIZE_> + class pool : public etl::generic_pool::value, SIZE_> { private: - typedef etl::generic_pool::value, SIZE_> base_t; + typedef etl::generic_pool::value, SIZE_> base_t; public: @@ -643,7 +643,7 @@ namespace etl template U* allocate() { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template allocate(); } @@ -657,7 +657,7 @@ namespace etl template U* create() { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(); } @@ -670,7 +670,7 @@ namespace etl template U* create(const T1& value1) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(value1); } @@ -683,7 +683,7 @@ namespace etl template U* create(const T1& value1, const T2& value2) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(value1, value2); } @@ -696,7 +696,7 @@ namespace etl template U* create(const T1& value1, const T2& value2, const T3& value3) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(value1, value2, value3); } @@ -709,7 +709,7 @@ namespace etl template U* create(const T1& value1, const T2& value2, const T3& value3, const T4& value4) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(value1, value2, value3, value4); } @@ -722,9 +722,9 @@ namespace etl template U* create(Args&&... args) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); - return base_t::template create(ETL_STD::forward(args)...); + return base_t::template create(etlstd::forward(args)...); } #endif @@ -736,7 +736,7 @@ namespace etl template void destroy(const void* const p_object) { - ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); reinterpret_cast((const_cast(p_object)))->~U(); base_t::release(p_object); diff --git a/include/etl/priority_queue.h b/include/etl/priority_queue.h index 9904c908..5a232a4d 100644 --- a/include/etl/priority_queue.h +++ b/include/etl/priority_queue.h @@ -35,8 +35,8 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "functional.h" #include "container.h" #include "vector.h" @@ -115,7 +115,7 @@ namespace etl /// \tparam TContainer to hold the T queue values /// \tparam TCompare to use in comparing T values //*************************************************************************** - template > + template > class ipriority_queue { public: @@ -126,7 +126,7 @@ namespace etl typedef T& reference; ///< A reference to the type used in the queue. typedef const T& const_reference; ///< A const reference to the type used in the queue. typedef typename TContainer::size_type size_type; ///< The type used for determining the size of the queue. - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; private: @@ -165,7 +165,7 @@ namespace etl // Put element at end container.push_back(value); // Make elements in container into heap - ETL_STD::push_heap(container.begin(), container.end(), compare); + etlstd::push_heap(container.begin(), container.end(), compare); } #if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_PRIORITY_QUEUE_FORCE_CPP03) @@ -181,9 +181,9 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(etl::priority_queue_full)); // Put element at end - container.emplace_back(ETL_STD::forward(args)...); + container.emplace_back(etlstd::forward(args)...); // Make elements in container into heap - ETL_STD::push_heap(container.begin(), container.end(), compare); + etlstd::push_heap(container.begin(), container.end(), compare); } #else //************************************************************************* @@ -200,7 +200,7 @@ namespace etl // Put element at end container.emplace_back(value1); // Make elements in container into heap - ETL_STD::push_heap(container.begin(), container.end(), compare); + etlstd::push_heap(container.begin(), container.end(), compare); } //************************************************************************* @@ -217,7 +217,7 @@ namespace etl // Put element at end container.emplace_back(value1, value2); // Make elements in container into heap - ETL_STD::push_heap(container.begin(), container.end(), compare); + etlstd::push_heap(container.begin(), container.end(), compare); } //************************************************************************* @@ -234,7 +234,7 @@ namespace etl // Put element at end container.emplace_back(value1, value2, value3); // Make elements in container into heap - ETL_STD::push_heap(container.begin(), container.end(), compare); + etlstd::push_heap(container.begin(), container.end(), compare); } //************************************************************************* @@ -251,7 +251,7 @@ namespace etl // Put element at end container.emplace_back(value1, value2, value3, value4); // Make elements in container into heap - ETL_STD::push_heap(container.begin(), container.end(), compare); + etlstd::push_heap(container.begin(), container.end(), compare); } #endif @@ -268,14 +268,14 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(etl::priority_queue_iterator)); ETL_ASSERT(static_cast(d) <= max_size(), ETL_ERROR(etl::priority_queue_full)); #endif clear(); container.assign(first, last); - ETL_STD::make_heap(container.begin(), container.end(), compare); + etlstd::make_heap(container.begin(), container.end(), compare); } //************************************************************************* @@ -285,7 +285,7 @@ namespace etl void pop() { // Move largest element to end - ETL_STD::pop_heap(container.begin(), container.end(), compare); + etlstd::pop_heap(container.begin(), container.end(), compare); // Actually remove largest element at end container.pop_back(); } @@ -386,7 +386,7 @@ namespace etl /// \tparam T The type this queue should support. /// \tparam SIZE The maximum capacity of the queue. //*************************************************************************** - template , typename TCompare = ETL_STD::less > + template , typename TCompare = etlstd::less > class priority_queue : public etl::ipriority_queue { public: diff --git a/include/etl/private/choose_namespace.h b/include/etl/private/choose_namespace.h index 935b72ac..c8271715 100644 --- a/include/etl/private/choose_namespace.h +++ b/include/etl/private/choose_namespace.h @@ -28,19 +28,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#ifndef ETL_STL_CHOOSE_NAMESPACE_INCLUDED -#define ETL_STL_CHOOSE_NAMESPACE_INCLUDED +#ifndef ETL_CHOOSE_NAMESPACE_INCLUDED +#define ETL_CHOOSE_NAMESPACE_INCLUDED #include "../platform.h" -#if defined(ETL_NO_STL) - #ifndef ETL_STD - #define ETL_STD etlstd /// Namespace for the alternate STL. - #endif +#undef ETL_OR_STD + +#if defined(ETL_NO_STL) && !defined(ETL_IN_UNIT_TEST) + // If we're not using the STL and we are not unit testing, then use the ETL's definitions under the etlstd namespace + #define ETL_OR_STD etlstd #else - #ifndef ETL_STD - #define ETL_STD std /// Namespace for conventional STL - #endif + // We will use the STL's definitions under the std namespace + #define ETL_OR_STD std #endif #endif diff --git a/include/etl/private/choose_pair_types.h b/include/etl/private/choose_pair_types.h deleted file mode 100644 index 96ba73fe..00000000 --- a/include/etl/private/choose_pair_types.h +++ /dev/null @@ -1,46 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2019 jwellbelove - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files(the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions : - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -******************************************************************************/ - -#ifndef ETL_STL_CHOOSE_PAIR_TYPES_INCLUDED -#define ETL_STL_CHOOSE_PAIR_TYPES_INCLUDED - -#include "../platform.h" - -// When in the unit tests we have to ensure that the STL and ETL are using the same definitions. -#if defined(ETL_IN_UNIT_TEST) || !defined(ETL_NO_STL) - #include - #define ETL_PAIR std::pair - #define ETL_MAKE_PAIR std::make_pair -#else - #define ETL_PAIR etlstd::pair - #define ETL_MAKE_PAIR etlstd::make_pair -#endif - -#endif diff --git a/include/etl/private/choose_tag_types.h b/include/etl/private/choose_tag_types.h deleted file mode 100644 index 7b536de8..00000000 --- a/include/etl/private/choose_tag_types.h +++ /dev/null @@ -1,52 +0,0 @@ -///\file - -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -https://www.etlcpp.com - -Copyright(c) 2019 jwellbelove - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files(the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and / or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions : - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -******************************************************************************/ - -#ifndef ETL_STL_CHOOSE_TAG_TYPES_INCLUDED -#define ETL_STL_CHOOSE_TAG_TYPES_INCLUDED - -#include "../platform.h" - -// When in the unit tests we have to ensure that the STL and ETL are using the same definitions. -#if defined(ETL_IN_UNIT_TEST) || !defined(ETL_NO_STL) - #include - #define ETL_INPUT_ITERATOR_TAG std::input_iterator_tag - #define ETL_OUTPUT_ITERATOR_TAG std::output_iterator_tag - #define ETL_FORWARD_ITERATOR_TAG std::forward_iterator_tag - #define ETL_BIDIRECTIONAL_ITERATOR_TAG std::bidirectional_iterator_tag - #define ETL_RANDOM_ACCESS_ITERATOR_TAG std::random_access_iterator_tag -#else - #define ETL_INPUT_ITERATOR_TAG etlstd::input_iterator_tag - #define ETL_OUTPUT_ITERATOR_TAG etlstd::output_iterator_tag - #define ETL_FORWARD_ITERATOR_TAG etlstd::forward_iterator_tag - #define ETL_BIDIRECTIONAL_ITERATOR_TAG etlstd::bidirectional_iterator_tag - #define ETL_RANDOM_ACCESS_ITERATOR_TAG etlstd::random_access_iterator_tag -#endif - -#endif diff --git a/include/etl/private/crc16_poly_0x1021_.h b/include/etl/private/crc16_poly_0x1021_.h index 793009d6..85fc83d0 100644 --- a/include/etl/private/crc16_poly_0x1021_.h +++ b/include/etl/private/crc16_poly_0x1021_.h @@ -36,8 +36,7 @@ SOFTWARE. #include "../platform.h" #include "../frame_check_sequence.h" #include "../binary.h" - -#include "../stl/iterator.h" +#include "../iterator.h" #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 1300 diff --git a/include/etl/private/crc16_poly_0x8005.h b/include/etl/private/crc16_poly_0x8005.h index 86f61343..14526ff5 100644 --- a/include/etl/private/crc16_poly_0x8005.h +++ b/include/etl/private/crc16_poly_0x8005.h @@ -36,8 +36,7 @@ SOFTWARE. #include "../platform.h" #include "../frame_check_sequence.h" #include "../binary.h" - -#include "../stl/iterator.h" +#include "../iterator.h" #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 1300 diff --git a/include/etl/private/crc32_poly_0x04c11db7.h b/include/etl/private/crc32_poly_0x04c11db7.h index 142d30e6..801e70e8 100644 --- a/include/etl/private/crc32_poly_0x04c11db7.h +++ b/include/etl/private/crc32_poly_0x04c11db7.h @@ -36,8 +36,7 @@ SOFTWARE. #include "../platform.h" #include "../frame_check_sequence.h" #include "../binary.h" - -#include "../stl/iterator.h" +#include "../iterator.h" #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 1300 diff --git a/include/etl/private/crc32_poly_0x1edc6f41.h b/include/etl/private/crc32_poly_0x1edc6f41.h index 969bdcc6..c389a424 100644 --- a/include/etl/private/crc32_poly_0x1edc6f41.h +++ b/include/etl/private/crc32_poly_0x1edc6f41.h @@ -36,8 +36,7 @@ SOFTWARE. #include "../platform.h" #include "../frame_check_sequence.h" #include "../binary.h" - -#include "../stl/iterator.h" +#include "../iterator.h" #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 1300 diff --git a/include/etl/private/crc64_poly_0x42f0e1eba9ea3693.h b/include/etl/private/crc64_poly_0x42f0e1eba9ea3693.h index 83f46d48..4c09435b 100644 --- a/include/etl/private/crc64_poly_0x42f0e1eba9ea3693.h +++ b/include/etl/private/crc64_poly_0x42f0e1eba9ea3693.h @@ -36,8 +36,7 @@ SOFTWARE. #include "../platform.h" #include "../frame_check_sequence.h" #include "../binary.h" - -#include "../stl/iterator.h" +#include "../iterator.h" #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 1300 diff --git a/include/etl/private/crc8_poly_0x07.h b/include/etl/private/crc8_poly_0x07.h index 558ea003..7615d0e2 100644 --- a/include/etl/private/crc8_poly_0x07.h +++ b/include/etl/private/crc8_poly_0x07.h @@ -36,8 +36,7 @@ SOFTWARE. #include "../platform.h" #include "../frame_check_sequence.h" #include "../binary.h" - -#include "../stl/iterator.h" +#include "../iterator.h" #if defined(ETL_COMPILER_KEIL) #pragma diag_suppress 1300 diff --git a/include/etl/private/ivectorpointer.h b/include/etl/private/ivectorpointer.h index 51e174f4..3497cf2c 100644 --- a/include/etl/private/ivectorpointer.h +++ b/include/etl/private/ivectorpointer.h @@ -56,10 +56,10 @@ namespace etl typedef const value_type* const_pointer; typedef value_type* iterator; typedef const value_type* const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -441,7 +441,7 @@ namespace etl //********************************************************************* void initialise_source_external_buffer_after_move() { - ETL_SUBTRACT_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end))) + ETL_SUBTRACT_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) p_end = p_buffer; } @@ -451,7 +451,7 @@ namespace etl //********************************************************************* void initialise_destination_external_buffer_after_move() { - ETL_ADD_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end))) + ETL_ADD_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) } }; @@ -467,10 +467,10 @@ namespace etl typedef const value_type* const_pointer; typedef value_type* iterator; typedef const value_type* const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -852,7 +852,7 @@ namespace etl //********************************************************************* void initialise_source_external_buffer_after_move() { - ETL_SUBTRACT_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end))) + ETL_SUBTRACT_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) p_end = p_buffer; } @@ -862,7 +862,7 @@ namespace etl //********************************************************************* void initialise_destination_external_buffer_after_move() { - ETL_ADD_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end))) + ETL_ADD_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) } }; diff --git a/include/etl/private/pvoidvector.h b/include/etl/private/pvoidvector.h index 7277b299..172dd41b 100644 --- a/include/etl/private/pvoidvector.h +++ b/include/etl/private/pvoidvector.h @@ -41,8 +41,8 @@ SOFTWARE. #include "../type_traits.h" #include "../error_handler.h" -#include "../stl/functional.h" -#include "../stl/iterator.h" +#include "../functional.h" +#include "../iterator.h" #ifdef ETL_COMPILER_GCC #pragma GCC diagnostic ignored "-Wunused-variable" @@ -67,10 +67,10 @@ namespace etl typedef const value_type* const_pointer; typedef value_type* iterator; typedef const value_type* const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef ETL_STD::iterator_traits::difference_type difference_type; + typedef etlstd::iterator_traits::difference_type difference_type; public: @@ -211,7 +211,7 @@ namespace etl // Size up if necessary. if (p_end < p_new_end) { - ETL_STD::fill(p_end, p_new_end, value); + etlstd::fill(p_end, p_new_end, value); } p_end = p_new_end; @@ -326,7 +326,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); #endif @@ -402,7 +402,7 @@ namespace etl if (position != end()) { ++p_end; - ETL_STD::copy_backward(position, end() - 1, end()); + etlstd::copy_backward(position, end() - 1, end()); *position = value; } else @@ -424,8 +424,8 @@ namespace etl { ETL_ASSERT((size() + 1) <= CAPACITY, ETL_ERROR(vector_full)); - ETL_STD::copy_backward(position, p_end, p_end + n); - ETL_STD::fill_n(position, n, value); + etlstd::copy_backward(position, p_end, p_end + n); + etlstd::fill_n(position, n, value); p_end += n; } @@ -441,12 +441,12 @@ namespace etl template void insert(iterator position, TIterator first, TIterator last) { - size_t count = ETL_STD::distance(first, last); + size_t count = etlstd::distance(first, last); ETL_ASSERT((size() + count) <= CAPACITY, ETL_ERROR(vector_full)); - ETL_STD::copy_backward(position, p_end, p_end + count); - ETL_STD::copy(first, last, position); + etlstd::copy_backward(position, p_end, p_end + count); + etlstd::copy(first, last, position); p_end += count; } @@ -457,7 +457,7 @@ namespace etl //********************************************************************* iterator erase(iterator i_element) { - ETL_STD::copy(i_element + 1, end(), i_element); + etlstd::copy(i_element + 1, end(), i_element); --p_end; return i_element; @@ -473,8 +473,8 @@ namespace etl //********************************************************************* iterator erase(iterator first, iterator last) { - ETL_STD::copy(last, end(), first); - size_t n_delete = ETL_STD::distance(first, last); + etlstd::copy(last, end(), first); + size_t n_delete = etlstd::distance(first, last); // Just adjust the count. p_end -= n_delete; @@ -580,7 +580,7 @@ namespace etl //*************************************************************************** inline bool operator ==(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -604,7 +604,7 @@ namespace etl //*************************************************************************** inline bool operator <(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //*************************************************************************** diff --git a/include/etl/private/to_string_helper.h b/include/etl/private/to_string_helper.h index 31452b86..f2102f41 100644 --- a/include/etl/private/to_string_helper.h +++ b/include/etl/private/to_string_helper.h @@ -42,10 +42,9 @@ SOFTWARE. #include "../type_traits.h" #include "../container.h" #include "../absolute.h" - -#include "../stl/algorithm.h" -#include "../stl/iterator.h" -#include "../stl/limits.h" +#include "../algorithm.h" +#include "../iterator.h" +#include "../limits.h" namespace etl { @@ -57,7 +56,7 @@ namespace etl template void add_alignment(TIString& str, typename TIString::iterator position, const etl::basic_format_spec& format) { - uint32_t length = static_cast(ETL_STD::distance(position, str.end())); + uint32_t length = static_cast(etlstd::distance(position, str.end())); if (length < format.get_width()) { @@ -166,7 +165,7 @@ namespace etl } // Reverse the string we appended. - ETL_STD::reverse(start, str.end()); + etlstd::reverse(start, str.end()); } etl::private_to_string::add_alignment(str, start, format); @@ -242,7 +241,7 @@ namespace etl else { // Make sure we format the two halves correctly. - uint32_t max_precision = ETL_STD::numeric_limits::digits10; + uint32_t max_precision = etlstd::numeric_limits::digits10; etl::basic_format_spec integral_format = format; integral_format.decimal().width(0).precision(format.get_precision() > max_precision ? max_precision : format.get_precision()); @@ -355,10 +354,10 @@ namespace etl /// For signed integrals less than 64 bits. Default format spec. //*************************************************************************** template - typename etl::enable_if::value && - etl::is_signed::value && - !etl::is_same::value && - !etl::is_same::value, const TIString&>::type + typename etlstd::enable_if::value && + etlstd::is_signed::value && + !etlstd::is_same::value && + !etlstd::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -372,10 +371,10 @@ namespace etl /// For signed integrals less than 64 bits. Supplied format spec. //*************************************************************************** template - typename etl::enable_if::value && - etl::is_signed::value && - !etl::is_same::value && - !etl::is_same::value, const TIString&>::type + typename etlstd::enable_if::value && + etlstd::is_signed::value && + !etlstd::is_same::value && + !etlstd::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_integral(int32_t(value), str, format, append); @@ -387,10 +386,10 @@ namespace etl /// For unsigned integrals less then 64 bits. Default format spec. //*************************************************************************** template - typename etl::enable_if::value && - etl::is_unsigned::value && - !etl::is_same::value && - !etl::is_same::value, const TIString&>::type + typename etlstd::enable_if::value && + etlstd::is_unsigned::value && + !etlstd::is_same::value && + !etlstd::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -404,10 +403,10 @@ namespace etl /// For unsigned integrals less than 64 bits. Supplied format spec. //*************************************************************************** template - typename etl::enable_if::value && - etl::is_unsigned::value && - !etl::is_same::value && - !etl::is_same::value, const TIString&>::type + typename etlstd::enable_if::value && + etlstd::is_unsigned::value && + !etlstd::is_same::value && + !etlstd::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_integral(uint32_t(value), str, format, append); @@ -419,10 +418,10 @@ namespace etl /// For signed 64 bit integrals. Default format spec. //*************************************************************************** template - typename etl::enable_if::value && - etl::is_signed::value && - !etl::is_same::value && - etl::is_same::value, const TIString&>::type + typename etlstd::enable_if::value && + etlstd::is_signed::value && + !etlstd::is_same::value && + etlstd::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -436,10 +435,10 @@ namespace etl /// For signed 64 bit integrals. Supplied format spec. //*************************************************************************** template - typename etl::enable_if::value && - etl::is_signed::value && - !etl::is_same::value && - etl::is_same::value, const TIString&>::type + typename etlstd::enable_if::value && + etlstd::is_signed::value && + !etlstd::is_same::value && + etlstd::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_integral(int64_t(value), str, format, append); @@ -451,10 +450,10 @@ namespace etl /// For unsigned 64 bit integrals. Default format spec. //*************************************************************************** template - typename etl::enable_if::value && - etl::is_unsigned::value && - !etl::is_same::value && - etl::is_same::value, const TIString&>::type + typename etlstd::enable_if::value && + etlstd::is_unsigned::value && + !etlstd::is_same::value && + etlstd::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -468,10 +467,10 @@ namespace etl /// For unsigned 64 bit integrals. Supplied format spec. //*************************************************************************** template - typename etl::enable_if::value && - etl::is_unsigned::value && - !etl::is_same::value && - etl::is_same::value, const TIString&>::type + typename etlstd::enable_if::value && + etlstd::is_unsigned::value && + !etlstd::is_same::value && + etlstd::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_integral(uint64_t(value), str, format, append); @@ -483,7 +482,7 @@ namespace etl /// For floating point. Default format spec. //*************************************************************************** template - typename etl::enable_if::value, const TIString&>::type + typename etlstd::enable_if::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -497,7 +496,7 @@ namespace etl /// For floating point. Supplied format spec. //*************************************************************************** template - typename etl::enable_if::value, const TIString&>::type + typename etlstd::enable_if::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_floating_point(value, str, format, append); diff --git a/include/etl/queue.h b/include/etl/queue.h index 143bd5b2..a251690b 100644 --- a/include/etl/queue.h +++ b/include/etl/queue.h @@ -330,7 +330,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(queue_full)); #endif - ::new (&p_buffer[in]) T(ETL_STD::forward(args)...); + ::new (&p_buffer[in]) T(etlstd::forward(args)...); add_in(); } #else @@ -582,7 +582,7 @@ namespace etl private: /// The uninitialised buffer of T used in the stack. - typename etl::aligned_storage::value>::type buffer[SIZE]; + typename etl::aligned_storage::value>::type buffer[SIZE]; }; } diff --git a/include/etl/queue_mpmc_mutex.h b/include/etl/queue_mpmc_mutex.h index 9a52eb53..e71de49f 100644 --- a/include/etl/queue_mpmc_mutex.h +++ b/include/etl/queue_mpmc_mutex.h @@ -46,7 +46,7 @@ SOFTWARE. #include "memory_model.h" #include "integral_limits.h" -#include "stl/utility.h" +#include "utility.h" #undef ETL_FILE #define ETL_FILE "48" @@ -179,7 +179,7 @@ namespace etl { access.lock(); - bool result = emplace_implementation(ETL_STD::forward(args)...); + bool result = emplace_implementation(etlstd::forward(args)...); access.unlock(); @@ -392,7 +392,7 @@ namespace etl { if (current_size != MAX_SIZE) { - ::new (&p_buffer[write_index]) T(ETL_STD::forward(args)...); + ::new (&p_buffer[write_index]) T(etlstd::forward(args)...); write_index = get_next_index(write_index, MAX_SIZE); @@ -585,7 +585,7 @@ namespace etl queue_mpmc_mutex& operator = (const queue_mpmc_mutex&); /// The uninitialised buffer of T used in the queue_mpmc_mutex. - typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; + typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; }; } diff --git a/include/etl/queue_spsc_atomic.h b/include/etl/queue_spsc_atomic.h index 08d36e1d..98f681b8 100644 --- a/include/etl/queue_spsc_atomic.h +++ b/include/etl/queue_spsc_atomic.h @@ -239,7 +239,7 @@ namespace etl if (next_index != read.load(etl::memory_order_acquire)) { - ::new (&p_buffer[write_index]) T(ETL_STD::forward(args)...); + ::new (&p_buffer[write_index]) T(etlstd::forward(args)...); write.store(next_index, etl::memory_order_release); @@ -469,7 +469,7 @@ namespace etl private: /// The uninitialised buffer of T used in the queue_spsc. - typename etl::aligned_storage::value>::type buffer[RESERVED_SIZE]; + typename etl::aligned_storage::value>::type buffer[RESERVED_SIZE]; }; } diff --git a/include/etl/queue_spsc_isr.h b/include/etl/queue_spsc_isr.h index e2b449d3..87ae3c98 100644 --- a/include/etl/queue_spsc_isr.h +++ b/include/etl/queue_spsc_isr.h @@ -42,7 +42,7 @@ SOFTWARE. #include "memory_model.h" #include "integral_limits.h" -#include "stl/utility.h" +#include "utility.h" #undef ETL_FILE #define ETL_FILE "46" @@ -82,7 +82,7 @@ namespace etl template bool emplace_from_isr(Args&&... args) { - return emplace_implementation(ETL_STD::forward(args)...); + return emplace_implementation(etlstd::forward(args)...); } #endif @@ -207,7 +207,7 @@ namespace etl { if (current_size != MAX_SIZE) { - ::new (&p_buffer[write_index]) T(ETL_STD::forward(args)...); + ::new (&p_buffer[write_index]) T(etlstd::forward(args)...); write_index = get_next_index(write_index, MAX_SIZE); @@ -440,7 +440,7 @@ namespace etl { TAccess::lock(); - bool result = this->emplace_implementation(ETL_STD::forward(args)...); + bool result = this->emplace_implementation(etlstd::forward(args)...); TAccess::unlock(); @@ -676,7 +676,7 @@ namespace etl queue_spsc_isr& operator = (const queue_spsc_isr&); /// The uninitialised buffer of T used in the queue_spsc_isr. - typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; + typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; }; } diff --git a/include/etl/queue_spsc_locked.h b/include/etl/queue_spsc_locked.h index 2f62dee5..52f7e5f5 100644 --- a/include/etl/queue_spsc_locked.h +++ b/include/etl/queue_spsc_locked.h @@ -43,7 +43,7 @@ SOFTWARE. #include "integral_limits.h" #include "function.h" -#include "stl/utility.h" +#include "utility.h" #undef ETL_FILE #define ETL_FILE "46" @@ -83,7 +83,7 @@ namespace etl template bool emplace_from_unlocked(Args&&... args) { - return emplace_implementation(ETL_STD::forward(args)...); + return emplace_implementation(etlstd::forward(args)...); } #endif @@ -208,7 +208,7 @@ namespace etl { if (current_size != MAX_SIZE) { - ::new (&p_buffer[write_index]) T(ETL_STD::forward(args)...); + ::new (&p_buffer[write_index]) T(etlstd::forward(args)...); write_index = get_next_index(write_index, MAX_SIZE); @@ -437,7 +437,7 @@ namespace etl { lock(); - bool result = this->emplace_implementation(ETL_STD::forward(args)...); + bool result = this->emplace_implementation(etlstd::forward(args)...); unlock(); @@ -677,7 +677,7 @@ namespace etl queue_spsc_locked& operator = (const queue_spsc_locked&); /// The uninitialised buffer of T used in the queue_spsc_locked. - typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; + typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; }; } diff --git a/include/etl/reference_flat_map.h b/include/etl/reference_flat_map.h index 4f95009d..9f834854 100644 --- a/include/etl/reference_flat_map.h +++ b/include/etl/reference_flat_map.h @@ -103,7 +103,7 @@ namespace etl /// Can be used as a reference type for all reference_flat_maps containing a specific type. ///\ingroup reference_flat_map //*************************************************************************** - template > + template > class ireference_flat_map { public: @@ -126,7 +126,7 @@ namespace etl typedef size_t size_type; //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -224,7 +224,7 @@ namespace etl }; //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -317,9 +317,9 @@ namespace etl typename lookup_t::const_iterator ilookup; }; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -525,10 +525,10 @@ namespace etl template void assign(TIterator first, TIterator last) { - ETL_STATIC_ASSERT((etl::is_same::value_type>::value), "Incompatible data for assign"); + ETL_STATIC_ASSERT((etlstd::is_same::value_type>::value), "Incompatible data for assign"); #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_map_full)); #endif @@ -693,7 +693,7 @@ namespace etl //********************************************************************* iterator lower_bound(key_parameter_t key) { - return ETL_STD::lower_bound(begin(), end(), key, compare); + return etlstd::lower_bound(begin(), end(), key, compare); } //********************************************************************* @@ -703,7 +703,7 @@ namespace etl //********************************************************************* const_iterator lower_bound(key_parameter_t key) const { - return ETL_STD::lower_bound(cbegin(), cend(), key, compare); + return etlstd::lower_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -713,7 +713,7 @@ namespace etl //********************************************************************* iterator upper_bound(key_parameter_t key) { - return ETL_STD::upper_bound(begin(), end(), key, compare); + return etlstd::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -723,7 +723,7 @@ namespace etl //********************************************************************* const_iterator upper_bound(key_parameter_t key) const { - return ETL_STD::upper_bound(begin(), end(), key, compare); + return etlstd::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -733,9 +733,9 @@ namespace etl //********************************************************************* ETL_PAIR equal_range(key_parameter_t key) { - iterator i_lower = ETL_STD::lower_bound(begin(), end(), key, compare); + iterator i_lower = etlstd::lower_bound(begin(), end(), key, compare); - return ETL_MAKE_PAIR(i_lower, ETL_STD::upper_bound(i_lower, end(), key, compare)); + return ETL_MAKE_PAIR(i_lower, etlstd::upper_bound(i_lower, end(), key, compare)); } //********************************************************************* @@ -745,9 +745,9 @@ namespace etl //********************************************************************* ETL_PAIR equal_range(key_parameter_t key) const { - const_iterator i_lower = ETL_STD::lower_bound(cbegin(), cend(), key, compare); + const_iterator i_lower = etlstd::lower_bound(cbegin(), cend(), key, compare); - return ETL_MAKE_PAIR(i_lower, ETL_STD::upper_bound(i_lower, cend(), key, compare)); + return ETL_MAKE_PAIR(i_lower, etlstd::upper_bound(i_lower, cend(), key, compare)); } //************************************************************************* @@ -886,7 +886,7 @@ namespace etl template bool operator ==(const etl::ireference_flat_map& lhs, const etl::ireference_flat_map& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -906,11 +906,11 @@ namespace etl /// A reference_flat_map implementation that uses a fixed size buffer. ///\tparam TKey The key type. ///\tparam TValue The value type. - ///\tparam TCompare The type to compare keys. Default = ETL_STD::less + ///\tparam TCompare The type to compare keys. Default = etlstd::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup reference_flat_map //*************************************************************************** - template > + template > class reference_flat_map : public ireference_flat_map { public: diff --git a/include/etl/reference_flat_multimap.h b/include/etl/reference_flat_multimap.h index b8c58f68..9af3770f 100644 --- a/include/etl/reference_flat_multimap.h +++ b/include/etl/reference_flat_multimap.h @@ -78,7 +78,7 @@ namespace etl /// Can be used as a reference type for all reference_flat_multimaps containing a specific type. ///\ingroup reference_flat_multimap //*************************************************************************** - template > + template > class ireference_flat_multimap { public: @@ -101,7 +101,7 @@ namespace etl typedef size_t size_type; //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -199,7 +199,7 @@ namespace etl }; //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -292,9 +292,9 @@ namespace etl typename lookup_t::const_iterator ilookup; }; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -443,7 +443,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multimap_full)); #endif @@ -513,7 +513,7 @@ namespace etl } else { - size_t d = ETL_STD::distance(range.first, range.second); + size_t d = etlstd::distance(range.first, range.second); erase(range.first, range.second); return d; } @@ -605,7 +605,7 @@ namespace etl { ETL_PAIR range = equal_range(key); - return ETL_STD::distance(range.first, range.second); + return etlstd::distance(range.first, range.second); } //********************************************************************* @@ -615,7 +615,7 @@ namespace etl //********************************************************************* iterator lower_bound(key_parameter_t key) { - return ETL_STD::lower_bound(begin(), end(), key, compare); + return etlstd::lower_bound(begin(), end(), key, compare); } //********************************************************************* @@ -625,7 +625,7 @@ namespace etl //********************************************************************* const_iterator lower_bound(key_parameter_t key) const { - return ETL_STD::lower_bound(cbegin(), cend(), key, compare); + return etlstd::lower_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -635,7 +635,7 @@ namespace etl //********************************************************************* iterator upper_bound(key_parameter_t key) { - return ETL_STD::upper_bound(begin(), end(), key, compare); + return etlstd::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -645,7 +645,7 @@ namespace etl //********************************************************************* const_iterator upper_bound(key_parameter_t key) const { - return ETL_STD::upper_bound(begin(), end(), key, compare); + return etlstd::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -655,9 +655,9 @@ namespace etl //********************************************************************* ETL_PAIR equal_range(key_parameter_t key) { - iterator i_lower = ETL_STD::lower_bound(begin(), end(), key, compare); + iterator i_lower = etlstd::lower_bound(begin(), end(), key, compare); - return ETL_MAKE_PAIR(i_lower, ETL_STD::upper_bound(i_lower, end(), key, compare)); + return ETL_MAKE_PAIR(i_lower, etlstd::upper_bound(i_lower, end(), key, compare)); } //********************************************************************* @@ -667,9 +667,9 @@ namespace etl //********************************************************************* ETL_PAIR equal_range(key_parameter_t key) const { - const_iterator i_lower = ETL_STD::lower_bound(cbegin(), cend(), key, compare); + const_iterator i_lower = etlstd::lower_bound(cbegin(), cend(), key, compare); - return ETL_MAKE_PAIR(i_lower, ETL_STD::upper_bound(i_lower, cend(), key, compare)); + return ETL_MAKE_PAIR(i_lower, etlstd::upper_bound(i_lower, cend(), key, compare)); } //************************************************************************* @@ -799,7 +799,7 @@ namespace etl template bool operator ==(const etl::ireference_flat_multimap& lhs, const etl::ireference_flat_multimap& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -819,11 +819,11 @@ namespace etl /// A reference_flat_multimap implementation that uses a fixed size buffer. ///\tparam TKey The key type. ///\tparam TValue The value type. - ///\tparam TCompare The type to compare keys. Default = ETL_STD::less + ///\tparam TCompare The type to compare keys. Default = etlstd::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup reference_flat_multimap //*************************************************************************** - template > + template > class reference_flat_multimap : public ireference_flat_multimap { public: diff --git a/include/etl/reference_flat_multiset.h b/include/etl/reference_flat_multiset.h index 5832da70..656cfe8e 100644 --- a/include/etl/reference_flat_multiset.h +++ b/include/etl/reference_flat_multiset.h @@ -35,10 +35,10 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" -#include "stl/utility.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" +#include "utility.h" #include "type_traits.h" #include "vector.h" @@ -98,7 +98,7 @@ namespace etl /// Can be used as a reference type for all reference_flat_multisets containing a specific type. ///\ingroup reference_flat_multiset //*************************************************************************** - template > + template > class ireference_flat_multiset { public: @@ -119,7 +119,7 @@ namespace etl public: //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -217,7 +217,7 @@ namespace etl }; //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -316,9 +316,9 @@ namespace etl public: - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; + typedef typename etlstd::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the reference_flat_multiset. @@ -439,7 +439,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multiset_full)); #endif @@ -462,7 +462,7 @@ namespace etl ETL_ASSERT(!lookup.full(), ETL_ERROR(flat_multiset_full)); - iterator i_element = ETL_STD::lower_bound(begin(), end(), value, compare); + iterator i_element = etlstd::lower_bound(begin(), end(), value, compare); if (i_element == end()) { @@ -524,7 +524,7 @@ namespace etl } else { - size_t d = ETL_STD::distance(range.first, range.second); + size_t d = etlstd::distance(range.first, range.second); erase(range.first, range.second); return d; } @@ -566,7 +566,7 @@ namespace etl //********************************************************************* iterator find(parameter_t key) { - iterator itr = ETL_STD::lower_bound(begin(), end(), key, compare); + iterator itr = etlstd::lower_bound(begin(), end(), key, compare); if (itr != end()) { @@ -590,7 +590,7 @@ namespace etl //********************************************************************* const_iterator find(parameter_t key) const { - const_iterator itr = ETL_STD::lower_bound(begin(), end(), key, compare); + const_iterator itr = etlstd::lower_bound(begin(), end(), key, compare); if (itr != end()) { @@ -616,7 +616,7 @@ namespace etl { ETL_PAIR range = equal_range(key); - return ETL_STD::distance(range.first, range.second); + return etlstd::distance(range.first, range.second); } //********************************************************************* @@ -626,7 +626,7 @@ namespace etl //********************************************************************* iterator lower_bound(parameter_t key) { - return ETL_STD::lower_bound(begin(), end(), key, compare); + return etlstd::lower_bound(begin(), end(), key, compare); } //********************************************************************* @@ -636,7 +636,7 @@ namespace etl //********************************************************************* const_iterator lower_bound(parameter_t key) const { - return ETL_STD::lower_bound(cbegin(), cend(), key, compare); + return etlstd::lower_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -646,7 +646,7 @@ namespace etl //********************************************************************* iterator upper_bound(parameter_t key) { - return ETL_STD::upper_bound(begin(), end(), key, compare); + return etlstd::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -656,7 +656,7 @@ namespace etl //********************************************************************* const_iterator upper_bound(parameter_t key) const { - return ETL_STD::upper_bound(cbegin(), cend(), key, compare); + return etlstd::upper_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -666,7 +666,7 @@ namespace etl //********************************************************************* ETL_PAIR equal_range(parameter_t key) { - return ETL_STD::equal_range(begin(), end(), key, compare); + return etlstd::equal_range(begin(), end(), key, compare); } //********************************************************************* @@ -676,7 +676,7 @@ namespace etl //********************************************************************* ETL_PAIR equal_range(parameter_t key) const { - return ETL_STD::equal_range(begin(), end(), key, compare); + return etlstd::equal_range(begin(), end(), key, compare); } //************************************************************************* @@ -805,7 +805,7 @@ namespace etl /// An reference flat set ///\ingroup reference_flat_multiset //*************************************************************************** - template > + template > class reference_flat_multiset : public ireference_flat_multiset { public: @@ -868,7 +868,7 @@ namespace etl template bool operator ==(const etl::ireference_flat_multiset& lhs, const etl::ireference_flat_multiset& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** diff --git a/include/etl/reference_flat_set.h b/include/etl/reference_flat_set.h index 816255e8..aac9e529 100644 --- a/include/etl/reference_flat_set.h +++ b/include/etl/reference_flat_set.h @@ -35,10 +35,10 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" -#include "stl/utility.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" +#include "utility.h" #include "type_traits.h" #include "pool.h" @@ -99,7 +99,7 @@ namespace etl /// Can be used as a reference type for all reference_flat_sets containing a specific type. ///\ingroup reference_flat_set //*************************************************************************** - template > + template > class ireference_flat_set { public: @@ -120,7 +120,7 @@ namespace etl public: //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -218,7 +218,7 @@ namespace etl }; //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -317,9 +317,9 @@ namespace etl public: - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; + typedef typename etlstd::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the reference_flat_set. @@ -440,7 +440,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_set_full)); #endif @@ -547,7 +547,7 @@ namespace etl //********************************************************************* iterator find(parameter_t key) { - iterator itr = ETL_STD::lower_bound(begin(), end(), key, compare); + iterator itr = etlstd::lower_bound(begin(), end(), key, compare); if (itr != end()) { @@ -571,7 +571,7 @@ namespace etl //********************************************************************* const_iterator find(parameter_t key) const { - const_iterator itr = ETL_STD::lower_bound(begin(), end(), key, compare); + const_iterator itr = etlstd::lower_bound(begin(), end(), key, compare); if (itr != end()) { @@ -605,7 +605,7 @@ namespace etl //********************************************************************* iterator lower_bound(parameter_t key) { - return ETL_STD::lower_bound(begin(), end(), key, compare); + return etlstd::lower_bound(begin(), end(), key, compare); } //********************************************************************* @@ -615,7 +615,7 @@ namespace etl //********************************************************************* const_iterator lower_bound(parameter_t key) const { - return ETL_STD::lower_bound(cbegin(), cend(), key, compare); + return etlstd::lower_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -625,7 +625,7 @@ namespace etl //********************************************************************* iterator upper_bound(parameter_t key) { - return ETL_STD::upper_bound(begin(), end(), key, compare); + return etlstd::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -635,7 +635,7 @@ namespace etl //********************************************************************* const_iterator upper_bound(parameter_t key) const { - return ETL_STD::upper_bound(cbegin(), cend(), key, compare); + return etlstd::upper_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -645,7 +645,7 @@ namespace etl //********************************************************************* ETL_PAIR equal_range(parameter_t key) { - return ETL_STD::equal_range(begin(), end(), key, compare); + return etlstd::equal_range(begin(), end(), key, compare); } //********************************************************************* @@ -655,7 +655,7 @@ namespace etl //********************************************************************* ETL_PAIR equal_range(parameter_t key) const { - return ETL_STD::upper_bound(cbegin(), cend(), key, compare); + return etlstd::upper_bound(cbegin(), cend(), key, compare); } //************************************************************************* @@ -788,7 +788,7 @@ namespace etl /// An reference flat set ///\ingroup reference_flat_set //*************************************************************************** - template > + template > class reference_flat_set : public ireference_flat_set { public: @@ -851,7 +851,7 @@ namespace etl template bool operator ==(const etl::ireference_flat_set& lhs, const etl::ireference_flat_set& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** diff --git a/include/etl/scaled_rounding.h b/include/etl/scaled_rounding.h index bef1d15a..c2a27cdb 100644 --- a/include/etl/scaled_rounding.h +++ b/include/etl/scaled_rounding.h @@ -41,7 +41,7 @@ namespace etl template struct scaled_rounding_t { - typedef typename etl::conditional::value, int32_t, uint32_t>::type type; + typedef typename etlstd::conditional::value, int32_t, uint32_t>::type type; }; //***************************************************************************** @@ -67,7 +67,7 @@ namespace etl template T round_ceiling_unscaled(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; if (value >= 0) @@ -101,7 +101,7 @@ namespace etl template T round_floor_unscaled(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; if (value >= 0) @@ -136,7 +136,7 @@ namespace etl template T round_half_up_unscaled(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); ETL_STATIC_ASSERT((((SCALING / 2U) * 2U) == SCALING), "Scaling must be divisible by 2"); typedef typename scaled_rounding_t::type scale_t; @@ -173,7 +173,7 @@ namespace etl template T round_half_down_unscaled(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); ETL_STATIC_ASSERT((((SCALING / 2U) * 2U) == SCALING), "Scaling must be divisible by 2"); typedef typename scaled_rounding_t::type scale_t; @@ -209,7 +209,7 @@ namespace etl template T round_zero_unscaled(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; return T(value / scale_t(SCALING)); @@ -236,7 +236,7 @@ namespace etl template T round_infinity_unscaled(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; if (value >= 0) @@ -271,7 +271,7 @@ namespace etl template T round_half_even_unscaled(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; // Half? @@ -316,7 +316,7 @@ namespace etl template T round_half_odd_unscaled(T value) { - ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; // Half? diff --git a/include/etl/scheduler.h b/include/etl/scheduler.h index bd54a32f..ade7fc20 100644 --- a/include/etl/scheduler.h +++ b/include/etl/scheduler.h @@ -285,10 +285,10 @@ namespace etl if (!task_list.full()) { - typename task_list_t::iterator itask = ETL_STD::upper_bound(task_list.begin(), - task_list.end(), - task.get_task_priority(), - compare_priority()); + typename task_list_t::iterator itask = etlstd::upper_bound(task_list.begin(), + task_list.end(), + task.get_task_priority(), + compare_priority()); task_list.insert(itask, &task); } diff --git a/include/etl/set.h b/include/etl/set.h index b8d1e399..9304bbf4 100755 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -46,9 +46,9 @@ SOFTWARE. #include "parameter_type.h" #include "iterator.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL) #include @@ -457,7 +457,7 @@ namespace etl /// A templated base for all etl::set types. ///\ingroup set //*************************************************************************** - template > + template > class iset : public etl::set_base { public: @@ -549,7 +549,7 @@ namespace etl //************************************************************************* /// iterator. //************************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -654,7 +654,7 @@ namespace etl //************************************************************************* /// const_iterator //************************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -761,10 +761,10 @@ namespace etl }; friend class const_iterator; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; //************************************************************************* /// Assignment operator. @@ -1950,7 +1950,7 @@ namespace etl //************************************************************************* /// A templated set implementation that uses a fixed size buffer. //************************************************************************* - template > + template > class set : public etl::iset { public: @@ -2037,7 +2037,7 @@ namespace etl template bool operator ==(const etl::iset& lhs, const etl::iset& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2063,10 +2063,7 @@ namespace etl template bool operator <(const etl::iset& lhs, const etl::iset& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), - lhs.end(), - rhs.begin(), - rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/smallest.h b/include/etl/smallest.h index b0e79020..0301376c 100644 --- a/include/etl/smallest.h +++ b/include/etl/smallest.h @@ -82,15 +82,15 @@ namespace etl // Set 'type' to be the smallest of the first parameter and any of the others. // This is recursive. - using type = typename etl::conditional<(etl::size_of() < etl::size_of()), // Boolean - T1, // TrueType - smallest_other> // FalseType - ::type; // The smallest type of the two. + using type = typename etlstd::conditional<(etl::size_of::value < etl::size_of::value), // Boolean + T1, // TrueType + smallest_other> // FalseType + ::type; // The smallest type of the two. // The size of the smallest type. enum { - size = etl::size_of() + size = etl::size_of::value }; }; @@ -106,7 +106,7 @@ namespace etl enum { - size = etl::size_of() + size = etl::size_of::value }; }; #else diff --git a/include/etl/smallest_generator.h b/include/etl/smallest_generator.h index 3b5c6d2c..54142e44 100644 --- a/include/etl/smallest_generator.h +++ b/include/etl/smallest_generator.h @@ -94,15 +94,15 @@ namespace etl // Set 'type' to be the smallest of the first parameter and any of the others. // This is recursive. - using type = typename etl::conditional<(etl::size_of() < etl::size_of()), // Boolean - T1, // TrueType - smallest_other> // FalseType - ::type; // The smallest type of the two. + using type = typename etlstd::conditional<(etl::size_of::value < etl::size_of::value), // Boolean + T1, // TrueType + smallest_other> // FalseType + ::type; // The smallest type of the two. // The size of the smallest type. enum { - size = etl::size_of() + size = etl::size_of::value }; }; @@ -118,7 +118,7 @@ namespace etl enum { - size = etl::size_of() + size = etl::size_of::value }; }; #else diff --git a/include/etl/sqrt.h b/include/etl/sqrt.h index 9fda08bf..d23da550 100644 --- a/include/etl/sqrt.h +++ b/include/etl/sqrt.h @@ -45,7 +45,7 @@ namespace etl template struct sqrt { - typedef typename etl::conditional<((I * I) > VALUE), + typedef typename etlstd::conditional<((I * I) > VALUE), etl::constant, etl::sqrt >::type type; diff --git a/include/etl/stack.h b/include/etl/stack.h index beba0899..84c99360 100644 --- a/include/etl/stack.h +++ b/include/etl/stack.h @@ -38,7 +38,7 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" +#include "algorithm.h" #include "container.h" #include "alignment.h" @@ -278,7 +278,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(stack_full)); #endif base_t::add_in(); - ::new (&p_buffer[top_index]) T(ETL_STD::forward(args)...); + ::new (&p_buffer[top_index]) T(etlstd::forward(args)...); } #else //************************************************************************* @@ -408,7 +408,7 @@ namespace etl //************************************************************************* void reverse() { - ETL_STD::reverse(p_buffer, p_buffer + current_size); + etlstd::reverse(p_buffer, p_buffer + current_size); } //************************************************************************* @@ -527,7 +527,7 @@ namespace etl private: /// The unintitialised buffer of T used in the stack. - typename etl::aligned_storage::value>::type buffer[SIZE]; + typename etl::aligned_storage::value>::type buffer[SIZE]; }; } diff --git a/include/etl/state_chart.h b/include/etl/state_chart.h index 800c7545..09aebb4c 100644 --- a/include/etl/state_chart.h +++ b/include/etl/state_chart.h @@ -235,9 +235,9 @@ namespace etl } else { - return ETL_STD::find_if(state_table.begin(), - state_table.end(), - is_state(state_id)); + return etlstd::find_if(state_table.begin(), + state_table.end(), + is_state(state_id)); } } @@ -280,9 +280,9 @@ namespace etl while (t != transition_table.end()) { // Scan the transition table from the latest position. - t = ETL_STD::find_if(t, - transition_table.end(), - is_transition(event_id, current_state_id)); + t = etlstd::find_if(t, + transition_table.end(), + is_transition(event_id, current_state_id)); // Found an entry? if (t != transition_table.end()) diff --git a/include/etl/stl/algorithm.h b/include/etl/stl/algorithm.h deleted file mode 100644 index 20df7f5b..00000000 --- a/include/etl/stl/algorithm.h +++ /dev/null @@ -1,46 +0,0 @@ -///\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" - -#include "../private/choose_namespace.h" -#include "../private/choose_tag_types.h" -#include "../private/choose_pair_types.h" - -#if defined(ETL_NO_STL) - #include "alternate/algorithm.h" -#else - #include -#endif - -#endif diff --git a/include/etl/stl/alternate/algorithm.h b/include/etl/stl/alternate/algorithm.h deleted file mode 100644 index e9c880f5..00000000 --- a/include/etl/stl/alternate/algorithm.h +++ /dev/null @@ -1,870 +0,0 @@ -///\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 "../../type_traits.h" - -#include - -#include "etl/private/choose_tag_types.h" -#include "etl/private/choose_pair_types.h" - -// Local alternate definitions. -#include "iterator.h" -#include "functional.h" -#include "utility.h" - -namespace etlstd -{ - //*************************************************************************** - // swap - template - void swap(T& a, T& b) - { - T c = a; - a = b; - b = c; - } - - //*************************************************************************** - // iter_swap - template - void iter_swap(TIterator1 a, TIterator2 b) - { - typename etlstd::iterator_traits::value_type c = *a; - *a = *b; - *b = c; - } - - //*************************************************************************** - // swap_ranges - template - TIterator2 swap_ranges(T1terator1 first1, - T1terator1 last1, - TIterator2 first2) - { - while (first1 != last1) - { - iter_swap(first1++, first2++); - } - - return first2; - } - - //*************************************************************************** - // advance - template - typename etl::enable_if::iterator_tag, etlstd::random_access_iterator_tag>::value, void>::type - advance(TIterator itr, TDistance distance) - { - while (distance-- != 0) - { - ++itr; - } - } - - template - typename etl::enable_if::iterator_tag, etlstd::random_access_iterator_tag>::value, void>::type - advance(TIterator itr, TDistance distance) - { - return itr += distance; - } - - //*************************************************************************** - // copy - // Pointer - template - typename etl::enable_if::value && - etl::is_pointer::value && - etl::is_pod::value_type>::value, TIterator2>::type - copy(TIterator1 sb, TIterator1 se, TIterator2 db) - { - typedef typename etlstd::iterator_traits::value_type value_t; - typedef typename etlstd::iterator_traits::difference_type difference_t; - - difference_t count = (se - sb); - - return TIterator2(memmove(db, sb, sizeof(value_t) * count)) + count; - } - - // Other iterator - template - typename etl::enable_if::value || - !etl::is_pointer::value || - !etl::is_pod::value_type>::value, TIterator2>::type - copy(TIterator1 sb, TIterator1 se, TIterator2 db) - { - while (sb != se) - { - *db++ = *sb++; - } - - return db; - } - - //*************************************************************************** - // reverse_copy - template - TIterator2 reverse_copy(TIterator1 sb, TIterator1 se, TIterator2 db) - { - while (sb != se) - { - *(db++) = *(--se); - } - - return db; - } - - //*************************************************************************** - // copy_n - // Pointer - template - typename etl::enable_if::value && - etl::is_pointer::value && - etl::is_pod::value_type>::value, TIterator2>::type - copy_n(TIterator1 sb, TSize count, TIterator2 db) - { - typedef typename etlstd::iterator_traits::value_type value_t; - - return TIterator2(memmove(db, sb, sizeof(value_t) * count)) + count; - } - - // Other iterator - template - typename etl::enable_if::value || - !etl::is_pointer::value || - !etl::is_pod::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 etl::enable_if::value && - etl::is_pointer::value && - etl::is_pod::value_type>::value, TIterator2>::type - copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de) - { - typedef typename etlstd::iterator_traits::value_type value_t; - - const size_t length = (se - sb); - - return TIterator2(memmove(de - length, sb, sizeof(value_t) * length)); - } - - // Other iterator - template - typename etl::enable_if::value || - !etl::is_pointer::value || - !etl::is_pod::value_type>::value, TIterator2>::type - copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de) - { - while (se != sb) - { - *(--de) = *(--se); - } - - return de; - } - - //*************************************************************************** - // move - template - TIterator2 move(TIterator1 sb, TIterator1 se, TIterator2 db) - { - while (sb != se) - { - *db++ = etlstd::move(*sb++); - } - - return db; - } - - //*************************************************************************** - // move_backward - template - TIterator2 move_backward(TIterator1 sb, TIterator1 se, TIterator2 de) - { - while (sb != se) - { - *(--de) = etlstd::move(*(--se)); - } - - return de; - } - - //*************************************************************************** - // reverse - // Pointers - template - typename etl::enable_if::value, void>::type - reverse(TIterator b, TIterator e) - { - if (b != e) - { - while (b < --e) - { - etlstd::iter_swap(b, e); - ++b; - } - } - } - - // Other - template - typename etl::enable_if::value, void>::type - reverse(TIterator b, TIterator e) - { - while ((b != e) && (b != --e)) - { - etlstd::iter_swap(b++, e); - } - } - - //*************************************************************************** - // lower_bound - template - TIterator lower_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) - { - typedef typename etlstd::iterator_traits::difference_type difference_t; - - difference_t count = etlstd::distance(first, last); - - while (count > 0) - { - TIterator itr = first; - difference_t step = count / 2; - - etlstd::advance(itr, step); - - if (compare(*itr, value)) - { - first = ++itr; - count -= step + 1; - } - else - { - count = step; - } - } - - return first; - } - - template - TIterator lower_bound(TIterator first, TIterator last, const TValue& value) - { - typedef etlstd::less::value_type> compare; - - return etlstd::lower_bound(first, last, value, compare()); - } - - //*************************************************************************** - // upper_bound - template - TIterator upper_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) - { - typedef typename etlstd::iterator_traits::difference_type difference_t; - - difference_t count = etlstd::distance(first, last); - - while (count > 0) - { - TIterator itr = first; - difference_t step = count / 2; - - etlstd::advance(itr, step); - - if (!compare(value, *itr)) - { - first = ++itr; - count -= step + 1; - } - else - { - count = step; - } - } - - return first; - } - - template - TIterator upper_bound(TIterator first, TIterator last, const TValue& value) - { - typedef etlstd::less::value_type> compare; - - return etlstd::upper_bound(first, last, value, compare()); - } - - //*************************************************************************** - // equal_range - template - ETL_PAIR equal_range(TIterator first, TIterator last, const TValue& value, TCompare compare) - { - return ETL_MAKE_PAIR(etlstd::lower_bound(first, last, value, compare), - etlstd::upper_bound(first, last, value, compare)); - } - - template - ETL_PAIR equal_range(TIterator first, TIterator last, const TValue& value) - { - typedef etlstd::less::value_type> compare; - - return ETL_MAKE_PAIR(etlstd::lower_bound(first, last, value, compare()), - etlstd::upper_bound(first, last, value, compare())); - } - - //*************************************************************************** - // find_if - template - TIterator find_if(TIterator first, TIterator last, TUnaryPredicate predicate) - { - while (first != last) - { - if (predicate(*first)) - { - return first; - } - - ++first; - } - - return last; - } - - //*************************************************************************** - // find - template - TIterator find(TIterator first, TIterator last, const T& value) - { - while (first != last) - { - if (*first == value) - { - return first; - } - - ++first; - } - - return last; - } - - //*************************************************************************** - // fill - template - typename etl::enable_if::value || etl::is_same::value) || !etl::is_pointer::value, void>::type - fill(TIterator first, TIterator last, const TValue& value) - { - while (first != last) - { - *first++ = value; - } - } - - template - typename etl::enable_if<(etl::is_same::value || etl::is_same::value) && etl::is_pointer::value, void>::type - fill(TIterator first, TIterator last, const TValue& value) - { - memset(first, value, last - first); - } - - //*************************************************************************** - // fill_n - template - typename etl::enable_if::value || etl::is_same::value) || !etl::is_pointer::value, TIterator>::type - fill_n(TIterator first, TSize count, const TValue& value) - { - for (TSize i = 0; i < count; ++i) - { - *first++ = value; - } - - return first; - } - - template - typename etl::enable_if<(etl::is_same::value || etl::is_same::value) && etl::is_pointer::value, void>::type - fill_n(TIterator first, TSize count, const TValue& value) - { - memset(first, value, count); - } - - //*************************************************************************** - // count - template - typename iterator_traits::difference_type count(TIterator first, TIterator last, const T& value) - { - typename iterator_traits::difference_type n = 0; - - while (first != last) - { - if (*first == value) - { - ++n; - } - - ++first; - } - - return n; - } - - //*************************************************************************** - // count - template - typename iterator_traits::difference_type count_if(TIterator first, TIterator last, TUnaryPredicate predicate) - { - typename iterator_traits::difference_type n = 0; - - while (first != last) - { - if (predicate(*first)) - { - ++n; - } - - ++first; - } - - return n; - } - - //*************************************************************************** - // equal - template - typename etl::enable_if::value || !etl::is_pointer::value || !etl::is_pod::value_type>::value, bool>::type - equal(TIterator1 first1, TIterator1 last1, TIterator2 first2) - { - while (first1 != last1) - { - if (*first1++ != *first2++) - { - return false; - } - } - - return true; - } - - template - typename etl::enable_if::value && etl::is_pointer::value && etl::is_pod::value_type>::value, bool>::type - equal(TIterator1 first1, TIterator1 last1, TIterator2 first2) - { - typedef typename etlstd::iterator_traits::value_type value_t; - - return (memcmp(first1, first2, sizeof(value_t) * (last1 - first1)) == 0); - } - - //*************************************************************************** - // lexicographical_compare - template - 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 - bool lexicographical_compare(TIterator1 first1, TIterator1 last1, - TIterator2 first2, TIterator2 last2) - { - typedef etlstd::less::value_type> compare; - - return etlstd::lexicographical_compare(first1, last1, first2, last2, compare()); - } - - //*************************************************************************** - // min - template - const T& min(const T& a, const T& b, TCompare compare) - { - return (compare(a, b)) ? a : b; - } - - template - const T& min(const T& a, const T& b) - { - typedef etlstd::less compare; - - return etlstd::min(a, b, compare()); - } - - //*************************************************************************** - // max - template - const T& max(const T& a, const T& b, TCompare compare) - { - return (compare(a, b)) ? b : a; - } - - template - const T& max(const T& a, const T& b) - { - typedef etlstd::less compare; - - return etlstd::max(a, b, compare()); - } - - //*************************************************************************** - // transform - template - TIteratorOut transform(TIteratorIn first1, TIteratorIn last1, TIteratorOut d_first, TUnaryOperation unary_operation) - { - while (first1 != last1) - { - *d_first++ = unary_operation(*first1++); - } - - return d_first; - } - - template - TIteratorOut transform(TIteratorIn1 first1, TIteratorIn1 last1, TIteratorIn2 first2, TIteratorOut d_first, TBinaryOperation binary_operation) - { - while (first1 != last1) - { - *d_first++ = binary_operation(*first1++, *first2++); - } - - return d_first; - } - - //*************************************************************************** - // Heap - namespace private_heap - { - // Push Heap Helper - template - 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 - 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 - 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 - void pop_heap(TIterator first, TIterator last, TCompare compare) - { - typedef typename etlstd::iterator_traits::value_type value_t; - typedef typename etlstd::iterator_traits::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 - void pop_heap(TIterator first, TIterator last) - { - typedef etlstd::less::value_type> compare; - - etlstd::pop_heap(first, last, compare()); - } - - // Push Heap - template - void push_heap(TIterator first, TIterator last, TCompare compare) - { - typedef typename etlstd::iterator_traits::difference_type difference_t; - typedef typename etlstd::iterator_traits::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 - void push_heap(TIterator first, TIterator last) - { - typedef etlstd::less::value_type> compare; - - etlstd::push_heap(first, last, compare()); - } - - // Make Heap - template - void make_heap(TIterator first, TIterator last, TCompare compare) - { - typedef typename etlstd::iterator_traits::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 - void make_heap(TIterator first, TIterator last) - { - typedef etlstd::less::value_type> compare; - - etlstd::make_heap(first, last, compare()); - } - - // Is Heap - template - bool is_heap(TIterator first, TIterator last) - { - typedef etlstd::less::value_type> compare; - - return private_heap::is_heap(first, last - first, compare()); - } - - // Is Heap - template - bool is_heap(TIterator first, TIterator last, TCompare compare) - { - return private_heap::is_heap(first, last - first, compare); - } - - //*************************************************************************** - // Search - template - TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last, TCompare compare) - { - while (true) - { - TIterator1 itr = first; - TIterator2 search_itr = search_first; - - while (true) - { - if (search_itr == search_last) - { - return first; - } - - if (itr == last) - { - return last; - } - - if (!compare(*itr, *search_itr)) - { - break; - } - - ++itr; - ++search_itr; - } - - ++first; - } - } - - // Search - template - TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last) - { - typedef etlstd::equal_to::value_type> compare; - - return etlstd::search(first, last, search_first, search_last, compare()); - } - - //*************************************************************************** - // Rotate - template - TIterator rotate(TIterator first, TIterator middle, TIterator last) - { - TIterator next = middle; - - while (first != next) - { - etlstd::swap(*first++, *next++); - - if (next == last) - { - next = middle; - } - else if (first == middle) - { - middle = next; - } - } - - return first; - } - - //*************************************************************************** - // find_end - // Predicate - template - TIterator1 find_end(TIterator1 b, TIterator1 e, - TIterator2 sb, TIterator2 se, - TPredicate predicate) - { - if (sb == se) - { - return e; - } - - TIterator1 result = e; - - while (true) - { - TIterator1 new_result = etlstd::search(b, e, sb, se, predicate); - - if (new_result == e) - { - break; - } - else - { - result = new_result; - b = result; - ++b; - } - } - return result; - } - - // Default - template - TIterator1 find_end(TIterator1 b, TIterator1 e, - TIterator2 sb, TIterator2 se) - { - typedef etlstd::equal_to::value_type> predicate; - - return find_end(b, e, sb, se, predicate()); - } -} - -#endif - - diff --git a/include/etl/stl/alternate/functional.h b/include/etl/stl/alternate/functional.h deleted file mode 100644 index 7ff28b5f..00000000 --- a/include/etl/stl/alternate/functional.h +++ /dev/null @@ -1,137 +0,0 @@ - -#ifndef ETL_STL_ALTERNATE_FUNCTIONAL_INCLUDED -#define ETL_STL_ALTERNATE_FUNCTIONAL_INCLUDED - -#include "../../platform.h" - -#include "../../private/choose_tag_types.h" -#include "../../private/choose_pair_types.h" - -namespace etlstd -{ - //*************************************************************************** - template - struct less - { - ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const - { - return lhs < rhs; - } - }; - - //*************************************************************************** - template - struct greater - { - ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const - { - return lhs > rhs; - } - }; - - //*************************************************************************** - template - struct equal_to - { - ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const - { - return lhs == rhs; - } - }; - - //*************************************************************************** - template - struct not_equal_to - { - ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const - { - return lhs != rhs; - } - }; - - //*************************************************************************** - - template - struct unary_function - { - typedef TArgumentType argument_type; - typedef TResultType result_type; - }; - - //*************************************************************************** - - template - struct binary_function - { - typedef TFirstArgumentType first_argument_type; - typedef TSecondArgumentType second_argument_type; - typedef TResultType result_type; - }; - - //*************************************************************************** - - template - class binder1st : public etlstd::unary_function - { - protected: - - TFunction operation; - typename TFunction::first_argument_type value; - - public: - - binder1st(const TFunction& f, const typename TFunction::first_argument_type& v) - : operation (f), value(v) - { - } - - typename TFunction::result_type operator()(typename TFunction::second_argument_type& x) const - { - return operation(value, x); - } - - typename TFunction::result_type operator()(const typename TFunction::second_argument_type& x) const - { - return operation(value, x); - } - }; - - template - binder1st bind1st(const F& f, const T& x) - { - return binder1st(f, x); - } - - //*************************************************************************** - - template - class binder2nd : public etlstd::unary_function - { - protected: - TFunction operation; - typename TFunction::second_argument_type value; - public: - binder2nd(const TFunction& f, const typename TFunction::second_argument_type& v) - : operation (f), value(v) - { - } - - typename TFunction::result_type operator()(typename TFunction::first_argument_type& x) const - { - return operation(x, value); - } - - typename TFunction::result_type operator()(const typename TFunction::first_argument_type& x) const - { - return operation(x, value); - } - }; - - template - binder2nd bind2nd(const F& f, const T& x) - { - return binder2nd(f, x); - } -} - -#endif diff --git a/include/etl/stl/alternate/iterator.h b/include/etl/stl/alternate/iterator.h deleted file mode 100644 index 0e7583c3..00000000 --- a/include/etl/stl/alternate/iterator.h +++ /dev/null @@ -1,394 +0,0 @@ - -///\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 "../../type_traits.h" - -#include - -#include "../../private/choose_tag_types.h" -#include "../../private/choose_pair_types.h" - -namespace etlstd -{ - //*************************************************************************** - // 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 - struct iterator_traits - { - typedef typename TIterator::iterator_category iterator_category; - typedef typename TIterator::value_type value_type; - typedef typename TIterator::difference_type difference_type; - typedef typename TIterator::pointer pointer; - typedef typename TIterator::reference reference; - }; - - template - struct iterator_traits - { - typedef ETL_RANDOM_ACCESS_ITERATOR_TAG iterator_category; - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef T& reference; - }; - - template - struct iterator_traits - { - typedef ETL_RANDOM_ACCESS_ITERATOR_TAG iterator_category; - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef const T* pointer; - typedef const T& reference; - }; - - //*************************************************************************** - // advance - template - ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_INPUT_ITERATOR_TAG) - { - while (n--) - { - ++itr; - } - } - - template - ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_OUTPUT_ITERATOR_TAG) - { - while (n--) - { - ++itr; - } - } - - template - ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_FORWARD_ITERATOR_TAG) - { - while (n--) - { - ++itr; - } - } - - template - ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_BIDIRECTIONAL_ITERATOR_TAG) - { - if (n > 0) - { - while (n--) - { - ++itr; - } - } - else - { - while (n++) - { - --itr; - } - } - } - - template - ETL_CONSTEXPR17 void advance_helper(TIterator& itr, TDistance n, ETL_RANDOM_ACCESS_ITERATOR_TAG) - { - itr += n; - } - - template - ETL_CONSTEXPR17 void advance(TIterator& itr, TDistance n) - { - typedef typename etlstd::iterator_traits::iterator_category tag; - - advance_helper(itr, n, tag()); - } - - //*************************************************************************** - // distance - template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_INPUT_ITERATOR_TAG) - { - typename etlstd::iterator_traits::difference_type d = 0; - - while (first != last) - { - ++d; - ++first; - } - - return d; - } - - template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_FORWARD_ITERATOR_TAG) - { - typename etlstd::iterator_traits::difference_type d = 0; - - while (first != last) - { - ++d; - ++first; - } - - return d; - } - - template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_BIDIRECTIONAL_ITERATOR_TAG) - { - typename etlstd::iterator_traits::difference_type d = 0; - - while (first != last) - { - ++d; - ++first; - } - - return d; - } - - template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_RANDOM_ACCESS_ITERATOR_TAG) - { - return last - first; - } - - template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance(TIterator first, TIterator last) - { - typedef typename etlstd::iterator_traits::iterator_category tag; - - return distance_helper(first, last, tag()); - } - - //*************************************************************************** - // reverse_iterator - template - class reverse_iterator - { - public: - - typedef typename iterator_traits::iterator_category iterator_category; - typedef typename iterator_traits::value_type value_type; - typedef typename iterator_traits::difference_type difference_type; - typedef typename iterator_traits::pointer pointer; - typedef typename iterator_traits::reference reference; - - typedef TIterator iterator_type; - - ETL_CONSTEXPR17 reverse_iterator() - : current() - { - } - - ETL_CONSTEXPR17 explicit reverse_iterator(TIterator itr) - : current(itr) - { - } - - template - ETL_CONSTEXPR17 reverse_iterator(const reverse_iterator& other) - : current(other.base()) - { - } - - template - ETL_CONSTEXPR17 reverse_iterator& operator=(const reverse_iterator& other) - { - current = other.base(); - - return (*this); - } - - ETL_CONSTEXPR17 TIterator base() const - { - return current; - } - - ETL_NODISCARD ETL_CONSTEXPR17 reference operator*() const - { - TIterator temp = current; - - return *(--temp); - } - - ETL_NODISCARD ETL_CONSTEXPR17 pointer operator->() const - { - TIterator temp = current; - - return &(*--temp); - } - - ETL_CONSTEXPR17 reverse_iterator& operator++() - { - --current; - - return *this; - } - - ETL_CONSTEXPR17 reverse_iterator operator++(int) - { - reverse_iterator temp = *this; - --current; - - return temp; - } - - ETL_CONSTEXPR17 reverse_iterator& operator--() - { - ++current; - - return (*this); - } - - ETL_CONSTEXPR17 reverse_iterator operator--(int) - { - reverse_iterator temp = *this; - ++current; - - return temp; - } - - ETL_CONSTEXPR17 reverse_iterator& operator+=(const difference_type offset) - { - current -= offset; - - return (*this); - } - - ETL_CONSTEXPR17 reverse_iterator& operator-=(const difference_type offset) - { - current += offset; - - return (*this); - } - - ETL_NODISCARD ETL_CONSTEXPR17 reverse_iterator operator+(const difference_type offset) const - { - return reverse_iterator(current - offset); - } - - ETL_NODISCARD ETL_CONSTEXPR17 reverse_iterator operator-(const difference_type offset) const - { - return (reverse_iterator(current + offset)); - } - - ETL_NODISCARD ETL_CONSTEXPR17 reference operator[](const difference_type offset) const - { - return (*(*this + offset)); - } - - protected: - - TIterator current; - }; - - template - inline ETL_CONSTEXPR17 bool operator ==(const reverse_iterator& lhs, const reverse_iterator& rhs) - { - return lhs.base() == rhs.base(); - } - - template - inline ETL_CONSTEXPR17 bool operator !=(const reverse_iterator& lhs, const reverse_iterator& rhs) - { - return !(lhs == rhs); - } - - template - inline ETL_CONSTEXPR17 bool operator <(const reverse_iterator& lhs, const reverse_iterator& rhs) - { - return rhs.base() < lhs.base(); - } - - template - inline ETL_CONSTEXPR17 bool operator >(const reverse_iterator& lhs, const reverse_iterator& rhs) - { - return rhs < lhs; - } - - template - inline ETL_CONSTEXPR17 bool operator <=(const reverse_iterator& lhs, const reverse_iterator& rhs) - { - return !(rhs < lhs); - } - - template - inline ETL_CONSTEXPR17 bool operator >=(const reverse_iterator& lhs, const reverse_iterator& rhs) - { - return !(lhs < rhs); - } - - template - inline ETL_CONSTEXPR17 typename reverse_iterator::difference_type operator -(const reverse_iterator& lhs, const reverse_iterator& rhs) - { - return rhs.base() - lhs.base(); - } - - template - inline ETL_CONSTEXPR17 reverse_iterator operator +(TDifference n, const reverse_iterator& itr) - { - return itr.operator +(n); - } - - //*************************************************************************** - // Previous - template - ETL_CONSTEXPR17 TIterator prev(TIterator itr, typename etlstd::iterator_traits::difference_type n = 1) - { - etlstd::advance(itr, -n); - return itr; - } - - //*************************************************************************** - // Next - template - ETL_CONSTEXPR17 TIterator next(TIterator itr, typename etlstd::iterator_traits::difference_type n = 1) - { - etlstd::advance(itr, n); - return itr; - } -} - -#endif diff --git a/include/etl/stl/alternate/utility.h b/include/etl/stl/alternate/utility.h deleted file mode 100644 index ac0bfc00..00000000 --- a/include/etl/stl/alternate/utility.h +++ /dev/null @@ -1,163 +0,0 @@ - ///\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 "../../type_traits.h" - -#include "../../private/choose_tag_types.h" -#include "../../private/choose_pair_types.h" - -namespace etlstd -{ - //****************************************************************************** - template - 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 - pair(const pair& other) - : first(other.first), - second(other.second) - { - } - - pair(const pair& other) - : first(other.first), - second(other.second) - { - } - - void swap(pair& other) - { - T1 temp1 = first; - T2 temp2 = second; - first = other.first; - second = other.second; - other.first = temp1; - other.second = temp2; - } - }; - - //****************************************************************************** - template - inline pair make_pair(T1 a, T2 b) - { - return pair(a, b); - } - - //****************************************************************************** - template - inline void swap(pair& a, pair& b) - { - a.swap(b); - } - - //****************************************************************************** - template - inline bool operator ==(const pair& a, const pair& b) - { - return (a.first == b.first) && (a.second == b.second); - } - - template - inline bool operator !=(const pair& a, const pair& b) - { - return !(a == b); - } - - template - inline bool operator <(const pair& a, const pair& b) - { - return (a.first < b.first) || - (!(b.first < a.first) && (a.second < b.second)); - } - - template - inline bool operator >(const pair& a, const pair& b) - { - return (b < a); - } - - template - inline bool operator <=(const pair& a, const pair& b) - { - return !(b < a); - } - - template - inline bool operator >=(const pair& a, const pair& b) - { - return !(a < b); - } - -#if ETL_CPP11_SUPPORTED - //****************************************************************************** - template - constexpr typename etl::remove_reference::type&& move(T&& t) noexcept - { - return static_cast::type&&>(t); - } - - //****************************************************************************** - template - constexpr T&& forward(typename etl::remove_reference::type& t) noexcept - { - return static_cast(t); - } - - template - constexpr T&& forward(typename etl::remove_reference::type&& t) noexcept - { - return static_cast(t); - } -#endif -} - -#endif diff --git a/include/etl/stl/functional.h b/include/etl/stl/functional.h deleted file mode 100644 index 89052b39..00000000 --- a/include/etl/stl/functional.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef ETL_STL_FUNCTIONAL_INCLUDED -#define ETL_STL_FUNCTIONAL_INCLUDED - -#include "../platform.h" - -#include "../private/choose_namespace.h" -#include "../private/choose_tag_types.h" -#include "../private/choose_pair_types.h" - -#if defined(ETL_NO_STL) - #include "alternate/functional.h" -#else - #include -#endif - -#endif diff --git a/include/etl/stl/iterator.h b/include/etl/stl/iterator.h deleted file mode 100644 index 60e157ec..00000000 --- a/include/etl/stl/iterator.h +++ /dev/null @@ -1,47 +0,0 @@ - -///\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" - -#include "../private/choose_namespace.h" -#include "../private/choose_tag_types.h" -#include "../private/choose_pair_types.h" - -#if defined(ETL_NO_STL) - #include "alternate/iterator.h" -#else - #include -#endif - -#endif diff --git a/include/etl/stl/limits.h b/include/etl/stl/limits.h deleted file mode 100644 index 477f5244..00000000 --- a/include/etl/stl/limits.h +++ /dev/null @@ -1,46 +0,0 @@ -///\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" - -#include "../private/choose_namespace.h" -#include "../private/choose_tag_types.h" -#include "../private/choose_pair_types.h" - -#if defined(ETL_NO_STL) - #include "alternate/limits.h" -#else - #include -#endif - -#endif diff --git a/include/etl/stl/utility.h b/include/etl/stl/utility.h deleted file mode 100644 index eb8e99b8..00000000 --- a/include/etl/stl/utility.h +++ /dev/null @@ -1,46 +0,0 @@ -///\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" - -#include "../private/choose_namespace.h" -#include "../private/choose_tag_types.h" -#include "../private/choose_pair_types.h" - -#if defined(ETL_NO_STL) - #include "alternate/utility.h" -#else - #include -#endif - -#endif diff --git a/include/etl/string_view.h b/include/etl/string_view.h index 8bc8bc60..40acb1b6 100644 --- a/include/etl/string_view.h +++ b/include/etl/string_view.h @@ -109,7 +109,7 @@ namespace etl typedef const T& const_reference; typedef const T* const_pointer; typedef const T* const_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; enum { @@ -155,7 +155,7 @@ namespace etl //************************************************************************* /// Construct from iterator/size. //************************************************************************* - template ::value, void>::type> + template ::value, void>::type> ETL_CONSTEXPR17 basic_string_view(const T* begin_, TSize size_) : mbegin(begin_), mend(begin_ + size_) @@ -309,11 +309,11 @@ namespace etl /// Assign from iterators //************************************************************************* template ::value, void>::type> - void assign(TIterator begin_, TIterator end_) + typename TDummy = typename etlstd::enable_if::value, void>::type> + void assign(TIterator begin_, TIterator end_) { mbegin = etl::addressof(*begin_); - mend = etl::addressof(*begin_) + ETL_STD::distance(begin_, end_); + mend = etl::addressof(*begin_) + etlstd::distance(begin_, end_); } //************************************************************************* @@ -321,8 +321,8 @@ namespace etl //************************************************************************* template ::value, void>::type> - void assign(TIterator begin_, TSize size_) + typename TDummy = typename etlstd::enable_if::value, void>::type> + void assign(TIterator begin_, TSize size_) { mbegin = etl::addressof(*begin_); mend = etl::addressof(*begin_) + size_; @@ -351,8 +351,14 @@ namespace etl //************************************************************************* void swap(basic_string_view& other) { - ETL_STD::swap(mbegin, other.mbegin); - ETL_STD::swap(mend, other.mend); +#if defined(ETL_NO_STL) + using etlstd::swap; +#else + using std::swap; +#endif + + swap(mbegin, other.mbegin); + swap(mend, other.mend); } //************************************************************************* @@ -364,9 +370,9 @@ namespace etl if (position < size()) { - n = ETL_STD::min(count, size() - position); + n = etlstd::min(count, size() - position); - ETL_STD::copy(mbegin + position, mbegin + position + n, destination); + etlstd::copy(mbegin + position, mbegin + position + n, destination); } return n; @@ -381,7 +387,7 @@ namespace etl if (position < size()) { - size_t n = ETL_STD::min(count, size() - position); + size_t n = etlstd::min(count, size() - position); view = basic_string_view(mbegin + position, mbegin + position + n); } @@ -495,7 +501,7 @@ namespace etl return npos; } - const_iterator iposition = ETL_STD::search(begin() + position, end(), view.begin(), view.end()); + const_iterator iposition = etlstd::search(begin() + position, end(), view.begin(), view.end()); if (iposition == end()) { @@ -503,7 +509,7 @@ namespace etl } else { - return ETL_STD::distance(begin(), iposition); + return etlstd::distance(begin(), iposition); } } @@ -532,9 +538,9 @@ namespace etl return npos; } - position = ETL_STD::min(position, size()); + position = etlstd::min(position, size()); - const_iterator iposition = ETL_STD::find_end(begin(), + const_iterator iposition = etlstd::find_end(begin(), begin() + position, view.begin(), view.end()); @@ -545,7 +551,7 @@ namespace etl } else { - return ETL_STD::distance(begin(), iposition); + return etlstd::distance(begin(), iposition); } } @@ -615,7 +621,7 @@ namespace etl return npos; } - position = ETL_STD::min(position, size() - 1); + position = etlstd::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -711,7 +717,7 @@ namespace etl return npos; } - position = ETL_STD::min(position, size() - 1); + position = etlstd::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -762,7 +768,7 @@ namespace etl friend bool operator == (const etl::basic_string_view& lhs, const etl::basic_string_view& rhs) { return (lhs.size() == rhs.size()) && - ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -778,7 +784,7 @@ namespace etl //************************************************************************* friend bool operator < (const etl::basic_string_view& lhs, const etl::basic_string_view& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/type_lookup.h b/include/etl/type_lookup.h index c95bfe41..4a583a24 100644 --- a/include/etl/type_lookup.h +++ b/include/etl/type_lookup.h @@ -101,28 +101,28 @@ namespace etl struct type_from_id { typedef - typename etl::conditional>::type>::type>::type>::type> + typename etlstd::conditional >::type>::type>::type>::type> ::type>::type>::type>::type> ::type>::type>::type>::type> ::type>::type>::type>::type type; - ETL_STATIC_ASSERT(!(etl::is_same, type>::value), "Invalid id"); + ETL_STATIC_ASSERT(!(etlstd::is_same, type>::value), "Invalid id"); }; //************************************ @@ -137,22 +137,22 @@ namespace etl enum { value = - (unsigned int) etl::is_same::value ? T1::ID : - (unsigned int) etl::is_same::value ? T2::ID : - (unsigned int) etl::is_same::value ? T3::ID : - (unsigned int) etl::is_same::value ? T4::ID : - (unsigned int) etl::is_same::value ? T5::ID : - (unsigned int) etl::is_same::value ? T6::ID : - (unsigned int) etl::is_same::value ? T7::ID : - (unsigned int) etl::is_same::value ? T8::ID : - (unsigned int) etl::is_same::value ? T9::ID : - (unsigned int) etl::is_same::value ? T10::ID : - (unsigned int) etl::is_same::value ? T11::ID : - (unsigned int) etl::is_same::value ? T12::ID : - (unsigned int) etl::is_same::value ? T13::ID : - (unsigned int) etl::is_same::value ? T14::ID : - (unsigned int) etl::is_same::value ? T15::ID : - (unsigned int) etl::is_same::value ? T16::ID : + (unsigned int) etlstd::is_same::value ? T1::ID : + (unsigned int) etlstd::is_same::value ? T2::ID : + (unsigned int) etlstd::is_same::value ? T3::ID : + (unsigned int) etlstd::is_same::value ? T4::ID : + (unsigned int) etlstd::is_same::value ? T5::ID : + (unsigned int) etlstd::is_same::value ? T6::ID : + (unsigned int) etlstd::is_same::value ? T7::ID : + (unsigned int) etlstd::is_same::value ? T8::ID : + (unsigned int) etlstd::is_same::value ? T9::ID : + (unsigned int) etlstd::is_same::value ? T10::ID : + (unsigned int) etlstd::is_same::value ? T11::ID : + (unsigned int) etlstd::is_same::value ? T12::ID : + (unsigned int) etlstd::is_same::value ? T13::ID : + (unsigned int) etlstd::is_same::value ? T14::ID : + (unsigned int) etlstd::is_same::value ? T15::ID : + (unsigned int) etlstd::is_same::value ? T16::ID : (unsigned int) UNKNOWN }; @@ -202,26 +202,26 @@ namespace etl struct type_from_type { typedef - typename etl::conditional::value, typename T1::type2, - typename etl::conditional::value, typename T2::type2, - typename etl::conditional::value, typename T3::type2, - typename etl::conditional::value, typename T4::type2, - typename etl::conditional::value, typename T5::type2, - typename etl::conditional::value, typename T6::type2, - typename etl::conditional::value, typename T7::type2, - typename etl::conditional::value, typename T8::type2, - typename etl::conditional::value, typename T9::type2, - typename etl::conditional::value, typename T10::type2, - typename etl::conditional::value, typename T11::type2, - typename etl::conditional::value, typename T12::type2, - typename etl::conditional::value, typename T13::type2, - typename etl::conditional::value, typename T14::type2, - typename etl::conditional::value, typename T15::type2, - typename etl::conditional::value, typename T16::type2, - etl::null_type<0>>::type>::type>::type>::type>::type>::type>::type>::type> + typename etlstd::conditional::value, typename T1::type2, + typename etlstd::conditional::value, typename T2::type2, + typename etlstd::conditional::value, typename T3::type2, + typename etlstd::conditional::value, typename T4::type2, + typename etlstd::conditional::value, typename T5::type2, + typename etlstd::conditional::value, typename T6::type2, + typename etlstd::conditional::value, typename T7::type2, + typename etlstd::conditional::value, typename T8::type2, + typename etlstd::conditional::value, typename T9::type2, + typename etlstd::conditional::value, typename T10::type2, + typename etlstd::conditional::value, typename T11::type2, + typename etlstd::conditional::value, typename T12::type2, + typename etlstd::conditional::value, typename T13::type2, + typename etlstd::conditional::value, typename T14::type2, + typename etlstd::conditional::value, typename T15::type2, + typename etlstd::conditional::value, typename T16::type2, + etl::null_type<0> >::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type>::type>::type>::type type; - ETL_STATIC_ASSERT(!(etl::is_same, type>::value), "Invalid type"); + ETL_STATIC_ASSERT(!(etlstd::is_same, type>::value), "Invalid type"); }; }; } diff --git a/include/etl/type_lookup_generator.h b/include/etl/type_lookup_generator.h index 1e5a785f..8a814ca5 100644 --- a/include/etl/type_lookup_generator.h +++ b/include/etl/type_lookup_generator.h @@ -104,7 +104,7 @@ namespace etl cog.outl(" {") cog.outl(" typedef ") for n in range(1, int(NTypes) + 1): - cog.outl(" typename etl::conditional >") for n in range(1, int(NTypes) + 1): if n == int(NTypes): @@ -116,7 +116,7 @@ namespace etl cog.outl("") cog.out(" ") cog.outl("") - cog.outl(" ETL_STATIC_ASSERT(!(etl::is_same, type>::value), \"Invalid id\");") + cog.outl(" ETL_STATIC_ASSERT(!(etlstd::is_same, type>::value), \"Invalid id\");") cog.outl(" };") cog.outl("") cog.outl(" //************************************") @@ -132,7 +132,7 @@ namespace etl cog.outl(" {") cog.outl(" value =") for n in range(1, int(NTypes) + 1) : - cog.outl(" (unsigned int) etl::is_same::value ? T%s::ID :" % (n, n)) + cog.outl(" (unsigned int) etlstd::is_same::value ? T%s::ID :" % (n, n)) cog.outl(" (unsigned int) UNKNOWN") cog.outl(" };") cog.outl("") @@ -171,7 +171,7 @@ namespace etl cog.outl(" {") cog.outl(" typedef ") for n in range(1, int(NTypes) + 1): - cog.outl(" typename etl::conditional::value, typename T%s::type2," %(n, n)) + cog.outl(" typename etlstd::conditional::value, typename T%s::type2," %(n, n)) cog.out(" etl::null_type<0> >") for n in range(1, int(NTypes) + 1): if n == int(NTypes): @@ -183,7 +183,7 @@ namespace etl cog.outl("") cog.out(" ") cog.outl("") - cog.outl(" ETL_STATIC_ASSERT(!(etl::is_same, type>::value), \"Invalid type\");") + cog.outl(" ETL_STATIC_ASSERT(!(etlstd::is_same, type>::value), \"Invalid type\");") cog.outl(" };") cog.outl("};") ]]]*/ diff --git a/include/etl/type_select.h b/include/etl/type_select.h index 894b642d..94b70004 100644 --- a/include/etl/type_select.h +++ b/include/etl/type_select.h @@ -73,22 +73,22 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type>::type>::type>::type type; @@ -121,21 +121,21 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type>::type>::type type; @@ -167,20 +167,20 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type>::type type; @@ -211,19 +211,19 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type type; @@ -253,18 +253,18 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type type; @@ -293,17 +293,17 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type type; @@ -331,16 +331,16 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type type; @@ -367,15 +367,15 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type type; @@ -401,14 +401,14 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type>::type type; @@ -432,13 +432,13 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type>::type type; @@ -461,12 +461,12 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type>::type type; @@ -488,11 +488,11 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type>::type type; @@ -513,10 +513,10 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type>::type type; @@ -536,9 +536,9 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type>::type type; @@ -557,8 +557,8 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type>::type type; @@ -576,7 +576,7 @@ namespace etl template struct select { - typedef typename etl::conditional > ::type type; diff --git a/include/etl/type_select_generator.h b/include/etl/type_select_generator.h index 70880f9c..7b3f1fc2 100644 --- a/include/etl/type_select_generator.h +++ b/include/etl/type_select_generator.h @@ -75,9 +75,9 @@ namespace etl cog.outl(" template ") cog.outl(" struct select") cog.outl(" {") - cog.outl(" typedef typename etl::conditional >") cog.out(" ") for n in range(1, int(NTypes)) : @@ -110,9 +110,9 @@ namespace etl cog.outl(" template ") cog.outl(" struct select") cog.outl(" {") - cog.outl(" typedef typename etl::conditional >") cog.out(" ") for n in range(1, s) : diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index ebd296b8..d4dac3c6 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -60,18 +60,20 @@ SOFTWARE. #include "nullptr.h" #include "static_assert.h" -#if (ETL_CPP11_SUPPORTED) && !defined(ETL_NO_STL) - #include -#endif - ///\defgroup type_traits type_traits -/// A set of type traits definitions for compilers that do not support the standard header. +/// A set of type traits definitions. +/// Derived from either the standard or alternate definitions, dependant on whether or not ETL_NO_STL is defined. /// \ingroup utilities -namespace etl +#if defined(ETL_NO_STL) + +//***************************************************************************** +// Traits are defined by the ETL +//***************************************************************************** +namespace etlstd { + //*************************************************************************** /// integral_constant - ///\ingroup type_traits template struct integral_constant { @@ -82,27 +84,31 @@ namespace etl operator value_type() const { - return value; + return value; } }; /// integral_constant specialisations - ///\ingroup type_traits typedef integral_constant false_type; typedef integral_constant true_type; +#if ETL_CPP17_SUPPORTED + template + using bool_constant = integral_constant; +#endif + + //*************************************************************************** /// remove_reference - ///\ingroup type_traits template struct remove_reference { typedef T type; }; template struct remove_reference { typedef T type; }; - /// add_reference - ///\ingroup type_traits - template struct add_reference { typedef T& type; }; - template struct add_reference { typedef T& type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_reference_t = typename remove_reference::type; +#endif + //*************************************************************************** /// remove_pointer - ///\ingroup type_traits template struct remove_pointer { typedef T type; }; template struct remove_pointer { typedef T type; }; template struct remove_pointer { typedef const T type; }; @@ -113,58 +119,108 @@ namespace etl template struct remove_pointer { typedef volatile T type; }; template struct remove_pointer { typedef const volatile T type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_pointer_t = typename remove_pointer::type; +#endif + + //*************************************************************************** /// add_pointer - ///\ingroup type_traits template struct add_pointer { typedef typename remove_reference::type* type; }; +#if ETL_CPP14_SUPPORTED + template + using add_pointer_t = typename add_pointer::type; +#endif + + //*************************************************************************** /// is_const - ///\ingroup type_traits template struct is_const : false_type {}; template struct is_const : true_type {}; template struct is_const : true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_const_v = is_const::value; +#endif + + //*************************************************************************** /// remove_const - ///\ingroup type_traits template struct remove_const { typedef T type; }; template struct remove_const { typedef T type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_const_t = typename remove_const::type; +#endif + + //*************************************************************************** /// add_const - ///\ingroup type_traits template struct add_const { typedef const T type; }; template struct add_const { typedef const T type; }; +#if ETL_CPP14_SUPPORTED + template + using add_const_t = typename add_const::type; +#endif + + //*************************************************************************** /// is_volatile - ///\ingroup type_traits template struct is_volatile : false_type {}; template struct is_volatile : true_type {}; template struct is_volatile : true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_volatile_v = is_volatile::value; +#endif + + //*************************************************************************** /// remove_volatile - ///\ingroup type_traits template struct remove_volatile { typedef T type; }; template struct remove_volatile { typedef T type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_volatile_t = typename remove_volatile::type; +#endif + + //*************************************************************************** /// add_volatile - ///\ingroup type_traits template struct add_volatile { typedef volatile T type; }; template struct add_volatile { typedef volatile T type; }; +#if ETL_CPP14_SUPPORTED + template + using add_volatile_t = typename add_volatile::type; +#endif + + //*************************************************************************** /// remove_cv - ///\ingroup type_traits template struct remove_cv { typedef typename remove_volatile::type>::type type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_cv_t = typename remove_cv::type; +#endif + + //*************************************************************************** /// add_cv - ///\ingroup type_traits template struct add_cv { typedef typename add_volatile::type>::type type; }; +#if ETL_CPP14_SUPPORTED + template + using add_cv_t = typename add_cv::type; +#endif + + //*************************************************************************** /// is_integral - ///\ingroup type_traits template struct is_integral : false_type {}; template <> struct is_integral : true_type {}; template <> struct is_integral : true_type {}; @@ -183,30 +239,40 @@ namespace etl template struct is_integral : is_integral {}; template struct is_integral : is_integral {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_integral_v = is_integral::value; +#endif + + //*************************************************************************** /// is_signed - ///\ingroup type_traits template struct is_signed : false_type {}; template <> struct is_signed : integral_constant {}; - template <> struct is_signed : public etl::integral_constant(wchar_t(-1) < wchar_t(0))> {}; + template <> struct is_signed : public etlstd::integral_constant(wchar_t(-1) < wchar_t(0))> {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; - template <> struct is_signed : true_type{}; - template <> struct is_signed : true_type{}; - template <> struct is_signed : true_type{}; + template <> struct is_signed : true_type {}; + template <> struct is_signed : true_type {}; + template <> struct is_signed : true_type {}; template struct is_signed : is_signed {}; template struct is_signed : is_signed {}; template struct is_signed : is_signed {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_signed_v = is_signed::value; +#endif + + //*************************************************************************** /// is_unsigned - ///\ingroup type_traits template struct is_unsigned : false_type {}; template <> struct is_unsigned : true_type {}; template <> struct is_unsigned : integral_constant 0)> {}; template <> struct is_unsigned : true_type {}; - template <> struct is_unsigned : public etl::integral_constant wchar_t(0))> {}; + template <> struct is_unsigned : public etlstd::integral_constant wchar_t(0))> {}; template <> struct is_unsigned : true_type {}; template <> struct is_unsigned : true_type {}; template <> struct is_unsigned : true_type {}; @@ -215,8 +281,13 @@ namespace etl template struct is_unsigned : is_unsigned {}; template struct is_unsigned : is_unsigned {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_unsigned_v = is_unsigned::value; +#endif + + //*************************************************************************** /// is_floating_point - ///\ingroup type_traits template struct is_floating_point : false_type {}; template <> struct is_floating_point : true_type {}; template <> struct is_floating_point : true_type {}; @@ -225,149 +296,193 @@ namespace etl template struct is_floating_point : is_floating_point {}; template struct is_floating_point : is_floating_point {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_floating_point_v = is_floating_point::value; +#endif + + //*************************************************************************** /// is_same - ///\ingroup type_traits template struct is_same : public false_type {}; template struct is_same : public true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_same_v = is_same::value; +#endif + + //*************************************************************************** /// is_void - ///\ingroup type_traits template struct is_void : false_type {}; template<> struct is_void : true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_void_v = is_void::value; +#endif + + //*************************************************************************** /// is_arithmetic - ///\ingroup type_traits template struct is_arithmetic : integral_constant::value || is_floating_point::value> {}; - /// is_fundamental - ///\ingroup type_traits - template struct is_fundamental : integral_constant::value || - is_void::value || - is_same::type>::value> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_arithmetic_v = is_arithmetic::value; +#endif + //*************************************************************************** + /// is_fundamental + template struct is_fundamental : integral_constant::value || + is_void::value || + is_same::type>::value> {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_fundamental_v = is_fundamental::value; +#endif + + //*************************************************************************** /// is_compound - ///\ingroup type_traits template struct is_compound : integral_constant::value> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_compound_v = is_compound::value; +#endif + + //*************************************************************************** /// is_array - ///\ingroup type_traits template struct is_array : false_type {}; template struct is_array : true_type {}; template struct is_array : true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_array_v = is_array::value; +#endif + + //*************************************************************************** /// is_pointer - ///\ingroup type_traits template struct is_pointer_helper : false_type {}; template struct is_pointer_helper : true_type {}; template struct is_pointer : is_pointer_helper::type> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_pointer_v = is_pointer::value; +#endif + + //*************************************************************************** /// is_reference - ///\ingroup type_traits template struct is_reference_helper : false_type {}; template struct is_reference_helper : true_type {}; template struct is_reference : is_reference_helper::type> {}; - /// 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(IN_TYPE_TRAITS_TEST) && !defined(ETL_NO_STL) - // For compilers that support C++11 - template struct is_pod : std::is_pod {}; -#else - template struct is_pod : etl::integral_constant::value || etl::is_pointer::value> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_reference_v = is_reference::value; #endif -#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_STLPORT) && !defined(IN_TYPE_TRAITS_TEST) && !defined(ETL_NO_STL) - /// is_trivially_constructible - ///\ingroup type_traits - template struct is_trivially_constructible : std::is_trivially_constructible {}; + //*************************************************************************** + /// is_lvalue_reference + template struct is_lvalue_reference_helper : false_type {}; + template struct is_lvalue_reference_helper : true_type {}; + template struct is_lvalue_reference : is_lvalue_reference_helper::type> {}; - /// is_trivially_copy_constructible - ///\ingroup type_traits - template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; - - /// is_trivially_destructible - ///\ingroup type_traits - template struct is_trivially_destructible : std::is_trivially_destructible {}; - - /// is_trivially_copy_assignable - ///\ingroup type_traits - template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; - - /// is_trivially_copyable - ///\ingroup type_traits - template struct is_trivially_copyable : std::is_trivially_copyable {}; -#else - /// is_trivially_constructible - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_constructible : etl::is_pod {}; - - /// is_trivially_copy_constructible - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_copy_constructible : etl::is_pod {}; - - /// is_trivially_destructible - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_destructible : etl::is_pod {}; - - /// is_trivially_copy_assignable - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_copy_assignable : etl::is_pod {}; - - /// is_trivially_copyable - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_copyable : etl::is_pod {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_lvalue_reference_v = etlstd::is_lvalue_reference::value; #endif -#if ETL_CPP11_SUPPORTED + //*************************************************************************** /// is_rvalue_reference - ///\ingroup type_traits - template struct is_rvalue_reference : etl::false_type {}; - template struct is_rvalue_reference : etl::true_type {}; + template struct is_rvalue_reference_helper : false_type {}; + template struct is_rvalue_reference_helper : true_type {}; + template struct is_rvalue_reference : is_rvalue_reference_helper::type> {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_rvalue_reference_v = etlstd::is_rvalue_reference::value; #endif + //*************************************************************************** + /// is_pod + /// Only fundamental and pointers types are recognised. + template struct is_pod : etlstd::integral_constant::value || etlstd::is_pointer::value> {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_pod_v = etlstd::is_pod::value; +#endif + + //*************************************************************************** + /// is_trivially_constructible + /// Only POD types are recognised. + template struct is_trivially_constructible : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_constructible_v = etlstd::is_trivially_constructible::value; +#endif + + //*************************************************************************** + /// is_trivially_copy_constructible + /// Only POD types are recognised. + template struct is_trivially_copy_constructible : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_constructible_v = etlstd::is_trivially_copy_constructible::value; +#endif + + //*************************************************************************** + /// is_trivially_destructible + /// Only POD types are recognised. + template struct is_trivially_destructible : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_destructible_v = etlstd::is_trivially_destructible::value; +#endif + + //*************************************************************************** + /// is_trivially_copy_assignable + /// Only POD types are recognised. + template struct is_trivially_copy_assignable : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_assignable_v = etlstd::is_trivially_copy_assignable::value; +#endif + + //*************************************************************************** + /// is_trivially_copyable + /// Only POD types are recognised. + template struct is_trivially_copyable : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copyable_v = etlstd::is_trivially_copyable::value; +#endif + + //*************************************************************************** /// conditional - ///\ingroup type_traits template struct conditional { typedef T type; }; template struct conditional { typedef F type; }; - /// conditional_integral_constant - ///\ingroup type_traits - template - struct conditional_integral_constant; - - template - struct conditional_integral_constant - { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); - static const T value = TRUE_VALUE; - }; - - template - struct conditional_integral_constant - { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); - static const T value = FALSE_VALUE; - }; - + //*************************************************************************** /// make_signed - ///\ingroup type_traits template struct make_signed { typedef T type; }; template <> struct make_signed { typedef signed char type; }; template <> struct make_signed { typedef signed char type; }; template <> struct make_signed { - typedef etl::conditional::type>::type type; + typedef etlstd::conditional::type>::type type; }; template <> struct make_signed { typedef short type; }; @@ -378,8 +493,13 @@ namespace etl template struct make_signed : add_volatile::type> {}; template struct make_signed : add_const::type>::type> {}; +#if ETL_CPP14_SUPPORTED + template + using make_signed_t = typename make_signed::type; +#endif + + //*************************************************************************** /// make_unsigned - ///\ingroup type_traits template struct make_unsigned { typedef T type; }; template <> struct make_unsigned { typedef unsigned char type; }; template <> struct make_unsigned { typedef unsigned char type; }; @@ -387,11 +507,11 @@ namespace etl template <> struct make_unsigned { - typedef etl::conditional::type>::type type; + typedef etlstd::conditional::type>::type type; }; template <> struct make_unsigned { typedef unsigned int type; }; @@ -401,18 +521,28 @@ namespace etl template struct make_unsigned : add_volatile::type> {}; template struct make_unsigned : add_const::type>::type> {}; +#if ETL_CPP14_SUPPORTED + template + using make_unsigned_t = typename make_unsigned::type; +#endif + + //*************************************************************************** /// enable_if - ///\ingroup type_traits template struct enable_if {}; template struct enable_if { typedef T type; }; +#if ETL_CPP14_SUPPORTED + template + using enable_if_t = typename enable_if::type; +#endif + + //*************************************************************************** /// extent - ///\ingroup type_traits - template - struct extent : integral_constant {}; + template + struct extent : integral_constant {}; template - struct extent : integral_constant {}; + struct extent : integral_constant {}; template struct extent : integral_constant::value> {}; @@ -423,49 +553,74 @@ namespace etl template struct extent : integral_constant::value> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t extent_v = extent::value; +#endif + + //*************************************************************************** /// remove_extent - ///\ingroup type_traits template struct remove_extent { typedef T type; }; template struct remove_extent { typedef T type; }; - template struct remove_extent { typedef T type;}; + template struct remove_extent { typedef T type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_extent_t = typename remove_extent::type; +#endif + + //*************************************************************************** /// remove_all_extents - ///\ingroup type_traits - template struct remove_all_extents { typedef T type;}; + template struct remove_all_extents { typedef T type; }; template struct remove_all_extents { typedef typename remove_all_extents::type type; }; template struct remove_all_extents { typedef typename remove_all_extents::type type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_all_extents_t = typename remove_all_extents::type; +#endif + + //*************************************************************************** /// rank - ///\ingroup type_traits template struct rank : integral_constant {}; template struct rank : public integral_constant::value + 1> {}; template struct rank : public integral_constant::value + 1> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t rank_v = rank::value; +#endif + + //*************************************************************************** /// decay - ///\ingroup type_traits template struct decay { - typedef typename etl::remove_reference::type U; - typedef typename etl::conditional::value, - typename etl::remove_extent::type*, - typename etl::remove_cv::type>::type type; + typedef typename etlstd::remove_reference::type U; + typedef typename etlstd::conditional::value, + typename etlstd::remove_extent::type*, + typename etlstd::remove_cv::type>::type type; }; +#if ETL_CPP14_SUPPORTED + template + using decay_t = typename decay::type; +#endif + + //*************************************************************************** /// is_base_of - ///\ingroup type_traits template::value || etl::is_fundamental::value)> + const bool IsFundamental = (etlstd::is_fundamental::value || etlstd::is_fundamental::value)> struct is_base_of { private: template struct dummy {}; - struct internal: TDerived, dummy{}; + struct internal: TDerived, dummy{}; - static TBase* check(TBase*); - template static char check(dummy*); + static TBase* check(TBase*); + template static char check(dummy*); public: @@ -479,42 +634,681 @@ namespace etl static const bool value = false; }; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_base_of_v = is_base_of::value; +#endif + + //*************************************************************************** + /// add_lvalue_reference + template struct add_lvalue_reference { using type = T & ; }; + template struct add_lvalue_reference { using type = T & ; }; + template <> struct add_lvalue_reference { using type = void; }; + template <> struct add_lvalue_reference { using type = const void; }; + template <> struct add_lvalue_reference { using type = volatile void; }; + template <> struct add_lvalue_reference { using type = const volatile void; }; + +#if ETL_CPP14_SUPPORTED + template + using add_lvalue_reference_t = typename etlstd::add_lvalue_reference::type; +#endif + + //*************************************************************************** + /// add_rvalue_reference +#if ETL_CPP11_SUPPORTED + template struct add_rvalue_reference { using type = T && ; }; + template struct add_rvalue_reference { using type = T & ; }; + template <> struct add_rvalue_reference { using type = void; }; + template <> struct add_rvalue_reference { using type = const void; }; + template <> struct add_rvalue_reference { using type = volatile void; }; + template <> struct add_rvalue_reference { using type = const volatile void; }; +#endif + +#if ETL_CPP14_SUPPORTED + template + using add_rvalue_reference_t = typename etlstd::add_rvalue_reference::type; +#endif + + //*************************************************************************** + /// decval +#if ETL_CPP11_SUPPORTED + template + typename etlstd::add_rvalue_reference::type declval() ETL_NOEXCEPT; +#endif + + //*************************************************************************** + /// is_convertible +#if ETL_CPP11_SUPPORTED + namespace private_type_traits + { + template + using true_type_for = etlstd::true_type; + + template + auto returnable(int)->true_type_for; + + template + auto returnable(...)->etlstd::false_type; + + template + auto nonvoid_convertible(int)->true_type_for()(etlstd::declval())) + >; + template + auto nonvoid_convertible(...)->etlstd::false_type; + } + + template + struct is_convertible : etlstd::integral_constant(0))::value && + decltype(private_type_traits::nonvoid_convertible(0))::value) || + (etlstd::is_void::value && etlstd::is_void::value)> {}; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_convertible_v = etlstd::is_convertible::value; +#endif + + //*************************************************************************** /// Alignment templates. /// These require compiler specific intrinsics. - ///\ingroup type_traits -#if ETL_CPP11_SUPPORTED - template struct alignment_of : integral_constant {}; +#ifdef ETL_COMPILER_MICROSOFT + template struct alignment_of : integral_constant {}; +#elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI) + template struct alignment_of : integral_constant {}; #else - #ifdef ETL_COMPILER_MICROSOFT - template struct alignment_of : integral_constant {}; - #elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI) - template struct alignment_of : integral_constant {}; - #else - template struct alignment_of : integral_constant {}; - #endif + template struct alignment_of : integral_constant {}; #endif /// Specialisation of 'alignment_of' for 'void'. ///\ingroup type_traits - template <> struct alignment_of : integral_constant {}; + template <> struct alignment_of : integral_constant {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t alignment_of_v = etlstd::alignment_of::value; +#endif +} + +#else + +//***************************************************************************** +// Traits are derived from the STL +//***************************************************************************** +#include + +namespace etlstd +{ + //*************************************************************************** + /// integral_constant + ///\ingroup type_traits + template + struct integral_constant : std::integral_constant {}; + + /// integral_constant specialisations + ///\ingroup type_traits + typedef integral_constant false_type; + typedef integral_constant true_type; + +#if ETL_CPP17_SUPPORTED + template + using bool_constant = std::integral_constant; +#endif + + //*************************************************************************** + /// remove_reference + ///\ingroup type_traits + template struct remove_reference : std::remove_reference {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_reference_t = std::remove_reference_t; +#endif + + //*************************************************************************** + /// remove_pointer + ///\ingroup type_traits + template struct remove_pointer : std::remove_pointer {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_pointer_t = std::remove_pointer_t; +#endif + + //*************************************************************************** + /// add_pointer + ///\ingroup type_traits + template struct add_pointer : std::add_pointer {}; + +#if ETL_CPP14_SUPPORTED + template + using add_pointer_t = std::add_pointer_t; +#endif + + //*************************************************************************** + /// is_const + ///\ingroup type_traits + template struct is_const : std::is_const {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_const_v = std::is_const_v; +#endif + + //*************************************************************************** + /// remove_const + ///\ingroup type_traits + template struct remove_const : std::remove_const {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_const_t = std::remove_const_t; +#endif + + //*************************************************************************** + /// add_const + ///\ingroup type_traits + template struct add_const : std::add_const {}; + +#if ETL_CPP14_SUPPORTED + template + using add_const_t = std::add_const_t; +#endif + + //*************************************************************************** + /// is_volatile + ///\ingroup type_traits + template struct is_volatile : std::is_volatile {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_volatile_v = std::is_volatile_v; +#endif + + //*************************************************************************** + /// remove_volatile + ///\ingroup type_traits + template struct remove_volatile : std::remove_volatile {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_volatile_t = std::remove_volatile_t; +#endif + + //*************************************************************************** + /// add_volatile + ///\ingroup type_traits + template struct add_volatile : std::add_volatile {}; + +#if ETL_CPP14_SUPPORTED + template + using add_volatile_t = std::add_volatile_t; +#endif + + //*************************************************************************** + /// remove_cv + ///\ingroup type_traits + template struct remove_cv : std::remove_cv {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_cv_t = std::remove_cv_t; +#endif + + //*************************************************************************** + /// add_cv + ///\ingroup type_traits + template struct add_cv : std::add_cv {}; + +#if ETL_CPP14_SUPPORTED + template + using add_cv_t = std::add_cv_t; +#endif + + //*************************************************************************** + /// is_integral + ///\ingroup type_traits + template struct is_integral : std::is_integral {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_integral_v = std::is_integral_v; +#endif + + //*************************************************************************** + /// is_signed + ///\ingroup type_traits + template struct is_signed : std::is_signed {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_signed_v = std::is_signed_v; +#endif + + //*************************************************************************** + /// is_unsigned + ///\ingroup type_traits + template struct is_unsigned : std::is_unsigned {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_unsigned_v = std::is_unsigned_v; +#endif + + //*************************************************************************** + /// is_floating_point + ///\ingroup type_traits + template struct is_floating_point : std::is_floating_point {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_floating_point_v = std::is_floating_point_v; +#endif + + //*************************************************************************** + /// is_same + ///\ingroup type_traits + template struct is_same : std::is_same {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_same_v = std::is_same_v; +#endif + + //*************************************************************************** + /// is_void + ///\ingroup type_traits + template struct is_void : std::is_void {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_void_v = std::is_void_v; +#endif + + //*************************************************************************** + /// is_arithmetic + ///\ingroup type_traits + template struct is_arithmetic : std::is_arithmetic {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_arithmetic_v = std::is_arithmetic_v; +#endif + + //*************************************************************************** + /// is_fundamental + ///\ingroup type_traits + template struct is_fundamental : std::is_fundamental {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_fundamental_v = std::is_fundamental_v; +#endif + + //*************************************************************************** + /// is_compound + ///\ingroup type_traits + template struct is_compound : std::is_compound {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_compound_v = std::is_compound_v; +#endif + + //*************************************************************************** + /// is_array + ///\ingroup type_traits + template struct is_array : std::is_array {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_array_v = std::is_array_v; +#endif + + //*************************************************************************** + /// is_pointer + ///\ingroup type_traits + template struct is_pointer : std::is_pointer {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_pointer_v = std::is_pointer_v; +#endif + + //*************************************************************************** + /// is_reference + ///\ingroup type_traits + template struct is_reference : std::is_reference {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_reference_v = std::is_reference_v; +#endif + + //*************************************************************************** + /// is_lvalue_reference + ///\ingroup type_traits + template struct is_lvalue_reference : std::is_lvalue_reference {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_lvalue_reference_v = std::is_lvalue_reference_v; +#endif + + //*************************************************************************** + /// is_rvalue_reference + ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED + template struct is_rvalue_reference : std::is_rvalue_reference {}; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_rvalue_reference_v = std::is_rvalue_reference_v; +#endif + + //*************************************************************************** + /// is_pod + ///\ingroup type_traits + template struct is_pod : std::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_pod_v = std::is_pod_v; +#endif + +#if !defined(ARDUINO) && !defined(ETL_STLPORT) + //*************************************************************************** + /// is_trivially_constructible + ///\ingroup type_traits + template struct is_trivially_constructible : std::is_trivially_constructible {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_constructible_v = std::is_trivially_constructible_v; + #endif + + //*************************************************************************** + /// is_trivially_copy_constructible + ///\ingroup type_traits + template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_constructible_v = std::is_trivially_copy_constructible_v; + #endif + + //*************************************************************************** + /// is_trivially_destructible + ///\ingroup type_traits + template struct is_trivially_destructible : std::is_trivially_destructible {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_destructible_v = std::is_trivially_destructible_v; + #endif + + //*************************************************************************** + /// is_trivially_copy_assignable + ///\ingroup type_traits + template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_assignable_v = std::is_trivially_copy_assignable_v; + #endif + + //*************************************************************************** + /// is_trivially_copyable + ///\ingroup type_traits + template struct is_trivially_copyable : std::is_trivially_copyable {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copyable_v = std::is_trivially_copyable_v; + #endif +#else + // //*************************************************************************** + // /// is_trivially_constructible + // ///\ingroup type_traits + // template struct is_trivially_constructible : etlstd::is_trivially_constructible {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_constructible_v = typename etlstd::::is_trivially_constructible_v; + //#endif + + // //*************************************************************************** + // /// is_trivially_copy_constructible + // ///\ingroup type_traits + // template struct is_trivially_copy_constructible : etlstd::::is_trivially_copy_constructible {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_copy_constructible_v = typename etlstd::::is_trivially_copy_constructible_v; + //#endif + + // //*************************************************************************** + // /// is_trivially_destructible + // ///\ingroup type_traits + // template struct is_trivially_destructible : etlstd::::is_trivially_destructible {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_destructible_v = typename etlstd::::is_trivially_destructible_v; + //#endif + + // //*************************************************************************** + // /// is_trivially_copy_assignable + // ///\ingroup type_traits + // template struct is_trivially_copy_assignable : etlstd::::is_trivially_copy_assignable {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_copy_assignable_v = typename etlstd::::is_trivially_copy_assignable_v; + //#endif + + // //*************************************************************************** + // /// is_trivially_copyable + // ///\ingroup type_traits + // template struct is_trivially_copyable : etlstd::::is_trivially_copyable {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_copyable_v = typename etlstd::::is_trivially_copyable_v; + //#endif +#endif + + //*************************************************************************** + /// conditional + ///\ingroup type_traits + template struct conditional { typedef T type; }; + template struct conditional { typedef F type; }; + + //*************************************************************************** + /// make_signed + ///\ingroup type_traits + template struct make_signed : std::make_signed {}; + +#if ETL_CPP14_SUPPORTED + template + using make_signed_t = std::make_signed_t; +#endif + + //*************************************************************************** + /// make_unsigned + ///\ingroup type_traits + template struct make_unsigned : std::make_unsigned {}; + +#if ETL_CPP14_SUPPORTED + template + using make_unsigned_t = std::make_unsigned_t; +#endif + + //*************************************************************************** + /// enable_if + ///\ingroup type_traits + template struct enable_if : std::enable_if {}; + +#if ETL_CPP14_SUPPORTED + template + using enable_if_t = std::enable_if_t; +#endif + + //*************************************************************************** + /// extent + ///\ingroup type_traits + template + struct extent : std::extent {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t extent_v = std::extent_v; +#endif + + //*************************************************************************** + /// remove_extent + ///\ingroup type_traits + template struct remove_extent : std::remove_extent { }; + +#if ETL_CPP14_SUPPORTED + template + using remove_extent_t = std::remove_extent_t; +#endif + + //*************************************************************************** + /// remove_all_extents + ///\ingroup type_traits + template struct remove_all_extents : std::remove_all_extents { }; + +#if ETL_CPP14_SUPPORTED + template + using remove_all_extents_t = std::remove_all_extents_t; +#endif + + //*************************************************************************** + /// rank + ///\ingroup type_traits + template struct rank : std::rank {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t rank_v = std::rank_v; +#endif + + //*************************************************************************** + /// decay + ///\ingroup type_traits + template struct decay : std::decay {}; + +#if ETL_CPP14_SUPPORTED + template + using decay_t = std::decay_t; +#endif + + //*************************************************************************** + /// is_base_of + ///\ingroup type_traits + template struct is_base_of : std::is_base_of {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_base_of_v = std::is_base_of_v; +#endif + + //*************************************************************************** + /// add_lvalue_reference + template struct add_lvalue_reference : std::add_lvalue_reference {}; + +#if ETL_CPP14_SUPPORTED + template + using add_lvalue_reference_t = std::add_lvalue_reference_t; +#endif + + //*************************************************************************** + /// add_rvalue_reference +#if ETL_CPP11_SUPPORTED + template struct add_rvalue_reference : std::add_rvalue_reference {}; +#endif + +#if ETL_CPP14_SUPPORTED + template + using add_rvalue_reference_t = std::add_rvalue_reference_t; +#endif + + //*************************************************************************** + /// decval +#if ETL_CPP11_SUPPORTED + template + typename std::add_rvalue_reference::type declval() ETL_NOEXCEPT; +#endif + + //*************************************************************************** + /// is_convertible + ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED + template + struct is_convertible : std::is_convertible {}; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_convertible_v = std::is_convertible_v; +#endif + + //*************************************************************************** + /// Alignment templates. + ///\ingroup type_traits + template struct alignment_of : std::alignment_of {}; + template <> struct alignment_of : std::integral_constant {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t alignment_of_v = std::alignment_of_v; +#endif +} +#endif + +//*************************************************************************** +// ETL specific type traits. +//*************************************************************************** +namespace etl +{ + //*************************************************************************** + /// conditional_integral_constant + // /\ingroup type_traits + template + struct conditional_integral_constant; + + template + struct conditional_integral_constant + { + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + static const T value = TRUE_VALUE; + }; + + template + struct conditional_integral_constant + { + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + static const T value = FALSE_VALUE; + }; + #if ETL_CPP11_SUPPORTED - - //***************************************************************************" + //*************************************************************************** /// Template to determine if a type is one of a specified list. ///\ingroup types - //***************************************************************************" template struct is_one_of { - static const bool value = etl::is_same::value || - etl::is_one_of::value; + static const bool value = etlstd::is_same::value || + etl::is_one_of::value; }; template struct is_one_of { - static const bool value = etl::is_same::value; + static const bool value = etlstd::is_same::value; }; #else @@ -522,47 +1316,52 @@ namespace etl //*************************************************************************** /// Template to determine if a type is one of a specified list. ///\ingroup types - //*************************************************************************** template struct is_one_of { - static const bool value = - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value || - etl::is_same::value; + static const bool value = + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value || + etlstd::is_same::value; }; #endif +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_one_of_v = etl::is_one_of::value; +#endif + //*************************************************************************** - // A set of templates to allow related types to be derived. - //*************************************************************************** + /// A set of templates to allow related types to be derived. + ///\ingroup types + // Default. template struct types { private: - typedef typename etl::remove_cv::type type_t; + typedef typename etlstd::remove_cv::type type_t; public: @@ -580,7 +1379,7 @@ namespace etl { private: - typedef typename etl::remove_cv::type type_t; + typedef typename etlstd::remove_cv::type type_t; public: @@ -598,7 +1397,7 @@ namespace etl { private: - typedef typename etl::remove_cv::type type_t; + typedef typename etlstd::remove_cv::type type_t; public: @@ -616,7 +1415,7 @@ namespace etl { private: - typedef typename etl::remove_cv::type type_t; + typedef typename etlstd::remove_cv::type type_t; public: @@ -628,22 +1427,57 @@ namespace etl typedef const type_t* const const_pointer_const; }; - //*************************************************************************** - // size_of - //*************************************************************************** #if ETL_CPP11_SUPPORTED + // rvalue References. template - constexpr size_t size_of() + struct types { - return sizeof(T); - } + private: - template <> - constexpr size_t size_of() - { - return 1; - } + typedef typename etlstd::remove_cv::type type_t; + + public: + + typedef type_t type; + typedef type_t& reference; + typedef const type_t& const_reference; + typedef type_t* pointer; + typedef const type_t* const_pointer; + typedef const type_t* const const_pointer_const; + }; +#endif + +#if ETL_CPP14_SUPPORTED + template + using types_t = typename types::type; + + template + using types_r = typename types::reference; + + template + using types_cr = typename types::const_reference; + + template + using types_p = typename types::pointer; + + template + using types_cp = typename types::const_pointer; + + template + using types_cpc = typename types::const_pointer_const; +#endif + + //*************************************************************************** + /// size_of + ///\ingroup types + template struct size_of : etlstd::integral_constant {}; + template <> struct size_of : etlstd::integral_constant {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t size_of_v = etl::size_of::value; #endif } + #endif diff --git a/include/etl/type_traits_generator.h b/include/etl/type_traits_generator.h index f090f469..1da6f67a 100644 --- a/include/etl/type_traits_generator.h +++ b/include/etl/type_traits_generator.h @@ -72,18 +72,20 @@ cog.outl("//******************************************************************** #include "nullptr.h" #include "static_assert.h" -#if (ETL_CPP11_SUPPORTED) && !defined(ETL_NO_STL) - #include -#endif - ///\defgroup type_traits type_traits -/// A set of type traits definitions for compilers that do not support the standard header. +/// A set of type traits definitions. +/// Derived from either the standard or alternate definitions, dependant on whether or not ETL_NO_STL is defined. /// \ingroup utilities -namespace etl +#if defined(ETL_NO_STL) + +//***************************************************************************** +// Traits are defined by the ETL +//***************************************************************************** +namespace etlstd { + //*************************************************************************** /// integral_constant - ///\ingroup type_traits template struct integral_constant { @@ -94,27 +96,31 @@ namespace etl operator value_type() const { - return value; + return value; } }; /// integral_constant specialisations - ///\ingroup type_traits typedef integral_constant false_type; typedef integral_constant true_type; +#if ETL_CPP17_SUPPORTED + template + using bool_constant = integral_constant; +#endif + + //*************************************************************************** /// remove_reference - ///\ingroup type_traits template struct remove_reference { typedef T type; }; template struct remove_reference { typedef T type; }; - /// add_reference - ///\ingroup type_traits - template struct add_reference { typedef T& type; }; - template struct add_reference { typedef T& type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_reference_t = typename remove_reference::type; +#endif + //*************************************************************************** /// remove_pointer - ///\ingroup type_traits template struct remove_pointer { typedef T type; }; template struct remove_pointer { typedef T type; }; template struct remove_pointer { typedef const T type; }; @@ -125,58 +131,108 @@ namespace etl template struct remove_pointer { typedef volatile T type; }; template struct remove_pointer { typedef const volatile T type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_pointer_t = typename remove_pointer::type; +#endif + + //*************************************************************************** /// add_pointer - ///\ingroup type_traits template struct add_pointer { typedef typename remove_reference::type* type; }; +#if ETL_CPP14_SUPPORTED + template + using add_pointer_t = typename add_pointer::type; +#endif + + //*************************************************************************** /// is_const - ///\ingroup type_traits template struct is_const : false_type {}; template struct is_const : true_type {}; template struct is_const : true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_const_v = is_const::value; +#endif + + //*************************************************************************** /// remove_const - ///\ingroup type_traits template struct remove_const { typedef T type; }; template struct remove_const { typedef T type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_const_t = typename remove_const::type; +#endif + + //*************************************************************************** /// add_const - ///\ingroup type_traits template struct add_const { typedef const T type; }; template struct add_const { typedef const T type; }; +#if ETL_CPP14_SUPPORTED + template + using add_const_t = typename add_const::type; +#endif + + //*************************************************************************** /// is_volatile - ///\ingroup type_traits template struct is_volatile : false_type {}; template struct is_volatile : true_type {}; template struct is_volatile : true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_volatile_v = is_volatile::value; +#endif + + //*************************************************************************** /// remove_volatile - ///\ingroup type_traits template struct remove_volatile { typedef T type; }; template struct remove_volatile { typedef T type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_volatile_t = typename remove_volatile::type; +#endif + + //*************************************************************************** /// add_volatile - ///\ingroup type_traits template struct add_volatile { typedef volatile T type; }; template struct add_volatile { typedef volatile T type; }; +#if ETL_CPP14_SUPPORTED + template + using add_volatile_t = typename add_volatile::type; +#endif + + //*************************************************************************** /// remove_cv - ///\ingroup type_traits template struct remove_cv { typedef typename remove_volatile::type>::type type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_cv_t = typename remove_cv::type; +#endif + + //*************************************************************************** /// add_cv - ///\ingroup type_traits template struct add_cv { typedef typename add_volatile::type>::type type; }; +#if ETL_CPP14_SUPPORTED + template + using add_cv_t = typename add_cv::type; +#endif + + //*************************************************************************** /// is_integral - ///\ingroup type_traits template struct is_integral : false_type {}; template <> struct is_integral : true_type {}; template <> struct is_integral : true_type {}; @@ -195,8 +251,13 @@ namespace etl template struct is_integral : is_integral {}; template struct is_integral : is_integral {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_integral_v = is_integral::value; +#endif + + //*************************************************************************** /// is_signed - ///\ingroup type_traits template struct is_signed : false_type {}; template <> struct is_signed : integral_constant {}; template <> struct is_signed : public etl::integral_constant(wchar_t(-1) < wchar_t(0))> {}; @@ -205,15 +266,20 @@ namespace etl template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; - template <> struct is_signed : true_type{}; - template <> struct is_signed : true_type{}; - template <> struct is_signed : true_type{}; + template <> struct is_signed : true_type {}; + template <> struct is_signed : true_type {}; + template <> struct is_signed : true_type {}; template struct is_signed : is_signed {}; template struct is_signed : is_signed {}; template struct is_signed : is_signed {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_signed_v = is_signed::value; +#endif + + //*************************************************************************** /// is_unsigned - ///\ingroup type_traits template struct is_unsigned : false_type {}; template <> struct is_unsigned : true_type {}; template <> struct is_unsigned : integral_constant 0)> {}; @@ -227,8 +293,13 @@ namespace etl template struct is_unsigned : is_unsigned {}; template struct is_unsigned : is_unsigned {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_unsigned_v = is_unsigned::value; +#endif + + //*************************************************************************** /// is_floating_point - ///\ingroup type_traits template struct is_floating_point : false_type {}; template <> struct is_floating_point : true_type {}; template <> struct is_floating_point : true_type {}; @@ -237,149 +308,193 @@ namespace etl template struct is_floating_point : is_floating_point {}; template struct is_floating_point : is_floating_point {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_floating_point_v = is_floating_point::value; +#endif + + //*************************************************************************** /// is_same - ///\ingroup type_traits template struct is_same : public false_type {}; template struct is_same : public true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_same_v = is_same::value; +#endif + + //*************************************************************************** /// is_void - ///\ingroup type_traits template struct is_void : false_type {}; template<> struct is_void : true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_void_v = is_void::value; +#endif + + //*************************************************************************** /// is_arithmetic - ///\ingroup type_traits template struct is_arithmetic : integral_constant::value || is_floating_point::value> {}; - /// is_fundamental - ///\ingroup type_traits - template struct is_fundamental : integral_constant::value || - is_void::value || - is_same::type>::value> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_arithmetic_v = is_arithmetic::value; +#endif + //*************************************************************************** + /// is_fundamental + template struct is_fundamental : integral_constant::value || + is_void::value || + is_same::type>::value> {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_fundamental_v = is_fundamental::value; +#endif + + //*************************************************************************** /// is_compound - ///\ingroup type_traits template struct is_compound : integral_constant::value> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_compound_v = is_compound::value; +#endif + + //*************************************************************************** /// is_array - ///\ingroup type_traits template struct is_array : false_type {}; template struct is_array : true_type {}; template struct is_array : true_type {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_array_v = is_array::value; +#endif + + //*************************************************************************** /// is_pointer - ///\ingroup type_traits template struct is_pointer_helper : false_type {}; template struct is_pointer_helper : true_type {}; template struct is_pointer : is_pointer_helper::type> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_pointer_v = is_pointer::value; +#endif + + //*************************************************************************** /// is_reference - ///\ingroup type_traits template struct is_reference_helper : false_type {}; template struct is_reference_helper : true_type {}; template struct is_reference : is_reference_helper::type> {}; - /// 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(IN_TYPE_TRAITS_TEST) && !defined(ETL_NO_STL) - // For compilers that support C++11 - template struct is_pod : std::is_pod {}; -#else - template struct is_pod : etl::integral_constant::value || etl::is_pointer::value> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_reference_v = is_reference::value; #endif -#if (ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED) && !defined(ETL_STLPORT) && !defined(IN_TYPE_TRAITS_TEST) && !defined(ETL_NO_STL) - /// is_trivially_constructible - ///\ingroup type_traits - template struct is_trivially_constructible : std::is_trivially_constructible {}; + //*************************************************************************** + /// is_lvalue_reference + template struct is_lvalue_reference_helper : false_type {}; + template struct is_lvalue_reference_helper : true_type {}; + template struct is_lvalue_reference : is_lvalue_reference_helper::type> {}; - /// is_trivially_copy_constructible - ///\ingroup type_traits - template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; - - /// is_trivially_destructible - ///\ingroup type_traits - template struct is_trivially_destructible : std::is_trivially_destructible {}; - - /// is_trivially_copy_assignable - ///\ingroup type_traits - template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; - - /// is_trivially_copyable - ///\ingroup type_traits - template struct is_trivially_copyable : std::is_trivially_copyable {}; -#else - /// is_trivially_constructible - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_constructible : etl::is_pod {}; - - /// is_trivially_copy_constructible - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_copy_constructible : etl::is_pod {}; - - /// is_trivially_destructible - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_destructible : etl::is_pod {}; - - /// is_trivially_copy_assignable - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_copy_assignable : etl::is_pod {}; - - /// is_trivially_copyable - /// For C++03, only POD types are recognised. - ///\ingroup type_traits - template struct is_trivially_copyable : etl::is_pod {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_lvalue_reference_v = etl::is_lvalue_reference::value; #endif -#if ETL_CPP11_SUPPORTED + //*************************************************************************** /// is_rvalue_reference - ///\ingroup type_traits - template struct is_rvalue_reference : etl::false_type {}; - template struct is_rvalue_reference : etl::true_type {}; + template struct is_rvalue_reference_helper : false_type {}; + template struct is_rvalue_reference_helper : true_type {}; + template struct is_rvalue_reference : is_rvalue_reference_helper::type> {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_rvalue_reference_v = etl::is_rvalue_reference::value; #endif + //*************************************************************************** + /// is_pod + /// Only fundamental and pointers types are recognised. + template struct is_pod : etl::integral_constant::value || etlstd::is_pointer::value> {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_pod_v = etlstd::is_pod::value; +#endif + + //*************************************************************************** + /// is_trivially_constructible + /// Only POD types are recognised. + template struct is_trivially_constructible : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_constructible_v = etlstd::is_trivially_constructible::value; +#endif + + //*************************************************************************** + /// is_trivially_copy_constructible + /// Only POD types are recognised. + template struct is_trivially_copy_constructible : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_constructible_v = etl::is_trivially_copy_constructible::value; +#endif + + //*************************************************************************** + /// is_trivially_destructible + /// Only POD types are recognised. + template struct is_trivially_destructible : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_destructible_v = etl::is_trivially_destructible::value; +#endif + + //*************************************************************************** + /// is_trivially_copy_assignable + /// Only POD types are recognised. + template struct is_trivially_copy_assignable : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_assignable_v = etl::is_trivially_copy_assignable::value; +#endif + + //*************************************************************************** + /// is_trivially_copyable + /// Only POD types are recognised. + template struct is_trivially_copyable : etlstd::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable::value; +#endif + + //*************************************************************************** /// conditional - ///\ingroup type_traits template struct conditional { typedef T type; }; template struct conditional { typedef F type; }; - /// conditional_integral_constant - ///\ingroup type_traits - template - struct conditional_integral_constant; - - template - struct conditional_integral_constant - { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); - static const T value = TRUE_VALUE; - }; - - template - struct conditional_integral_constant - { - ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); - static const T value = FALSE_VALUE; - }; - + //*************************************************************************** /// make_signed - ///\ingroup type_traits template struct make_signed { typedef T type; }; template <> struct make_signed { typedef signed char type; }; template <> struct make_signed { typedef signed char type; }; template <> struct make_signed { - typedef etl::conditional::type>::type type; + typedef etlstd::conditional::type>::type type; }; template <> struct make_signed { typedef short type; }; @@ -390,8 +505,13 @@ namespace etl template struct make_signed : add_volatile::type> {}; template struct make_signed : add_const::type>::type> {}; +#if ETL_CPP14_SUPPORTED + template + using make_signed_t = typename make_signed::type; +#endif + + //*************************************************************************** /// make_unsigned - ///\ingroup type_traits template struct make_unsigned { typedef T type; }; template <> struct make_unsigned { typedef unsigned char type; }; template <> struct make_unsigned { typedef unsigned char type; }; @@ -399,11 +519,11 @@ namespace etl template <> struct make_unsigned { - typedef etl::conditional::type>::type type; + typedef etlstd::conditional::type>::type type; }; template <> struct make_unsigned { typedef unsigned int type; }; @@ -413,18 +533,28 @@ namespace etl template struct make_unsigned : add_volatile::type> {}; template struct make_unsigned : add_const::type>::type> {}; +#if ETL_CPP14_SUPPORTED + template + using make_unsigned_t = typename make_unsigned::type; +#endif + + //*************************************************************************** /// enable_if - ///\ingroup type_traits template struct enable_if {}; template struct enable_if { typedef T type; }; +#if ETL_CPP14_SUPPORTED + template + using enable_if_t = typename enable_if::type; +#endif + + //*************************************************************************** /// extent - ///\ingroup type_traits - template - struct extent : integral_constant {}; + template + struct extent : integral_constant {}; template - struct extent : integral_constant {}; + struct extent : integral_constant {}; template struct extent : integral_constant::value> {}; @@ -435,49 +565,74 @@ namespace etl template struct extent : integral_constant::value> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t extent_v = extent::value; +#endif + + //*************************************************************************** /// remove_extent - ///\ingroup type_traits template struct remove_extent { typedef T type; }; template struct remove_extent { typedef T type; }; - template struct remove_extent { typedef T type;}; + template struct remove_extent { typedef T type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_extent_t = typename remove_extent::type; +#endif + + //*************************************************************************** /// remove_all_extents - ///\ingroup type_traits - template struct remove_all_extents { typedef T type;}; + template struct remove_all_extents { typedef T type; }; template struct remove_all_extents { typedef typename remove_all_extents::type type; }; template struct remove_all_extents { typedef typename remove_all_extents::type type; }; +#if ETL_CPP14_SUPPORTED + template + using remove_all_extents_t = typename remove_all_extents::type; +#endif + + //*************************************************************************** /// rank - ///\ingroup type_traits template struct rank : integral_constant {}; template struct rank : public integral_constant::value + 1> {}; template struct rank : public integral_constant::value + 1> {}; +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t rank_v = rank::value; +#endif + + //*************************************************************************** /// decay - ///\ingroup type_traits template struct decay { - typedef typename etl::remove_reference::type U; - typedef typename etl::conditional::value, - typename etl::remove_extent::type*, - typename etl::remove_cv::type>::type type; + typedef typename etlstd::remove_reference::type U; + typedef typename etlstd::conditional::value, + typename etlstd::remove_extent::type*, + typename etlstd::remove_cv::type>::type type; }; +#if ETL_CPP14_SUPPORTED + template + using decay_t = typename decay::type; +#endif + + //*************************************************************************** /// is_base_of - ///\ingroup type_traits template::value || etl::is_fundamental::value)> + const bool IsFundamental = (etlstd::is_fundamental::value || etlstd::is_fundamental::value)> struct is_base_of { private: template struct dummy {}; - struct internal: TDerived, dummy{}; + struct internal: TDerived, dummy{}; - static TBase* check(TBase*); - template static char check(dummy*); + static TBase* check(TBase*); + template static char check(dummy*); public: @@ -491,42 +646,681 @@ namespace etl static const bool value = false; }; +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_base_of_v = is_base_of::value; +#endif + + //*************************************************************************** + /// add_lvalue_reference + template struct add_lvalue_reference { using type = T & ; }; + template struct add_lvalue_reference { using type = T & ; }; + template <> struct add_lvalue_reference { using type = void; }; + template <> struct add_lvalue_reference { using type = const void; }; + template <> struct add_lvalue_reference { using type = volatile void; }; + template <> struct add_lvalue_reference { using type = const volatile void; }; + +#if ETL_CPP14_SUPPORTED + template + using add_lvalue_reference_t = typename etlstd::add_lvalue_reference::type; +#endif + + //*************************************************************************** + /// add_rvalue_reference +#if ETL_CPP11_SUPPORTED + template struct add_rvalue_reference { using type = T && ; }; + template struct add_rvalue_reference { using type = T & ; }; + template <> struct add_rvalue_reference { using type = void; }; + template <> struct add_rvalue_reference { using type = const void; }; + template <> struct add_rvalue_reference { using type = volatile void; }; + template <> struct add_rvalue_reference { using type = const volatile void; }; +#endif + +#if ETL_CPP14_SUPPORTED + template + using add_rvalue_reference_t = typename etlstd::add_rvalue_reference::type; +#endif + + //*************************************************************************** + /// decval +#if ETL_CPP11_SUPPORTED + template + typename etlstd::add_rvalue_reference::type declval() ETL_NOEXCEPT; +#endif + + //*************************************************************************** + /// is_convertible +#if ETL_CPP11_SUPPORTED + namespace private_type_traits + { + template + using true_type_for = etlstd::true_type; + + template + auto returnable(int)->true_type_for; + + template + auto returnable(...)->etlstd::false_type; + + template + auto nonvoid_convertible(int)->true_type_for()(etl::declval())) + >; + template + auto nonvoid_convertible(...)->etlstd::false_type; + } + + template + struct is_convertible : etl::integral_constant(0))::value && + decltype(private_type_traits::nonvoid_convertible(0))::value) || + (etl::is_void::value && etl::is_void::value)> {}; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_convertible_v = etlstd::is_convertible::value; +#endif + + //*************************************************************************** /// Alignment templates. /// These require compiler specific intrinsics. - ///\ingroup type_traits -#if ETL_CPP11_SUPPORTED - template struct alignment_of : integral_constant {}; +#ifdef ETL_COMPILER_MICROSOFT + template struct alignment_of : integral_constant {}; +#elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI) + template struct alignment_of : integral_constant {}; #else - #ifdef ETL_COMPILER_MICROSOFT - template struct alignment_of : integral_constant {}; - #elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI) - template struct alignment_of : integral_constant {}; - #else - template struct alignment_of : integral_constant {}; - #endif + template struct alignment_of : integral_constant {}; #endif /// Specialisation of 'alignment_of' for 'void'. ///\ingroup type_traits - template <> struct alignment_of : integral_constant {}; + template <> struct alignment_of : integral_constant {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t alignment_of_v = etlstd::alignment_of::value; +#endif +} + +#else + +//***************************************************************************** +// Traits are derived from the STL +//***************************************************************************** +#include + +namespace etlstd +{ + //*************************************************************************** + /// integral_constant + ///\ingroup type_traits + template + struct integral_constant : std::integral_constant {}; + + /// integral_constant specialisations + ///\ingroup type_traits + typedef integral_constant false_type; + typedef integral_constant true_type; + +#if ETL_CPP17_SUPPORTED + template + using bool_constant = std::integral_constant; +#endif + + //*************************************************************************** + /// remove_reference + ///\ingroup type_traits + template struct remove_reference : std::remove_reference {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_reference_t = std::remove_reference_t; +#endif + + //*************************************************************************** + /// remove_pointer + ///\ingroup type_traits + template struct remove_pointer : std::remove_pointer {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_pointer_t = std::remove_pointer_t; +#endif + + //*************************************************************************** + /// add_pointer + ///\ingroup type_traits + template struct add_pointer : std::add_pointer {}; + +#if ETL_CPP14_SUPPORTED + template + using add_pointer_t = std::add_pointer_t; +#endif + + //*************************************************************************** + /// is_const + ///\ingroup type_traits + template struct is_const : std::is_const {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_const_v = std::is_const_v; +#endif + + //*************************************************************************** + /// remove_const + ///\ingroup type_traits + template struct remove_const : std::remove_const {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_const_t = std::remove_const_t; +#endif + + //*************************************************************************** + /// add_const + ///\ingroup type_traits + template struct add_const : std::add_const {}; + +#if ETL_CPP14_SUPPORTED + template + using add_const_t = std::add_const_t; +#endif + + //*************************************************************************** + /// is_volatile + ///\ingroup type_traits + template struct is_volatile : std::is_volatile {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_volatile_v = std::is_volatile_v; +#endif + + //*************************************************************************** + /// remove_volatile + ///\ingroup type_traits + template struct remove_volatile : std::remove_volatile {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_volatile_t = std::remove_volatile_t; +#endif + + //*************************************************************************** + /// add_volatile + ///\ingroup type_traits + template struct add_volatile : std::add_volatile {}; + +#if ETL_CPP14_SUPPORTED + template + using add_volatile_t = std::add_volatile_t; +#endif + + //*************************************************************************** + /// remove_cv + ///\ingroup type_traits + template struct remove_cv : std::remove_cv {}; + +#if ETL_CPP14_SUPPORTED + template + using remove_cv_t = std::remove_cv_t; +#endif + + //*************************************************************************** + /// add_cv + ///\ingroup type_traits + template struct add_cv : std::add_cv {}; + +#if ETL_CPP14_SUPPORTED + template + using add_cv_t = std::add_cv_t; +#endif + + //*************************************************************************** + /// is_integral + ///\ingroup type_traits + template struct is_integral : std::is_integral {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_integral_v = std::is_integral_v; +#endif + + //*************************************************************************** + /// is_signed + ///\ingroup type_traits + template struct is_signed : std::is_signed {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_signed_v = std::is_signed_v; +#endif + + //*************************************************************************** + /// is_unsigned + ///\ingroup type_traits + template struct is_unsigned : std::is_unsigned {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_unsigned_v = std::is_unsigned_v; +#endif + + //*************************************************************************** + /// is_floating_point + ///\ingroup type_traits + template struct is_floating_point : std::is_floating_point {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_floating_point_v = std::is_floating_point_v; +#endif + + //*************************************************************************** + /// is_same + ///\ingroup type_traits + template struct is_same : std::is_same {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_same_v = std::is_same_v; +#endif + + //*************************************************************************** + /// is_void + ///\ingroup type_traits + template struct is_void : std::is_void {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_void_v = std::is_void_v; +#endif + + //*************************************************************************** + /// is_arithmetic + ///\ingroup type_traits + template struct is_arithmetic : std::is_arithmetic {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_arithmetic_v = std::is_arithmetic_v; +#endif + + //*************************************************************************** + /// is_fundamental + ///\ingroup type_traits + template struct is_fundamental : std::is_fundamental {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_fundamental_v = std::is_fundamental_v; +#endif + + //*************************************************************************** + /// is_compound + ///\ingroup type_traits + template struct is_compound : std::is_compound {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_compound_v = std::is_compound_v; +#endif + + //*************************************************************************** + /// is_array + ///\ingroup type_traits + template struct is_array : std::is_array {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_array_v = std::is_array_v; +#endif + + //*************************************************************************** + /// is_pointer + ///\ingroup type_traits + template struct is_pointer : std::is_pointer {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_pointer_v = std::is_pointer_v; +#endif + + //*************************************************************************** + /// is_reference + ///\ingroup type_traits + template struct is_reference : std::is_reference {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_reference_v = std::is_reference_v; +#endif + + //*************************************************************************** + /// is_lvalue_reference + ///\ingroup type_traits + template struct is_lvalue_reference : std::is_lvalue_reference {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_lvalue_reference_v = std::is_lvalue_reference_v; +#endif + + //*************************************************************************** + /// is_rvalue_reference + ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED + template struct is_rvalue_reference : std::is_rvalue_reference {}; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_rvalue_reference_v = std::is_rvalue_reference_v; +#endif + + //*************************************************************************** + /// is_pod + ///\ingroup type_traits + template struct is_pod : std::is_pod {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_pod_v = std::is_pod_v; +#endif + +#if !defined(ARDUINO) && !defined(ETL_STLPORT) + //*************************************************************************** + /// is_trivially_constructible + ///\ingroup type_traits + template struct is_trivially_constructible : std::is_trivially_constructible {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_constructible_v = std::is_trivially_constructible_v; + #endif + + //*************************************************************************** + /// is_trivially_copy_constructible + ///\ingroup type_traits + template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_constructible_v = std::is_trivially_copy_constructible_v; + #endif + + //*************************************************************************** + /// is_trivially_destructible + ///\ingroup type_traits + template struct is_trivially_destructible : std::is_trivially_destructible {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_destructible_v = std::is_trivially_destructible_v; + #endif + + //*************************************************************************** + /// is_trivially_copy_assignable + ///\ingroup type_traits + template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_assignable_v = std::is_trivially_copy_assignable_v; + #endif + + //*************************************************************************** + /// is_trivially_copyable + ///\ingroup type_traits + template struct is_trivially_copyable : std::is_trivially_copyable {}; + + #if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copyable_v = std::is_trivially_copyable_v; + #endif +#else + // //*************************************************************************** + // /// is_trivially_constructible + // ///\ingroup type_traits + // template struct is_trivially_constructible : etlstd::is_trivially_constructible {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_constructible_v = typename etl::::is_trivially_constructible_v; + //#endif + + // //*************************************************************************** + // /// is_trivially_copy_constructible + // ///\ingroup type_traits + // template struct is_trivially_copy_constructible : etl::::is_trivially_copy_constructible {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_copy_constructible_v = typename etl::::is_trivially_copy_constructible_v; + //#endif + + // //*************************************************************************** + // /// is_trivially_destructible + // ///\ingroup type_traits + // template struct is_trivially_destructible : etl::::is_trivially_destructible {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_destructible_v = typename etl::::is_trivially_destructible_v; + //#endif + + // //*************************************************************************** + // /// is_trivially_copy_assignable + // ///\ingroup type_traits + // template struct is_trivially_copy_assignable : etl::::is_trivially_copy_assignable {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_copy_assignable_v = typename etl::::is_trivially_copy_assignable_v; + //#endif + + // //*************************************************************************** + // /// is_trivially_copyable + // ///\ingroup type_traits + // template struct is_trivially_copyable : etl::::is_trivially_copyable {}; + + //#if ETL_CPP17_SUPPORTED + // template + // inline constexpr bool is_trivially_copyable_v = typename etl::::is_trivially_copyable_v; + //#endif +#endif + + //*************************************************************************** + /// conditional + ///\ingroup type_traits + template struct conditional { typedef T type; }; + template struct conditional { typedef F type; }; + + //*************************************************************************** + /// make_signed + ///\ingroup type_traits + template struct make_signed : std::make_signed {}; + +#if ETL_CPP14_SUPPORTED + template + using make_signed_t = std::make_signed_t; +#endif + + //*************************************************************************** + /// make_unsigned + ///\ingroup type_traits + template struct make_unsigned : std::make_unsigned {}; + +#if ETL_CPP14_SUPPORTED + template + using make_unsigned_t = std::make_unsigned_t; +#endif + + //*************************************************************************** + /// enable_if + ///\ingroup type_traits + template struct enable_if : std::enable_if {}; + +#if ETL_CPP14_SUPPORTED + template + using enable_if_t = std::enable_if_t; +#endif + + //*************************************************************************** + /// extent + ///\ingroup type_traits + template + struct extent : std::extent {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t extent_v = std::extent_v; +#endif + + //*************************************************************************** + /// remove_extent + ///\ingroup type_traits + template struct remove_extent : std::remove_extent { }; + +#if ETL_CPP14_SUPPORTED + template + using remove_extent_t = std::remove_extent_t; +#endif + + //*************************************************************************** + /// remove_all_extents + ///\ingroup type_traits + template struct remove_all_extents : std::remove_all_extents { }; + +#if ETL_CPP14_SUPPORTED + template + using remove_all_extents_t = std::remove_all_extents_t; +#endif + + //*************************************************************************** + /// rank + ///\ingroup type_traits + template struct rank : std::rank {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t rank_v = std::rank_v; +#endif + + //*************************************************************************** + /// decay + ///\ingroup type_traits + template struct decay : std::decay {}; + +#if ETL_CPP14_SUPPORTED + template + using decay_t = std::decay_t; +#endif + + //*************************************************************************** + /// is_base_of + ///\ingroup type_traits + template struct is_base_of : std::is_base_of {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_base_of_v = std::is_base_of_v; +#endif + + //*************************************************************************** + /// add_lvalue_reference + template struct add_lvalue_reference : std::add_lvalue_reference {}; + +#if ETL_CPP14_SUPPORTED + template + using add_lvalue_reference_t = std::add_lvalue_reference_t; +#endif + + //*************************************************************************** + /// add_rvalue_reference +#if ETL_CPP11_SUPPORTED + template struct add_rvalue_reference : std::add_rvalue_reference {}; +#endif + +#if ETL_CPP14_SUPPORTED + template + using add_rvalue_reference_t = std::add_rvalue_reference_t; +#endif + + //*************************************************************************** + /// decval +#if ETL_CPP11_SUPPORTED + template + typename std::add_rvalue_reference::type declval() ETL_NOEXCEPT; +#endif + + //*************************************************************************** + /// is_convertible + ///\ingroup type_traits +#if ETL_CPP11_SUPPORTED + template + struct is_convertible : std::is_convertible {}; +#endif + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_convertible_v = std::is_convertible_v; +#endif + + //*************************************************************************** + /// Alignment templates. + ///\ingroup type_traits + template struct alignment_of : std::alignment_of {}; + template <> struct alignment_of : std::integral_constant {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t alignment_of_v = std::alignment_of_v; +#endif +} +#endif + +//*************************************************************************** +// ETL specific type traits. +//*************************************************************************** +namespace etl +{ + //*************************************************************************** + /// conditional_integral_constant + // /\ingroup type_traits + template + struct conditional_integral_constant; + + template + struct conditional_integral_constant + { + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + static const T value = TRUE_VALUE; + }; + + template + struct conditional_integral_constant + { + ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + static const T value = FALSE_VALUE; + }; + #if ETL_CPP11_SUPPORTED - - //***************************************************************************" + //*************************************************************************** /// Template to determine if a type is one of a specified list. ///\ingroup types - //***************************************************************************" template struct is_one_of { - static const bool value = etl::is_same::value || - etl::is_one_of::value; + static const bool value = etlstd::is_same::value || + etl::is_one_of::value; }; template struct is_one_of { - static const bool value = etl::is_same::value; + static const bool value = etlstd::is_same::value; }; #else @@ -536,7 +1330,6 @@ namespace etl cog.outl("//***************************************************************************") cog.outl("/// Template to determine if a type is one of a specified list.") cog.outl("///\ingroup types") - cog.outl("//***************************************************************************") cog.outl("template ::value ||" % n) - cog.outl(" etl::is_same::value;" % IsOneOf) + cog.outl(" etlstd::is_same::value ||" % n) + cog.outl(" etlstd::is_same::value;" % IsOneOf) cog.outl("};") ]]]*/ /*[[[end]]]*/ #endif +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_one_of_v = etl::is_one_of::value; +#endif + //*************************************************************************** - // A set of templates to allow related types to be derived. - //*************************************************************************** + /// A set of templates to allow related types to be derived. + ///\ingroup types + // Default. template struct types { private: - typedef typename etl::remove_cv::type type_t; + typedef typename etlstd::remove_cv::type type_t; public: @@ -585,7 +1384,7 @@ namespace etl { private: - typedef typename etl::remove_cv::type type_t; + typedef typename etlstd::remove_cv::type type_t; public: @@ -603,7 +1402,7 @@ namespace etl { private: - typedef typename etl::remove_cv::type type_t; + typedef typename etlstd::remove_cv::type type_t; public: @@ -621,7 +1420,7 @@ namespace etl { private: - typedef typename etl::remove_cv::type type_t; + typedef typename etlstd::remove_cv::type type_t; public: @@ -633,22 +1432,57 @@ namespace etl typedef const type_t* const const_pointer_const; }; - //*************************************************************************** - // size_of - //*************************************************************************** #if ETL_CPP11_SUPPORTED + // rvalue References. template - constexpr size_t size_of() + struct types { - return sizeof(T); - } + private: - template <> - constexpr size_t size_of() - { - return 1; - } + typedef typename etlstd::remove_cv::type type_t; + + public: + + typedef type_t type; + typedef type_t& reference; + typedef const type_t& const_reference; + typedef type_t* pointer; + typedef const type_t* const_pointer; + typedef const type_t* const const_pointer_const; + }; +#endif + +#if ETL_CPP14_SUPPORTED + template + using types_t = typename types::type; + + template + using types_r = typename types::reference; + + template + using types_cr = typename types::const_reference; + + template + using types_p = typename types::pointer; + + template + using types_cp = typename types::const_pointer; + + template + using types_cpc = typename types::const_pointer_const; +#endif + + //*************************************************************************** + /// size_of + ///\ingroup types + template struct size_of : etlstd::integral_constant {}; + template <> struct size_of : etlstd::integral_constant {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr size_t size_of_v = etl::size_of::value; #endif } + #endif diff --git a/include/etl/u16string.h b/include/etl/u16string.h index c571ebab..4da9ff67 100644 --- a/include/etl/u16string.h +++ b/include/etl/u16string.h @@ -191,7 +191,7 @@ namespace etl { ETL_ASSERT(position < size(), ETL_ERROR(string_out_of_bounds)); - length_ = ETL_STD::min(length_, size() - position); + length_ = etlstd::min(length_, size() - position); new_string.assign(buffer + position, buffer + position + length_); } diff --git a/include/etl/u32string.h b/include/etl/u32string.h index 8e152ae8..4606fe21 100644 --- a/include/etl/u32string.h +++ b/include/etl/u32string.h @@ -191,7 +191,7 @@ namespace etl { ETL_ASSERT(position < size(), ETL_ERROR(string_out_of_bounds)); - length_ = ETL_STD::min(length_, size() - position); + length_ = etlstd::min(length_, size() - position); new_string.assign(buffer + position, buffer + position + length_); } diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 8f27ffaf..701f7b12 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -37,10 +37,10 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" -#include "stl/utility.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" +#include "utility.h" #include "container.h" #include "pool.h" @@ -127,7 +127,7 @@ namespace etl /// Can be used as a reference type for all unordered_map containing a specific type. ///\ingroup unordered_map //*************************************************************************** - template , typename TKeyEqual = ETL_STD::equal_to > + template , typename TKeyEqual = etlstd::equal_to > class iunordered_map { public: @@ -172,7 +172,7 @@ namespace etl typedef typename bucket_t::const_iterator local_const_iterator; //********************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -332,7 +332,7 @@ namespace etl }; //********************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -482,7 +482,7 @@ namespace etl local_iterator inode; }; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the unordered_map. @@ -609,7 +609,7 @@ namespace etl { size_t index = bucket(key); - return ETL_STD::distance(pbuckets[index].begin(), pbuckets[index].end()); + return etlstd::distance(pbuckets[index].begin(), pbuckets[index].end()); } //********************************************************************* @@ -752,7 +752,7 @@ namespace etl void assign(TIterator first_, TIterator last_) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first_, last_); + difference_type d = etlstd::distance(first_, last_); ETL_ASSERT(d >= 0, ETL_ERROR(unordered_map_iterator)); ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_map_full)); #endif @@ -1370,7 +1370,7 @@ namespace etl template bool operator ==(const etl::iunordered_map& lhs, const etl::iunordered_map& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1389,7 +1389,7 @@ namespace etl //************************************************************************* /// A templated unordered_map implementation that uses a fixed size buffer. //************************************************************************* - template , typename TKeyEqual = ETL_STD::equal_to > + template , typename TKeyEqual = etlstd::equal_to > class unordered_map : public etl::iunordered_map { private: diff --git a/include/etl/unordered_multimap.h b/include/etl/unordered_multimap.h index 7a4edc26..1951e5f0 100644 --- a/include/etl/unordered_multimap.h +++ b/include/etl/unordered_multimap.h @@ -37,10 +37,10 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" -#include "stl/utility.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" +#include "utility.h" #include "container.h" #include "pool.h" @@ -127,7 +127,7 @@ namespace etl /// Can be used as a reference type for all unordered_multimap containing a specific type. ///\ingroup unordered_multimap //*************************************************************************** - template , typename TKeyEqual = ETL_STD::equal_to > + template , typename TKeyEqual = etlstd::equal_to > class iunordered_multimap { public: @@ -171,7 +171,7 @@ namespace etl typedef typename bucket_t::const_iterator local_const_iterator; //********************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -331,7 +331,7 @@ namespace etl }; //********************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -482,7 +482,7 @@ namespace etl local_iterator inode; }; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the unordered_multimap. @@ -609,7 +609,7 @@ namespace etl { size_t index = bucket(key); - return ETL_STD::distance(pbuckets[index].begin(), pbuckets[index].end()); + return etlstd::distance(pbuckets[index].begin(), pbuckets[index].end()); } //********************************************************************* @@ -641,7 +641,7 @@ namespace etl void assign(TIterator first_, TIterator last_) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first_, last_); + difference_type d = etlstd::distance(first_, last_); ETL_ASSERT(d >= 0, ETL_ERROR(unordered_multimap_iterator)); ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_multimap_full)); #endif @@ -1279,7 +1279,7 @@ namespace etl template bool operator ==(const etl::iunordered_multimap& lhs, const etl::iunordered_multimap& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1298,7 +1298,7 @@ namespace etl //************************************************************************* /// A templated unordered_multimap implementation that uses a fixed size buffer. //************************************************************************* - template , typename TKeyEqual = ETL_STD::equal_to > + template , typename TKeyEqual = etlstd::equal_to > class unordered_multimap : public etl::iunordered_multimap { private: diff --git a/include/etl/unordered_multiset.h b/include/etl/unordered_multiset.h index 3b634a7b..b7c58585 100644 --- a/include/etl/unordered_multiset.h +++ b/include/etl/unordered_multiset.h @@ -37,10 +37,10 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" -#include "stl/utility.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" +#include "utility.h" #include "container.h" #include "pool.h" @@ -126,7 +126,7 @@ namespace etl /// Can be used as a reference type for all unordered_multiset containing a specific type. ///\ingroup unordered_multiset //*************************************************************************** - template , typename TKeyEqual = ETL_STD::equal_to > + template , typename TKeyEqual = etlstd::equal_to > class iunordered_multiset { public: @@ -168,7 +168,7 @@ namespace etl typedef typename bucket_t::const_iterator local_const_iterator; //********************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -327,7 +327,7 @@ namespace etl }; //********************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -477,7 +477,7 @@ namespace etl local_iterator inode; }; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the unordered_multiset. @@ -604,7 +604,7 @@ namespace etl { size_t index = bucket(key); - return ETL_STD::distance(pbuckets[index].begin(), pbuckets[index].end()); + return etlstd::distance(pbuckets[index].begin(), pbuckets[index].end()); } //********************************************************************* @@ -636,7 +636,7 @@ namespace etl void assign(TIterator first_, TIterator last_) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first_, last_); + difference_type d = etlstd::distance(first_, last_); ETL_ASSERT(d >= 0, ETL_ERROR(unordered_multiset_iterator)); ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_multiset_full)); #endif @@ -1274,7 +1274,7 @@ namespace etl template bool operator ==(const etl::iunordered_multiset& lhs, const etl::iunordered_multiset& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1293,7 +1293,7 @@ namespace etl //************************************************************************* /// A templated unordered_multiset implementation that uses a fixed size buffer. //************************************************************************* - template , typename TKeyEqual = ETL_STD::equal_to > + template , typename TKeyEqual = etlstd::equal_to > class unordered_multiset : public etl::iunordered_multiset { private: diff --git a/include/etl/unordered_set.h b/include/etl/unordered_set.h index 1babd690..c545adfb 100644 --- a/include/etl/unordered_set.h +++ b/include/etl/unordered_set.h @@ -37,10 +37,10 @@ SOFTWARE. #include "platform.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" -#include "stl/utility.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" +#include "utility.h" #include "container.h" #include "pool.h" @@ -127,7 +127,7 @@ namespace etl /// Can be used as a reference type for all unordered_set containing a specific type. ///\ingroup unordered_set //*************************************************************************** - template , typename TKeyEqual = ETL_STD::equal_to > + template , typename TKeyEqual = etlstd::equal_to > class iunordered_set { public: @@ -169,7 +169,7 @@ namespace etl typedef typename bucket_t::const_iterator local_const_iterator; //********************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -328,7 +328,7 @@ namespace etl }; //********************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -478,7 +478,7 @@ namespace etl local_iterator inode; }; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the unordered_set. @@ -605,7 +605,7 @@ namespace etl { size_t index = bucket(key); - return ETL_STD::distance(pbuckets[index].begin(), pbuckets[index].end()); + return etlstd::distance(pbuckets[index].begin(), pbuckets[index].end()); } //********************************************************************* @@ -637,7 +637,7 @@ namespace etl void assign(TIterator first_, TIterator last_) { #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first_, last_); + difference_type d = etlstd::distance(first_, last_); ETL_ASSERT(d >= 0, ETL_ERROR(unordered_set_iterator)); ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_set_full)); #endif @@ -1251,7 +1251,7 @@ namespace etl template bool operator ==(const etl::iunordered_set& lhs, const etl::iunordered_set& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1270,7 +1270,7 @@ namespace etl //************************************************************************* /// A templated unordered_set implementation that uses a fixed size buffer. //************************************************************************* - template , typename TKeyEqual = ETL_STD::equal_to > + template , typename TKeyEqual = etlstd::equal_to > class unordered_set : public etl::iunordered_set { private: diff --git a/include/etl/utility.h b/include/etl/utility.h index 1743c01c..ec357560 100644 --- a/include/etl/utility.h +++ b/include/etl/utility.h @@ -37,8 +37,128 @@ SOFTWARE. ///\defgroup utility utility ///\ingroup utilities -namespace etl +namespace etlstd { + //****************************************************************************** + template + 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 + pair(const pair& other) + : first(other.first), + second(other.second) + { + } + + pair(const pair& other) + : first(other.first), + second(other.second) + { + } + + void swap(pair& other) + { + T1 temp1 = first; + T2 temp2 = second; + first = other.first; + second = other.second; + other.first = temp1; + other.second = temp2; + } + }; + + //****************************************************************************** + template + inline pair make_pair(T1 a, T2 b) + { + return pair(a, b); + } + + //****************************************************************************** + template + inline void swap(pair& a, pair& b) + { + a.swap(b); + } + + //****************************************************************************** + template + inline bool operator ==(const pair& a, const pair& b) + { + return (a.first == b.first) && (a.second == b.second); + } + + template + inline bool operator !=(const pair& a, const pair& b) + { + return !(a == b); + } + + template + inline bool operator <(const pair& a, const pair& b) + { + return (a.first < b.first) || + (!(b.first < a.first) && (a.second < b.second)); + } + + template + inline bool operator >(const pair& a, const pair& b) + { + return (b < a); + } + + template + inline bool operator <=(const pair& a, const pair& b) + { + return !(b < a); + } + + template + inline bool operator >=(const pair& a, const pair& b) + { + return !(a < b); + } + +#if ETL_CPP11_SUPPORTED + //****************************************************************************** + template + constexpr typename etlstd::remove_reference::type&& move(T&& t) noexcept + { + return static_cast::type&&>(t); + } + + //****************************************************************************** + template + constexpr T&& forward(typename etlstd::remove_reference::type& t) noexcept + { + return static_cast(t); + } + + template + constexpr T&& forward(typename etlstd::remove_reference::type&& t) noexcept + { + return static_cast(t); + } +#endif + //*************************************************************************** /// exchange (const) //*************************************************************************** @@ -54,7 +174,7 @@ namespace etl /// as_const //*************************************************************************** template - typename etl::add_const::type& as_const(T& t) + typename etlstd::add_const::type& as_const(T& t) { return t; } diff --git a/include/etl/variant.h b/include/etl/variant.h index dd84fc72..82f06e35 100644 --- a/include/etl/variant.h +++ b/include/etl/variant.h @@ -164,14 +164,14 @@ namespace etl template struct Type_Id_Lookup { - static const uint_least8_t type_id = etl::is_same::value ? 0 : - etl::is_same::value ? 1 : - etl::is_same::value ? 2 : - etl::is_same::value ? 3 : - etl::is_same::value ? 4 : - etl::is_same::value ? 5 : - etl::is_same::value ? 6 : - etl::is_same::value ? 7 : + static const uint_least8_t type_id = etlstd::is_same::value ? 0 : + etlstd::is_same::value ? 1 : + etlstd::is_same::value ? 2 : + etlstd::is_same::value ? 3 : + etlstd::is_same::value ? 4 : + etlstd::is_same::value ? 5 : + etlstd::is_same::value ? 6 : + etlstd::is_same::value ? 7 : UNSUPPORTED_TYPE_ID; }; @@ -723,7 +723,7 @@ namespace etl ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); destruct_current(); - ::new (static_cast(data)) T(ETL_STD::forward(args)...); + ::new (static_cast(data)) T(etlstd::forward(args)...); type_id = Type_Id_Lookup::type_id; return *static_cast(data); diff --git a/include/etl/variant_pool.h b/include/etl/variant_pool.h index f9823f6c..ae53934f 100644 --- a/include/etl/variant_pool.h +++ b/include/etl/variant_pool.h @@ -63,7 +63,7 @@ SOFTWARE. #include "type_lookup.h" #include "pool.h" -#include "stl/utility.h" +#include "utility.h" #undef ETL_FILE #define ETL_FILE "40" @@ -105,21 +105,21 @@ namespace etl //*************************************************************************** template class variant_pool { @@ -290,7 +290,7 @@ namespace etl if (p != nullptr) { - new (p) T(ETL_STD::forward(args)...); + new (p) T(etlstd::forward(args)...); } } @@ -305,22 +305,22 @@ namespace etl bool destroy(const T* const p) { ETL_STATIC_ASSERT((etl::is_one_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value || - etl::is_base_of::value), "Invalid type"); + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value || + etlstd::is_base_of::value), "Invalid type"); p->~T(); diff --git a/include/etl/variant_pool_generator.h b/include/etl/variant_pool_generator.h index 47d305e7..d6f785e3 100644 --- a/include/etl/variant_pool_generator.h +++ b/include/etl/variant_pool_generator.h @@ -75,7 +75,7 @@ cog.outl("//******************************************************************** #include "type_lookup.h" #include "pool.h" -#include "stl/utility.h" +#include "utility.h" #undef ETL_FILE #define ETL_FILE "40" @@ -357,7 +357,7 @@ namespace etl if (p != nullptr) { - new (p) T(ETL_STD::forward(args)...); + new (p) T(ETL_OR_STD::forward(args)...); } } @@ -382,8 +382,8 @@ namespace etl cog.outl("T%s>::value ||" % int(NTypes)) for n in range(1, int(NTypes)): - cog.outl(" etl::is_base_of::value ||" % n) - cog.outl(" etl::is_base_of::value), \"Invalid type\");" % int(NTypes)) + cog.outl(" etlstd::is_base_of::value ||" % n) + cog.outl(" etlstd::is_base_of::value), \"Invalid type\");" % int(NTypes)) ]]]*/ /*[[[end]]]*/ diff --git a/include/etl/vector.h b/include/etl/vector.h index 4cc0f656..77d23d8a 100644 --- a/include/etl/vector.h +++ b/include/etl/vector.h @@ -51,9 +51,9 @@ SOFTWARE. #include "debug_count.h" #include "private/vector_base.h" -#include "stl/algorithm.h" -#include "stl/iterator.h" -#include "stl/functional.h" +#include "algorithm.h" +#include "iterator.h" +#include "functional.h" #if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_NO_STL) #include @@ -92,10 +92,10 @@ namespace etl typedef const T* const_pointer; typedef T* iterator; typedef const T* const_iterator; - typedef ETL_STD::reverse_iterator reverse_iterator; - typedef ETL_STD::reverse_iterator const_reverse_iterator; + typedef ETL_OR_STD::reverse_iterator reverse_iterator; + typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef typename ETL_STD::iterator_traits::difference_type difference_type; + typedef typename etlstd::iterator_traits::difference_type difference_type; protected: @@ -365,17 +365,17 @@ namespace etl template void assign(TIterator first, TIterator last) { - ETL_STATIC_ASSERT((etl::is_same::type, typename etl::remove_cv::value_type>::type>::value), "Iterator type does not match container type"); + ETL_STATIC_ASSERT((etlstd::is_same::type, typename etlstd::remove_cv::value_type>::type>::value), "Iterator type does not match container type"); #if defined(ETL_DEBUG) - difference_type d = ETL_STD::distance(first, last); + difference_type d = etlstd::distance(first, last); ETL_ASSERT(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); #endif initialise(); p_end = etl::uninitialized_copy(first, last, p_buffer); - ETL_ADD_DEBUG_COUNT(uint32_t(ETL_STD::distance(first, last))) + ETL_ADD_DEBUG_COUNT(uint32_t(etlstd::distance(first, last))) } //********************************************************************* @@ -426,7 +426,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full)); #endif - create_back(ETL_STD::move(value)); + create_back(etlstd::move(value)); } #endif @@ -442,7 +442,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full)); #endif - ::new (p_end) T(ETL_STD::forward(args)...); + ::new (p_end) T(etlstd::forward(args)...); ++p_end; ETL_INCREMENT_DEBUG_COUNT } @@ -541,7 +541,7 @@ namespace etl else { create_back(back()); - ETL_STD::copy_backward(position, p_end - 2, p_end - 1); + etlstd::copy_backward(position, p_end - 2, p_end - 1); *position = value; } @@ -561,13 +561,13 @@ namespace etl if (position == end()) { - create_back(ETL_STD::move(value)); + create_back(etlstd::move(value)); } else { - create_back(ETL_STD::move(back())); - ETL_STD::move_backward(position, p_end - 2, p_end - 1); - *position = ETL_STD::move(value); + create_back(etlstd::move(back())); + etlstd::move_backward(position, p_end - 2, p_end - 1); + *position = etlstd::move(value); } return position; @@ -594,11 +594,11 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - ETL_STD::copy_backward(position, p_end - 2, p_end - 1); + etlstd::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } - ::new (p) T(ETL_STD::forward(args)...); + ::new (p) T(etlstd::forward(args)...); return position; } @@ -619,7 +619,7 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - ETL_STD::copy_backward(position, p_end - 2, p_end - 1); + etlstd::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } @@ -644,7 +644,7 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - ETL_STD::copy_backward(position, p_end - 2, p_end - 1); + etlstd::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } @@ -669,7 +669,7 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - ETL_STD::copy_backward(position, p_end - 2, p_end - 1); + etlstd::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } @@ -694,7 +694,7 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - ETL_STD::copy_backward(position, p_end - 2, p_end - 1); + etlstd::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } @@ -716,7 +716,7 @@ namespace etl ETL_ASSERT((size() + n) <= CAPACITY, ETL_ERROR(vector_full)); size_t insert_n = n; - size_t insert_begin = ETL_STD::distance(begin(), position); + size_t insert_begin = etlstd::distance(begin(), position); size_t insert_end = insert_begin + insert_n; // Copy old data. @@ -745,14 +745,14 @@ namespace etl ETL_ADD_DEBUG_COUNT(construct_old_n) // Copy old. - ETL_STD::copy_backward(p_buffer + insert_begin, p_buffer + insert_begin + copy_old_n, p_buffer + insert_end + copy_old_n); + etlstd::copy_backward(p_buffer + insert_begin, p_buffer + insert_begin + copy_old_n, p_buffer + insert_end + copy_old_n); // Construct new. etl::uninitialized_fill_n(p_end, construct_new_n, value); ETL_ADD_DEBUG_COUNT(construct_new_n) // Copy new. - ETL_STD::fill_n(p_buffer + insert_begin, copy_new_n, value); + etlstd::fill_n(p_buffer + insert_begin, copy_new_n, value); p_end += n; } @@ -768,12 +768,12 @@ namespace etl template void insert(iterator position, TIterator first, TIterator last) { - size_t count = ETL_STD::distance(first, last); + size_t count = etlstd::distance(first, last); ETL_ASSERT((size() + count) <= CAPACITY, ETL_ERROR(vector_full)); size_t insert_n = count; - size_t insert_begin = ETL_STD::distance(begin(), position); + size_t insert_begin = etlstd::distance(begin(), position); size_t insert_end = insert_begin + insert_n; // Copy old data. @@ -802,7 +802,7 @@ namespace etl ETL_ADD_DEBUG_COUNT(construct_old_n) // Copy old. - ETL_STD::copy_backward(p_buffer + insert_begin, p_buffer + insert_begin + copy_old_n, p_buffer + insert_end + copy_old_n); + etlstd::copy_backward(p_buffer + insert_begin, p_buffer + insert_begin + copy_old_n, p_buffer + insert_end + copy_old_n); // Construct new. etl::uninitialized_copy_n(first + copy_new_n, construct_new_n, p_end); @@ -821,7 +821,7 @@ namespace etl //********************************************************************* iterator erase(iterator i_element) { - ETL_STD::copy(i_element + 1, end(), i_element); + etlstd::copy(i_element + 1, end(), i_element); destroy_back(); return i_element; @@ -843,8 +843,8 @@ namespace etl } else { - ETL_STD::copy(last, end(), first); - size_t n_delete = ETL_STD::distance(first, last); + etlstd::copy(last, end(), first); + size_t n_delete = etlstd::distance(first, last); // Destroy the elements left over at the end. etl::destroy(p_end - n_delete, p_end); @@ -880,7 +880,7 @@ namespace etl iterator itr = rhs.begin(); while (itr != rhs.end()) { - push_back(ETL_STD::move(*itr)); + push_back(etlstd::move(*itr)); ++itr; } @@ -952,7 +952,7 @@ namespace etl void initialise() { etl::destroy(p_buffer, p_end); - ETL_SUBTRACT_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end))) + ETL_SUBTRACT_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) p_end = p_buffer; } @@ -962,7 +962,7 @@ namespace etl //********************************************************************* void initialise_source_external_buffer_after_move() { - ETL_SUBTRACT_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end))) + ETL_SUBTRACT_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) p_end = p_buffer; } @@ -972,7 +972,7 @@ namespace etl //********************************************************************* void initialise_destination_external_buffer_after_move() { - ETL_ADD_DEBUG_COUNT(int32_t(ETL_STD::distance(p_buffer, p_end))) + ETL_ADD_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) } //************************************************************************* @@ -1018,7 +1018,7 @@ namespace etl //********************************************************************* inline void create_back(rvalue_reference value) { - etl::create_copy_at(p_end, ETL_STD::move(value)); + etl::create_copy_at(p_end, etlstd::move(value)); ETL_INCREMENT_DEBUG_COUNT ++p_end; @@ -1065,7 +1065,7 @@ namespace etl template bool operator ==(const etl::ivector& lhs, const etl::ivector& rhs) { - return (lhs.size() == rhs.size()) && ETL_STD::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1091,7 +1091,7 @@ namespace etl template bool operator <(const etl::ivector& lhs, const etl::ivector& rhs) { - return ETL_STD::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //*************************************************************************** @@ -1243,7 +1243,7 @@ namespace etl typename etl::ivector::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -1262,7 +1262,7 @@ namespace etl typename etl::ivector::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -1298,7 +1298,7 @@ namespace etl private: - typename etl::aligned_storage::value>::type buffer; + typename etl::aligned_storage::value>::type buffer; }; //*************************************************************************** @@ -1560,7 +1560,7 @@ namespace etl typename etl::ivector::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -1579,7 +1579,7 @@ namespace etl typename etl::ivector::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(ETL_STD::move(*itr)); + this->push_back(etlstd::move(*itr)); ++itr; } @@ -1600,7 +1600,7 @@ namespace etl private: - typename etl::aligned_storage::value>::type buffer; + typename etl::aligned_storage::value>::type buffer; }; //*************************************************************************** diff --git a/include/etl/wstring.h b/include/etl/wstring.h index ebe0c455..df0ac6d0 100644 --- a/include/etl/wstring.h +++ b/include/etl/wstring.h @@ -192,7 +192,7 @@ namespace etl { ETL_ASSERT(position < size(), ETL_ERROR(string_out_of_bounds)); - length_ = ETL_STD::min(length_, size() - position); + length_ = etlstd::min(length_, size() - position); new_string.assign(buffer + position, buffer + position + length_); } diff --git a/test/codeblocks/ETL.cbp b/test/codeblocks/ETL.cbp index 7221311a..52a08930 100644 --- a/test/codeblocks/ETL.cbp +++ b/test/codeblocks/ETL.cbp @@ -361,7 +361,6 @@ - diff --git a/test/no_stl_test_iterators.h b/test/no_stl_test_iterators.h index 476ed842..49d54c56 100644 --- a/test/no_stl_test_iterators.h +++ b/test/no_stl_test_iterators.h @@ -34,10 +34,10 @@ SOFTWARE. #include "etl/platform.h" #include "etl/iterator.h" -#include "etl/stl/iterator.h" +#include "etl/iterator.h" template -struct non_random_iterator : public etl::iterator +struct non_random_iterator : public etl::iterator { non_random_iterator() : ptr(nullptr) @@ -116,7 +116,7 @@ bool operator !=(const non_random_iterator& lhs, const non_random_iterator } template -struct random_iterator : public etl::iterator +struct random_iterator : public etl::iterator { random_iterator() : ptr(nullptr) diff --git a/test/test_algorithm.cpp b/test/test_algorithm.cpp index d0301308..e73fc4fb 100644 --- a/test/test_algorithm.cpp +++ b/test/test_algorithm.cpp @@ -88,7 +88,7 @@ namespace TEST(minmax_element) { ETL_PAIR expected = std::minmax_element(data.begin(), data.end()); - ETL_PAIR result = etl::minmax_element(data.begin(), data.end()); + ETL_PAIR result = etlstd::minmax_element(data.begin(), data.end()); CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); } @@ -97,7 +97,7 @@ namespace TEST(minmax_element_compare) { ETL_PAIR expected = std::minmax_element(data.begin(), data.end(), std::greater()); - ETL_PAIR result = etl::minmax_element(data.begin(), data.end(), std::greater()); + ETL_PAIR result = etlstd::minmax_element(data.begin(), data.end(), std::greater()); CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); } @@ -109,11 +109,11 @@ namespace int b = 2; ETL_PAIR expected = std::minmax(a, b); - ETL_PAIR result = etl::minmax(a, b); + ETL_PAIR result = etlstd::minmax(a, b); CHECK_EQUAL(expected.first, result.first); CHECK_EQUAL(expected.second, result.second); - result = etl::minmax(b, a); + result = etlstd::minmax(b, a); expected = std::minmax(b, a); CHECK_EQUAL(expected.first, result.first); CHECK_EQUAL(expected.second, result.second); @@ -126,11 +126,11 @@ namespace int b = 2; ETL_PAIR expected = std::minmax(a, b, std::greater()); - ETL_PAIR result = etl::minmax(a, b, std::greater()); + ETL_PAIR result = etlstd::minmax(a, b, std::greater()); CHECK_EQUAL(expected.first, result.first); CHECK_EQUAL(expected.second, result.second); - result = etl::minmax(b, a, std::greater()); + result = etlstd::minmax(b, a, std::greater()); expected = std::minmax(b, a, std::greater()); CHECK_EQUAL(expected.first, result.first); CHECK_EQUAL(expected.second, result.second); @@ -142,7 +142,7 @@ namespace int data[] = { 1, 2, 3, 4, 6, 5, 7, 8, 9, 10 }; int* p1 = std::is_sorted_until(std::begin(data), std::end(data)); - int* p2 = etl::is_sorted_until(std::begin(data), std::end(data)); + int* p2 = etlstd::is_sorted_until(std::begin(data), std::end(data)); CHECK_EQUAL(std::distance(std::begin(data), p1), std::distance(std::begin(data), p2)); } @@ -152,7 +152,7 @@ namespace int data[] = { 10, 9, 8, 7, 5, 6, 4, 3, 4, 2, 1 }; int* p1 = std::is_sorted_until(std::begin(data), std::end(data), std::greater()); - int* p2 = etl::is_sorted_until(std::begin(data), std::end(data), std::greater()); + int* p2 = etlstd::is_sorted_until(std::begin(data), std::end(data), std::greater()); CHECK_EQUAL(std::distance(etl::begin(data), p1), std::distance(std::begin(data), p2)); } @@ -161,12 +161,12 @@ namespace { int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - bool is_sorted = etl::is_sorted(std::begin(data1), std::end(data1)); + bool is_sorted = etlstd::is_sorted(std::begin(data1), std::end(data1)); CHECK(is_sorted); int data2[] = { 1, 2, 3, 4, 6, 5, 7, 8 , 9, 10}; - is_sorted = etl::is_sorted(std::begin(data2), std::end(data2)); + is_sorted = etlstd::is_sorted(std::begin(data2), std::end(data2)); CHECK(!is_sorted); } @@ -175,12 +175,12 @@ namespace { int data1[] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; - bool is_sorted = etl::is_sorted(std::begin(data1), std::end(data1), std::greater()); + bool is_sorted = etlstd::is_sorted(std::begin(data1), std::end(data1), std::greater()); CHECK(is_sorted); int data2[] = { 10, 9, 8, 7, 5, 6, 4, 3, 2, 1 }; - is_sorted = etl::is_sorted(std::begin(data2), std::end(data2), std::greater()); + is_sorted = etlstd::is_sorted(std::begin(data2), std::end(data2), std::greater()); CHECK(!is_sorted); } @@ -268,7 +268,7 @@ namespace int* result; std::copy_n(std::begin(data1), 4, std::begin(data2)); - result = etl::copy_n(std::begin(data1), 4, std::begin(data3)); + result = etlstd::copy_n(std::begin(data1), 4, std::begin(data3)); CHECK_EQUAL(std::begin(data3) + 4, result); @@ -286,7 +286,7 @@ namespace int* result; std::copy_n(std::begin(data1), 4, std::begin(data2)); - result = etl::copy_n(std::begin(data1), 4, std::begin(data3)); + result = etlstd::copy_n(std::begin(data1), 4, std::begin(data3)); CHECK_EQUAL(std::begin(data3) + 4, result); @@ -375,7 +375,7 @@ namespace // Copy everything less than 5. std::copy_if(std::begin(data1), std::end(data1), std::begin(data2), std::bind(std::less(), std::placeholders::_1, 5)); - etl::copy_if(std::begin(data1), std::end(data1), std::begin(data3), std::bind(std::less(), std::placeholders::_1, 5)); + etlstd::copy_if(std::begin(data1), std::end(data1), std::begin(data3), std::bind(std::less(), std::placeholders::_1, 5)); bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); CHECK(is_same); @@ -446,11 +446,11 @@ namespace int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; bool expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - bool result = etl::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + bool result = etlstd::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); CHECK_EQUAL(expected, result); expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - result = etl::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + result = etlstd::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); CHECK_EQUAL(expected, result); } @@ -460,11 +460,11 @@ namespace int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; bool expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - bool result = etl::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + bool result = etlstd::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); CHECK_EQUAL(expected, result); expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - result = etl::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + result = etlstd::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); CHECK_EQUAL(expected, result); } @@ -474,11 +474,11 @@ namespace int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; bool expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); - bool result = etl::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); + bool result = etlstd::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); CHECK_EQUAL(expected, result); expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - result = etl::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + result = etlstd::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); CHECK_EQUAL(expected, result); } @@ -497,28 +497,28 @@ namespace int permutation[] = { 1, 3, 2, 4, 7, 6, 5, 8 }; int not_permutation[] = { 1, 2, 3, 4, 5, 6, 7, 7 }; - bool is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation)); + bool is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation)); CHECK(is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation)); + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation)); CHECK(!is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::equal_to()); + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::equal_to()); CHECK(is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::equal_to()); + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::equal_to()); CHECK(!is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation)); + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation)); CHECK(is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation)); + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation)); CHECK(!is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation), std::equal_to()); + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation), std::equal_to()); CHECK(is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation), std::equal_to()); + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation), std::equal_to()); CHECK(!is_permutation); } @@ -528,13 +528,13 @@ namespace int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; bool expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - bool result = etl::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + bool result = etlstd::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); CHECK_EQUAL(expected, result); std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - result = etl::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + result = etlstd::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); CHECK_EQUAL(expected, result); } @@ -546,13 +546,13 @@ namespace std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); int* partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - int* partition2 = etl::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + int* partition2 = etlstd::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - partition2 = etl::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + partition2 = etlstd::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); } @@ -566,7 +566,7 @@ namespace int data5[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; std::partition_copy(std::begin(data1), std::end(data1), std::begin(data2), std::begin(data3), std::bind(std::greater(), std::placeholders::_1, 4)); - etl::partition_copy(std::begin(data1), std::end(data1), std::begin(data4), std::begin(data5), std::bind(std::greater(), std::placeholders::_1, 4)); + etlstd::partition_copy(std::begin(data1), std::end(data1), std::begin(data4), std::begin(data5), std::bind(std::greater(), std::placeholders::_1, 4)); bool are_equal; @@ -583,7 +583,7 @@ namespace int data1[] = { 1, 2, 3, 5, 6, 7, 8 }; // Find the element not less than 4. - int* p = etl::find_if_not(std::begin(data1), std::end(data1), std::bind(std::less(), std::placeholders::_1, 4)); + int* p = etlstd::find_if_not(std::begin(data1), std::end(data1), std::bind(std::less(), std::placeholders::_1, 4)); CHECK_EQUAL(5, *p); } @@ -693,7 +693,7 @@ namespace int compare[] = { 2, 16, 4, 14, 6, 0, 0, 0, 0, 0 }; // Double everything and copy to output. - etl::transform(std::begin(input), + etlstd::transform(std::begin(input), std::end(input), std::begin(output), std::begin(output) + (etl::size(output) / 2), @@ -704,7 +704,7 @@ namespace std::fill(std::begin(output), std::end(output), 0); - etl::transform(std::begin(input), + etlstd::transform(std::begin(input), std::begin(input) + (etl::size(input) / 2), std::begin(output), std::end(output), diff --git a/test/test_alignment.cpp b/test/test_alignment.cpp index 7a03a248..3d069a1e 100644 --- a/test/test_alignment.cpp +++ b/test/test_alignment.cpp @@ -50,10 +50,10 @@ namespace size_t alignment; size_t expected; - typedef etl::aligned_storage::value>::type storage32_t; + typedef etl::aligned_storage::value>::type storage32_t; static storage32_t data32[10]; - alignment = etl::alignment_of::value; + alignment = etlstd::alignment_of::value; expected = std::alignment_of::value; CHECK_EQUAL(expected, alignment); @@ -70,7 +70,7 @@ namespace //************************************************************************* TEST(test_aligned_storage_conversion_operators) { - typedef etl::aligned_storage::value>::type storage32_t; + typedef etl::aligned_storage::value>::type storage32_t; static storage32_t data; void* pdata = &data.data; @@ -105,7 +105,7 @@ namespace typedef etl::aligned_storage_as::type storage32_t; static storage32_t data32[10]; - alignment = etl::alignment_of::value; + alignment = etlstd::alignment_of::value; expected = std::alignment_of::value; CHECK_EQUAL(expected, alignment); diff --git a/test/test_binary.cpp b/test/test_binary.cpp index 6c11fcfe..304ca419 100644 --- a/test/test_binary.cpp +++ b/test/test_binary.cpp @@ -939,71 +939,71 @@ namespace CHECK_EQUAL(18446744073709551615U, etl::max_value_for_nbits<64>::value); // Check that the value types are correct. - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); - CHECK((std::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); + CHECK((etlstd::is_same::value_type>::value)); } //************************************************************************* diff --git a/test/test_constant.cpp b/test/test_constant.cpp index 4f18979d..6ce02f35 100644 --- a/test/test_constant.cpp +++ b/test/test_constant.cpp @@ -51,15 +51,15 @@ namespace CHECK_EQUAL((char)etl::integral_limits::max, c1.value); CHECK_EQUAL((char)etl::integral_limits::max, C1::value); - CHECK((std::is_same::value)); + CHECK((etlstd::is_same::value)); CHECK_EQUAL((uint32_t)etl::integral_limits::max, c2.value); CHECK_EQUAL((uint32_t)etl::integral_limits::max, C2::value); - CHECK((std::is_same::value)); + CHECK((etlstd::is_same::value)); CHECK_EQUAL((int64_t)etl::integral_limits::max, c3.value); CHECK_EQUAL((int64_t)etl::integral_limits::max, C3::value); - CHECK((std::is_same::value)); + CHECK((etlstd::is_same::value)); } }; } diff --git a/test/test_iterator.cpp b/test/test_iterator.cpp index 59f652e8..0c3d6492 100644 --- a/test/test_iterator.cpp +++ b/test/test_iterator.cpp @@ -32,27 +32,27 @@ SOFTWARE. namespace { - struct input : public etl::iterator + struct input : public etl::iterator { }; - struct output : public etl::iterator + struct output : public etl::iterator { }; - struct forward : public etl::iterator + struct forward : public etl::iterator { }; - struct bidirectional : public etl::iterator + struct bidirectional : public etl::iterator { }; - struct random : public etl::iterator + struct random : public etl::iterator { }; diff --git a/test/test_largest.cpp b/test/test_largest.cpp index 932015f6..f9638bae 100644 --- a/test/test_largest.cpp +++ b/test/test_largest.cpp @@ -43,13 +43,13 @@ namespace bool type; size = etl::largest_type::size; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK_EQUAL(sizeof(int), size); CHECK(type); size = etl::largest_type::size; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK_EQUAL(sizeof(int), size); CHECK(type); @@ -66,13 +66,13 @@ namespace struct S3 { int a; short b; char c; }; size = etl::largest_type::size; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK_EQUAL(sizeof(S3), size); CHECK(type); size = etl::largest_type::size; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK_EQUAL(sizeof(S3), size); CHECK(type); @@ -101,43 +101,43 @@ namespace //************************************************************************* TEST(test_larger_int_type) { - CHECK(bool(std::is_same::type, int16_t>::value)); - CHECK(bool(std::is_same::type, int32_t>::value)); - CHECK(bool(std::is_same::type, int64_t>::value)); - CHECK(bool(std::is_same::type, int64_t>::value)); + CHECK(bool(etlstd::is_same::type, int16_t>::value)); + CHECK(bool(etlstd::is_same::type, int32_t>::value)); + CHECK(bool(etlstd::is_same::type, int64_t>::value)); + CHECK(bool(etlstd::is_same::type, int64_t>::value)); - CHECK(bool(std::is_same::type, int16_t>::value)); - CHECK(bool(std::is_same::type, int32_t>::value)); - CHECK(bool(std::is_same::type, int64_t>::value)); - CHECK(bool(std::is_same::type, int64_t>::value)); + CHECK(bool(etlstd::is_same::type, int16_t>::value)); + CHECK(bool(etlstd::is_same::type, int32_t>::value)); + CHECK(bool(etlstd::is_same::type, int64_t>::value)); + CHECK(bool(etlstd::is_same::type, int64_t>::value)); } //************************************************************************* TEST(test_larger_uint_type) { - CHECK(bool(std::is_same::type, uint16_t>::value)); - CHECK(bool(std::is_same::type, uint32_t>::value)); - CHECK(bool(std::is_same::type, uint64_t>::value)); - CHECK(bool(std::is_same::type, uint64_t>::value)); + CHECK(bool(etlstd::is_same::type, uint16_t>::value)); + CHECK(bool(etlstd::is_same::type, uint32_t>::value)); + CHECK(bool(etlstd::is_same::type, uint64_t>::value)); + CHECK(bool(etlstd::is_same::type, uint64_t>::value)); - CHECK(bool(std::is_same::type, uint16_t>::value)); - CHECK(bool(std::is_same::type, uint32_t>::value)); - CHECK(bool(std::is_same::type, uint64_t>::value)); - CHECK(bool(std::is_same::type, uint64_t>::value)); + CHECK(bool(etlstd::is_same::type, uint16_t>::value)); + CHECK(bool(etlstd::is_same::type, uint32_t>::value)); + CHECK(bool(etlstd::is_same::type, uint64_t>::value)); + CHECK(bool(etlstd::is_same::type, uint64_t>::value)); } //************************************************************************* TEST(test_larger_type) { - CHECK(bool(std::is_same::type, int16_t>::value)); - CHECK(bool(std::is_same::type, int32_t>::value)); - CHECK(bool(std::is_same::type, int64_t>::value)); - CHECK(bool(std::is_same::type, int64_t>::value)); + CHECK(bool(etlstd::is_same::type, int16_t>::value)); + CHECK(bool(etlstd::is_same::type, int32_t>::value)); + CHECK(bool(etlstd::is_same::type, int64_t>::value)); + CHECK(bool(etlstd::is_same::type, int64_t>::value)); - CHECK(bool(std::is_same::type, uint16_t>::value)); - CHECK(bool(std::is_same::type, uint32_t>::value)); - CHECK(bool(std::is_same::type, uint64_t>::value)); - CHECK(bool(std::is_same::type, uint64_t>::value)); + CHECK(bool(etlstd::is_same::type, uint16_t>::value)); + CHECK(bool(etlstd::is_same::type, uint32_t>::value)); + CHECK(bool(etlstd::is_same::type, uint64_t>::value)); + CHECK(bool(etlstd::is_same::type, uint64_t>::value)); } }; } diff --git a/test/test_no_stl_algorithm.cpp b/test/test_no_stl_algorithm.cpp index e9a1ae89..0bf610c2 100644 --- a/test/test_no_stl_algorithm.cpp +++ b/test/test_no_stl_algorithm.cpp @@ -31,8 +31,7 @@ SOFTWARE. #undef min #undef max -#include "etl/stl/algorithm.h" -#include "etl/stl/alternate/algorithm.h" +#include "etl/algorithm.h" #include #include @@ -520,7 +519,7 @@ namespace int a = 1; int b = 2; - etlstd::swap(a, b); + swap(a, b); CHECK_EQUAL(2, a); CHECK_EQUAL(1, b); } @@ -765,6 +764,26 @@ namespace CHECK(isEqual); } + //************************************************************************* + TEST(transform_safer) + { + struct Function + { + int operator()(int d) const + { + return d * 2; + } + }; + + int* p1 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataD1), Function()); + int* p2 = etl::transform(std::begin(dataS), std::end(dataS), std::begin(dataD2), std::end(dataD2), Function()); + + CHECK(p2 == std::end(dataD2)); + + bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2)); + CHECK(isEqual); + } + //************************************************************************* TEST(transform2) { @@ -777,7 +796,7 @@ namespace }; int* p1 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataA), std::begin(dataD1), Function()); - int* p2 = etlstd::transform(std::begin(dataS), std::end(dataS), std::begin(dataA), std::begin(dataD2), Function()); + int* p2 = etl::transform(std::begin(dataS), std::end(dataS), std::begin(dataA), std::begin(dataD2), Function()); CHECK(p2 == std::end(dataD2)); diff --git a/test/test_no_stl_functional.cpp b/test/test_no_stl_functional.cpp index 8925f732..b7bbe998 100644 --- a/test/test_no_stl_functional.cpp +++ b/test/test_no_stl_functional.cpp @@ -31,8 +31,7 @@ SOFTWARE. #undef min #undef max -#include "etl/stl/functional.h" -#include "etl/stl/alternate/functional.h" +#include "etl/functional.h" namespace { @@ -42,7 +41,7 @@ namespace return TCompare()(a, b); } - struct test : etlstd::binary_function + struct test : etl::binary_function { bool operator()(int a, int b) const { @@ -63,25 +62,25 @@ namespace //************************************************************************* TEST(test_greater) { - CHECK(!(compare>(1, 2))); - CHECK((compare>(2, 1))); - CHECK(!(compare>(1, 1))); + CHECK(!(compare>(1, 2))); + CHECK((compare>(2, 1))); + CHECK(!(compare>(1, 1))); } //************************************************************************* TEST(test_equal_to) { - CHECK((compare>(1, 1))); - CHECK(!(compare>(1, 2))); - CHECK(!(compare>(2, 1))); + CHECK((compare>(1, 1))); + CHECK(!(compare>(1, 2))); + CHECK(!(compare>(2, 1))); } //************************************************************************* TEST(test_not_equal_to) { - CHECK(!(compare>(1, 1))); - CHECK((compare>(1, 2))); - CHECK((compare>(2, 1))); + CHECK(!(compare>(1, 1))); + CHECK((compare>(1, 2))); + CHECK((compare>(2, 1))); } //************************************************************************* @@ -94,8 +93,8 @@ namespace //************************************************************************* TEST(test_bind2nd) { - CHECK(!(etlstd::bind2nd(test(), 1)(2))); - CHECK((etlstd::bind2nd(test(), 2)(1))); + CHECK(!(etl::bind2nd(test(), 1)(2))); + CHECK((etl::bind2nd(test(), 2)(1))); } }; } diff --git a/test/test_no_stl_iterator.cpp b/test/test_no_stl_iterator.cpp index b96d1f0b..8c209de5 100644 --- a/test/test_no_stl_iterator.cpp +++ b/test/test_no_stl_iterator.cpp @@ -31,8 +31,7 @@ SOFTWARE. #undef min #undef max -#include "etl/stl/iterator.h" -#include "etl/stl/alternate/iterator.h" +#include "etl/iterator.h" #include #include @@ -71,11 +70,11 @@ namespace non_random_iterator itr2 = std::begin(dataA); std::advance(itr1, 4); - etlstd::advance(itr2, 4); + etl::advance(itr2, 4); CHECK_EQUAL(*itr1, *itr2); std::advance(itr1, -3); - etlstd::advance(itr2, -3); + etl::advance(itr2, -3); CHECK_EQUAL(*itr1, *itr2); } @@ -86,11 +85,11 @@ namespace random_iterator itr2 = std::begin(dataA); std::advance(itr1, 4); - etlstd::advance(itr2, 4); + etl::advance(itr2, 4); CHECK_EQUAL(*itr1, *itr2); std::advance(itr1, -3); - etlstd::advance(itr2, -3); + etl::advance(itr2, -3); CHECK_EQUAL(*itr1, *itr2); } @@ -105,7 +104,7 @@ namespace for (size_t i = 1; i <= length; ++i) { - CHECK_EQUAL(data[length - i], *etlstd::prev(itr, i)); + CHECK_EQUAL(data[length - i], *etl::prev(itr, i)); } } @@ -120,7 +119,7 @@ namespace for (size_t i = 1; i <= length; ++i) { - CHECK_EQUAL(data[i], *etlstd::next(itr, i)); + CHECK_EQUAL(data[i], *etl::next(itr, i)); } } @@ -130,34 +129,34 @@ namespace int data[] = { 1, 2, 3, 4, 5, 6, 7 }; std::reverse_iterator sri(&data[7]); - etlstd::reverse_iterator eri(&data[7]); + etl::reverse_iterator eri(&data[7]); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); - CHECK(etlstd::reverse_iterator(&data[5]) < eri); - CHECK(etlstd::reverse_iterator(&data[3]) > eri); - CHECK(etlstd::reverse_iterator(&data[4]) <= eri); - CHECK(etlstd::reverse_iterator(&data[5]) <= eri); - CHECK(etlstd::reverse_iterator(&data[4]) >= eri); - CHECK(etlstd::reverse_iterator(&data[3]) >= eri); + CHECK(etl::reverse_iterator(&data[5]) < eri); + CHECK(etl::reverse_iterator(&data[3]) > eri); + CHECK(etl::reverse_iterator(&data[4]) <= eri); + CHECK(etl::reverse_iterator(&data[5]) <= eri); + CHECK(etl::reverse_iterator(&data[4]) >= eri); + CHECK(etl::reverse_iterator(&data[3]) >= eri); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri, *eri); - CHECK(etlstd::reverse_iterator(&data[1]) == eri); - CHECK(etlstd::reverse_iterator(&data[2]) != eri); - CHECK(etlstd::reverse_iterator(&data[3]) != eri); - CHECK(etlstd::reverse_iterator(&data[4]) != eri); - CHECK(etlstd::reverse_iterator(&data[5]) != eri); - CHECK(etlstd::reverse_iterator(&data[6]) != eri); - CHECK(etlstd::reverse_iterator(&data[7]) != eri); + CHECK(etl::reverse_iterator(&data[1]) == eri); + CHECK(etl::reverse_iterator(&data[2]) != eri); + CHECK(etl::reverse_iterator(&data[3]) != eri); + CHECK(etl::reverse_iterator(&data[4]) != eri); + CHECK(etl::reverse_iterator(&data[5]) != eri); + CHECK(etl::reverse_iterator(&data[6]) != eri); + CHECK(etl::reverse_iterator(&data[7]) != eri); sri = std::reverse_iterator(&data[7]); - eri = etlstd::reverse_iterator(&data[7]); + eri = etl::reverse_iterator(&data[7]); CHECK_EQUAL(sri[0], eri[0]); CHECK_EQUAL(sri[1], eri[1]); CHECK_EQUAL(sri[2], eri[2]); @@ -175,7 +174,7 @@ namespace CHECK_EQUAL(*sri, *eri); std::reverse_iterator sri2 = sri + 3; - etlstd::reverse_iterator eri2 = eri + 3; + etl::reverse_iterator eri2 = eri + 3; CHECK_EQUAL(*sri, *eri); sri2 = sri - 3; @@ -189,34 +188,34 @@ namespace const int data[] = { 1, 2, 3, 4, 5, 6, 7 }; std::reverse_iterator sri(&data[7]); - etlstd::reverse_iterator eri(&data[7]); + etl::reverse_iterator eri(&data[7]); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); - CHECK(etlstd::reverse_iterator(&data[5]) < eri); - CHECK(etlstd::reverse_iterator(&data[3]) > eri); - CHECK(etlstd::reverse_iterator(&data[4]) <= eri); - CHECK(etlstd::reverse_iterator(&data[5]) <= eri); - CHECK(etlstd::reverse_iterator(&data[4]) >= eri); - CHECK(etlstd::reverse_iterator(&data[3]) >= eri); + CHECK(etl::reverse_iterator(&data[5]) < eri); + CHECK(etl::reverse_iterator(&data[3]) > eri); + CHECK(etl::reverse_iterator(&data[4]) <= eri); + CHECK(etl::reverse_iterator(&data[5]) <= eri); + CHECK(etl::reverse_iterator(&data[4]) >= eri); + CHECK(etl::reverse_iterator(&data[3]) >= eri); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri, *eri); - CHECK(etlstd::reverse_iterator(&data[1]) == eri); - CHECK(etlstd::reverse_iterator(&data[2]) != eri); - CHECK(etlstd::reverse_iterator(&data[3]) != eri); - CHECK(etlstd::reverse_iterator(&data[4]) != eri); - CHECK(etlstd::reverse_iterator(&data[5]) != eri); - CHECK(etlstd::reverse_iterator(&data[6]) != eri); - CHECK(etlstd::reverse_iterator(&data[7]) != eri); + CHECK(etl::reverse_iterator(&data[1]) == eri); + CHECK(etl::reverse_iterator(&data[2]) != eri); + CHECK(etl::reverse_iterator(&data[3]) != eri); + CHECK(etl::reverse_iterator(&data[4]) != eri); + CHECK(etl::reverse_iterator(&data[5]) != eri); + CHECK(etl::reverse_iterator(&data[6]) != eri); + CHECK(etl::reverse_iterator(&data[7]) != eri); sri = std::reverse_iterator(&data[7]); - eri = etlstd::reverse_iterator(&data[7]); + eri = etl::reverse_iterator(&data[7]); CHECK_EQUAL(sri[0], eri[0]); CHECK_EQUAL(sri[1], eri[1]); CHECK_EQUAL(sri[2], eri[2]); @@ -242,7 +241,7 @@ namespace CHECK_EQUAL(*sri, *eri); std::reverse_iterator sri2 = sri + 3; - etlstd::reverse_iterator eri2 = eri + 3; + etl::reverse_iterator eri2 = eri + 3; CHECK_EQUAL(*sri, *eri); sri2 = sri - 3; diff --git a/test/test_no_stl_limits.cpp b/test/test_no_stl_limits.cpp index 21df7ce4..4924024f 100644 --- a/test/test_no_stl_limits.cpp +++ b/test/test_no_stl_limits.cpp @@ -28,8 +28,7 @@ SOFTWARE. #include "UnitTest++.h" -#include "etl/stl/alternate/limits.h" - +#include "etl/limits.h" #include namespace @@ -39,724 +38,724 @@ namespace //************************************************************************* TEST(test_bool) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(STD::is_modulo, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_char) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_unsigned_char) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(true, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_signed_char) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_char16_t) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_char32_t) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_wchar_t) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(STD::is_modulo, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_short) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_unsigned_short) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(true, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_int) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_unsigned_int) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(true, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_long) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_unsigned_long) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(true, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_long_long) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_unsigned_long_long) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(STD::has_denorm_loss, ETL::has_denorm_loss); - CHECK_EQUAL(STD::has_infinity, ETL::has_infinity); - CHECK_EQUAL(STD::has_quiet_NaN, ETL::has_quiet_NaN); - CHECK_EQUAL(STD::has_signaling_NaN, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::infinity(), ETL::infinity()); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(true, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - CHECK_EQUAL(STD::tinyness_before, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_float) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(true, ETL::has_denorm_loss); - CHECK_EQUAL(false, ETL::has_infinity); - CHECK_EQUAL(false, ETL::has_quiet_NaN); - CHECK_EQUAL(false, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(true, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(true, ETL_NL::has_denorm_loss); + CHECK_EQUAL(false, ETL_NL::has_infinity); + CHECK_EQUAL(false, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(false, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(true, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); - // CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - // CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - // CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - // CHECK_EQUAL(STD::infinity(), ETL::infinity()); + // CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + // CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + // CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + // CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); } //************************************************************************* TEST(test_double) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(true, ETL::has_denorm_loss); - CHECK_EQUAL(false, ETL::has_infinity); - CHECK_EQUAL(false, ETL::has_quiet_NaN); - CHECK_EQUAL(false, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(true, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(true, ETL_NL::has_denorm_loss); + CHECK_EQUAL(false, ETL_NL::has_infinity); + CHECK_EQUAL(false, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(false, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(true, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); - // CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - // CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - // CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - // CHECK_EQUAL(STD::infinity(), ETL::infinity()); + // CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + // CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + // CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + // CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); } //************************************************************************* TEST(test_long_double) { - typedef etlstd::numeric_limits ETL; - typedef std::numeric_limits STD; + typedef etlstd::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD::digits, ETL::digits); - CHECK_EQUAL(STD::digits10, ETL::digits10); - CHECK_EQUAL(STD::epsilon(), ETL::epsilon()); - CHECK_EQUAL(int(STD::has_denorm), int(ETL::has_denorm)); - CHECK_EQUAL(true, ETL::has_denorm_loss); - CHECK_EQUAL(false, ETL::has_infinity); - CHECK_EQUAL(false, ETL::has_quiet_NaN); - CHECK_EQUAL(false, ETL::has_signaling_NaN); - CHECK_EQUAL(STD::is_bounded, ETL::is_bounded); - CHECK_EQUAL(STD::is_exact, ETL::is_exact); - CHECK_EQUAL(STD::is_iec559, ETL::is_iec559); - CHECK_EQUAL(STD::is_integer, ETL::is_integer); - CHECK_EQUAL(false, ETL::is_modulo); - CHECK_EQUAL(STD::is_signed, ETL::is_signed); - CHECK_EQUAL(STD::is_specialized, ETL::is_specialized); - CHECK_EQUAL(STD::lowest(), ETL::lowest()); - CHECK_EQUAL(STD::max(), ETL::max()); - CHECK_EQUAL(STD::max_digits10, ETL::max_digits10); - CHECK_EQUAL(STD::max_exponent, ETL::max_exponent); - CHECK_EQUAL(STD::max_exponent10, ETL::max_exponent10); - CHECK_EQUAL(STD::min(), ETL::min()); - CHECK_EQUAL(STD::min_exponent, ETL::min_exponent); - CHECK_EQUAL(STD::min_exponent10, ETL::min_exponent10); - CHECK_EQUAL(STD::radix, ETL::radix); - CHECK_EQUAL(STD::round_error(), ETL::round_error()); - CHECK_EQUAL(int(STD::round_style), int(ETL::round_style)); - CHECK_EQUAL(true, ETL::tinyness_before); - CHECK_EQUAL(false, ETL::traps); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(true, ETL_NL::has_denorm_loss); + CHECK_EQUAL(false, ETL_NL::has_infinity); + CHECK_EQUAL(false, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(false, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(true, ETL_NL::tinyness_before); + CHECK_EQUAL(false, ETL_NL::traps); - // CHECK_EQUAL(STD::denorm_min(), ETL::denorm_min()); - // CHECK_EQUAL(STD::signaling_NaN(), ETL::signaling_NaN()); - // CHECK_EQUAL(STD::quiet_NaN(), ETL::quiet_NaN()); - // CHECK_EQUAL(STD::infinity(), ETL::infinity()); + // CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + // CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + // CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + // CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); } }; } diff --git a/test/test_no_stl_utility.cpp b/test/test_no_stl_utility.cpp index d4d10d67..00d30a9a 100644 --- a/test/test_no_stl_utility.cpp +++ b/test/test_no_stl_utility.cpp @@ -31,7 +31,7 @@ SOFTWARE. #undef min #undef max -#include "etl/stl/alternate/utility.h" +#include "etl/utility.h" namespace { @@ -40,7 +40,7 @@ namespace //************************************************************************* TEST(pair_default_construct) { - etlstd::pair p1; + etl::pair p1; CHECK_EQUAL(int(), p1.first); CHECK_EQUAL(double(), p1.second); @@ -49,7 +49,7 @@ namespace //************************************************************************* TEST(test_pair_construct) { - etlstd::pair p1(1, 2.3); + etl::pair p1(1, 2.3); CHECK_EQUAL(1, p1.first); CHECK_EQUAL(2.3, p1.second); @@ -58,8 +58,8 @@ namespace //************************************************************************* TEST(test_pair_copy_construct) { - etlstd::pair p1(1, 2.3); - etlstd::pair p2(p1); + etl::pair p1(1, 2.3); + etl::pair p2(p1); CHECK_EQUAL(p1.first, p2.first); CHECK_EQUAL(p1.second, p2.second); @@ -68,8 +68,8 @@ namespace //************************************************************************* TEST(test_pair_copy_construct_alternate) { - etlstd::pair p1(1, 2.3f); - etlstd::pair p2(p1); + etl::pair p1(1, 2.3f); + etl::pair p2(p1); CHECK_EQUAL(p1.first, p2.first); CHECK_EQUAL(p1.second, p2.second); @@ -78,9 +78,9 @@ namespace //************************************************************************* TEST(test_make_pair) { - etlstd::pair p1(1, 2.3); - etlstd::pair p2; - p2 = etlstd::make_pair(1, 2.3); + etl::pair p1(1, 2.3); + etl::pair p2; + p2 = etl::make_pair(1, 2.3); CHECK_EQUAL(p1.first, p2.first); CHECK_EQUAL(p1.second, p2.second); @@ -89,8 +89,8 @@ namespace //************************************************************************* TEST(test_pair_swap_member) { - etlstd::pair p1(1, 2.3); - etlstd::pair p2(2, 3.4); + etl::pair p1(1, 2.3); + etl::pair p2(2, 3.4); p1.swap(p2); @@ -104,10 +104,10 @@ namespace //************************************************************************* TEST(test_pair_swap_global) { - etlstd::pair p1(1, 2.3); - etlstd::pair p2(2, 3.4); + etl::pair p1(1, 2.3); + etl::pair p2(2, 3.4); - etlstd::swap(p1, p2); + swap(p1, p2); CHECK_EQUAL(2, p1.first); CHECK_EQUAL(3.4, p1.second); @@ -119,9 +119,9 @@ namespace //************************************************************************* TEST(test_pair_conditional) { - etlstd::pair p1(1, 2.3); - etlstd::pair p2(1, 2.3); - etlstd::pair p3(2, 3.4); + etl::pair p1(1, 2.3); + etl::pair p2(1, 2.3); + etl::pair p3(2, 3.4); CHECK(p1 == p2); CHECK(!(p1 == p3)); diff --git a/test/test_parameter_type.cpp b/test/test_parameter_type.cpp index f4c445ae..d71b853a 100644 --- a/test/test_parameter_type.cpp +++ b/test/test_parameter_type.cpp @@ -77,13 +77,13 @@ namespace { bool b; - b = !etl::is_reference::type>::value; + b = !etlstd::is_reference::type>::value; CHECK(b); - b = etl::is_reference::type>::value; + b = etlstd::is_reference::type>::value; CHECK(b); - b = !etl::is_reference::type>::value; + b = !etlstd::is_reference::type>::value; CHECK(b); } }; diff --git a/test/test_priority_queue.cpp b/test/test_priority_queue.cpp index cd988643..690c47cf 100644 --- a/test/test_priority_queue.cpp +++ b/test/test_priority_queue.cpp @@ -455,8 +455,8 @@ namespace etl::priority_queue priority_queue2; - etl::ipriority_queue, ETL_STD::less>& ipriority_queue1 = priority_queue1; - etl::ipriority_queue, ETL_STD::less>& ipriority_queue2 = priority_queue2; + etl::ipriority_queue, std::less>& ipriority_queue1 = priority_queue1; + etl::ipriority_queue, std::less>& ipriority_queue2 = priority_queue2; ipriority_queue2 = ipriority_queue1; diff --git a/test/test_smallest.cpp b/test/test_smallest.cpp index aa27cd45..b7a2837d 100644 --- a/test/test_smallest.cpp +++ b/test/test_smallest.cpp @@ -33,7 +33,7 @@ SOFTWARE. #include namespace -{ +{ SUITE(test_smallst) { //************************************************************************* @@ -43,13 +43,13 @@ namespace bool type; size = etl::smallest_type::size; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK_EQUAL(sizeof(char), size); CHECK(type); size = etl::smallest_type::size; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK_EQUAL(sizeof(char), size); CHECK(type); @@ -66,13 +66,13 @@ namespace struct S3 { int a; short b; char c; }; size = etl::smallest_type::size; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK_EQUAL(sizeof(S1), size); CHECK(type); size = etl::smallest_type::size; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK_EQUAL(sizeof(S1), size); CHECK(type); @@ -83,40 +83,40 @@ namespace { bool type; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); } @@ -125,40 +125,40 @@ namespace { bool type; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); } @@ -167,28 +167,28 @@ namespace { bool type; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); } @@ -197,49 +197,49 @@ namespace { bool type; - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); - type = std::is_same::type>::value; + type = etlstd::is_same::type>::value; CHECK(type); } }; diff --git a/test/test_type_lookup.cpp b/test/test_type_lookup.cpp index 1d6a2015..fdad5378 100644 --- a/test/test_type_lookup.cpp +++ b/test/test_type_lookup.cpp @@ -117,41 +117,41 @@ namespace //************************************************************************* TEST(test_type_from_id_16) { - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); } //************************************************************************* TEST(test_type_from_id_8) { - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); } //************************************************************************* TEST(test_type_from_id_1) { - CHECK((std::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); } //************************************************************************* @@ -177,7 +177,7 @@ namespace CHECK_EQUAL((unsigned int)Type1::ID, (unsigned int)Type_Id_Lookup16::get_id_from_type()); CHECK_EQUAL((unsigned int)Type1::ID, (unsigned int)Type_Id_Lookup16::get_id_from_type(Type1())); CHECK_EQUAL((unsigned int)Type2::ID, (unsigned int)Type_Id_Lookup16::get_id_from_type()); - CHECK_EQUAL((unsigned int)Type2::ID, (unsigned int)Type_Id_Lookup16::get_id_from_type(Type2())); + CHECK_EQUAL((unsigned int)Type2::ID, (unsigned int)Type_Id_Lookup16::get_id_from_type(Type2())); CHECK_EQUAL((unsigned int)Type3::ID, (unsigned int)Type_Id_Lookup16::get_id_from_type()); CHECK_EQUAL((unsigned int)Type3::ID, (unsigned int)Type_Id_Lookup16::get_id_from_type(Type3())); CHECK_EQUAL((unsigned int)Type4::ID, (unsigned int)Type_Id_Lookup16::get_id_from_type()); @@ -251,41 +251,41 @@ namespace //************************************************************************* TEST(test_type_from_type_16) { - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); } //************************************************************************* TEST(test_type_from_type_8) { - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); } //************************************************************************* TEST(test_type_from_type_1) { - CHECK((std::is_same::type>::value)); + CHECK((etlstd::is_same::type>::value)); } }; } diff --git a/test/test_type_select.cpp b/test/test_type_select.cpp index dec01aea..113dce3b 100644 --- a/test/test_type_select.cpp +++ b/test/test_type_select.cpp @@ -51,66 +51,66 @@ namespace //************************************************************************* TEST(test_type_select1) { - CHECK((std::is_same, typename Types1::select<0>::type>::value)); - CHECK(!(std::is_same, typename Types1::select<0>::type>::value)); + CHECK((etlstd::is_same, typename Types1::select<0>::type>::value)); + CHECK(!(etlstd::is_same, typename Types1::select<0>::type>::value)); } //************************************************************************* TEST(test_type_select8) { - CHECK((std::is_same, typename Types8::select<0>::type>::value)); - CHECK(!(std::is_same, typename Types8::select<0>::type>::value)); - CHECK((std::is_same, typename Types8::select<1>::type>::value)); - CHECK(!(std::is_same, typename Types8::select<1>::type>::value)); - CHECK((std::is_same, typename Types8::select<2>::type>::value)); - CHECK(!(std::is_same, typename Types8::select<2>::type>::value)); - CHECK((std::is_same, typename Types8::select<3>::type>::value)); - CHECK(!(std::is_same, typename Types8::select<3>::type>::value)); - CHECK((std::is_same, typename Types8::select<4>::type>::value)); - CHECK(!(std::is_same, typename Types8::select<4>::type>::value)); - CHECK((std::is_same, typename Types8::select<5>::type>::value)); - CHECK(!(std::is_same, typename Types8::select<5>::type>::value)); - CHECK((std::is_same, typename Types8::select<6>::type>::value)); - CHECK(!(std::is_same, typename Types8::select<6>::type>::value)); - CHECK((std::is_same, typename Types8::select<7>::type>::value)); - CHECK(!(std::is_same, typename Types8::select<7>::type>::value)); + CHECK((etlstd::is_same, typename Types8::select<0>::type>::value)); + CHECK(!(etlstd::is_same, typename Types8::select<0>::type>::value)); + CHECK((etlstd::is_same, typename Types8::select<1>::type>::value)); + CHECK(!(etlstd::is_same, typename Types8::select<1>::type>::value)); + CHECK((etlstd::is_same, typename Types8::select<2>::type>::value)); + CHECK(!(etlstd::is_same, typename Types8::select<2>::type>::value)); + CHECK((etlstd::is_same, typename Types8::select<3>::type>::value)); + CHECK(!(etlstd::is_same, typename Types8::select<3>::type>::value)); + CHECK((etlstd::is_same, typename Types8::select<4>::type>::value)); + CHECK(!(etlstd::is_same, typename Types8::select<4>::type>::value)); + CHECK((etlstd::is_same, typename Types8::select<5>::type>::value)); + CHECK(!(etlstd::is_same, typename Types8::select<5>::type>::value)); + CHECK((etlstd::is_same, typename Types8::select<6>::type>::value)); + CHECK(!(etlstd::is_same, typename Types8::select<6>::type>::value)); + CHECK((etlstd::is_same, typename Types8::select<7>::type>::value)); + CHECK(!(etlstd::is_same, typename Types8::select<7>::type>::value)); } //************************************************************************* TEST(test_type_select16) { - CHECK((std::is_same, typename Types16::select<0>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<0>::type>::value)); - CHECK((std::is_same, typename Types16::select<1>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<1>::type>::value)); - CHECK((std::is_same, typename Types16::select<2>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<2>::type>::value)); - CHECK((std::is_same, typename Types16::select<3>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<3>::type>::value)); - CHECK((std::is_same, typename Types16::select<4>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<4>::type>::value)); - CHECK((std::is_same, typename Types16::select<5>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<5>::type>::value)); - CHECK((std::is_same, typename Types16::select<6>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<6>::type>::value)); - CHECK((std::is_same, typename Types16::select<7>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<7>::type>::value)); - CHECK((std::is_same, typename Types16::select<8>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<8>::type>::value)); - CHECK((std::is_same, typename Types16::select<9>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<9>::type>::value)); - CHECK((std::is_same, typename Types16::select<10>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<10>::type>::value)); - CHECK((std::is_same, typename Types16::select<11>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<11>::type>::value)); - CHECK((std::is_same, typename Types16::select<12>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<12>::type>::value)); - CHECK((std::is_same, typename Types16::select<13>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<13>::type>::value)); - CHECK((std::is_same, typename Types16::select<14>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<14>::type>::value)); - CHECK((std::is_same, typename Types16::select<15>::type>::value)); - CHECK(!(std::is_same, typename Types16::select<15>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<0>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<0>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<1>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<1>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<2>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<2>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<3>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<3>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<4>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<4>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<5>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<5>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<6>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<6>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<7>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<7>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<8>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<8>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<9>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<9>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<10>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<10>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<11>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<11>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<12>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<12>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<13>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<13>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<14>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<14>::type>::value)); + CHECK((etlstd::is_same, typename Types16::select<15>::type>::value)); + CHECK(!(etlstd::is_same, typename Types16::select<15>::type>::value)); } }; } diff --git a/test/test_type_traits.cpp b/test/test_type_traits.cpp index f05a8bd9..459ec0fa 100644 --- a/test/test_type_traits.cpp +++ b/test/test_type_traits.cpp @@ -30,16 +30,6 @@ SOFTWARE. #define IN_TYPE_TRAITS_TEST -#if defined(ETL_COMPILER_GCC) -namespace std -{ - template - struct add_reference : public std::add_lvalue_reference - { - }; -} -#endif - #include "etl/type_traits.h" #include @@ -51,10 +41,7 @@ namespace namespace etl { template <> - constexpr size_t size_of() - { - return 20; - } + struct size_of : etlstd::integral_constant {}; } namespace @@ -76,467 +63,456 @@ namespace //************************************************************************* TEST(test_is_integral) { - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); - CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); + CHECK(etlstd::is_integral::value == std::is_integral::value); } //************************************************************************* TEST(test_is_signed) { - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); - CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); + CHECK(etlstd::is_signed::value == std::is_signed::value); } //************************************************************************* TEST(test_is_unsigned) { - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); - CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); + CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); } //************************************************************************* TEST(test_is_floating_point) { - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_floating_point::value); - CHECK(etl::is_floating_point::value == std::is_signed::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); + CHECK(etlstd::is_floating_point::value == std::is_signed::value); } //************************************************************************* TEST(test_is_pointer) { - CHECK(etl::is_pointer::value == std::is_pointer::value); - CHECK(etl::is_pointer::value == std::is_pointer::value); - CHECK(etl::is_pointer::value == std::is_pointer::value); - CHECK(etl::is_pointer::value == std::is_pointer::value); - CHECK(etl::is_pointer::value == std::is_pointer::value); + CHECK(etlstd::is_pointer::value == std::is_pointer::value); + CHECK(etlstd::is_pointer::value == std::is_pointer::value); + CHECK(etlstd::is_pointer::value == std::is_pointer::value); + CHECK(etlstd::is_pointer::value == std::is_pointer::value); + CHECK(etlstd::is_pointer::value == std::is_pointer::value); } //************************************************************************* TEST(test_is_reference) { - CHECK(etl::is_reference::value == std::is_reference::value); - CHECK(etl::is_reference::value == std::is_reference::value); - CHECK(etl::is_reference::value == std::is_reference::value); - CHECK(etl::is_reference::value == std::is_reference::value); - CHECK(etl::is_reference::value == std::is_reference::value); + CHECK(etlstd::is_reference::value == std::is_reference::value); + CHECK(etlstd::is_reference::value == std::is_reference::value); + CHECK(etlstd::is_reference::value == std::is_reference::value); + CHECK(etlstd::is_reference::value == std::is_reference::value); + CHECK(etlstd::is_reference::value == std::is_reference::value); } //************************************************************************* TEST(test_is_same) { - CHECK((etl::is_same::value == std::is_same::value)); - CHECK((etl::is_same::value == std::is_same::value)); + CHECK((etlstd::is_same::value == etlstd::is_same::value)); + CHECK((etlstd::is_same::value == etlstd::is_same::value)); } //************************************************************************* TEST(test_is_array) { - CHECK(etl::is_array::value == std::is_array::value); - CHECK(etl::is_array::value == std::is_array::value); + CHECK(etlstd::is_array::value == std::is_array::value); + CHECK(etlstd::is_array::value == std::is_array::value); } //************************************************************************* TEST(test_remove_pointer) { - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); - CHECK((std::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); } //************************************************************************* TEST(test_add_pointer) { - CHECK((std::is_same::type, std::add_pointer::type>::value)); - CHECK((std::is_same::type, std::add_pointer::type>::value)); - CHECK((std::is_same::type, std::add_pointer::type>::value)); - CHECK((std::is_same::type, std::add_pointer::type>::value)); - CHECK((std::is_same::type, std::add_pointer::type>::value)); - CHECK((std::is_same::type, std::add_pointer::type>::value)); - CHECK((std::is_same::type, std::add_pointer::type>::value)); - CHECK((std::is_same::type, std::add_pointer::type>::value)); - CHECK((std::is_same::type, std::add_pointer::type>::value)); - CHECK((std::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); + CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); } //************************************************************************* TEST(test_remove_reference) { - CHECK((std::is_same::type, std::remove_reference::type>::value)); - CHECK((std::is_same::type, std::remove_reference::type>::value)); - CHECK((std::is_same::type, std::remove_reference::type>::value)); - CHECK((std::is_same::type, std::remove_reference::type>::value)); - CHECK((std::is_same::type, std::remove_reference::type>::value)); - } - - //************************************************************************* - TEST(test_add_reference) - { - CHECK((std::is_same::type, std::add_lvalue_reference::type>::value)); - CHECK((std::is_same::type, std::add_lvalue_reference::type>::value)); - CHECK((std::is_same::type, std::add_lvalue_reference::type>::value)); - CHECK((std::is_same::type, std::add_lvalue_reference::type>::value)); - CHECK((std::is_same::type, std::add_lvalue_reference::type>::value)); - + CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); + CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); + CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); + CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); + CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); } //************************************************************************* TEST(test_remove_const) { - CHECK((std::is_same::type, std::remove_const::type>::value)); - CHECK((std::is_same::type, std::remove_const::type>::value)); - CHECK((std::is_same::type, std::remove_const::type>::value)); + CHECK((etlstd::is_same::type, std::remove_const::type>::value)); + CHECK((etlstd::is_same::type, std::remove_const::type>::value)); + CHECK((etlstd::is_same::type, std::remove_const::type>::value)); } //************************************************************************* TEST(test_add_const) { - CHECK((std::is_same::type, std::add_const::type>::value)); - CHECK((std::is_same::type, std::add_const::type>::value)); - CHECK((std::is_same::type, std::add_const::type>::value)); + CHECK((etlstd::is_same::type, std::add_const::type>::value)); + CHECK((etlstd::is_same::type, std::add_const::type>::value)); + CHECK((etlstd::is_same::type, std::add_const::type>::value)); } //************************************************************************* TEST(test_is_const) { - CHECK(etl::is_const::value == std::is_const::value); - CHECK(etl::is_const::value == std::is_const::value); - CHECK(etl::is_const::value == std::is_const::value); + CHECK(etlstd::is_const::value == std::is_const::value); + CHECK(etlstd::is_const::value == std::is_const::value); + CHECK(etlstd::is_const::value == std::is_const::value); } //************************************************************************* TEST(test_is_volatile) { - CHECK(etl::is_volatile::value == std::is_volatile::value); - CHECK(etl::is_volatile::value == std::is_volatile::value); - CHECK(etl::is_volatile::value == std::is_volatile::value); + CHECK(etlstd::is_volatile::value == std::is_volatile::value); + CHECK(etlstd::is_volatile::value == std::is_volatile::value); + CHECK(etlstd::is_volatile::value == std::is_volatile::value); } //************************************************************************* TEST(test_remove_volatile) { - CHECK((std::is_same::type, std::remove_volatile::type>::value)); - CHECK((std::is_same::type, std::remove_volatile::type>::value)); - CHECK((std::is_same::type, std::remove_volatile::type>::value)); + CHECK((etlstd::is_same::type, std::remove_volatile::type>::value)); + CHECK((etlstd::is_same::type, std::remove_volatile::type>::value)); + CHECK((etlstd::is_same::type, std::remove_volatile::type>::value)); } //************************************************************************* TEST(test_add_volatile) { - CHECK((std::is_same::type, std::add_volatile::type>::value)); - CHECK((std::is_same::type, std::add_volatile::type>::value)); - CHECK((std::is_same::type, std::add_volatile::type>::value)); + CHECK((etlstd::is_same::type, std::add_volatile::type>::value)); + CHECK((etlstd::is_same::type, std::add_volatile::type>::value)); + CHECK((etlstd::is_same::type, std::add_volatile::type>::value)); } //************************************************************************* TEST(test_remove_cv) { - CHECK((std::is_same::type, std::remove_cv::type>::value)); - CHECK((std::is_same::type, std::remove_cv::type>::value)); - CHECK((std::is_same::type, std::remove_cv::type>::value)); - CHECK((std::is_same::type, std::remove_cv::type>::value)); + CHECK((etlstd::is_same::type, std::remove_cv::type>::value)); + CHECK((etlstd::is_same::type, std::remove_cv::type>::value)); + CHECK((etlstd::is_same::type, std::remove_cv::type>::value)); + CHECK((etlstd::is_same::type, std::remove_cv::type>::value)); } //************************************************************************* TEST(test_add_cv) { - typedef etl::add_cv::type t1; + typedef etlstd::add_cv::type t1; typedef std::add_cv::type t2; - bool pass = std::is_same::value; - //std::is_same::type, std::add_cv::type>::value; + bool pass = etlstd::is_same::value; + //etlstd::is_same::type, std::add_cv::type>::value; CHECK(pass); - CHECK((std::is_same::type, std::add_cv::type>::value)); - CHECK((std::is_same::type, std::add_cv::type>::value)); - CHECK((std::is_same::type, std::add_cv::type>::value)); + CHECK((etlstd::is_same::type, std::add_cv::type>::value)); + CHECK((etlstd::is_same::type, std::add_cv::type>::value)); + CHECK((etlstd::is_same::type, std::add_cv::type>::value)); } //************************************************************************* TEST(test_is_arithmetic) { - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); } //************************************************************************* TEST(test_is_fundamental) { - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); - CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); + CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); } //************************************************************************* TEST(test_is_compound) { - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); - CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); + CHECK(etlstd::is_compound::value == std::is_compound::value); } //************************************************************************* TEST(test_is_void) { - CHECK(etl::is_void::value == std::is_void::value); - CHECK(etl::is_void::value == std::is_void::value); + CHECK(etlstd::is_void::value == std::is_void::value); + CHECK(etlstd::is_void::value == std::is_void::value); } //************************************************************************* TEST(test_make_signed) { - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK(std::is_signed::type>::value && (sizeof(wchar_t) == sizeof(etl::make_signed::type))); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); - CHECK((std::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK(etlstd::is_signed::type>::value && (sizeof(wchar_t) == sizeof(etlstd::make_signed::type))); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); + CHECK((etlstd::is_same::type, std::make_signed::type>::value)); } //************************************************************************* TEST(test_make_unsigned) { - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK(std::is_unsigned::type>::value && (sizeof(wchar_t) == sizeof(etl::make_unsigned::type))); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); - CHECK((std::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK(etlstd::is_unsigned::type>::value && (sizeof(wchar_t) == sizeof(etlstd::make_unsigned::type))); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); + CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); } //************************************************************************* TEST(test_extent) { - CHECK(std::extent::value == etl::extent::value); - CHECK(std::extent::value == etl::extent::value); - CHECK(std::extent::value == etl::extent::value); + CHECK(std::extent::value == etlstd::extent::value); + CHECK(std::extent::value == etlstd::extent::value); + CHECK(std::extent::value == etlstd::extent::value); } //************************************************************************* TEST(test_remove_extent) { - CHECK((std::is_same::type, std::remove_extent::type>::value)); - CHECK((std::is_same::type, std::remove_extent::type>::value)); - CHECK((std::is_same::type, std::remove_extent::type>::value)); + CHECK((etlstd::is_same::type, std::remove_extent::type>::value)); + CHECK((etlstd::is_same::type, std::remove_extent::type>::value)); + CHECK((etlstd::is_same::type, std::remove_extent::type>::value)); } //************************************************************************* TEST(test_remove_all_extents) { - CHECK((std::is_same::type, std::remove_all_extents::type>::value)); - CHECK((std::is_same::type, std::remove_all_extents::type>::value)); - CHECK((std::is_same::type, std::remove_all_extents::type>::value)); + CHECK((etlstd::is_same::type, std::remove_all_extents::type>::value)); + CHECK((etlstd::is_same::type, std::remove_all_extents::type>::value)); + CHECK((etlstd::is_same::type, std::remove_all_extents::type>::value)); } //************************************************************************* TEST(test_rank) { - CHECK(etl::rank::value == std::rank::value); - CHECK(etl::rank::value == std::rank::value); - CHECK(etl::rank::value == std::rank::value); + CHECK(etlstd::rank::value == std::rank::value); + CHECK(etlstd::rank::value == std::rank::value); + CHECK(etlstd::rank::value == std::rank::value); } //************************************************************************* @@ -549,19 +525,19 @@ namespace float c; }; - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); - CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); + CHECK(std::alignment_of::value == etlstd::alignment_of::value); } //************************************************************************* @@ -603,135 +579,135 @@ namespace struct B : public A { }; struct C { }; - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); - CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); + CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); } //************************************************************************* TEST(test_types) { - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); - CHECK((std::is_same::type>::value)); - CHECK((std::is_same::reference>::value)); - CHECK((std::is_same::const_reference>::value)); - CHECK((std::is_same::pointer>::value)); - CHECK((std::is_same::const_pointer>::value)); - CHECK((std::is_same::const_pointer_const>::value)); + CHECK((etlstd::is_same::type>::value)); + CHECK((etlstd::is_same::reference>::value)); + CHECK((etlstd::is_same::const_reference>::value)); + CHECK((etlstd::is_same::pointer>::value)); + CHECK((etlstd::is_same::const_pointer>::value)); + CHECK((etlstd::is_same::const_pointer_const>::value)); } }; @@ -748,10 +724,62 @@ namespace //************************************************************************* TEST(size_of) { - CHECK_EQUAL(1, etl::size_of()); - CHECK_EQUAL(1, etl::size_of()); - CHECK_EQUAL(2, etl::size_of()); - CHECK_EQUAL(4, etl::size_of()); - CHECK_EQUAL(20, etl::size_of()); + CHECK_EQUAL(1, etl::size_of::value); + CHECK_EQUAL(1, etl::size_of::value); + CHECK_EQUAL(2, etl::size_of::value); + CHECK_EQUAL(4, etl::size_of::value); + CHECK_EQUAL(20, etl::size_of::value); + + CHECK_EQUAL(1, etl::size_of_v); + CHECK_EQUAL(1, etl::size_of_v); + CHECK_EQUAL(2, etl::size_of_v); + CHECK_EQUAL(4, etl::size_of_v); + CHECK_EQUAL(20, etl::size_of_v); + } + + //************************************************************************* + TEST(is_convertible) + { + CHECK((etlstd::is_convertible::value)); + CHECK((etlstd::is_convertible::value)); + CHECK((etlstd::is_convertible::value)); + CHECK((etlstd::is_convertible::value)); + CHECK((etlstd::is_convertible::value)); + CHECK((etlstd::is_convertible::value)); + CHECK((etlstd::is_convertible::value)); + CHECK(!(etlstd::is_convertible::value)); + CHECK(!(etlstd::is_convertible::value)); + CHECK(!(etlstd::is_convertible::value)); + CHECK(!(etlstd::is_convertible::value)); + } + + //************************************************************************* + TEST(add_lvalue_reference) + { + CHECK(!std::is_lvalue_reference_v::type>); + CHECK(std::is_lvalue_reference_v::type>); + CHECK(std::is_lvalue_reference_v::type>); + CHECK(std::is_lvalue_reference_v::type>); + CHECK(std::is_lvalue_reference_v::type>); + } + + //************************************************************************* + TEST(add_rvalue_reference) + { + CHECK(!std::is_rvalue_reference_v::type>); + CHECK(std::is_rvalue_reference_v::type>); + CHECK(std::is_rvalue_reference_v::type>); + CHECK(!std::is_rvalue_reference_v::type>); + CHECK(std::is_rvalue_reference_v::type>); + } + + //************************************************************************* + TEST(is_lvalue_reference) + { + CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); + CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); + CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); + CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); + CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); } } diff --git a/test/test_variant.cpp b/test/test_variant.cpp index 65c70f27..5ef05e8d 100644 --- a/test/test_variant.cpp +++ b/test/test_variant.cpp @@ -216,10 +216,10 @@ namespace static test_variant_c c(3); static test_variant_d d(4.5); - CHECK((uintptr_t(&a.get()) % uintptr_t(etl::alignment_of::value)) == 0); - CHECK((uintptr_t(&b.get()) % uintptr_t(etl::alignment_of::value)) == 0); - CHECK((uintptr_t(&c.get()) % uintptr_t(etl::alignment_of::value)) == 0); - CHECK((uintptr_t(&d.get()) % uintptr_t(etl::alignment_of::value)) == 0); + CHECK((uintptr_t(&a.get()) % uintptr_t(etlstd::alignment_of::value)) == 0); + CHECK((uintptr_t(&b.get()) % uintptr_t(etlstd::alignment_of::value)) == 0); + CHECK((uintptr_t(&c.get()) % uintptr_t(etlstd::alignment_of::value)) == 0); + CHECK((uintptr_t(&d.get()) % uintptr_t(etlstd::alignment_of::value)) == 0); } //************************************************************************* diff --git a/test/vs2017/etl.vcxproj b/test/vs2017/etl.vcxproj index 3e2240c0..db8603b9 100644 --- a/test/vs2017/etl.vcxproj +++ b/test/vs2017/etl.vcxproj @@ -732,6 +732,7 @@ + @@ -798,16 +799,6 @@ - - - - - - - - - - diff --git a/test/vs2017/etl.vcxproj.filters b/test/vs2017/etl.vcxproj.filters index a467fa68..e27c2993 100644 --- a/test/vs2017/etl.vcxproj.filters +++ b/test/vs2017/etl.vcxproj.filters @@ -67,12 +67,6 @@ {0bcdf7f9-8e2b-4f70-932b-bde56404f421} - - {86dc2850-2ddf-4582-9908-2436a1aa6e86} - - - {0d093ee6-686c-4c9e-856e-bdf7075ff7a6} - {da88d71d-e5ea-4c26-9807-94616d31addb} @@ -618,15 +612,6 @@ ETL\Private - - ETL\STL\Alternate - - - ETL\STL\Alternate - - - ETL\STL - ETL\Profiles @@ -642,27 +627,6 @@ ETL\Profiles - - ETL\STL\Alternate - - - ETL\STL - - - ETL\STL - - - ETL\STL\Alternate - - - ETL\STL - - - ETL\STL\Alternate - - - ETL\STL - ETL\Maths @@ -792,9 +756,6 @@ ETL\Containers - - ETL\Private - ETL\Private @@ -858,6 +819,12 @@ ETL\Profiles + + ETL\Private + + + ETL\Utilities + @@ -1364,9 +1331,6 @@ Resource Files - - Resource Files\CI\CircleCI - Resource Files From 94c5eed5a473378dc2b2d33437f3bdc7cac7a1f2 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 4 Jan 2020 11:49:22 +0000 Subject: [PATCH 2/6] Work in progress --- include/etl/algorithm.h | 26 +- include/etl/flat_map.h | 32 +- include/etl/flat_multimap.h | 26 +- include/etl/flat_multiset.h | 32 +- include/etl/flat_set.h | 40 +- include/etl/map.h | 8 +- include/etl/message_bus.h | 4 +- include/etl/multimap.h | 6 +- include/etl/multiset.h | 4 +- include/etl/platform.h | 2 - include/etl/reference_flat_map.h | 12 +- include/etl/reference_flat_multimap.h | 18 +- include/etl/reference_flat_multiset.h | 16 +- include/etl/reference_flat_set.h | 10 +- include/etl/set.h | 6 +- include/etl/unordered_map.h | 14 +- include/etl/unordered_multimap.h | 10 +- include/etl/unordered_multiset.h | 12 +- include/etl/unordered_set.h | 12 +- test/no_stl_test_iterators.h | 6 +- test/test_algorithm.cpp | 367 ++--------------- test/test_atomic_std.cpp | 72 ++-- test/test_callback_timer.cpp | 30 +- ...lgorithm.cpp => test_etlstl_algorithm.cpp} | 380 ++++++++++++++---- ...ctional.cpp => test_etlstl_functional.cpp} | 0 ..._iterator.cpp => test_etlstl_iterator.cpp} | 0 ..._stl_limits.cpp => test_etlstl_limits.cpp} | 0 ...tl_utility.cpp => test_etlstl_utility.cpp} | 0 test/test_flat_map.cpp | 40 +- test/test_flat_multimap.cpp | 24 +- test/test_flat_multiset.cpp | 10 +- test/test_flat_set.cpp | 6 +- test/test_map.cpp | 32 +- test/test_message_bus.cpp | 16 +- test/test_message_router.cpp | 10 +- test/test_message_timer.cpp | 26 +- test/test_multimap.cpp | 162 ++++---- test/test_multiset.cpp | 12 +- test/test_queue_mpmc_mutex.cpp | 2 +- test/test_queue_mpmc_mutex_small.cpp | 2 +- test/test_queue_spsc_atomic.cpp | 2 +- test/test_queue_spsc_atomic_small.cpp | 2 +- test/test_queue_spsc_isr.cpp | 2 +- test/test_queue_spsc_isr_small.cpp | 2 +- test/test_queue_spsc_locked.cpp | 2 +- test/test_queue_spsc_locked_small.cpp | 2 +- test/test_random.cpp | 28 +- test/test_reference_flat_map.cpp | 18 +- test/test_reference_flat_multimap.cpp | 14 +- test/test_reference_flat_multiset.cpp | 10 +- test/test_reference_flat_set.cpp | 6 +- test/test_set.cpp | 28 +- test/test_task_scheduler.cpp | 8 +- test/test_type_def.cpp | 10 +- test/test_unordered_map.cpp | 8 +- test/test_unordered_multimap.cpp | 8 +- test/test_unordered_multiset.cpp | 4 +- test/test_utility.cpp | 6 +- test/vs2017/etl.vcxproj | 11 +- test/vs2017/etl.vcxproj.filters | 33 +- 60 files changed, 817 insertions(+), 874 deletions(-) rename test/{test_no_stl_algorithm.cpp => test_etlstl_algorithm.cpp} (66%) rename test/{test_no_stl_functional.cpp => test_etlstl_functional.cpp} (100%) rename test/{test_no_stl_iterator.cpp => test_etlstl_iterator.cpp} (100%) rename test/{test_no_stl_limits.cpp => test_etlstl_limits.cpp} (100%) rename test/{test_no_stl_utility.cpp => test_etlstl_utility.cpp} (100%) diff --git a/include/etl/algorithm.h b/include/etl/algorithm.h index f37e9eef..788223ec 100644 --- a/include/etl/algorithm.h +++ b/include/etl/algorithm.h @@ -346,7 +346,7 @@ namespace etlstd { while (b < --e) { - etl::iter_swap(b, e); + etlstd::iter_swap(b, e); ++b; } } @@ -359,7 +359,7 @@ namespace etlstd { while ((b != e) && (b != --e)) { - etl::iter_swap(b++, e); + etlstd::iter_swap(b++, e); } } #else @@ -462,7 +462,7 @@ namespace etlstd { typedef etlstd::less::value_type> compare; - return etl::upper_bound(first, last, value, compare()); + return etlstd::upper_bound(first, last, value, compare()); } #else //*************************************************************************** @@ -761,7 +761,7 @@ namespace etlstd { typedef etlstd::less::value_type> compare; - return etl::lexicographical_compare(first1, last1, first2, last2, compare()); + return etlstd::lexicographical_compare(first1, last1, first2, last2, compare()); } #else //*************************************************************************** @@ -798,7 +798,7 @@ namespace etlstd { typedef etlstd::less compare; - return etl::min(a, b, compare()); + return etlstd::min(a, b, compare()); } #else //*************************************************************************** @@ -830,7 +830,7 @@ namespace etlstd { typedef etlstd::less compare; - return etl::max(a, b, compare()); + return etlstd::max(a, b, compare()); } #else //*************************************************************************** @@ -979,7 +979,7 @@ namespace etlstd { typedef etlstd::less::value_type> compare; - etl::pop_heap(first, last, compare()); + etlstd::pop_heap(first, last, compare()); } // Push Heap @@ -998,7 +998,7 @@ namespace etlstd { typedef etlstd::less::value_type> compare; - etl::push_heap(first, last, compare()); + etlstd::push_heap(first, last, compare()); } // Make Heap @@ -1034,7 +1034,7 @@ namespace etlstd { typedef etlstd::less::value_type> compare; - etl::make_heap(first, last, compare()); + etlstd::make_heap(first, last, compare()); } // Is Heap @@ -1152,9 +1152,9 @@ namespace etlstd template TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last) { - typedef etl::equal_to::value_type> compare; + typedef etlstd::equal_to::value_type> compare; - return etl::search(first, last, search_first, search_last, compare()); + return etlstd::search(first, last, search_first, search_last, compare()); } #else //*************************************************************************** @@ -1231,7 +1231,7 @@ namespace etlstd while (true) { - TIterator1 new_result = etl::search(b, e, sb, se, predicate); + TIterator1 new_result = etlstd::search(b, e, sb, se, predicate); if (new_result == e) { @@ -1252,7 +1252,7 @@ namespace etlstd TIterator1 find_end(TIterator1 b, TIterator1 e, TIterator2 sb, TIterator2 se) { - typedef etl::equal_to::value_type> predicate; + typedef etlstd::equal_to::value_type> predicate; return find_end(b, e, sb, se, predicate()); } diff --git a/include/etl/flat_map.h b/include/etl/flat_map.h index 1ba17f4b..1e0e0200 100644 --- a/include/etl/flat_map.h +++ b/include/etl/flat_map.h @@ -72,7 +72,7 @@ namespace etl public: - typedef ETL_PAIR value_type; + typedef ETL_OR_STD::pair value_type; typedef TKey key_type; typedef TMapped mapped_type; typedef TKeyCompare key_compare; @@ -285,11 +285,11 @@ namespace etl /// If asserts or exceptions are enabled, emits flat_map_full if the flat_map is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(const_reference value) + ETL_OR_STD::pair insert(const_reference value) { iterator i_element = lower_bound(value.first); - ETL_PAIR result(i_element, false); + ETL_OR_STD::pair result(i_element, false); // Doesn't already exist? if ((i_element == end()) || compare(value.first, i_element->first)) @@ -335,7 +335,7 @@ namespace etl //************************************************************************* /// Emplaces a value to the map. //************************************************************************* - ETL_PAIR emplace(const value_type& value) + ETL_OR_STD::pair emplace(const value_type& value) { return emplace(value.first, value.second); } @@ -345,7 +345,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, Args && ... args) + ETL_OR_STD::pair emplace(const key_type& key, Args && ... args) { ETL_ASSERT(!full(), ETL_ERROR(flat_map_full)); @@ -356,7 +356,7 @@ namespace etl iterator i_element = lower_bound(key); - ETL_PAIR result(i_element, false); + ETL_OR_STD::pair result(i_element, false); // Doesn't already exist? if ((i_element == end()) || compare(key, i_element->first)) @@ -379,7 +379,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, const T1& value1) + ETL_OR_STD::pair emplace(const key_type& key, const T1& value1) { ETL_ASSERT(!full(), ETL_ERROR(flat_map_full)); @@ -390,7 +390,7 @@ namespace etl iterator i_element = lower_bound(key); - ETL_PAIR result(i_element, false); + ETL_OR_STD::pair result(i_element, false); // Doesn't already exist? if ((i_element == end()) || compare(key, i_element->first)) @@ -411,7 +411,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, const T1& value1, const T2& value2) + ETL_OR_STD::pair emplace(const key_type& key, const T1& value1, const T2& value2) { ETL_ASSERT(!full(), ETL_ERROR(flat_map_full)); @@ -422,7 +422,7 @@ namespace etl iterator i_element = lower_bound(key); - ETL_PAIR result(i_element, false); + ETL_OR_STD::pair result(i_element, false); // Doesn't already exist? if ((i_element == end()) || compare(key, i_element->first)) @@ -443,7 +443,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3) + ETL_OR_STD::pair emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3) { ETL_ASSERT(!full(), ETL_ERROR(flat_map_full)); @@ -454,7 +454,7 @@ namespace etl iterator i_element = lower_bound(key); - ETL_PAIR result(i_element, false); + ETL_OR_STD::pair result(i_element, false); // Doesn't already exist? if ((i_element == end()) || compare(key, i_element->first)) @@ -475,7 +475,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3, const T4& value4) + ETL_OR_STD::pair emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3, const T4& value4) { ETL_ASSERT(!full(), ETL_ERROR(flat_map_full)); @@ -486,7 +486,7 @@ namespace etl iterator i_element = lower_bound(key); - ETL_PAIR result(i_element, false); + ETL_OR_STD::pair result(i_element, false); // Doesn't already exist? if ((i_element == end()) || compare(key, i_element->first)) @@ -662,7 +662,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { return refmap_t::equal_range(key); } @@ -672,7 +672,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { return refmap_t::equal_range(key); } diff --git a/include/etl/flat_multimap.h b/include/etl/flat_multimap.h index fcdfd017..67a739ad 100644 --- a/include/etl/flat_multimap.h +++ b/include/etl/flat_multimap.h @@ -64,7 +64,7 @@ namespace etl { public: - typedef ETL_PAIR value_type; + typedef ETL_OR_STD::pair value_type; private: @@ -254,11 +254,11 @@ namespace etl /// If asserts or exceptions are enabled, emits flat_multimap_full if the flat_multimap is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(const value_type& value) + ETL_OR_STD::pair insert(const value_type& value) { ETL_ASSERT(!refmap_t::full(), ETL_ERROR(flat_multimap_full)); - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); iterator i_element = lower_bound(value.first); @@ -300,7 +300,7 @@ namespace etl //************************************************************************* /// Emplaces a value to the map. //************************************************************************* - ETL_PAIR emplace(const value_type& value) + ETL_OR_STD::pair emplace(const value_type& value) { return insert(value); } @@ -308,7 +308,7 @@ namespace etl //************************************************************************* /// Emplaces a value to the map. //************************************************************************* - ETL_PAIR emplace(const key_type& key, const mapped_type& value) + ETL_OR_STD::pair emplace(const key_type& key, const mapped_type& value) { ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full)); @@ -327,7 +327,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, Args && ... args) + ETL_OR_STD::pair emplace(const key_type& key, Args && ... args) { ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full)); @@ -346,7 +346,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, const T1& value1) + ETL_OR_STD::pair emplace(const key_type& key, const T1& value1) { ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full)); @@ -364,7 +364,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, const T1& value1, const T2& value2) + ETL_OR_STD::pair emplace(const key_type& key, const T1& value1, const T2& value2) { ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full)); @@ -382,7 +382,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3) + ETL_OR_STD::pair emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3) { ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full)); @@ -400,7 +400,7 @@ namespace etl /// Emplaces a value to the map. //************************************************************************* template - ETL_PAIR emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3, const T4& value4) + ETL_OR_STD::pair emplace(const key_type& key, const T1& value1, const T2& value2, const T3& value3, const T4& value4) { ETL_ASSERT(!full(), ETL_ERROR(flat_multimap_full)); @@ -423,7 +423,7 @@ namespace etl //********************************************************************* size_t erase(key_parameter_t key) { - ETL_PAIR range = equal_range(key); + ETL_OR_STD::pair range = equal_range(key); if (range.first == end()) { @@ -571,7 +571,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { return refmap_t::equal_range(key); } @@ -581,7 +581,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { return refmap_t::equal_range(key); } diff --git a/include/etl/flat_multiset.h b/include/etl/flat_multiset.h index 0014d1e2..4bd21bf9 100644 --- a/include/etl/flat_multiset.h +++ b/include/etl/flat_multiset.h @@ -226,9 +226,9 @@ namespace etl /// If asserts or exceptions are enabled, emits flat_multiset_full if the flat_multiset is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(parameter_t value) + ETL_OR_STD::pair insert(parameter_t value) { - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full)); @@ -273,7 +273,7 @@ namespace etl /// Emplaces a value to the set. //************************************************************************* template - ETL_PAIR emplace(parameter_t value) + ETL_OR_STD::pair emplace(parameter_t value) { return insert(value); } @@ -283,7 +283,7 @@ namespace etl //************************************************************************* #if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) template - ETL_PAIR emplace(Args && ... args) + ETL_OR_STD::pair emplace(Args && ... args) { ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full)); @@ -294,14 +294,14 @@ namespace etl iterator i_element = lower_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_PAIR(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } #else //************************************************************************* /// Emplaces a value to the set. //************************************************************************* template - ETL_PAIR emplace(const T1& value1) + ETL_OR_STD::pair emplace(const T1& value1) { ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full)); @@ -312,14 +312,14 @@ namespace etl iterator i_element = lower_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_PAIR(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } //************************************************************************* /// Emplaces a value to the set. //************************************************************************* template - ETL_PAIR emplace(const T1& value1, const T2& value2) + ETL_OR_STD::pair emplace(const T1& value1, const T2& value2) { ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full)); @@ -330,14 +330,14 @@ namespace etl iterator i_element = lower_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_PAIR(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } //************************************************************************* /// Emplaces a value to the set. //************************************************************************* template - ETL_PAIR emplace(const T1& value1, const T2& value2, const T3& value3) + ETL_OR_STD::pair emplace(const T1& value1, const T2& value2, const T3& value3) { ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full)); @@ -348,14 +348,14 @@ namespace etl iterator i_element = lower_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_PAIR(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } //************************************************************************* /// Emplaces a value to the set. //************************************************************************* template - ETL_PAIR emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4) + ETL_OR_STD::pair emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4) { ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full)); @@ -366,7 +366,7 @@ namespace etl iterator i_element = lower_bound(*pvalue); ETL_INCREMENT_DEBUG_COUNT - return ETL_PAIR(refset_t::insert_at(i_element, *pvalue)); + return ETL_OR_STD::pair(refset_t::insert_at(i_element, *pvalue)); } #endif @@ -377,7 +377,7 @@ namespace etl //********************************************************************* size_t erase(parameter_t key) { - ETL_PAIR range = equal_range(key); + ETL_OR_STD::pair range = equal_range(key); if (range.first == end()) { @@ -525,7 +525,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(parameter_t key) + ETL_OR_STD::pair equal_range(parameter_t key) { return refset_t::equal_range(key); } @@ -535,7 +535,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(parameter_t key) const + ETL_OR_STD::pair equal_range(parameter_t key) const { return refset_t::equal_range(key); } diff --git a/include/etl/flat_set.h b/include/etl/flat_set.h index 6884e410..0b997420 100644 --- a/include/etl/flat_set.h +++ b/include/etl/flat_set.h @@ -228,11 +228,11 @@ namespace etl /// If asserts or exceptions are enabled, emits flat_set_full if the flat_set is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(parameter_t value) + ETL_OR_STD::pair insert(parameter_t value) { iterator i_element = lower_bound(value); - ETL_PAIR result(i_element, false); + ETL_OR_STD::pair result(i_element, false); // Doesn't already exist? if ((i_element == end()) || compare(value, *i_element)) @@ -278,7 +278,7 @@ namespace etl //************************************************************************* /// Emplaces a value to the set. //************************************************************************* - ETL_PAIR emplace(parameter_t value) + ETL_OR_STD::pair emplace(parameter_t value) { return insert(value); } @@ -288,11 +288,11 @@ namespace etl //************************************************************************* #if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) template - ETL_PAIR emplace(Args && ... args) + ETL_OR_STD::pair emplace(Args && ... args) { ETL_ASSERT(!full(), ETL_ERROR(flat_set_full)); - ETL_PAIR result; + ETL_OR_STD::pair result; // Create it. value_type* pvalue = storage.allocate(); @@ -311,7 +311,7 @@ namespace etl // Destroy it. pvalue->~value_type(); storage.release(pvalue); - result = ETL_PAIR(end(), false); + result = ETL_OR_STD::pair(end(), false); } return result; @@ -321,11 +321,11 @@ namespace etl /// Emplaces a value to the set. //************************************************************************* template - ETL_PAIR emplace(const T1& value1) + ETL_OR_STD::pair emplace(const T1& value1) { ETL_ASSERT(!full(), ETL_ERROR(flat_set_full)); - ETL_PAIR result; + ETL_OR_STD::pair result; // Create it. value_type* pvalue = storage.allocate(); @@ -344,7 +344,7 @@ namespace etl // Destroy it. pvalue->~value_type(); storage.release(pvalue); - result = ETL_PAIR(end(), false); + result = ETL_OR_STD::pair(end(), false); } return result; @@ -354,11 +354,11 @@ namespace etl /// Emplaces a value to the set. //************************************************************************* template - ETL_PAIR emplace(const T1& value1, const T2& value2) + ETL_OR_STD::pair emplace(const T1& value1, const T2& value2) { ETL_ASSERT(!full(), ETL_ERROR(flat_set_full)); - ETL_PAIR result; + ETL_OR_STD::pair result; // Create it. value_type* pvalue = storage.allocate(); @@ -377,7 +377,7 @@ namespace etl // Destroy it. pvalue->~value_type(); storage.release(pvalue); - result = ETL_PAIR(end(), false); + result = ETL_OR_STD::pair(end(), false); } return result; @@ -387,11 +387,11 @@ namespace etl /// Emplaces a value to the set. //************************************************************************* template - ETL_PAIR emplace(const T1& value1, const T2& value2, const T3& value3) + ETL_OR_STD::pair emplace(const T1& value1, const T2& value2, const T3& value3) { ETL_ASSERT(!full(), ETL_ERROR(flat_set_full)); - ETL_PAIR result; + ETL_OR_STD::pair result; // Create it. value_type* pvalue = storage.allocate(); @@ -410,7 +410,7 @@ namespace etl // Destroy it. pvalue->~value_type(); storage.release(pvalue); - result = ETL_PAIR(end(), false); + result = ETL_OR_STD::pair(end(), false); } return result; @@ -420,11 +420,11 @@ namespace etl /// Emplaces a value to the set. //************************************************************************* template - ETL_PAIR emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4) + ETL_OR_STD::pair emplace(const T1& value1, const T2& value2, const T3& value3, const T4& value4) { ETL_ASSERT(!full(), ETL_ERROR(flat_set_full)); - ETL_PAIR result; + ETL_OR_STD::pair result; // Create it. value_type* pvalue = storage.allocate(); @@ -443,7 +443,7 @@ namespace etl // Destroy it. pvalue->~value_type(); storage.release(pvalue); - result = ETL_PAIR(end(), false); + result = ETL_OR_STD::pair(end(), false); } return result; @@ -608,7 +608,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(parameter_t key) + ETL_OR_STD::pair equal_range(parameter_t key) { return refset_t::equal_range(key); } @@ -618,7 +618,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(parameter_t key) const + ETL_OR_STD::pair equal_range(parameter_t key) const { return refset_t::upper_bound(key); } diff --git a/include/etl/map.h b/include/etl/map.h index e1630b26..131e3dd1 100755 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -468,7 +468,7 @@ namespace etl public: typedef TKey key_type; - typedef ETL_PAIR value_type; + typedef ETL_OR_STD::pair value_type; typedef TMapped mapped_type; typedef TKeyCompare key_compare; typedef value_type& reference; @@ -989,7 +989,7 @@ namespace etl /// Returns two iterators with bounding (lower bound, upper bound) the key /// provided //************************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { return ETL_MAKE_PAIR( iterator(*this, find_lower_node(root_node, key)), @@ -1000,7 +1000,7 @@ namespace etl /// Returns two const iterators with bounding (lower bound, upper bound) /// the key provided. //************************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { return ETL_MAKE_PAIR( const_iterator(*this, find_lower_node(root_node, key)), @@ -1093,7 +1093,7 @@ namespace etl /// If asserts or exceptions are enabled, emits map_full if the map is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(const value_type& value) + ETL_OR_STD::pair insert(const value_type& value) { // Default to no inserted node Node* inserted_node = nullptr; diff --git a/include/etl/message_bus.h b/include/etl/message_bus.h index cda5bef6..32e4eb7f 100644 --- a/include/etl/message_bus.h +++ b/include/etl/message_bus.h @@ -125,7 +125,7 @@ namespace etl } else { - ETL_PAIR range = etlstd::equal_range(router_list.begin(), + ETL_OR_STD::pair range = etlstd::equal_range(router_list.begin(), router_list.end(), id, compare_router_id()); @@ -212,7 +212,7 @@ namespace etl router_list_t::iterator irouter = router_list.begin(); // Find routers with the id. - ETL_PAIR range = etlstd::equal_range(router_list.begin(), + ETL_OR_STD::pair range = etlstd::equal_range(router_list.begin(), router_list.end(), destination_router_id, compare_router_id()); diff --git a/include/etl/multimap.h b/include/etl/multimap.h index 371a1639..e9b88f50 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -629,7 +629,7 @@ namespace etl { public: - typedef ETL_PAIR value_type; + typedef ETL_OR_STD::pair value_type; typedef const TKey key_type; typedef TMapped mapped_type; typedef TKeyCompare key_compare; @@ -1097,7 +1097,7 @@ namespace etl /// Returns two iterators with bounding (lower bound, upper bound) the key /// provided //************************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { return ETL_MAKE_PAIR( iterator(*this, find_lower_node(root_node, key)), @@ -1108,7 +1108,7 @@ namespace etl /// Returns two const iterators with bounding (lower bound, upper bound) /// the key provided. //************************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { return ETL_MAKE_PAIR( const_iterator(*this, find_lower_node(root_node, key)), diff --git a/include/etl/multiset.h b/include/etl/multiset.h index 958affdc..72111914 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -1062,7 +1062,7 @@ namespace etl /// Returns two iterators with bounding (lower bound, upper bound) the key /// provided //************************************************************************* - ETL_PAIR equal_range(const value_type& key) + ETL_OR_STD::pair equal_range(const value_type& key) { return ETL_MAKE_PAIR( iterator(*this, find_lower_node(root_node, key)), @@ -1073,7 +1073,7 @@ namespace etl /// Returns two const iterators with bounding (lower bound, upper bound) /// the key provided. //************************************************************************* - ETL_PAIR equal_range(const value_type& key) const + ETL_OR_STD::pair equal_range(const value_type& key) const { return ETL_MAKE_PAIR( const_iterator(*this, find_lower_node(root_node, key)), diff --git a/include/etl/platform.h b/include/etl/platform.h index 5df07d4f..e5a21937 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -104,7 +104,5 @@ SOFTWARE. // Sort out names for STL/No STL options. #include "private/choose_namespace.h" -#include "private/choose_tag_types.h" -#include "private/choose_pair_types.h" #endif diff --git a/include/etl/reference_flat_map.h b/include/etl/reference_flat_map.h index 9f834854..2293fe7e 100644 --- a/include/etl/reference_flat_map.h +++ b/include/etl/reference_flat_map.h @@ -108,7 +108,7 @@ namespace etl { public: - typedef ETL_PAIR value_type; + typedef ETL_OR_STD::pair value_type; protected: @@ -545,7 +545,7 @@ namespace etl /// If asserts or exceptions are enabled, emits flat_map_full if the reference_flat_map is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(reference value) + ETL_OR_STD::pair insert(reference value) { iterator i_element = lower_bound(value.first); @@ -731,7 +731,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { iterator i_lower = etlstd::lower_bound(begin(), end(), key, compare); @@ -743,7 +743,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { const_iterator i_lower = etlstd::lower_bound(cbegin(), cend(), key, compare); @@ -819,9 +819,9 @@ namespace etl ///\param i_element The place to insert. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert_at(iterator i_element, value_type& value) + ETL_OR_STD::pair insert_at(iterator i_element, value_type& value) { - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); if (i_element == end()) { diff --git a/include/etl/reference_flat_multimap.h b/include/etl/reference_flat_multimap.h index 9af3770f..08afd781 100644 --- a/include/etl/reference_flat_multimap.h +++ b/include/etl/reference_flat_multimap.h @@ -83,7 +83,7 @@ namespace etl { public: - typedef ETL_PAIR value_type; + typedef ETL_OR_STD::pair value_type; protected: @@ -460,11 +460,11 @@ namespace etl /// If asserts or exceptions are enabled, emits reference_flat_multimap_full if the reference_flat_multimap is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(value_type& value) + ETL_OR_STD::pair insert(value_type& value) { ETL_ASSERT(!lookup.full(), ETL_ERROR(flat_multimap_full)); - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); iterator i_element = lower_bound(value.first); @@ -505,7 +505,7 @@ namespace etl //********************************************************************* size_t erase(key_parameter_t key) { - ETL_PAIR range = equal_range(key); + ETL_OR_STD::pair range = equal_range(key); if (range.first == end()) { @@ -603,7 +603,7 @@ namespace etl //********************************************************************* size_t count(key_parameter_t key) const { - ETL_PAIR range = equal_range(key); + ETL_OR_STD::pair range = equal_range(key); return etlstd::distance(range.first, range.second); } @@ -653,7 +653,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { iterator i_lower = etlstd::lower_bound(begin(), end(), key, compare); @@ -665,7 +665,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { const_iterator i_lower = etlstd::lower_bound(cbegin(), cend(), key, compare); @@ -741,9 +741,9 @@ namespace etl ///\param i_element The place to insert. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert_at(iterator i_element, value_type& value) + ETL_OR_STD::pair insert_at(iterator i_element, value_type& value) { - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); if (i_element == end()) { diff --git a/include/etl/reference_flat_multiset.h b/include/etl/reference_flat_multiset.h index 656cfe8e..48decc45 100644 --- a/include/etl/reference_flat_multiset.h +++ b/include/etl/reference_flat_multiset.h @@ -456,9 +456,9 @@ namespace etl /// If asserts or exceptions are enabled, emits reference_flat_multiset_full if the reference_flat_multiset is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(value_type& value) + ETL_OR_STD::pair insert(value_type& value) { - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); ETL_ASSERT(!lookup.full(), ETL_ERROR(flat_multiset_full)); @@ -516,7 +516,7 @@ namespace etl //********************************************************************* size_t erase(parameter_t key) { - ETL_PAIR range = equal_range(key); + ETL_OR_STD::pair range = equal_range(key); if (range.first == end()) { @@ -614,7 +614,7 @@ namespace etl //********************************************************************* size_t count(parameter_t key) const { - ETL_PAIR range = equal_range(key); + ETL_OR_STD::pair range = equal_range(key); return etlstd::distance(range.first, range.second); } @@ -664,7 +664,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(parameter_t key) + ETL_OR_STD::pair equal_range(parameter_t key) { return etlstd::equal_range(begin(), end(), key, compare); } @@ -674,7 +674,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(parameter_t key) const + ETL_OR_STD::pair equal_range(parameter_t key) const { return etlstd::equal_range(begin(), end(), key, compare); } @@ -748,9 +748,9 @@ namespace etl ///\param i_element The place to insert. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert_at(iterator i_element, reference value) + ETL_OR_STD::pair insert_at(iterator i_element, reference value) { - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); if (i_element == end()) { diff --git a/include/etl/reference_flat_set.h b/include/etl/reference_flat_set.h index aac9e529..a8b5faf9 100644 --- a/include/etl/reference_flat_set.h +++ b/include/etl/reference_flat_set.h @@ -457,7 +457,7 @@ namespace etl /// If asserts or exceptions are enabled, emits reference_flat_set_full if the reference_flat_set is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(reference value) + ETL_OR_STD::pair insert(reference value) { iterator i_element = lower_bound(value); @@ -643,7 +643,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(parameter_t key) + ETL_OR_STD::pair equal_range(parameter_t key) { return etlstd::equal_range(begin(), end(), key, compare); } @@ -653,7 +653,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair. //********************************************************************* - ETL_PAIR equal_range(parameter_t key) const + ETL_OR_STD::pair equal_range(parameter_t key) const { return etlstd::upper_bound(cbegin(), cend(), key, compare); } @@ -727,9 +727,9 @@ namespace etl ///\param i_element The place to insert. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert_at(iterator i_element, reference value) + ETL_OR_STD::pair insert_at(iterator i_element, reference value) { - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); if (i_element == end()) { diff --git a/include/etl/set.h b/include/etl/set.h index 9304bbf4..566781c2 100755 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -911,7 +911,7 @@ namespace etl /// Returns two iterators with bounding (lower bound, upper bound) the /// value provided //************************************************************************* - ETL_PAIR equal_range(const value_type& value) + ETL_OR_STD::pair equal_range(const value_type& value) { return ETL_MAKE_PAIR( iterator(*this, find_lower_node(root_node, value)), @@ -922,7 +922,7 @@ namespace etl /// Returns two const iterators with bounding (lower bound, upper bound) /// the value provided. //************************************************************************* - ETL_PAIR equal_range(const value_type& value) const + ETL_OR_STD::pair equal_range(const value_type& value) const { return ETL_MAKE_PAIR( const_iterator(*this, find_lower_node(root_node, value)), @@ -1015,7 +1015,7 @@ namespace etl /// If asserts or exceptions are enabled, emits set_full if the set is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(value_type& value) + ETL_OR_STD::pair insert(value_type& value) { // Default to no inserted node Node* inserted_node = nullptr; diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index 701f7b12..eda2a631 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -132,7 +132,7 @@ namespace etl { public: - typedef ETL_PAIR value_type; + typedef ETL_OR_STD::pair value_type; typedef TKey key_type; typedef T mapped_type; @@ -770,9 +770,9 @@ namespace etl /// If asserts or exceptions are enabled, emits unordered_map_full if the unordered_map is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(const value_type& key_value_pair) + ETL_OR_STD::pair insert(const value_type& key_value_pair) { - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); ETL_ASSERT(!full(), ETL_ERROR(unordered_map_full)); @@ -1082,7 +1082,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair to the range of elements if the key exists, otherwise end(). //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { iterator f = find(key); iterator l = f; @@ -1092,7 +1092,7 @@ namespace etl ++l; } - return ETL_PAIR(f, l); + return ETL_OR_STD::pair(f, l); } //********************************************************************* @@ -1103,7 +1103,7 @@ namespace etl ///\param key The key to search for. ///\return A const iterator pair to the range of elements if the key exists, otherwise end(). //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { const_iterator f = find(key); const_iterator l = f; @@ -1113,7 +1113,7 @@ namespace etl ++l; } - return ETL_PAIR(f, l); + return ETL_OR_STD::pair(f, l); } //************************************************************************* diff --git a/include/etl/unordered_multimap.h b/include/etl/unordered_multimap.h index 1951e5f0..9f96a7a8 100644 --- a/include/etl/unordered_multimap.h +++ b/include/etl/unordered_multimap.h @@ -132,7 +132,7 @@ namespace etl { public: - typedef ETL_PAIR value_type; + typedef ETL_OR_STD::pair value_type; typedef TKey key_type; typedef T mapped_type; @@ -982,7 +982,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair to the range of elements if the key exists, otherwise end(). //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { iterator f = find(key); iterator l = f; @@ -997,7 +997,7 @@ namespace etl } } - return ETL_PAIR(f, l); + return ETL_OR_STD::pair(f, l); } //********************************************************************* @@ -1008,7 +1008,7 @@ namespace etl ///\param key The key to search for. ///\return A const iterator pair to the range of elements if the key exists, otherwise end(). //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { const_iterator f = find(key); const_iterator l = f; @@ -1023,7 +1023,7 @@ namespace etl } } - return ETL_PAIR(f, l); + return ETL_OR_STD::pair(f, l); } //************************************************************************* diff --git a/include/etl/unordered_multiset.h b/include/etl/unordered_multiset.h index b7c58585..2e03f02a 100644 --- a/include/etl/unordered_multiset.h +++ b/include/etl/unordered_multiset.h @@ -654,9 +654,9 @@ namespace etl /// If asserts or exceptions are enabled, emits unordered_multiset_full if the unordered_multiset is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(const value_type& key) + ETL_OR_STD::pair insert(const value_type& key) { - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); ETL_ASSERT(!full(), ETL_ERROR(unordered_multiset_full)); @@ -977,7 +977,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair to the range of elements if the key exists, otherwise end(). //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { iterator f = find(key); iterator l = f; @@ -992,7 +992,7 @@ namespace etl } } - return ETL_PAIR(f, l); + return ETL_OR_STD::pair(f, l); } //********************************************************************* @@ -1003,7 +1003,7 @@ namespace etl ///\param key The key to search for. ///\return A const iterator pair to the range of elements if the key exists, otherwise end(). //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { const_iterator f = find(key); const_iterator l = f; @@ -1018,7 +1018,7 @@ namespace etl } } - return ETL_PAIR(f, l); + return ETL_OR_STD::pair(f, l); } //************************************************************************* diff --git a/include/etl/unordered_set.h b/include/etl/unordered_set.h index c545adfb..c16772de 100644 --- a/include/etl/unordered_set.h +++ b/include/etl/unordered_set.h @@ -655,9 +655,9 @@ namespace etl /// If asserts or exceptions are enabled, emits unordered_set_full if the unordered_set is already full. ///\param value The value to insert. //********************************************************************* - ETL_PAIR insert(const value_type& key) + ETL_OR_STD::pair insert(const value_type& key) { - ETL_PAIR result(end(), false); + ETL_OR_STD::pair result(end(), false); ETL_ASSERT(!full(), ETL_ERROR(unordered_set_full)); @@ -964,7 +964,7 @@ namespace etl ///\param key The key to search for. ///\return An iterator pair to the range of elements if the key exists, otherwise end(). //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) + ETL_OR_STD::pair equal_range(key_parameter_t key) { iterator f = find(key); iterator l = f; @@ -974,7 +974,7 @@ namespace etl ++l; } - return ETL_PAIR(f, l); + return ETL_OR_STD::pair(f, l); } //********************************************************************* @@ -985,7 +985,7 @@ namespace etl ///\param key The key to search for. ///\return A const iterator pair to the range of elements if the key exists, otherwise end(). //********************************************************************* - ETL_PAIR equal_range(key_parameter_t key) const + ETL_OR_STD::pair equal_range(key_parameter_t key) const { const_iterator f = find(key); const_iterator l = f; @@ -995,7 +995,7 @@ namespace etl ++l; } - return ETL_PAIR(f, l); + return ETL_OR_STD::pair(f, l); } //************************************************************************* diff --git a/test/no_stl_test_iterators.h b/test/no_stl_test_iterators.h index 49d54c56..b2084de9 100644 --- a/test/no_stl_test_iterators.h +++ b/test/no_stl_test_iterators.h @@ -34,10 +34,8 @@ SOFTWARE. #include "etl/platform.h" #include "etl/iterator.h" -#include "etl/iterator.h" - template -struct non_random_iterator : public etl::iterator +struct non_random_iterator : public etlstd::iterator { non_random_iterator() : ptr(nullptr) @@ -116,7 +114,7 @@ bool operator !=(const non_random_iterator& lhs, const non_random_iterator } template -struct random_iterator : public etl::iterator +struct random_iterator : public etlstd::iterator { random_iterator() : ptr(nullptr) diff --git a/test/test_algorithm.cpp b/test/test_algorithm.cpp index e73fc4fb..e0fa0a91 100644 --- a/test/test_algorithm.cpp +++ b/test/test_algorithm.cpp @@ -49,6 +49,11 @@ namespace typedef std::vector Data; Data data = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; + constexpr size_t SIZE = 10; + + int dataS[SIZE] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + std::list dataSL = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + struct StructData { int a; @@ -84,107 +89,7 @@ namespace SUITE(test_algorithm) { - //========================================================================= - TEST(minmax_element) - { - ETL_PAIR expected = std::minmax_element(data.begin(), data.end()); - ETL_PAIR result = etlstd::minmax_element(data.begin(), data.end()); - CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); - CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); - } - - //========================================================================= - TEST(minmax_element_compare) - { - ETL_PAIR expected = std::minmax_element(data.begin(), data.end(), std::greater()); - ETL_PAIR result = etlstd::minmax_element(data.begin(), data.end(), std::greater()); - CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); - CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); - } - - //========================================================================= - TEST(minmax) - { - int a = 1; - int b = 2; - - ETL_PAIR expected = std::minmax(a, b); - ETL_PAIR result = etlstd::minmax(a, b); - CHECK_EQUAL(expected.first, result.first); - CHECK_EQUAL(expected.second, result.second); - - result = etlstd::minmax(b, a); - expected = std::minmax(b, a); - CHECK_EQUAL(expected.first, result.first); - CHECK_EQUAL(expected.second, result.second); - } - - //========================================================================= - TEST(minmax_compare) - { - int a = 1; - int b = 2; - - ETL_PAIR expected = std::minmax(a, b, std::greater()); - ETL_PAIR result = etlstd::minmax(a, b, std::greater()); - CHECK_EQUAL(expected.first, result.first); - CHECK_EQUAL(expected.second, result.second); - - result = etlstd::minmax(b, a, std::greater()); - expected = std::minmax(b, a, std::greater()); - CHECK_EQUAL(expected.first, result.first); - CHECK_EQUAL(expected.second, result.second); - } - - //========================================================================= - TEST(is_sorted_until) - { - int data[] = { 1, 2, 3, 4, 6, 5, 7, 8, 9, 10 }; - - int* p1 = std::is_sorted_until(std::begin(data), std::end(data)); - int* p2 = etlstd::is_sorted_until(std::begin(data), std::end(data)); - CHECK_EQUAL(std::distance(std::begin(data), p1), std::distance(std::begin(data), p2)); - } - - //========================================================================= - TEST(is_sorted_until_compare) - { - int data[] = { 10, 9, 8, 7, 5, 6, 4, 3, 4, 2, 1 }; - - int* p1 = std::is_sorted_until(std::begin(data), std::end(data), std::greater()); - int* p2 = etlstd::is_sorted_until(std::begin(data), std::end(data), std::greater()); - CHECK_EQUAL(std::distance(etl::begin(data), p1), std::distance(std::begin(data), p2)); - } - - //========================================================================= - TEST(is_sorted) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - bool is_sorted = etlstd::is_sorted(std::begin(data1), std::end(data1)); - CHECK(is_sorted); - - int data2[] = { 1, 2, 3, 4, 6, 5, 7, 8 , 9, 10}; - - is_sorted = etlstd::is_sorted(std::begin(data2), std::end(data2)); - CHECK(!is_sorted); - } - - //========================================================================= - TEST(is_sorted_compare) - { - int data1[] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; - - bool is_sorted = etlstd::is_sorted(std::begin(data1), std::end(data1), std::greater()); - CHECK(is_sorted); - - int data2[] = { 10, 9, 8, 7, 5, 6, 4, 3, 2, 1 }; - - is_sorted = etlstd::is_sorted(std::begin(data2), std::end(data2), std::greater()); - CHECK(!is_sorted); - } - - //========================================================================= + //************************************************************************* TEST(copy_4_parameter_random_iterator) { int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; @@ -221,7 +126,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(copy_4_parameter_non_random_iterator) { std::list data1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; @@ -258,43 +163,7 @@ namespace CHECK(is_same); } - //========================================================================= - TEST(copy_n_random_iterator) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - int* result; - - std::copy_n(std::begin(data1), 4, std::begin(data2)); - result = etlstd::copy_n(std::begin(data1), 4, std::begin(data3)); - - CHECK_EQUAL(std::begin(data3) + 4, result); - - bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); - CHECK(is_same); - } - - //========================================================================= - TEST(copy_n_non_random_iterator) - { - std::list data1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - int* result; - - std::copy_n(std::begin(data1), 4, std::begin(data2)); - result = etlstd::copy_n(std::begin(data1), 4, std::begin(data3)); - - CHECK_EQUAL(std::begin(data3) + 4, result); - - bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); - CHECK(is_same); - } - - //========================================================================= + //************************************************************************* TEST(copy_n_4_parameter) { int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; @@ -330,7 +199,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(copy_2n_4_parameter) { int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; @@ -366,22 +235,7 @@ namespace CHECK(is_same); } - //========================================================================= - TEST(copy_if) - { - int data1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; - int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Copy everything less than 5. - std::copy_if(std::begin(data1), std::end(data1), std::begin(data2), std::bind(std::less(), std::placeholders::_1, 5)); - etlstd::copy_if(std::begin(data1), std::end(data1), std::begin(data3), std::bind(std::less(), std::placeholders::_1, 5)); - - bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); - CHECK(is_same); - } - - //========================================================================= + //************************************************************************* TEST(copy_n_if) { int data1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -403,7 +257,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(copy_if_4_parameter) { int data1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -440,154 +294,7 @@ namespace CHECK(is_same); } - //========================================================================= - TEST(any_of) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - bool expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - bool result = etlstd::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - - expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - result = etlstd::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - CHECK_EQUAL(expected, result); - } - - //========================================================================= - TEST(all_of) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - bool expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - bool result = etlstd::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - CHECK_EQUAL(expected, result); - - expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - result = etlstd::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - } - - //========================================================================= - TEST(none_of) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - bool expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); - bool result = etlstd::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); - CHECK_EQUAL(expected, result); - - expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - result = etlstd::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - } - - struct Compare - { - bool operator()(int a, int b) const - { - return a == b; - } - }; - - //========================================================================= - TEST(is_permutation) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - int permutation[] = { 1, 3, 2, 4, 7, 6, 5, 8 }; - int not_permutation[] = { 1, 2, 3, 4, 5, 6, 7, 7 }; - - bool is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation)); - CHECK(is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation)); - CHECK(!is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::equal_to()); - CHECK(is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::equal_to()); - CHECK(!is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation)); - CHECK(is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation)); - CHECK(!is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation), std::equal_to()); - CHECK(is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation), std::equal_to()); - CHECK(!is_permutation); - } - - //========================================================================= - TEST(is_partitioned) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - - bool expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - bool result = etlstd::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - - std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - - expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - result = etlstd::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - } - - //========================================================================= - TEST(partition_point) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - - std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - - int* partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - int* partition2 = etlstd::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); - - std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); - - partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - partition2 = etlstd::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); - } - - //========================================================================= - TEST(partition_copy) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int data4[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int data5[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - std::partition_copy(std::begin(data1), std::end(data1), std::begin(data2), std::begin(data3), std::bind(std::greater(), std::placeholders::_1, 4)); - etlstd::partition_copy(std::begin(data1), std::end(data1), std::begin(data4), std::begin(data5), std::bind(std::greater(), std::placeholders::_1, 4)); - - bool are_equal; - - are_equal = std::equal(std::begin(data2), std::end(data2), std::begin(data4)); - CHECK(are_equal); - - are_equal = std::equal(std::begin(data3), std::end(data3), std::begin(data5)); - CHECK(are_equal); - } - - //========================================================================= - TEST(find_if_not) - { - int data1[] = { 1, 2, 3, 5, 6, 7, 8 }; - - // Find the element not less than 4. - int* p = etlstd::find_if_not(std::begin(data1), std::end(data1), std::bind(std::less(), std::placeholders::_1, 4)); - CHECK_EQUAL(5, *p); - } - - //========================================================================= + //************************************************************************* TEST(binary_find) { int data1[] = { 1, 2, 3, 5, 6, 7, 8 }; @@ -601,7 +308,7 @@ namespace CHECK_EQUAL(std::end(data1), p); } - //========================================================================= + //************************************************************************* TEST(binary_find_StructDataPredicate_StructDataEquality) { StructData data1[] = { { 1, 8 }, { 2, 7 }, { 3, 6 },{ 4, 5 },{ 5, 4 },{ 6, 3 },{ 7, 2 },{ 8, 1 } }; @@ -617,7 +324,7 @@ namespace CHECK_EQUAL(std::end(data1), p); } - //========================================================================= + //************************************************************************* TEST(for_each_if) { int data1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -645,7 +352,7 @@ namespace CHECK_EQUAL(10, accumulator.sum); } - //========================================================================= + //************************************************************************* TEST(for_each_n) { int data1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -665,7 +372,7 @@ namespace CHECK(are_equal); } - //========================================================================= + //************************************************************************* TEST(for_each_n_if) { int data1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -685,7 +392,7 @@ namespace CHECK(are_equal); } - //========================================================================= + //************************************************************************* TEST(transform_4_parameter) { int input[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -714,7 +421,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(transform_n_random_iterator) { int input[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -730,7 +437,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(transform_n_non_random_iterator) { std::list input = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -746,7 +453,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(transform_if) { int input[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -764,7 +471,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(transform_if_2_input_ranges) { int input1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -784,7 +491,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(transform_n_if) { int input[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -802,7 +509,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(transform_n_if_2_input_ranges) { int input1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -822,7 +529,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(partition_transform) { int input[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -848,7 +555,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(partition_transform_2_input_ranges) { int input1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; @@ -875,7 +582,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(sort_default) { std::vector data(100, 0); @@ -896,7 +603,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(sort_greater) { std::vector data(100, 0); @@ -917,7 +624,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(stable_sort_default) { std::vector initial_data = { NDC(1, 1), NDC(2, 1), NDC(3, 1), NDC(2, 2), NDC(3, 2), NDC(4, 1), NDC(2, 3), NDC(3, 3), NDC(5, 1) }; @@ -932,7 +639,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(stable_sort_greater) { std::vector initial_data = { NDC(1, 1), NDC(2, 1), NDC(3, 1), NDC(2, 2), NDC(3, 2), NDC(4, 1), NDC(2, 3), NDC(3, 3), NDC(5, 1) }; @@ -947,7 +654,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(shell_sort_default) { std::vector data(100, 0); @@ -968,7 +675,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(shell_sort_greater) { std::vector data(100, 0); @@ -989,7 +696,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(insertion_sort_default) { std::vector initial_data = { NDC(1, 1), NDC(2, 1), NDC(3, 1), NDC(2, 2), NDC(3, 2), NDC(4, 1), NDC(2, 3), NDC(3, 3), NDC(5, 1) }; @@ -1004,7 +711,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(insertion_sort_greater) { std::vector initial_data = { NDC(1, 1), NDC(2, 1), NDC(3, 1), NDC(2, 2), NDC(3, 2), NDC(4, 1), NDC(2, 3), NDC(3, 3), NDC(5, 1) }; @@ -1019,7 +726,7 @@ namespace CHECK(is_same); } - //========================================================================= + //************************************************************************* TEST(multimax) { CHECK_EQUAL(8, etl::multimax(1, 2, 3, 4, 5, 6, 7, 8)); @@ -1027,7 +734,7 @@ namespace CHECK_EQUAL(1, etl::multimax_compare(std::greater(), 1, 2, 3, 4, 5, 6, 7, 8)); } - //========================================================================= + //************************************************************************* TEST(multimax_iter) { int i[8] = { 1, 2, 3, 4, 5, 6, 7, 8 }; @@ -1037,7 +744,7 @@ namespace CHECK_EQUAL(1, *etl::multimax_iter_compare(std::greater(), &i[0], &i[1], &i[2], &i[3], &i[4], &i[5], &i[6], &i[7])); } - //========================================================================= + //************************************************************************* TEST(multimin) { CHECK_EQUAL(1, etl::multimin(1, 2, 3, 4, 5, 6, 7, 8)); @@ -1045,7 +752,7 @@ namespace CHECK_EQUAL(8, etl::multimin_compare(std::greater(), 1, 2, 3, 4, 5, 6, 7, 8)); } - //========================================================================= + //************************************************************************* TEST(multimin_iter) { int i[8] = { 1, 2, 3, 4, 5, 6, 7, 8 }; diff --git a/test/test_atomic_std.cpp b/test/test_atomic_std.cpp index ba8de484..23b19d71 100644 --- a/test/test_atomic_std.cpp +++ b/test/test_atomic_std.cpp @@ -37,7 +37,7 @@ namespace { SUITE(test_atomic_std) { - //========================================================================= + //************************************************************************* TEST(test_atomic_integer_is_lock_free) { std::atomic compare; @@ -46,7 +46,7 @@ namespace CHECK_EQUAL(compare.is_lock_free(), test.is_lock_free()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_pointer_is_lock_free) { std::atomic compare; @@ -55,7 +55,7 @@ namespace CHECK_EQUAL(compare.is_lock_free(), test.is_lock_free()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_integer_load) { std::atomic compare(1); @@ -64,7 +64,7 @@ namespace CHECK_EQUAL((int)compare.load(), (int)test.load()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_pointer_load) { int i; @@ -75,7 +75,7 @@ namespace CHECK_EQUAL((int*)compare.load(), (int*)test.load()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_integer_store) { std::atomic compare(1); @@ -86,7 +86,7 @@ namespace CHECK_EQUAL((int)compare.load(), (int)test.load()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_pointer_store) { int i; @@ -100,7 +100,7 @@ namespace CHECK_EQUAL((int*)compare.load(), (int*)test.load()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_integer_assignment) { std::atomic compare(1); @@ -111,7 +111,7 @@ namespace CHECK_EQUAL((int)compare.load(), (int)test.load()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_pointer_assignment) { int i; @@ -125,7 +125,7 @@ namespace CHECK_EQUAL((int*)compare.load(), (int*)test.load()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_pre_increment) { std::atomic compare(1); @@ -135,7 +135,7 @@ namespace CHECK_EQUAL((int)++compare, (int)++test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_post_increment) { std::atomic compare(1); @@ -145,7 +145,7 @@ namespace CHECK_EQUAL((int)compare++, (int)test++); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_pre_decrement) { std::atomic compare(1); @@ -155,7 +155,7 @@ namespace CHECK_EQUAL((int)--compare, (int)--test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_post_decrement) { std::atomic compare(1); @@ -165,7 +165,7 @@ namespace CHECK_EQUAL((int)compare--, (int)test--); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_pointer_pre_increment) { int data[] = { 1, 2, 3, 4 }; @@ -177,7 +177,7 @@ namespace CHECK_EQUAL((int*)++compare, (int*)++test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_pointer_post_increment) { int data[] = { 1, 2, 3, 4 }; @@ -189,7 +189,7 @@ namespace CHECK_EQUAL((int*)compare++, (int*)test++); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_pointer_pre_decrement) { int data[] = { 1, 2, 3, 4 }; @@ -201,7 +201,7 @@ namespace CHECK_EQUAL((int*)--compare, (int*)--test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_pointer_post_decrement) { int data[] = { 1, 2, 3, 4 }; @@ -213,7 +213,7 @@ namespace CHECK_EQUAL((int*)compare--, (int*)test--); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_fetch_add) { std::atomic compare(1); @@ -222,7 +222,7 @@ namespace CHECK_EQUAL((int)compare.fetch_add(2), (int)test.fetch_add(2)); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_pointer_fetch_add) { int data[] = { 1, 2, 3, 4 }; @@ -233,7 +233,7 @@ namespace CHECK_EQUAL((int*)compare.fetch_add(ptrdiff_t(10)), (int*)test.fetch_add(ptrdiff_t(10))); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_plus_equals) { std::atomic compare(1); @@ -245,7 +245,7 @@ namespace CHECK_EQUAL((int)compare, (int)test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_pointer_plus_equals) { int data[] = { 1, 2, 3, 4 }; @@ -259,7 +259,7 @@ namespace CHECK_EQUAL((int*)compare, (int*)test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_minus_equals) { std::atomic compare(1); @@ -271,7 +271,7 @@ namespace CHECK_EQUAL((int)compare, (int)test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_pointer_minus_equals) { int data[] = { 1, 2, 3, 4 }; @@ -285,7 +285,7 @@ namespace CHECK_EQUAL((int*)compare, (int*)test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_and_equals) { std::atomic compare(0x0000FFFF); @@ -297,7 +297,7 @@ namespace CHECK_EQUAL((int)compare, (int)test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_or_equals) { std::atomic compare(0x0000FFFF); @@ -309,7 +309,7 @@ namespace CHECK_EQUAL((int)compare, (int)test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_xor_equals) { std::atomic compare(0x0000FFFF); @@ -321,7 +321,7 @@ namespace CHECK_EQUAL((int)compare, (int)test); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_integer_fetch_sub) { std::atomic compare(1); @@ -330,7 +330,7 @@ namespace CHECK_EQUAL((int)compare.fetch_sub(2), (int)test.fetch_sub(2)); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_pointer_fetch_sub) { int data[] = { 1, 2, 3, 4 }; @@ -341,7 +341,7 @@ namespace CHECK_EQUAL((int*)compare.fetch_add(ptrdiff_t(10)), (int*)test.fetch_add(ptrdiff_t(10))); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_fetch_and) { std::atomic compare(0xFFFFFFFF); @@ -350,7 +350,7 @@ namespace CHECK_EQUAL((int)compare.fetch_and(0x55AA55AA), (int)test.fetch_and(0x55AA55AA)); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_fetch_or) { std::atomic compare(0x0000FFFF); @@ -359,7 +359,7 @@ namespace CHECK_EQUAL((int)compare.fetch_or(0x55AA55AA), (int)test.fetch_or(0x55AA55AA)); } - //========================================================================= + //************************************************************************* TEST(test_atomic_operator_fetch_xor) { std::atomic compare(0x0000FFFF); @@ -368,7 +368,7 @@ namespace CHECK_EQUAL((int)compare.fetch_xor(0x55AA55AA), (int)test.fetch_xor(0x55AA55AA)); } - //========================================================================= + //************************************************************************* TEST(test_atomic_integer_exchange) { std::atomic compare(1); @@ -377,7 +377,7 @@ namespace CHECK_EQUAL((int)compare.exchange(2), (int)test.exchange(2)); } - //========================================================================= + //************************************************************************* TEST(test_atomic_pointer_exchange) { int i; @@ -389,7 +389,7 @@ namespace CHECK_EQUAL((int*)compare.exchange(&j), (int*)test.exchange(&j)); } - //========================================================================= + //************************************************************************* TEST(test_atomic_compare_exchange_weak_fail) { std::atomic compare; @@ -412,7 +412,7 @@ namespace CHECK_EQUAL(compare.load(), test.load()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_compare_exchange_weak_pass) { std::atomic compare; @@ -435,7 +435,7 @@ namespace CHECK_EQUAL(compare.load(), test.load()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_compare_exchange_strong_fail) { std::atomic compare; @@ -458,7 +458,7 @@ namespace CHECK_EQUAL(compare.load(), test.load()); } - //========================================================================= + //************************************************************************* TEST(test_atomic_compare_exchange_strong_pass) { std::atomic compare; diff --git a/test/test_callback_timer.cpp b/test/test_callback_timer.cpp index 6e6eb512..67e248e8 100644 --- a/test/test_callback_timer.cpp +++ b/test/test_callback_timer.cpp @@ -109,7 +109,7 @@ namespace SUITE(test_callback_timer) { - //========================================================================= + //************************************************************************* TEST(callback_timer_too_many_timers) { etl::callback_timer<2> timer_controller; @@ -127,7 +127,7 @@ namespace CHECK(id3 != etl::timer::id::NO_TIMER); } - //========================================================================= + //************************************************************************* TEST(callback_timer_one_shot) { etl::callback_timer<4> timer_controller; @@ -169,7 +169,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(message_timer_one_shot_after_timeout) { etl::callback_timer<1> timer_controller; @@ -215,7 +215,7 @@ namespace CHECK(!timer_controller.stop(id1)); } - //========================================================================= + //************************************************************************* TEST(callback_timer_repeating) { etl::callback_timer<3> timer_controller; @@ -257,7 +257,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_repeating_bigger_step) { etl::callback_timer<3> timer_controller; @@ -303,7 +303,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_repeating_stop_start) { etl::callback_timer<3> timer_controller; @@ -356,7 +356,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_timer_starts_timer_small_step) { etl::callback_timer<3> timer_controller; @@ -393,7 +393,7 @@ namespace CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_timer_starts_timer_big_step) { etl::callback_timer<3> timer_controller; @@ -430,7 +430,7 @@ namespace CHECK_ARRAY_EQUAL(compare1.data(), test.tick_list.data(), compare1.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_repeating_register_unregister) { etl::callback_timer<3> timer_controller; @@ -479,7 +479,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_repeating_clear) { etl::callback_timer<3> timer_controller; @@ -527,7 +527,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_delayed_immediate) { etl::callback_timer<3> timer_controller; @@ -570,7 +570,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), free_tick_list2.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_one_shot_big_step_short_delay_insert) { etl::callback_timer<3> timer_controller; @@ -606,7 +606,7 @@ namespace CHECK_ARRAY_EQUAL(compare2.data(), free_tick_list2.data(), compare2.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_one_shot_empty_list_huge_tick_before_insert) { etl::callback_timer<3> timer_controller; @@ -646,7 +646,7 @@ namespace CHECK_ARRAY_EQUAL(compare1.data(), free_tick_list1.data(), compare1.size()); } - //========================================================================= + //************************************************************************* class test_object { public: @@ -677,7 +677,7 @@ namespace CHECK(test_obj.called == 1); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported diff --git a/test/test_no_stl_algorithm.cpp b/test/test_etlstl_algorithm.cpp similarity index 66% rename from test/test_no_stl_algorithm.cpp rename to test/test_etlstl_algorithm.cpp index 0bf610c2..c69565a3 100644 --- a/test/test_no_stl_algorithm.cpp +++ b/test/test_etlstl_algorithm.cpp @@ -38,12 +38,16 @@ SOFTWARE. #include #include #include +#include #include "no_stl_test_iterators.h" namespace { - const size_t SIZE = 10; + constexpr size_t SIZE = 10; + + typedef std::vector Vector; + Vector data = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; int dataEQ[SIZE] = { 1, 1, 3, 3, 5, 5, 7, 7, 9, 9 }; std::list dataEQL = { 1, 1, 3, 3, 5, 5, 7, 7, 9, 9 }; @@ -105,12 +109,6 @@ namespace } }; -// std::ostream& operator << (std::ostream& os, const Data& data_) -// { -// os << data_.a << "," << data_.b; -// return os; -// } - struct Greater : public etlstd::binary_function { bool operator()(int a, int b) const @@ -161,6 +159,106 @@ namespace CHECK_EQUAL((std::max(b, a, Greater())), (etlstd::max(b, a, Greater()))); } + //************************************************************************* + TEST(minmax_element) + { + std::pair expected = std::minmax_element(data.begin(), data.end()); + std::pair result = etlstd::minmax_element(data.begin(), data.end()); + CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); + CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); + } + + //************************************************************************* + TEST(minmax_element_compare) + { + std::pair expected = std::minmax_element(data.begin(), data.end(), std::greater()); + std::pair result = etlstd::minmax_element(data.begin(), data.end(), std::greater()); + CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); + CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); + } + + //************************************************************************* + TEST(minmax) + { + int a = 1; + int b = 2; + + std::pair expected = std::minmax(a, b); + std::pair result = etlstd::minmax(a, b); + CHECK_EQUAL(expected.first, result.first); + CHECK_EQUAL(expected.second, result.second); + + result = etlstd::minmax(b, a); + expected = std::minmax(b, a); + CHECK_EQUAL(expected.first, result.first); + CHECK_EQUAL(expected.second, result.second); + } + + //************************************************************************* + TEST(minmax_compare) + { + int a = 1; + int b = 2; + + std::pair expected = std::minmax(a, b, std::greater()); + std::pair result = etlstd::minmax(a, b, std::greater()); + CHECK_EQUAL(expected.first, result.first); + CHECK_EQUAL(expected.second, result.second); + + result = etlstd::minmax(b, a, std::greater()); + expected = std::minmax(b, a, std::greater()); + CHECK_EQUAL(expected.first, result.first); + CHECK_EQUAL(expected.second, result.second); + } + + //************************************************************************* + TEST(is_sorted_until) + { + int data[] = { 1, 2, 3, 4, 6, 5, 7, 8, 9, 10 }; + + int* p1 = std::is_sorted_until(std::begin(data), std::end(data)); + int* p2 = etlstd::is_sorted_until(std::begin(data), std::end(data)); + CHECK_EQUAL(std::distance(std::begin(data), p1), std::distance(std::begin(data), p2)); + } + + //************************************************************************* + TEST(is_sorted_until_compare) + { + int data[] = { 10, 9, 8, 7, 5, 6, 4, 3, 4, 2, 1 }; + + int* p1 = std::is_sorted_until(std::begin(data), std::end(data), std::greater()); + int* p2 = etlstd::is_sorted_until(std::begin(data), std::end(data), std::greater()); + CHECK_EQUAL(std::distance(etl::begin(data), p1), std::distance(std::begin(data), p2)); + } + + //************************************************************************* + TEST(is_sorted) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + bool is_sorted = etlstd::is_sorted(std::begin(data1), std::end(data1)); + CHECK(is_sorted); + + int data2[] = { 1, 2, 3, 4, 6, 5, 7, 8 , 9, 10 }; + + is_sorted = etlstd::is_sorted(std::begin(data2), std::end(data2)); + CHECK(!is_sorted); + } + + //************************************************************************* + TEST(is_sorted_compare) + { + int data1[] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; + + bool is_sorted = etlstd::is_sorted(std::begin(data1), std::end(data1), std::greater()); + CHECK(is_sorted); + + int data2[] = { 10, 9, 8, 7, 5, 6, 4, 3, 2, 1 }; + + is_sorted = etlstd::is_sorted(std::begin(data2), std::end(data2), std::greater()); + CHECK(!is_sorted); + } + //************************************************************************* TEST(copy_pod_pointer) { @@ -221,6 +319,57 @@ namespace CHECK(isEqual); } + //************************************************************************* + TEST(copy_n_random_iterator) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + int* result; + + std::copy_n(std::begin(data1), 4, std::begin(data2)); + result = etlstd::copy_n(std::begin(data1), 4, std::begin(data3)); + + CHECK_EQUAL(std::begin(data3) + 4, result); + + bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); + CHECK(is_same); + } + + //************************************************************************* + TEST(copy_n_non_random_iterator) + { + std::list data1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + int* result; + + std::copy_n(std::begin(data1), 4, std::begin(data2)); + result = etlstd::copy_n(std::begin(data1), 4, std::begin(data3)); + + CHECK_EQUAL(std::begin(data3) + 4, result); + + bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); + CHECK(is_same); + } + + //************************************************************************* + TEST(copy_if) + { + int data1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; + int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + // Copy everything less than 5. + std::copy_if(std::begin(data1), std::end(data1), std::begin(data2), std::bind(std::less(), std::placeholders::_1, 5)); + etlstd::copy_if(std::begin(data1), std::end(data1), std::begin(data3), std::bind(std::less(), std::placeholders::_1, 5)); + + bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); + CHECK(is_same); + } + //************************************************************************* TEST(reverse_copy_pod_pointer) { @@ -281,26 +430,6 @@ namespace CHECK(isEqual); } - //************************************************************************* - TEST(copy_n_non_random_iterator) - { - List data1(dataL.size()); - List data2(dataL.size()); - - List::iterator pstl = std::copy_n(std::begin(dataA), 10, std::begin(data1)); - List::iterator petl = etlstd::copy_n(std::begin(dataA), 10, std::begin(data2)); - - using difference_type_t = List::difference_type; - - difference_type_t dstl = std::distance(data1.begin(), pstl); - difference_type_t detl = std::distance(data2.begin(), petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - //************************************************************************* TEST(copy_backward_pod_pointer) { @@ -466,8 +595,8 @@ namespace { for (int i = 0; i < 11; ++i) { - ETL_PAIR lb1 = std::equal_range(std::begin(dataEQ), std::end(dataEQ), i); - ETL_PAIR, random_iterator> lb2 = etlstd::equal_range(random_iterator(std::begin(dataEQ)), random_iterator(std::end(dataEQ)), i); + ETL_OR_STD::pair lb1 = std::equal_range(std::begin(dataEQ), std::end(dataEQ), i); + ETL_OR_STD::pair, random_iterator> lb2 = etlstd::equal_range(random_iterator(std::begin(dataEQ)), random_iterator(std::end(dataEQ)), i); CHECK_EQUAL(std::distance(std::begin(dataEQ), lb1.first), std::distance(std::begin(dataEQ), lb2.first)); CHECK_EQUAL(std::distance(lb1.first, lb1.second), std::distance(lb2.first, lb2.second)); @@ -479,8 +608,8 @@ namespace { for (int i = 0; i < 11; ++i) { - ETL_PAIR lb1 = std::equal_range(std::begin(dataEQ), std::end(dataEQ), i); - ETL_PAIR, non_random_iterator> lb2 = etlstd::equal_range(non_random_iterator(std::begin(dataEQ)), non_random_iterator(std::end(dataEQ)), i); + ETL_OR_STD::pair lb1 = std::equal_range(std::begin(dataEQ), std::end(dataEQ), i); + ETL_OR_STD::pair, non_random_iterator> lb2 = etlstd::equal_range(non_random_iterator(std::begin(dataEQ)), non_random_iterator(std::end(dataEQ)), i); CHECK_EQUAL(std::distance(std::begin(dataEQ), lb1.first), std::distance(std::begin(dataEQ), lb2.first)); CHECK_EQUAL(std::distance(lb1.first, lb1.second), std::distance(lb2.first, lb2.second)); @@ -519,7 +648,7 @@ namespace int a = 1; int b = 2; - swap(a, b); + etlstd::swap(a, b); CHECK_EQUAL(2, a); CHECK_EQUAL(1, b); } @@ -764,46 +893,6 @@ namespace CHECK(isEqual); } - //************************************************************************* - TEST(transform_safer) - { - struct Function - { - int operator()(int d) const - { - return d * 2; - } - }; - - int* p1 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataD1), Function()); - int* p2 = etl::transform(std::begin(dataS), std::end(dataS), std::begin(dataD2), std::end(dataD2), Function()); - - CHECK(p2 == std::end(dataD2)); - - bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(transform2) - { - struct Function - { - int operator()(int d1, int d2) const - { - return d1 + d2; - } - }; - - int* p1 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataA), std::begin(dataD1), Function()); - int* p2 = etl::transform(std::begin(dataS), std::end(dataS), std::begin(dataA), std::begin(dataD2), Function()); - - CHECK(p2 == std::end(dataD2)); - - bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2)); - CHECK(isEqual); - } - //************************************************************************* TEST(move) { @@ -915,5 +1004,152 @@ namespace CHECK(isEqual); } } + + //************************************************************************* + TEST(any_of) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + bool expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + bool result = etlstd::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + + expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + result = etlstd::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + CHECK_EQUAL(expected, result); + } + + //************************************************************************* + TEST(all_of) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + bool expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + bool result = etlstd::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + CHECK_EQUAL(expected, result); + + expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + result = etlstd::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + } + + //************************************************************************* + TEST(none_of) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + bool expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); + bool result = etlstd::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); + CHECK_EQUAL(expected, result); + + expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + result = etlstd::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + } + + struct Compare + { + bool operator()(int a, int b) const + { + return a == b; + } + }; + + //************************************************************************* + TEST(is_permutation) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + int permutation[] = { 1, 3, 2, 4, 7, 6, 5, 8 }; + int not_permutation[] = { 1, 2, 3, 4, 5, 6, 7, 7 }; + + bool is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation)); + CHECK(is_permutation); + + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation)); + CHECK(!is_permutation); + + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::equal_to()); + CHECK(is_permutation); + + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::equal_to()); + CHECK(!is_permutation); + + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation)); + CHECK(is_permutation); + + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation)); + CHECK(!is_permutation); + + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation), std::equal_to()); + CHECK(is_permutation); + + is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation), std::equal_to()); + CHECK(!is_permutation); + } + + //************************************************************************* + TEST(is_partitioned) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + + bool expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + bool result = etlstd::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + + std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + + expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + result = etlstd::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + } + + //************************************************************************* + TEST(partition_point) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + + std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + + int* partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + int* partition2 = etlstd::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); + + std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); + + partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + partition2 = etlstd::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); + } + + //************************************************************************* + TEST(partition_copy) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + int data4[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + int data5[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + std::partition_copy(std::begin(data1), std::end(data1), std::begin(data2), std::begin(data3), std::bind(std::greater(), std::placeholders::_1, 4)); + etlstd::partition_copy(std::begin(data1), std::end(data1), std::begin(data4), std::begin(data5), std::bind(std::greater(), std::placeholders::_1, 4)); + + bool are_equal; + + are_equal = std::equal(std::begin(data2), std::end(data2), std::begin(data4)); + CHECK(are_equal); + + are_equal = std::equal(std::begin(data3), std::end(data3), std::begin(data5)); + CHECK(are_equal); + } + + //************************************************************************* + TEST(find_if_not) + { + int data1[] = { 1, 2, 3, 5, 6, 7, 8 }; + + // Find the element not less than 4. + int* p = etlstd::find_if_not(std::begin(data1), std::end(data1), std::bind(std::less(), std::placeholders::_1, 4)); + CHECK_EQUAL(5, *p); + } }; } diff --git a/test/test_no_stl_functional.cpp b/test/test_etlstl_functional.cpp similarity index 100% rename from test/test_no_stl_functional.cpp rename to test/test_etlstl_functional.cpp diff --git a/test/test_no_stl_iterator.cpp b/test/test_etlstl_iterator.cpp similarity index 100% rename from test/test_no_stl_iterator.cpp rename to test/test_etlstl_iterator.cpp diff --git a/test/test_no_stl_limits.cpp b/test/test_etlstl_limits.cpp similarity index 100% rename from test/test_no_stl_limits.cpp rename to test/test_etlstl_limits.cpp diff --git a/test/test_no_stl_utility.cpp b/test/test_etlstl_utility.cpp similarity index 100% rename from test/test_no_stl_utility.cpp rename to test/test_etlstl_utility.cpp diff --git a/test/test_flat_map.cpp b/test/test_flat_map.cpp index dc9fd88c..88615048 100644 --- a/test/test_flat_map.cpp +++ b/test/test_flat_map.cpp @@ -49,10 +49,10 @@ namespace typedef TestDataDC DC; typedef TestDataNDC NDC; - typedef ETL_PAIR ElementDC; - typedef ETL_PAIR ElementNDC; + typedef ETL_OR_STD::pair ElementDC; + typedef ETL_OR_STD::pair ElementNDC; - typedef ETL_PAIR ElementInt; + typedef ETL_OR_STD::pair ElementInt; typedef etl::flat_map DataDC; typedef etl::flat_map DataNDC; @@ -156,10 +156,10 @@ namespace return !(lhs == rhs); } - typedef ETL_PAIR Element1; - typedef ETL_PAIR Element2; - typedef ETL_PAIR Element3; - typedef ETL_PAIR Element4; + typedef ETL_OR_STD::pair Element1; + typedef ETL_OR_STD::pair Element2; + typedef ETL_OR_STD::pair Element3; + typedef ETL_OR_STD::pair Element4; typedef etl::flat_map Data1; typedef etl::flat_map Data2; @@ -592,7 +592,7 @@ namespace Compare_DataNDC compare_data; DataNDC data; - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.insert(ETL_MAKE_PAIR(0, N0)); compare_data.insert(ETL_MAKE_PAIR(0, N0)); @@ -636,8 +636,8 @@ namespace Compare_DataNDC compare_data; DataNDC data; - ETL_PAIR result1; - ETL_PAIR result2; + ETL_OR_STD::pair result1; + ETL_OR_STD::pair result2; result1 = data.insert(DataNDC::value_type(0, N0)); result2 = compare_data.insert(ETL_MAKE_PAIR(0, N0)); @@ -668,8 +668,8 @@ namespace Compare_DataNDC compare_data; DataNDC data; - ETL_PAIR dr; - ETL_PAIR cr; + ETL_OR_STD::pair dr; + ETL_OR_STD::pair cr; dr = data.insert(ETL_MAKE_PAIR(0, N0)); cr = compare_data.insert(ETL_MAKE_PAIR(0, N0)); @@ -749,7 +749,7 @@ namespace Compare1 compare; Data1 data; - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.emplace(0, "0"); compare.emplace(0, D1("0")); @@ -794,7 +794,7 @@ namespace Compare2 compare; Data2 data; - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.emplace(0, "0", "1"); compare.emplace(0, D2("0", "1")); @@ -839,7 +839,7 @@ namespace Compare3 compare; Data3 data; - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.emplace(0, "0", "1", "2"); compare.emplace(0, D3("0", "1", "2")); @@ -884,7 +884,7 @@ namespace Compare4 compare; Data4 data; - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.emplace(0, "0", "1", "2", "3"); compare.emplace(0, D4("0", "1", "2", "3")); @@ -1149,8 +1149,8 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare = compare_data.equal_range(5); - ETL_PAIR i_data = data.equal_range(5); + ETL_OR_STD::pair i_compare = compare_data.equal_range(5); + ETL_OR_STD::pair i_data = data.equal_range(5); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); @@ -1162,9 +1162,9 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare; + ETL_OR_STD::pair i_compare; - ETL_PAIR i_data; + ETL_OR_STD::pair i_data; i_data = data.equal_range(-1); CHECK_EQUAL(data.begin(), i_data.first); diff --git a/test/test_flat_multimap.cpp b/test/test_flat_multimap.cpp index fda15bfd..e341c21b 100644 --- a/test/test_flat_multimap.cpp +++ b/test/test_flat_multimap.cpp @@ -47,10 +47,10 @@ namespace typedef TestDataDC DC; typedef TestDataNDC NDC; - typedef ETL_PAIR ElementDC; - typedef ETL_PAIR ElementNDC; + typedef ETL_OR_STD::pair ElementDC; + typedef ETL_OR_STD::pair ElementNDC; - typedef ETL_PAIR ElementInt; + typedef ETL_OR_STD::pair ElementInt; typedef etl::flat_multimap DataDC; typedef etl::flat_multimap DataNDC; @@ -182,10 +182,10 @@ namespace return !(lhs == rhs); } - typedef ETL_PAIR Element1; - typedef ETL_PAIR Element2; - typedef ETL_PAIR Element3; - typedef ETL_PAIR Element4; + typedef ETL_OR_STD::pair Element1; + typedef ETL_OR_STD::pair Element2; + typedef ETL_OR_STD::pair Element3; + typedef ETL_OR_STD::pair Element4; typedef etl::flat_multimap Data1; typedef etl::flat_multimap Data2; @@ -921,8 +921,8 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare = compare_data.equal_range(5); - ETL_PAIR i_data = data.equal_range(5); + ETL_OR_STD::pair i_compare = compare_data.equal_range(5); + ETL_OR_STD::pair i_data = data.equal_range(5); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); @@ -933,7 +933,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_data; + ETL_OR_STD::pair i_data; i_data = data.equal_range(-1); CHECK_EQUAL(data.begin(), i_data.first); @@ -976,8 +976,8 @@ namespace Compare_DataNDC compare_data(multi_data.begin(), multi_data.end()); DataNDC data(multi_data.begin(), multi_data.end()); - ETL_PAIR compare_range; - ETL_PAIR test_range; + ETL_OR_STD::pair compare_range; + ETL_OR_STD::pair test_range; compare_range = compare_data.equal_range(0); test_range = data.equal_range(0); diff --git a/test/test_flat_multiset.cpp b/test/test_flat_multiset.cpp index 4be58a48..f3f38acb 100644 --- a/test/test_flat_multiset.cpp +++ b/test/test_flat_multiset.cpp @@ -884,8 +884,8 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare = compare_data.equal_range(N5); - ETL_PAIR i_data = data.equal_range(N5); + ETL_OR_STD::pair i_compare = compare_data.equal_range(N5); + ETL_OR_STD::pair i_data = data.equal_range(N5); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); @@ -896,7 +896,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_data; + ETL_OR_STD::pair i_data; i_data = data.equal_range(NX); CHECK_EQUAL(data.begin(), i_data.first); @@ -939,8 +939,8 @@ namespace Compare_DataNDC compare_data(multi_data.begin(), multi_data.end()); DataNDC data(multi_data.begin(), multi_data.end()); - ETL_PAIR compare_range; - ETL_PAIR test_range; + ETL_OR_STD::pair compare_range; + ETL_OR_STD::pair test_range; compare_range = compare_data.equal_range(N0); test_range = data.equal_range(N0); diff --git a/test/test_flat_set.cpp b/test/test_flat_set.cpp index bff725c4..4e6d9548 100644 --- a/test/test_flat_set.cpp +++ b/test/test_flat_set.cpp @@ -861,8 +861,8 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare = compare_data.equal_range(N5); - ETL_PAIR i_data = data.equal_range(N5); + ETL_OR_STD::pair i_compare = compare_data.equal_range(N5); + ETL_OR_STD::pair i_data = data.equal_range(N5); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); @@ -873,7 +873,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_data; + ETL_OR_STD::pair i_data; i_data = data.equal_range(NX); CHECK_EQUAL(data.begin(), i_data.first); diff --git a/test/test_map.cpp b/test/test_map.cpp index 5d85a90b..77ce0f57 100755 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -459,9 +459,9 @@ namespace Compare_Data compare_data; Data data; - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.insert(Data::value_type(std::string("0"), 0)); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("0"), 0)); // Check that both return successful return results @@ -554,9 +554,9 @@ namespace Compare_Data compare_data; Data data; - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.insert(Data::value_type(std::string("2"), 2)); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("2"), 2)); // Check that both return successful return results @@ -585,9 +585,9 @@ namespace Compare_Data compare_data; Data data; - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.insert(Data::value_type(std::string("2"), 2)); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("2"), 2)); // Check that both return successful return results @@ -666,10 +666,10 @@ namespace Compare_Data compare_data(random_data.begin(), random_data.end()); Data data(random_data.begin(), random_data.end()); - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.equal_range("2"); Data::iterator data_lb = data.lower_bound("2"); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.equal_range("2"); Compare_Data::iterator compare_data_lb = compare_data.lower_bound("2"); @@ -694,9 +694,9 @@ namespace const Compare_Data compare_data(initial_data.begin(), initial_data.end()); const Data data(initial_data.begin(), initial_data.end()); - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.equal_range("2"); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.equal_range("2"); // Check that both return the same return results @@ -1137,16 +1137,16 @@ namespace Data data(initial_data_even.begin(), initial_data_even.end()); Compare_Data compare(initial_data_even.begin(), initial_data_even.end()); - std::vector > tab(test_data.begin(), test_data.end()); + std::vector > tab(test_data.begin(), test_data.end()); //make sure both data and compare contain same elements - std::vector > data_elements(data.begin(), data.end()); - std::vector > compare_data_elements(compare.begin(), compare.end()); + std::vector > data_elements(data.begin(), data.end()); + std::vector > compare_data_elements(compare.begin(), compare.end()); CHECK(data_elements == compare_data_elements); CHECK_EQUAL(data_elements.size(), MAX_SIZE); - for(std::vector >::iterator it = tab.begin() ; it != tab.end() ; ++it) + for(std::vector >::iterator it = tab.begin() ; it != tab.end() ; ++it) { std::string i = it->first; @@ -1161,8 +1161,8 @@ namespace CHECK((*compare.lower_bound(i)) == (*data.lower_bound(i))); } - ETL_PAIR stlret = compare.equal_range(i); - ETL_PAIR etlret = data.equal_range(i); + ETL_OR_STD::pair stlret = compare.equal_range(i); + ETL_OR_STD::pair etlret = data.equal_range(i); CHECK_EQUAL(stlret.first == compare.end(), etlret.first == data.end()); if((stlret.first != compare.end()) && (etlret.first != data.end())) diff --git a/test/test_message_bus.cpp b/test/test_message_bus.cpp index db4dfba6..618b561e 100644 --- a/test/test_message_bus.cpp +++ b/test/test_message_bus.cpp @@ -207,7 +207,7 @@ namespace SUITE(test_message_router) { - //========================================================================= + //************************************************************************* TEST(message_bus_subscribe_unsubscribe) { etl::message_bus<2> bus1; @@ -243,7 +243,7 @@ namespace CHECK_EQUAL(0U, bus1.size()); } - //========================================================================= + //************************************************************************* TEST(message_bus_subscribe_unsubscribe_sub_bus) { etl::message_bus<4> bus1; @@ -272,7 +272,7 @@ namespace CHECK_EQUAL(0U, bus1.size()); } - //========================================================================= + //************************************************************************* TEST(message_bus_broadcast) { etl::message_bus<2> bus1; @@ -354,7 +354,7 @@ namespace CHECK_EQUAL(7, sender.message5_count); } - //========================================================================= + //************************************************************************* TEST(message_bus_broadcast_as_router) { etl::message_bus<2> bus1; @@ -439,7 +439,7 @@ namespace CHECK_EQUAL(7, sender.message5_count); } - //========================================================================= + //************************************************************************* TEST(message_bus_addressed) { etl::message_bus<2> bus1; @@ -539,7 +539,7 @@ namespace CHECK_EQUAL(4, sender.message5_count); } - //========================================================================= + //************************************************************************* TEST(message_bus_addressed_duplicate_router_id) { etl::message_bus<3> bus1; @@ -577,7 +577,7 @@ namespace CHECK_EQUAL(2, sender.message5_count); } - //========================================================================= + //************************************************************************* TEST(message_bus_broadcast_addressed_sub_bus) { etl::message_bus<3> bus1; @@ -688,7 +688,7 @@ namespace CHECK_EQUAL(6, sender.message5_count); } - //========================================================================= + //************************************************************************* TEST(message_bus_broadcast_order) { etl::message_bus<4> bus1; diff --git a/test/test_message_router.cpp b/test/test_message_router.cpp index 60f19273..81d232da 100644 --- a/test/test_message_router.cpp +++ b/test/test_message_router.cpp @@ -201,7 +201,7 @@ namespace SUITE(test_message_router) { - //========================================================================= + //************************************************************************* TEST(message_router) { Router1 r1; @@ -272,7 +272,7 @@ namespace CHECK_EQUAL(4, r1.callback_count); } - //========================================================================= + //************************************************************************* TEST(message_null_router) { Router2 router; @@ -329,7 +329,7 @@ namespace CHECK_EQUAL(1, router.message_unknown_count); } - //========================================================================= + //************************************************************************* TEST(message_router_accepts) { Router2 r2; @@ -350,7 +350,7 @@ namespace CHECK(r2.accepts(message5.message_id)); } - //========================================================================= + //************************************************************************* TEST(message_router_queue) { Router1 r1; @@ -418,7 +418,7 @@ namespace queue.pop(); } - //========================================================================= + //************************************************************************* TEST(message_router_successor) { Router1 r1; diff --git a/test/test_message_timer.cpp b/test/test_message_timer.cpp index c457e759..cc4b734a 100644 --- a/test/test_message_timer.cpp +++ b/test/test_message_timer.cpp @@ -137,7 +137,7 @@ namespace SUITE(test_message_timer) { - //========================================================================= + //************************************************************************* TEST(message_timer_too_many_timers) { etl::message_timer<2> timer_controller; @@ -155,7 +155,7 @@ namespace CHECK(id3 != etl::timer::id::NO_TIMER); } - //========================================================================= + //************************************************************************* TEST(message_timer_one_shot) { etl::message_timer<3> timer_controller; @@ -191,7 +191,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), router1.message3.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(message_timer_one_shot_after_timeout) { etl::message_timer<1> timer_controller; @@ -237,7 +237,7 @@ namespace CHECK(!timer_controller.stop(id1)); } - //========================================================================= + //************************************************************************* TEST(message_timer_repeating) { etl::message_timer<3> timer_controller; @@ -273,7 +273,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), router1.message3.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(message_timer_repeating_bigger_step) { etl::message_timer<3> timer_controller; @@ -313,7 +313,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), router1.message3.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(message_timer_repeating_stop_start) { etl::message_timer<3> timer_controller; @@ -360,7 +360,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), router1.message3.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(message_timer_repeating_register_unregister) { etl::message_timer<3> timer_controller; @@ -403,7 +403,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), router1.message3.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(message_timer_repeating_clear) { etl::message_timer<3> timer_controller; @@ -445,7 +445,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), router1.message3.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(message_timer_route_through_bus) { etl::message_timer<3> timer_controller; @@ -483,7 +483,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), router1.message3.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(message_timer_immediate_delayed) { etl::message_timer<3> timer_controller; @@ -524,7 +524,7 @@ namespace CHECK_ARRAY_EQUAL(compare3.data(), router1.message3.data(), compare3.size()); } - //========================================================================= + //************************************************************************* TEST(message_timer_one_shot_big_step_short_delay_insert) { etl::message_timer<3> timer_controller; @@ -556,7 +556,7 @@ namespace CHECK_ARRAY_EQUAL(compare2.data(), router1.message2.data(), compare2.size()); } - //========================================================================= + //************************************************************************* TEST(callback_timer_one_shot_empty_list_huge_tick_before_insert) { etl::message_timer<3> timer_controller; @@ -594,7 +594,7 @@ namespace CHECK_ARRAY_EQUAL(compare1.data(), router1.message1.data(), compare1.size()); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported diff --git a/test/test_multimap.cpp b/test/test_multimap.cpp index 27833bad..1c152cfe 100755 --- a/test/test_multimap.cpp +++ b/test/test_multimap.cpp @@ -125,88 +125,88 @@ namespace SetupFixture() { // Create a map of initial data - initial_data.insert(ETL_PAIR("0", 0)); - initial_data.insert(ETL_PAIR("0", 1)); - initial_data.insert(ETL_PAIR("1", 2)); - initial_data.insert(ETL_PAIR("1", 3)); - initial_data.insert(ETL_PAIR("1", 4)); - initial_data.insert(ETL_PAIR("2", 5)); - initial_data.insert(ETL_PAIR("2", 8)); - initial_data.insert(ETL_PAIR("2", 7)); - initial_data.insert(ETL_PAIR("3", 6)); - initial_data.insert(ETL_PAIR("4", 9)); + initial_data.insert(ETL_OR_STD::pair("0", 0)); + initial_data.insert(ETL_OR_STD::pair("0", 1)); + initial_data.insert(ETL_OR_STD::pair("1", 2)); + initial_data.insert(ETL_OR_STD::pair("1", 3)); + initial_data.insert(ETL_OR_STD::pair("1", 4)); + initial_data.insert(ETL_OR_STD::pair("2", 5)); + initial_data.insert(ETL_OR_STD::pair("2", 8)); + initial_data.insert(ETL_OR_STD::pair("2", 7)); + initial_data.insert(ETL_OR_STD::pair("3", 6)); + initial_data.insert(ETL_OR_STD::pair("4", 9)); // Create a multimap of excess data - excess_data.insert(ETL_PAIR("0", 0)); - excess_data.insert(ETL_PAIR("1", 1)); - excess_data.insert(ETL_PAIR("2", 2)); - excess_data.insert(ETL_PAIR("2", 3)); - excess_data.insert(ETL_PAIR("3", 6)); - excess_data.insert(ETL_PAIR("3", 5)); - excess_data.insert(ETL_PAIR("3", 4)); - excess_data.insert(ETL_PAIR("4", 7)); - excess_data.insert(ETL_PAIR("5", 8)); - excess_data.insert(ETL_PAIR("6", 9)); - excess_data.insert(ETL_PAIR("10", 10)); + excess_data.insert(ETL_OR_STD::pair("0", 0)); + excess_data.insert(ETL_OR_STD::pair("1", 1)); + excess_data.insert(ETL_OR_STD::pair("2", 2)); + excess_data.insert(ETL_OR_STD::pair("2", 3)); + excess_data.insert(ETL_OR_STD::pair("3", 6)); + excess_data.insert(ETL_OR_STD::pair("3", 5)); + excess_data.insert(ETL_OR_STD::pair("3", 4)); + excess_data.insert(ETL_OR_STD::pair("4", 7)); + excess_data.insert(ETL_OR_STD::pair("5", 8)); + excess_data.insert(ETL_OR_STD::pair("6", 9)); + excess_data.insert(ETL_OR_STD::pair("10", 10)); // Create a multimap of different data - different_data.insert(ETL_PAIR("10", 10)); - different_data.insert(ETL_PAIR("11", 11)); - different_data.insert(ETL_PAIR("12", 12)); - different_data.insert(ETL_PAIR("13", 13)); - different_data.insert(ETL_PAIR("14", 14)); - different_data.insert(ETL_PAIR("15", 15)); - different_data.insert(ETL_PAIR("16", 16)); - different_data.insert(ETL_PAIR("17", 17)); - different_data.insert(ETL_PAIR("18", 18)); - different_data.insert(ETL_PAIR("19", 19)); + different_data.insert(ETL_OR_STD::pair("10", 10)); + different_data.insert(ETL_OR_STD::pair("11", 11)); + different_data.insert(ETL_OR_STD::pair("12", 12)); + different_data.insert(ETL_OR_STD::pair("13", 13)); + different_data.insert(ETL_OR_STD::pair("14", 14)); + different_data.insert(ETL_OR_STD::pair("15", 15)); + different_data.insert(ETL_OR_STD::pair("16", 16)); + different_data.insert(ETL_OR_STD::pair("17", 17)); + different_data.insert(ETL_OR_STD::pair("18", 18)); + different_data.insert(ETL_OR_STD::pair("19", 19)); // Create a multimap of random data - random_data.insert(ETL_PAIR("3", 6)); - random_data.insert(ETL_PAIR("3", 5)); - random_data.insert(ETL_PAIR("0", 0)); - random_data.insert(ETL_PAIR("5", 8)); - random_data.insert(ETL_PAIR("6", 9)); - random_data.insert(ETL_PAIR("2", 2)); - random_data.insert(ETL_PAIR("0", 1)); - random_data.insert(ETL_PAIR("2", 3)); - random_data.insert(ETL_PAIR("4", 7)); - random_data.insert(ETL_PAIR("3", 4)); + random_data.insert(ETL_OR_STD::pair("3", 6)); + random_data.insert(ETL_OR_STD::pair("3", 5)); + random_data.insert(ETL_OR_STD::pair("0", 0)); + random_data.insert(ETL_OR_STD::pair("5", 8)); + random_data.insert(ETL_OR_STD::pair("6", 9)); + random_data.insert(ETL_OR_STD::pair("2", 2)); + random_data.insert(ETL_OR_STD::pair("0", 1)); + random_data.insert(ETL_OR_STD::pair("2", 3)); + random_data.insert(ETL_OR_STD::pair("4", 7)); + random_data.insert(ETL_OR_STD::pair("3", 4)); //even values - initial_data_even.insert(ETL_PAIR("00", 0)); - initial_data_even.insert(ETL_PAIR("02", 2)); - initial_data_even.insert(ETL_PAIR("04", 4)); - initial_data_even.insert(ETL_PAIR("06", 6)); - initial_data_even.insert(ETL_PAIR("08", 8)); - initial_data_even.insert(ETL_PAIR("10", 10)); - initial_data_even.insert(ETL_PAIR("12", 12)); - initial_data_even.insert(ETL_PAIR("14", 14)); - initial_data_even.insert(ETL_PAIR("16", 16)); - initial_data_even.insert(ETL_PAIR("18", 18)); + initial_data_even.insert(ETL_OR_STD::pair("00", 0)); + initial_data_even.insert(ETL_OR_STD::pair("02", 2)); + initial_data_even.insert(ETL_OR_STD::pair("04", 4)); + initial_data_even.insert(ETL_OR_STD::pair("06", 6)); + initial_data_even.insert(ETL_OR_STD::pair("08", 8)); + initial_data_even.insert(ETL_OR_STD::pair("10", 10)); + initial_data_even.insert(ETL_OR_STD::pair("12", 12)); + initial_data_even.insert(ETL_OR_STD::pair("14", 14)); + initial_data_even.insert(ETL_OR_STD::pair("16", 16)); + initial_data_even.insert(ETL_OR_STD::pair("18", 18)); //test set - test_data.insert(ETL_PAIR("00", 0)); - test_data.insert(ETL_PAIR("01", 1)); - test_data.insert(ETL_PAIR("02", 2)); - test_data.insert(ETL_PAIR("03", 3)); - test_data.insert(ETL_PAIR("04", 4)); - test_data.insert(ETL_PAIR("05", 5)); - test_data.insert(ETL_PAIR("06", 6)); - test_data.insert(ETL_PAIR("07", 7)); - test_data.insert(ETL_PAIR("08", 8)); - test_data.insert(ETL_PAIR("09", 9)); - test_data.insert(ETL_PAIR("10", 10)); - test_data.insert(ETL_PAIR("11", 11)); - test_data.insert(ETL_PAIR("12", 12)); - test_data.insert(ETL_PAIR("13", 13)); - test_data.insert(ETL_PAIR("14", 14)); - test_data.insert(ETL_PAIR("15", 15)); - test_data.insert(ETL_PAIR("16", 16)); - test_data.insert(ETL_PAIR("17", 17)); - test_data.insert(ETL_PAIR("18", 18)); - test_data.insert(ETL_PAIR("19", 19)); + test_data.insert(ETL_OR_STD::pair("00", 0)); + test_data.insert(ETL_OR_STD::pair("01", 1)); + test_data.insert(ETL_OR_STD::pair("02", 2)); + test_data.insert(ETL_OR_STD::pair("03", 3)); + test_data.insert(ETL_OR_STD::pair("04", 4)); + test_data.insert(ETL_OR_STD::pair("05", 5)); + test_data.insert(ETL_OR_STD::pair("06", 6)); + test_data.insert(ETL_OR_STD::pair("07", 7)); + test_data.insert(ETL_OR_STD::pair("08", 8)); + test_data.insert(ETL_OR_STD::pair("09", 9)); + test_data.insert(ETL_OR_STD::pair("10", 10)); + test_data.insert(ETL_OR_STD::pair("11", 11)); + test_data.insert(ETL_OR_STD::pair("12", 12)); + test_data.insert(ETL_OR_STD::pair("13", 13)); + test_data.insert(ETL_OR_STD::pair("14", 14)); + test_data.insert(ETL_OR_STD::pair("15", 15)); + test_data.insert(ETL_OR_STD::pair("16", 16)); + test_data.insert(ETL_OR_STD::pair("17", 17)); + test_data.insert(ETL_OR_STD::pair("18", 18)); + test_data.insert(ETL_OR_STD::pair("19", 19)); } }; @@ -551,9 +551,9 @@ namespace Data data(random_data.begin(), random_data.end()); // Test a number not available - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.equal_range("1"); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.equal_range("1"); // Check that both return the same return results @@ -576,9 +576,9 @@ namespace const Data data(initial_data.begin(), initial_data.end()); // Test a number with several of the same key - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.equal_range("2"); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.equal_range("2"); // Check that both return the same return results @@ -1094,16 +1094,16 @@ namespace Data data(initial_data_even.begin(), initial_data_even.end()); Compare_Data compare(initial_data_even.begin(), initial_data_even.end()); - std::vector > tab(test_data.begin(), test_data.end()); + std::vector > tab(test_data.begin(), test_data.end()); //make sure both data and compare contain same elements - std::vector > data_elements(data.begin(), data.end()); - std::vector > compare_data_elements(compare.begin(), compare.end()); + std::vector > data_elements(data.begin(), data.end()); + std::vector > compare_data_elements(compare.begin(), compare.end()); CHECK(data_elements == compare_data_elements); CHECK_EQUAL(data_elements.size(), MAX_SIZE); - for(std::vector >::iterator it = tab.begin() ; it != tab.end() ; ++it) + for(std::vector >::iterator it = tab.begin() ; it != tab.end() ; ++it) { std::string i = it->first; @@ -1118,8 +1118,8 @@ namespace CHECK((*compare.lower_bound(i)) == (*data.lower_bound(i))); } - ETL_PAIR stlret = compare.equal_range(i); - ETL_PAIR etlret = data.equal_range(i); + ETL_OR_STD::pair stlret = compare.equal_range(i); + ETL_OR_STD::pair etlret = data.equal_range(i); CHECK_EQUAL(stlret.first == compare.end(), etlret.first == data.end()); if((stlret.first != compare.end()) && (etlret.first != data.end())) diff --git a/test/test_multiset.cpp b/test/test_multiset.cpp index 59364610..03bd1140 100755 --- a/test/test_multiset.cpp +++ b/test/test_multiset.cpp @@ -521,9 +521,9 @@ namespace Data data(random_data.begin(), random_data.end()); // Test a number not available - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.equal_range(1); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.equal_range(1); // Check that both return the same return results @@ -544,9 +544,9 @@ namespace const Data data(initial_data.begin(), initial_data.end()); // Test a number with several of the same key - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.equal_range(2); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.equal_range(2); // Check that both return the same return results @@ -1076,8 +1076,8 @@ namespace CHECK((*compare.lower_bound(i)) == (*data.lower_bound(i))); } - ETL_PAIR stlret = compare.equal_range(i); - ETL_PAIR etlret = data.equal_range(i); + ETL_OR_STD::pair stlret = compare.equal_range(i); + ETL_OR_STD::pair etlret = data.equal_range(i); CHECK_EQUAL(stlret.first == compare.end(), etlret.first == data.end()); if((stlret.first != compare.end()) && (etlret.first != data.end())) diff --git a/test/test_queue_mpmc_mutex.cpp b/test/test_queue_mpmc_mutex.cpp index 8b3ec572..bbe9598d 100644 --- a/test/test_queue_mpmc_mutex.cpp +++ b/test/test_queue_mpmc_mutex.cpp @@ -311,7 +311,7 @@ namespace CHECK(queue.full()); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define SET_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL) diff --git a/test/test_queue_mpmc_mutex_small.cpp b/test/test_queue_mpmc_mutex_small.cpp index 2f3909b2..4aab31be 100644 --- a/test/test_queue_mpmc_mutex_small.cpp +++ b/test/test_queue_mpmc_mutex_small.cpp @@ -329,7 +329,7 @@ namespace CHECK(queue.full()); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define SET_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL) diff --git a/test/test_queue_spsc_atomic.cpp b/test/test_queue_spsc_atomic.cpp index 42cb318a..3c5805f5 100644 --- a/test/test_queue_spsc_atomic.cpp +++ b/test/test_queue_spsc_atomic.cpp @@ -301,7 +301,7 @@ namespace CHECK(queue.full()); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define FIX_PROCESSOR_AFFINITY1 SetThreadAffinityMask(GetCurrentThread(), 1); diff --git a/test/test_queue_spsc_atomic_small.cpp b/test/test_queue_spsc_atomic_small.cpp index 650a9dcd..4a8fe798 100644 --- a/test/test_queue_spsc_atomic_small.cpp +++ b/test/test_queue_spsc_atomic_small.cpp @@ -319,7 +319,7 @@ namespace CHECK(queue.full()); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define FIX_PROCESSOR_AFFINITY1 SetThreadAffinityMask(GetCurrentThread(), 1); diff --git a/test/test_queue_spsc_isr.cpp b/test/test_queue_spsc_isr.cpp index 56516beb..69a8a9c4 100644 --- a/test/test_queue_spsc_isr.cpp +++ b/test/test_queue_spsc_isr.cpp @@ -531,7 +531,7 @@ namespace CHECK(!Access::called_unlock); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) diff --git a/test/test_queue_spsc_isr_small.cpp b/test/test_queue_spsc_isr_small.cpp index ca5f4f22..8e874fda 100644 --- a/test/test_queue_spsc_isr_small.cpp +++ b/test/test_queue_spsc_isr_small.cpp @@ -549,7 +549,7 @@ namespace CHECK(!Access::called_unlock); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) diff --git a/test/test_queue_spsc_locked.cpp b/test/test_queue_spsc_locked.cpp index 60f4a31e..ea09280f 100644 --- a/test/test_queue_spsc_locked.cpp +++ b/test/test_queue_spsc_locked.cpp @@ -534,7 +534,7 @@ namespace CHECK(!access.called_unlock); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) diff --git a/test/test_queue_spsc_locked_small.cpp b/test/test_queue_spsc_locked_small.cpp index 30bedefb..1f32d8c0 100644 --- a/test/test_queue_spsc_locked_small.cpp +++ b/test/test_queue_spsc_locked_small.cpp @@ -551,7 +551,7 @@ namespace CHECK(!access.called_unlock); } - //========================================================================= + //************************************************************************* #if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) diff --git a/test/test_random.cpp b/test/test_random.cpp index 66409a78..3c06473f 100644 --- a/test/test_random.cpp +++ b/test/test_random.cpp @@ -41,7 +41,7 @@ namespace { SUITE(test_random) { - //========================================================================= + //************************************************************************* TEST(test_random_xorshift_sequence) { std::vector out1(10000); @@ -77,7 +77,7 @@ namespace file.close(); } - //========================================================================= + //************************************************************************* TEST(test_random_xorshift_range) { etl::random_xorshift r; @@ -94,7 +94,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(test_random_lcg_sequence) { std::vector out1(10000); @@ -130,7 +130,7 @@ namespace file.close(); } - //========================================================================= + //************************************************************************* TEST(test_random_lcg_range) { etl::random_lcg r; @@ -147,7 +147,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(test_random_clcg_sequence) { std::vector out1(10000); @@ -183,7 +183,7 @@ namespace file.close(); } - //========================================================================= + //************************************************************************* TEST(test_random_clcg_range) { etl::random_clcg r; @@ -200,7 +200,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(test_random_lfsr_sequence) { std::vector out1(10000); @@ -236,7 +236,7 @@ namespace file.close(); } - //========================================================================= + //************************************************************************* TEST(test_random_lfsr_range) { etl::random_lsfr r; @@ -253,7 +253,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(test_random_mwc_sequence) { std::vector out1(10000); @@ -289,7 +289,7 @@ namespace file.close(); } - //========================================================================= + //************************************************************************* TEST(test_random_mwc_range) { etl::random_mwc r; @@ -306,7 +306,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(test_random_pcg_sequence) { std::vector out1(10000); @@ -342,7 +342,7 @@ namespace file.close(); } - //========================================================================= + //************************************************************************* TEST(test_random_pcg_range) { etl::random_pcg r; @@ -359,7 +359,7 @@ namespace } } - //========================================================================= + //************************************************************************* TEST(test_random_hash_sequence) { std::vector out1(10000); @@ -395,7 +395,7 @@ namespace file.close(); } - //========================================================================= + //************************************************************************* TEST(test_random_hash_range) { etl::random_hash r; diff --git a/test/test_reference_flat_map.cpp b/test/test_reference_flat_map.cpp index 78af12cf..4eb80a6f 100644 --- a/test/test_reference_flat_map.cpp +++ b/test/test_reference_flat_map.cpp @@ -49,8 +49,8 @@ namespace typedef TestDataDC DC; typedef TestDataNDC NDC; - typedef ETL_PAIR ElementDC; - typedef ETL_PAIR ElementNDC; + typedef ETL_OR_STD::pair ElementDC; + typedef ETL_OR_STD::pair ElementNDC; typedef etl::reference_flat_map DataDC; typedef etl::reference_flat_map DataNDC; @@ -386,7 +386,7 @@ namespace Compare_DataNDC compare_data; DataNDC data; - ETL_PAIR result; + ETL_OR_STD::pair result; DataNDC::value_type item(0, N0); result = data.insert(item); @@ -433,8 +433,8 @@ namespace Compare_DataNDC compare_data; DataNDC data; - ETL_PAIR result1; - ETL_PAIR result2; + ETL_OR_STD::pair result1; + ETL_OR_STD::pair result2; DataNDC::value_type item(0, N0); result1 = data.insert(item); @@ -738,8 +738,8 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare = compare_data.equal_range(5); - ETL_PAIR i_data = data.equal_range(5); + ETL_OR_STD::pair i_compare = compare_data.equal_range(5); + ETL_OR_STD::pair i_data = data.equal_range(5); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); @@ -751,9 +751,9 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare; + ETL_OR_STD::pair i_compare; - ETL_PAIR i_data; + ETL_OR_STD::pair i_data; i_data = data.equal_range(-1); CHECK_EQUAL(data.begin(), i_data.first); diff --git a/test/test_reference_flat_multimap.cpp b/test/test_reference_flat_multimap.cpp index 1e9fab53..a260d189 100644 --- a/test/test_reference_flat_multimap.cpp +++ b/test/test_reference_flat_multimap.cpp @@ -47,8 +47,8 @@ namespace typedef TestDataDC DC; typedef TestDataNDC NDC; - typedef ETL_PAIR ElementDC; - typedef ETL_PAIR ElementNDC; + typedef ETL_OR_STD::pair ElementDC; + typedef ETL_OR_STD::pair ElementNDC; typedef etl::reference_flat_multimap DataDC; typedef etl::reference_flat_multimap DataNDC; @@ -569,8 +569,8 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare = compare_data.equal_range(5); - ETL_PAIR i_data = data.equal_range(5); + ETL_OR_STD::pair i_compare = compare_data.equal_range(5); + ETL_OR_STD::pair i_data = data.equal_range(5); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); @@ -581,7 +581,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_data; + ETL_OR_STD::pair i_data; i_data = data.equal_range(-1); CHECK_EQUAL(data.begin(), i_data.first); @@ -624,8 +624,8 @@ namespace Compare_DataNDC compare_data(multi_data.begin(), multi_data.end()); DataNDC data(multi_data.begin(), multi_data.end()); - ETL_PAIR compare_range; - ETL_PAIR test_range; + ETL_OR_STD::pair compare_range; + ETL_OR_STD::pair test_range; compare_range = compare_data.equal_range(0); test_range = data.equal_range(0); diff --git a/test/test_reference_flat_multiset.cpp b/test/test_reference_flat_multiset.cpp index d3f39763..bd920947 100644 --- a/test/test_reference_flat_multiset.cpp +++ b/test/test_reference_flat_multiset.cpp @@ -548,8 +548,8 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare = compare_data.equal_range(N5); - ETL_PAIR i_data = data.equal_range(N5); + ETL_OR_STD::pair i_compare = compare_data.equal_range(N5); + ETL_OR_STD::pair i_data = data.equal_range(N5); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); @@ -560,7 +560,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_data; + ETL_OR_STD::pair i_data; i_data = data.equal_range(NX); CHECK_EQUAL(data.begin(), i_data.first); @@ -603,8 +603,8 @@ namespace Compare_DataNDC compare_data(multi_data.begin(), multi_data.end()); DataNDC data(multi_data.begin(), multi_data.end()); - ETL_PAIR compare_range; - ETL_PAIR test_range; + ETL_OR_STD::pair compare_range; + ETL_OR_STD::pair test_range; compare_range = compare_data.equal_range(N0); test_range = data.equal_range(N0); diff --git a/test/test_reference_flat_set.cpp b/test/test_reference_flat_set.cpp index be2bab13..c88321b3 100644 --- a/test/test_reference_flat_set.cpp +++ b/test/test_reference_flat_set.cpp @@ -550,8 +550,8 @@ namespace Compare_DataNDC compare_data(initial_data.begin(), initial_data.end()); DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_compare = compare_data.equal_range(N5); - ETL_PAIR i_data = data.equal_range(N5); + ETL_OR_STD::pair i_compare = compare_data.equal_range(N5); + ETL_OR_STD::pair i_data = data.equal_range(N5); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.first), std::distance(data.begin(), i_data.first)); CHECK_EQUAL(std::distance(compare_data.begin(), i_compare.second), std::distance(data.begin(), i_data.second)); @@ -562,7 +562,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR i_data; + ETL_OR_STD::pair i_data; i_data = data.equal_range(NX); CHECK_EQUAL(data.begin(), i_data.first); diff --git a/test/test_set.cpp b/test/test_set.cpp index b96c3a5d..146336c8 100755 --- a/test/test_set.cpp +++ b/test/test_set.cpp @@ -377,9 +377,9 @@ namespace Compare_Data compare_data; Data data; - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.insert(0); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.insert(0); // Check that both return successful return results @@ -423,8 +423,8 @@ namespace Compare_Data compare_data; Data data; - ETL_PAIR data_result = data.insert(2); - ETL_PAIR compare_result = compare_data.insert(2); + ETL_OR_STD::pair data_result = data.insert(2); + ETL_OR_STD::pair compare_result = compare_data.insert(2); // Check that both return successful return results CHECK_EQUAL(*data_result.first, *compare_result.first); @@ -451,9 +451,9 @@ namespace Compare_Data compare_data; Data data; - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.insert(2); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.insert(2); // Check that both return successful return results @@ -529,8 +529,8 @@ namespace //Compare_Data compare_data; //Data data; - //ETL_PAIR data_result = data.emplace(0); - //ETL_PAIR compare_result = compare_data.emplace(0); + //ETL_OR_STD::pair data_result = data.emplace(0); + //ETL_OR_STD::pair compare_result = compare_data.emplace(0); //// Check that both return successful return results //CHECK_EQUAL(*data_result.first, *compare_result.first); @@ -573,10 +573,10 @@ namespace Compare_Data compare_data(random_data.begin(), random_data.end()); Data data(random_data.begin(), random_data.end()); - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.equal_range(2); Data::iterator data_lb = data.lower_bound(2); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.equal_range(2); Compare_Data::iterator compare_data_lb = compare_data.lower_bound(2); @@ -598,9 +598,9 @@ namespace const Compare_Data compare_data(initial_data.begin(), initial_data.end()); const Data data(initial_data.begin(), initial_data.end()); - ETL_PAIR data_result = + ETL_OR_STD::pair data_result = data.equal_range(2); - ETL_PAIR compare_result = + ETL_OR_STD::pair compare_result = compare_data.equal_range(2); // Check that both return the same return results @@ -1057,8 +1057,8 @@ namespace CHECK_EQUAL(*compare.lower_bound(i), *data.lower_bound(i)); } - ETL_PAIR stlret = compare.equal_range(i); - ETL_PAIR etlret = data.equal_range(i); + ETL_OR_STD::pair stlret = compare.equal_range(i); + ETL_OR_STD::pair etlret = data.equal_range(i); CHECK_EQUAL(stlret.first == compare.end(), etlret.first == data.end()); if((stlret.first != compare.end()) && (etlret.first != data.end())) diff --git a/test/test_task_scheduler.cpp b/test/test_task_scheduler.cpp index 7772857d..08e83222 100644 --- a/test/test_task_scheduler.cpp +++ b/test/test_task_scheduler.cpp @@ -160,7 +160,7 @@ namespace { SUITE(test_task_scheduler) { - //========================================================================= + //************************************************************************* TEST(test_scheduler_sequencial_single) { SchedulerSequencialSingle s; @@ -185,7 +185,7 @@ namespace CHECK(common.watchdog_called); } - //========================================================================= + //************************************************************************* TEST(test_scheduler_sequencial_multiple) { SchedulerSequencialMultiple s; @@ -210,7 +210,7 @@ namespace CHECK(common.watchdog_called); } - //========================================================================= + //************************************************************************* TEST(test_scheduler_highest_priority) { SchedulerHighestPriority s; @@ -235,7 +235,7 @@ namespace CHECK(common.watchdog_called); } - //========================================================================= + //************************************************************************* TEST(test_scheduler_most_work) { SchedulerMostWork s; diff --git a/test/test_type_def.cpp b/test/test_type_def.cpp index dbeb32dd..1f4b86ca 100644 --- a/test/test_type_def.cpp +++ b/test/test_type_def.cpp @@ -36,7 +36,7 @@ namespace { SUITE(test_type_def) { - //========================================================================= + //************************************************************************* TEST(test_macro) { ETL_TYPEDEF(uint32_t, type1_t); @@ -51,7 +51,7 @@ namespace CHECK_EQUAL(i1, i2); } - //========================================================================= + //************************************************************************* TEST(test_implicit) { class type1_t_tag; @@ -69,7 +69,7 @@ namespace CHECK_EQUAL(i1, i2); } - //========================================================================= + //************************************************************************* TEST(test_get) { class type1_t_tag; @@ -84,7 +84,7 @@ namespace CHECK_EQUAL(t1.get(), t2.get()); } - //========================================================================= + //************************************************************************* TEST(test_operators) { class __type_t__; @@ -119,7 +119,7 @@ namespace CHECK_EQUAL(0x1234U, uint32_t(t)); } - //========================================================================= + //************************************************************************* TEST(test_comparisons) { class __type_t__; diff --git a/test/test_unordered_map.cpp b/test/test_unordered_map.cpp index 25d23620..0df2c4fd 100644 --- a/test/test_unordered_map.cpp +++ b/test/test_unordered_map.cpp @@ -79,8 +79,8 @@ namespace typedef TestDataDC DC; typedef TestDataNDC NDC; - typedef ETL_PAIR ElementDC; - typedef ETL_PAIR ElementNDC; + typedef ETL_OR_STD::pair ElementDC; + typedef ETL_OR_STD::pair ElementNDC; typedef etl::unordered_map DataDC; typedef etl::unordered_map DataNDC; @@ -580,7 +580,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.equal_range(K0); CHECK(result.first == data.begin()); @@ -606,7 +606,7 @@ namespace { const DataNDC data(initial_data.begin(), initial_data.end()); - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.equal_range(K0); CHECK(result.first == data.begin()); diff --git a/test/test_unordered_multimap.cpp b/test/test_unordered_multimap.cpp index 3583de22..9173dfba 100644 --- a/test/test_unordered_multimap.cpp +++ b/test/test_unordered_multimap.cpp @@ -77,8 +77,8 @@ namespace typedef TestDataDC DC; typedef TestDataNDC NDC; - typedef ETL_PAIR ElementDC; - typedef ETL_PAIR ElementNDC; + typedef ETL_OR_STD::pair ElementDC; + typedef ETL_OR_STD::pair ElementNDC; typedef etl::unordered_multimap DataDC; typedef etl::unordered_multimap DataNDC; @@ -506,7 +506,7 @@ namespace { DataNDC data(equal_data.begin(), equal_data.end()); - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.equal_range(K10); CHECK(result.first == data.begin()); @@ -532,7 +532,7 @@ namespace { const DataNDC data(equal_data.begin(), equal_data.end()); - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.equal_range(K10); CHECK(result.first == data.begin()); diff --git a/test/test_unordered_multiset.cpp b/test/test_unordered_multiset.cpp index 7bfac162..83534f0c 100644 --- a/test/test_unordered_multiset.cpp +++ b/test/test_unordered_multiset.cpp @@ -430,7 +430,7 @@ namespace { DataNDC data(equal_data.begin(), equal_data.end()); - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.equal_range(N0); CHECK(result.first == data.begin()); @@ -456,7 +456,7 @@ namespace { const DataNDC data(equal_data.begin(), equal_data.end()); - ETL_PAIR result; + ETL_OR_STD::pair result; result = data.equal_range(N0); CHECK(result.first == data.begin()); diff --git a/test/test_utility.cpp b/test/test_utility.cpp index ac29ed19..f85f4969 100644 --- a/test/test_utility.cpp +++ b/test/test_utility.cpp @@ -50,7 +50,7 @@ namespace { SUITE(test_utility) { - //========================================================================= + //************************************************************************* TEST(test_exchange) { int a = 1; @@ -62,7 +62,7 @@ namespace CHECK_EQUAL(1, c); } - //========================================================================= + //************************************************************************* TEST(test_exchange_const) { int a = 1; @@ -74,7 +74,7 @@ namespace CHECK_EQUAL(1, c); } - //========================================================================= + //************************************************************************* TEST(test_as_const) { std::string text = "Hello World!"; diff --git a/test/vs2017/etl.vcxproj b/test/vs2017/etl.vcxproj index db8603b9..93bf097d 100644 --- a/test/vs2017/etl.vcxproj +++ b/test/vs2017/etl.vcxproj @@ -946,6 +946,11 @@ + + + + + @@ -953,7 +958,6 @@ - ../../../unittest-cpp ../../../unittest-cpp @@ -1163,10 +1167,7 @@ - - - - + false diff --git a/test/vs2017/etl.vcxproj.filters b/test/vs2017/etl.vcxproj.filters index e27c2993..136ea508 100644 --- a/test/vs2017/etl.vcxproj.filters +++ b/test/vs2017/etl.vcxproj.filters @@ -1196,18 +1196,6 @@ UnitTest++\Win32 - - Source Files - - - Source Files - - - Source Files - - - Source Files - Source Files @@ -1226,9 +1214,6 @@ Source Files - - Source Files - Source Files @@ -1289,6 +1274,24 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + From b99be4b2496cee742be6494f8cf7803a596f3920 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 4 Jan 2020 19:47:40 +0000 Subject: [PATCH 3/6] Work in progress --- include/etl/limits.h | 12 +-- include/etl/parameter_type.h | 6 +- include/etl/utility.h | 15 ++++ ...lgorithm.cpp => test_etlstd_algorithm.cpp} | 0 ...ctional.cpp => test_etlstd_functional.cpp} | 24 +++--- ..._iterator.cpp => test_etlstd_iterator.cpp} | 76 +++++++++---------- ...lstl_limits.cpp => test_etlstd_limits.cpp} | 0 ...traits.cpp => test_etlstd_type_traits.cpp} | 0 ...tl_utility.cpp => test_etlstd_utility.cpp} | 32 ++++---- test/vs2017/etl.vcxproj | 12 +-- test/vs2017/etl.vcxproj.filters | 16 ++-- 11 files changed, 104 insertions(+), 89 deletions(-) rename test/{test_etlstl_algorithm.cpp => test_etlstd_algorithm.cpp} (100%) rename test/{test_etlstl_functional.cpp => test_etlstd_functional.cpp} (80%) rename test/{test_etlstl_iterator.cpp => test_etlstd_iterator.cpp} (71%) rename test/{test_etlstl_limits.cpp => test_etlstd_limits.cpp} (100%) rename test/{test_type_traits.cpp => test_etlstd_type_traits.cpp} (100%) rename test/{test_etlstl_utility.cpp => test_etlstd_utility.cpp} (83%) diff --git a/include/etl/limits.h b/include/etl/limits.h index c8ad62c9..5ee6c417 100644 --- a/include/etl/limits.h +++ b/include/etl/limits.h @@ -49,18 +49,18 @@ namespace etlstd enum float_round_style { - round_indeterminate = -1, - round_toward_zero = 0, - round_to_nearest = 1, - round_toward_infinity = 2, + 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 + denorm_absent = 0, + denorm_present = 1 }; //*************************************************************************** diff --git a/include/etl/parameter_type.h b/include/etl/parameter_type.h index d0694544..a8587c71 100644 --- a/include/etl/parameter_type.h +++ b/include/etl/parameter_type.h @@ -43,9 +43,9 @@ namespace etl struct parameter_type { /// By default fundamental and pointer types are passed by value. - typedef typename etlstd::conditional::value || is_pointer::value, - T, - const T&>::type type; + typedef typename etlstd::conditional::value || is_pointer::value, + T, + const T&>::type type; }; } diff --git a/include/etl/utility.h b/include/etl/utility.h index ec357560..6bec4c24 100644 --- a/include/etl/utility.h +++ b/include/etl/utility.h @@ -34,6 +34,10 @@ SOFTWARE. #include "platform.h" #include "type_traits.h" +#if !defined(ETL_NO_STL) + #include +#endif + ///\defgroup utility utility ///\ingroup utilities @@ -159,6 +163,7 @@ namespace etlstd } #endif +#if defined(ETL_NO_STL) //*************************************************************************** /// exchange (const) //*************************************************************************** @@ -169,6 +174,16 @@ namespace etlstd object = new_value; return old_value; } +#else + //*************************************************************************** + /// exchange (const) + //*************************************************************************** + template + T exchange(T& object, const U& new_value) + { + return std::exchange(object, new_value); + } +#endif //*************************************************************************** /// as_const diff --git a/test/test_etlstl_algorithm.cpp b/test/test_etlstd_algorithm.cpp similarity index 100% rename from test/test_etlstl_algorithm.cpp rename to test/test_etlstd_algorithm.cpp diff --git a/test/test_etlstl_functional.cpp b/test/test_etlstd_functional.cpp similarity index 80% rename from test/test_etlstl_functional.cpp rename to test/test_etlstd_functional.cpp index b7bbe998..d2b14230 100644 --- a/test/test_etlstl_functional.cpp +++ b/test/test_etlstd_functional.cpp @@ -41,7 +41,7 @@ namespace return TCompare()(a, b); } - struct test : etl::binary_function + struct test : etlstd::binary_function { bool operator()(int a, int b) const { @@ -62,25 +62,25 @@ namespace //************************************************************************* TEST(test_greater) { - CHECK(!(compare>(1, 2))); - CHECK((compare>(2, 1))); - CHECK(!(compare>(1, 1))); + CHECK(!(compare>(1, 2))); + CHECK((compare>(2, 1))); + CHECK(!(compare>(1, 1))); } //************************************************************************* TEST(test_equal_to) { - CHECK((compare>(1, 1))); - CHECK(!(compare>(1, 2))); - CHECK(!(compare>(2, 1))); + CHECK((compare>(1, 1))); + CHECK(!(compare>(1, 2))); + CHECK(!(compare>(2, 1))); } //************************************************************************* TEST(test_not_equal_to) { - CHECK(!(compare>(1, 1))); - CHECK((compare>(1, 2))); - CHECK((compare>(2, 1))); + CHECK(!(compare>(1, 1))); + CHECK((compare>(1, 2))); + CHECK((compare>(2, 1))); } //************************************************************************* @@ -93,8 +93,8 @@ namespace //************************************************************************* TEST(test_bind2nd) { - CHECK(!(etl::bind2nd(test(), 1)(2))); - CHECK((etl::bind2nd(test(), 2)(1))); + CHECK(!(etlstd::bind2nd(test(), 1)(2))); + CHECK((etlstd::bind2nd(test(), 2)(1))); } }; } diff --git a/test/test_etlstl_iterator.cpp b/test/test_etlstd_iterator.cpp similarity index 71% rename from test/test_etlstl_iterator.cpp rename to test/test_etlstd_iterator.cpp index 8c209de5..52e4dee9 100644 --- a/test/test_etlstl_iterator.cpp +++ b/test/test_etlstd_iterator.cpp @@ -70,11 +70,11 @@ namespace non_random_iterator itr2 = std::begin(dataA); std::advance(itr1, 4); - etl::advance(itr2, 4); + etlstd::advance(itr2, 4); CHECK_EQUAL(*itr1, *itr2); std::advance(itr1, -3); - etl::advance(itr2, -3); + etlstd::advance(itr2, -3); CHECK_EQUAL(*itr1, *itr2); } @@ -85,11 +85,11 @@ namespace random_iterator itr2 = std::begin(dataA); std::advance(itr1, 4); - etl::advance(itr2, 4); + etlstd::advance(itr2, 4); CHECK_EQUAL(*itr1, *itr2); std::advance(itr1, -3); - etl::advance(itr2, -3); + etlstd::advance(itr2, -3); CHECK_EQUAL(*itr1, *itr2); } @@ -104,7 +104,7 @@ namespace for (size_t i = 1; i <= length; ++i) { - CHECK_EQUAL(data[length - i], *etl::prev(itr, i)); + CHECK_EQUAL(data[length - i], *etlstd::prev(itr, i)); } } @@ -119,7 +119,7 @@ namespace for (size_t i = 1; i <= length; ++i) { - CHECK_EQUAL(data[i], *etl::next(itr, i)); + CHECK_EQUAL(data[i], *etlstd::next(itr, i)); } } @@ -129,34 +129,34 @@ namespace int data[] = { 1, 2, 3, 4, 5, 6, 7 }; std::reverse_iterator sri(&data[7]); - etl::reverse_iterator eri(&data[7]); + etlstd::reverse_iterator eri(&data[7]); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); - CHECK(etl::reverse_iterator(&data[5]) < eri); - CHECK(etl::reverse_iterator(&data[3]) > eri); - CHECK(etl::reverse_iterator(&data[4]) <= eri); - CHECK(etl::reverse_iterator(&data[5]) <= eri); - CHECK(etl::reverse_iterator(&data[4]) >= eri); - CHECK(etl::reverse_iterator(&data[3]) >= eri); + CHECK(etlstd::reverse_iterator(&data[5]) < eri); + CHECK(etlstd::reverse_iterator(&data[3]) > eri); + CHECK(etlstd::reverse_iterator(&data[4]) <= eri); + CHECK(etlstd::reverse_iterator(&data[5]) <= eri); + CHECK(etlstd::reverse_iterator(&data[4]) >= eri); + CHECK(etlstd::reverse_iterator(&data[3]) >= eri); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri, *eri); - CHECK(etl::reverse_iterator(&data[1]) == eri); - CHECK(etl::reverse_iterator(&data[2]) != eri); - CHECK(etl::reverse_iterator(&data[3]) != eri); - CHECK(etl::reverse_iterator(&data[4]) != eri); - CHECK(etl::reverse_iterator(&data[5]) != eri); - CHECK(etl::reverse_iterator(&data[6]) != eri); - CHECK(etl::reverse_iterator(&data[7]) != eri); + CHECK(etlstd::reverse_iterator(&data[1]) == eri); + CHECK(etlstd::reverse_iterator(&data[2]) != eri); + CHECK(etlstd::reverse_iterator(&data[3]) != eri); + CHECK(etlstd::reverse_iterator(&data[4]) != eri); + CHECK(etlstd::reverse_iterator(&data[5]) != eri); + CHECK(etlstd::reverse_iterator(&data[6]) != eri); + CHECK(etlstd::reverse_iterator(&data[7]) != eri); sri = std::reverse_iterator(&data[7]); - eri = etl::reverse_iterator(&data[7]); + eri = etlstd::reverse_iterator(&data[7]); CHECK_EQUAL(sri[0], eri[0]); CHECK_EQUAL(sri[1], eri[1]); CHECK_EQUAL(sri[2], eri[2]); @@ -174,7 +174,7 @@ namespace CHECK_EQUAL(*sri, *eri); std::reverse_iterator sri2 = sri + 3; - etl::reverse_iterator eri2 = eri + 3; + etlstd::reverse_iterator eri2 = eri + 3; CHECK_EQUAL(*sri, *eri); sri2 = sri - 3; @@ -188,34 +188,34 @@ namespace const int data[] = { 1, 2, 3, 4, 5, 6, 7 }; std::reverse_iterator sri(&data[7]); - etl::reverse_iterator eri(&data[7]); + etlstd::reverse_iterator eri(&data[7]); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); - CHECK(etl::reverse_iterator(&data[5]) < eri); - CHECK(etl::reverse_iterator(&data[3]) > eri); - CHECK(etl::reverse_iterator(&data[4]) <= eri); - CHECK(etl::reverse_iterator(&data[5]) <= eri); - CHECK(etl::reverse_iterator(&data[4]) >= eri); - CHECK(etl::reverse_iterator(&data[3]) >= eri); + CHECK(etlstd::reverse_iterator(&data[5]) < eri); + CHECK(etlstd::reverse_iterator(&data[3]) > eri); + CHECK(etlstd::reverse_iterator(&data[4]) <= eri); + CHECK(etlstd::reverse_iterator(&data[5]) <= eri); + CHECK(etlstd::reverse_iterator(&data[4]) >= eri); + CHECK(etlstd::reverse_iterator(&data[3]) >= eri); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri++, *eri++); CHECK_EQUAL(*sri, *eri); - CHECK(etl::reverse_iterator(&data[1]) == eri); - CHECK(etl::reverse_iterator(&data[2]) != eri); - CHECK(etl::reverse_iterator(&data[3]) != eri); - CHECK(etl::reverse_iterator(&data[4]) != eri); - CHECK(etl::reverse_iterator(&data[5]) != eri); - CHECK(etl::reverse_iterator(&data[6]) != eri); - CHECK(etl::reverse_iterator(&data[7]) != eri); + CHECK(etlstd::reverse_iterator(&data[1]) == eri); + CHECK(etlstd::reverse_iterator(&data[2]) != eri); + CHECK(etlstd::reverse_iterator(&data[3]) != eri); + CHECK(etlstd::reverse_iterator(&data[4]) != eri); + CHECK(etlstd::reverse_iterator(&data[5]) != eri); + CHECK(etlstd::reverse_iterator(&data[6]) != eri); + CHECK(etlstd::reverse_iterator(&data[7]) != eri); sri = std::reverse_iterator(&data[7]); - eri = etl::reverse_iterator(&data[7]); + eri = etlstd::reverse_iterator(&data[7]); CHECK_EQUAL(sri[0], eri[0]); CHECK_EQUAL(sri[1], eri[1]); CHECK_EQUAL(sri[2], eri[2]); @@ -241,7 +241,7 @@ namespace CHECK_EQUAL(*sri, *eri); std::reverse_iterator sri2 = sri + 3; - etl::reverse_iterator eri2 = eri + 3; + etlstd::reverse_iterator eri2 = eri + 3; CHECK_EQUAL(*sri, *eri); sri2 = sri - 3; diff --git a/test/test_etlstl_limits.cpp b/test/test_etlstd_limits.cpp similarity index 100% rename from test/test_etlstl_limits.cpp rename to test/test_etlstd_limits.cpp diff --git a/test/test_type_traits.cpp b/test/test_etlstd_type_traits.cpp similarity index 100% rename from test/test_type_traits.cpp rename to test/test_etlstd_type_traits.cpp diff --git a/test/test_etlstl_utility.cpp b/test/test_etlstd_utility.cpp similarity index 83% rename from test/test_etlstl_utility.cpp rename to test/test_etlstd_utility.cpp index 00d30a9a..878d8a2b 100644 --- a/test/test_etlstl_utility.cpp +++ b/test/test_etlstd_utility.cpp @@ -40,7 +40,7 @@ namespace //************************************************************************* TEST(pair_default_construct) { - etl::pair p1; + etlstd::pair p1; CHECK_EQUAL(int(), p1.first); CHECK_EQUAL(double(), p1.second); @@ -49,7 +49,7 @@ namespace //************************************************************************* TEST(test_pair_construct) { - etl::pair p1(1, 2.3); + etlstd::pair p1(1, 2.3); CHECK_EQUAL(1, p1.first); CHECK_EQUAL(2.3, p1.second); @@ -58,8 +58,8 @@ namespace //************************************************************************* TEST(test_pair_copy_construct) { - etl::pair p1(1, 2.3); - etl::pair p2(p1); + etlstd::pair p1(1, 2.3); + etlstd::pair p2(p1); CHECK_EQUAL(p1.first, p2.first); CHECK_EQUAL(p1.second, p2.second); @@ -68,8 +68,8 @@ namespace //************************************************************************* TEST(test_pair_copy_construct_alternate) { - etl::pair p1(1, 2.3f); - etl::pair p2(p1); + etlstd::pair p1(1, 2.3f); + etlstd::pair p2(p1); CHECK_EQUAL(p1.first, p2.first); CHECK_EQUAL(p1.second, p2.second); @@ -78,9 +78,9 @@ namespace //************************************************************************* TEST(test_make_pair) { - etl::pair p1(1, 2.3); - etl::pair p2; - p2 = etl::make_pair(1, 2.3); + etlstd::pair p1(1, 2.3); + etlstd::pair p2; + p2 = etlstd::make_pair(1, 2.3); CHECK_EQUAL(p1.first, p2.first); CHECK_EQUAL(p1.second, p2.second); @@ -89,8 +89,8 @@ namespace //************************************************************************* TEST(test_pair_swap_member) { - etl::pair p1(1, 2.3); - etl::pair p2(2, 3.4); + etlstd::pair p1(1, 2.3); + etlstd::pair p2(2, 3.4); p1.swap(p2); @@ -104,8 +104,8 @@ namespace //************************************************************************* TEST(test_pair_swap_global) { - etl::pair p1(1, 2.3); - etl::pair p2(2, 3.4); + etlstd::pair p1(1, 2.3); + etlstd::pair p2(2, 3.4); swap(p1, p2); @@ -119,9 +119,9 @@ namespace //************************************************************************* TEST(test_pair_conditional) { - etl::pair p1(1, 2.3); - etl::pair p2(1, 2.3); - etl::pair p3(2, 3.4); + etlstd::pair p1(1, 2.3); + etlstd::pair p2(1, 2.3); + etlstd::pair p3(2, 3.4); CHECK(p1 == p2); CHECK(!(p1 == p3)); diff --git a/test/vs2017/etl.vcxproj b/test/vs2017/etl.vcxproj index 93bf097d..1ae168b8 100644 --- a/test/vs2017/etl.vcxproj +++ b/test/vs2017/etl.vcxproj @@ -946,11 +946,12 @@ - - - - - + + + + + + @@ -1232,7 +1233,6 @@ - diff --git a/test/vs2017/etl.vcxproj.filters b/test/vs2017/etl.vcxproj.filters index 136ea508..5cd061a2 100644 --- a/test/vs2017/etl.vcxproj.filters +++ b/test/vs2017/etl.vcxproj.filters @@ -860,9 +860,6 @@ Source Files - - Source Files - Source Files @@ -1277,19 +1274,22 @@ Source Files - + Source Files - + Source Files - + Source Files - + Source Files - + + Source Files + + Source Files From 83347ccfddd693789e0f33131cfc7646a737e914 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 9 Jan 2020 11:15:50 +0000 Subject: [PATCH 4/6] Work in progress --- .../ArmTimerCallbacks.uvprojx | 6 +- include/etl/absolute.h | 4 +- include/etl/algorithm.h | 465 +++--- include/etl/alignment.h | 22 +- include/etl/array.h | 40 +- include/etl/array_view.h | 14 +- include/etl/array_wrapper.h | 14 +- include/etl/atomic/atomic_gcc_sync.h | 2 +- include/etl/atomic/atomic_llvm_sync.h | 2 +- include/etl/basic_string.h | 117 +- include/etl/binary.h | 50 +- include/etl/bit_stream.h | 32 +- include/etl/bitset.h | 16 +- include/etl/bloom_filter.h | 8 +- include/etl/char_traits.h | 2 +- include/etl/compare.h | 2 +- include/etl/container.h | 2 +- include/etl/cstring.h | 2 +- include/etl/cumulative_moving_average.h | 12 +- include/etl/cyclic_value.h | 14 +- include/etl/deque.h | 130 +- include/etl/fixed_iterator.h | 16 +- include/etl/flat_map.h | 16 +- include/etl/flat_multimap.h | 16 +- include/etl/flat_multiset.h | 18 +- include/etl/flat_set.h | 14 +- include/etl/forward_list.h | 34 +- include/etl/frame_check_sequence.h | 6 +- include/etl/functional.h | 14 +- include/etl/generate_type_traits.bat | 2 +- include/etl/indirect_vector.h | 30 +- include/etl/integral_limits.h | 27 +- include/etl/intrusive_forward_list.h | 12 +- include/etl/intrusive_links.h | 94 +- include/etl/intrusive_list.h | 12 +- include/etl/iterator.h | 40 +- include/etl/largest.h | 26 +- include/etl/largest_generator.h | 26 +- include/etl/limits.h | 1404 ++++++++++++++--- include/etl/list.h | 54 +- include/etl/map.h | 18 +- include/etl/memory.h | 171 +- include/etl/message_bus.h | 10 +- include/etl/multimap.h | 14 +- include/etl/multiset.h | 6 +- include/etl/murmur3.h | 6 +- include/etl/negative.h | 4 +- include/etl/observer.h | 4 +- include/etl/packet.h | 8 +- include/etl/parameter_type.h | 2 +- include/etl/pearson.h | 4 +- include/etl/platform.h | 6 +- include/etl/pool.h | 44 +- include/etl/priority_queue.h | 26 +- include/etl/private/choose_namespace.h | 4 +- include/etl/private/ivectorpointer.h | 12 +- include/etl/private/minmax_pop.h | 6 +- include/etl/private/minmax_push.h | 10 +- include/etl/private/pvoidvector.h | 28 +- include/etl/private/to_string_helper.h | 74 +- include/etl/queue.h | 4 +- include/etl/queue_mpmc_mutex.h | 6 +- include/etl/queue_spsc_atomic.h | 4 +- include/etl/queue_spsc_isr.h | 8 +- include/etl/queue_spsc_locked.h | 8 +- include/etl/reference_flat_map.h | 30 +- include/etl/reference_flat_multimap.h | 32 +- include/etl/reference_flat_multiset.h | 32 +- include/etl/reference_flat_set.h | 26 +- include/etl/scaled_rounding.h | 18 +- include/etl/scheduler.h | 2 +- include/etl/set.h | 16 +- include/etl/smallest.h | 2 +- include/etl/smallest_generator.h | 2 +- include/etl/sqrt.h | 2 +- include/etl/stack.h | 6 +- include/etl/state_chart.h | 4 +- include/etl/string_view.h | 38 +- include/etl/type_lookup.h | 100 +- include/etl/type_lookup_generator.h | 10 +- include/etl/type_select.h | 272 ++-- include/etl/type_select_generator.h | 8 +- include/etl/type_traits.h | 274 ++-- include/etl/type_traits_generator.h | 246 ++- include/etl/u16string.h | 2 +- include/etl/u32string.h | 2 +- include/etl/unordered_map.h | 12 +- include/etl/unordered_multimap.h | 12 +- include/etl/unordered_multiset.h | 12 +- include/etl/unordered_set.h | 16 +- include/etl/utility.h | 12 +- include/etl/variant.h | 18 +- include/etl/variant_pool.h | 34 +- include/etl/variant_pool_generator.h | 4 +- include/etl/vector.h | 78 +- include/etl/wstring.h | 2 +- test/CMakeLists.txt | 9 - test/ExtraCheckMacros.h | 18 +- test/codeblocks/ETL.cbp | 70 +- test/data.h | 2 +- ...iterators.h => iterators_for_unit_tests.h} | 4 +- test/main.cpp | 2 +- test/maincpp03check.cpp | 2 +- test/test_algorithm.cpp | 1180 +++++++++++++- test/test_alignment.cpp | 10 +- test/test_array.cpp | 2 +- test/test_array_view.cpp | 2 +- test/test_array_wrapper.cpp | 2 +- test/test_atomic_gcc_sync.cpp | 2 +- test/test_atomic_std.cpp | 2 +- test/test_binary.cpp | 133 +- test/test_bit_stream.cpp | 2 +- test/test_bitset.cpp | 2 +- test/test_bloom_filter.cpp | 2 +- test/test_bsd_checksum.cpp | 2 +- test/test_callback_service.cpp | 2 +- test/test_callback_timer.cpp | 2 +- test/test_checksum.cpp | 2 +- test/test_compare.cpp | 2 +- test/test_compiler_settings.cpp | 2 +- test/test_constant.cpp | 8 +- test/test_container.cpp | 2 +- test/test_crc.cpp | 2 +- test/test_cumulative_moving_average.cpp | 2 +- test/test_cyclic_value.cpp | 2 +- test/test_debounce.cpp | 2 +- test/test_delegate.cpp | 2 +- test/test_delegate_service.cpp | 2 +- test/test_deque.cpp | 2 +- test/test_endian.cpp | 2 +- test/test_enum_type.cpp | 2 +- test/test_error_handler.cpp | 2 +- test/test_etlstd_algorithm.cpp | 1155 -------------- test/test_etlstd_functional.cpp | 100 -- test/test_etlstd_iterator.cpp | 252 --- test/test_etlstd_type_traits.cpp | 785 --------- test/test_etlstd_utility.cpp | 142 -- test/test_exception.cpp | 2 +- test/test_fixed_iterator.cpp | 2 +- test/test_flat_map.cpp | 62 +- test/test_flat_multimap.cpp | 70 +- test/test_flat_multiset.cpp | 2 +- test/test_flat_set.cpp | 2 +- test/test_fnv_1.cpp | 2 +- test/test_forward_list.cpp | 2 +- test/test_forward_list_shared_pool.cpp | 2 +- test/test_fsm.cpp | 2 +- test/test_function.cpp | 2 +- test/test_functional.cpp | 62 +- test/test_hash.cpp | 2 +- test/test_indirect_vector.cpp | 2 +- test/test_indirect_vector_external_buffer.cpp | 2 +- test/test_instance_count.cpp | 2 +- test/test_integral_limits.cpp | 2 +- test/test_intrusive_forward_list.cpp | 2 +- test/test_intrusive_links.cpp | 2 +- test/test_intrusive_list.cpp | 2 +- test/test_intrusive_queue.cpp | 2 +- test/test_intrusive_stack.cpp | 2 +- test/test_io_port.cpp | 2 +- test/test_iterator.cpp | 212 ++- test/test_jenkins.cpp | 2 +- test/test_largest.cpp | 58 +- ...test_etlstd_limits.cpp => test_limits.cpp} | 548 +++---- test/test_list.cpp | 2 +- test/test_list_shared_pool.cpp | 2 +- test/test_make_string.cpp | 2 +- test/test_map.cpp | 40 +- test/test_maths.cpp | 2 +- test/test_memory.cpp | 2 +- test/test_message_bus.cpp | 2 +- test/test_message_router.cpp | 2 +- test/test_message_timer.cpp | 2 +- test/test_multi_array.cpp | 2 +- test/test_multimap.cpp | 30 +- test/test_multiset.cpp | 2 +- test/test_murmur3.cpp | 2 +- test/test_numeric.cpp | 2 +- test/test_observer.cpp | 2 +- test/test_optional.cpp | 2 +- test/test_packet.cpp | 2 +- test/test_parameter_type.cpp | 8 +- test/test_pearson.cpp | 2 +- test/test_pool.cpp | 2 +- test/test_priority_queue.cpp | 34 +- test/test_queue.cpp | 2 +- test/test_queue_memory_model_small.cpp | 2 +- test/test_queue_mpmc_mutex.cpp | 2 +- test/test_queue_mpmc_mutex_small.cpp | 2 +- test/test_queue_spsc_atomic.cpp | 2 +- test/test_queue_spsc_atomic_small.cpp | 2 +- test/test_queue_spsc_isr.cpp | 2 +- test/test_queue_spsc_isr_small.cpp | 2 +- test/test_queue_spsc_locked.cpp | 2 +- test/test_queue_spsc_locked_small.cpp | 2 +- test/test_random.cpp | 2 +- test/test_reference_flat_map.cpp | 2 +- test/test_reference_flat_multimap.cpp | 2 +- test/test_reference_flat_multiset.cpp | 2 +- test/test_reference_flat_set.cpp | 2 +- test/test_scaled_rounding.cpp | 2 +- test/test_set.cpp | 2 +- test/test_smallest.cpp | 104 +- test/test_stack.cpp | 2 +- test/test_state_chart.cpp | 2 +- test/test_string_char.cpp | 2 +- test/test_string_u16.cpp | 2 +- test/test_string_u32.cpp | 2 +- test/test_string_view.cpp | 2 +- test/test_string_wchar_t.cpp | 2 +- test/test_task_scheduler.cpp | 2 +- test/test_to_string.cpp | 2 +- test/test_to_u16string.cpp | 2 +- test/test_to_u32string.cpp | 2 +- test/test_to_wstring.cpp | 2 +- test/test_type_def.cpp | 2 +- test/test_type_lookup.cpp | 102 +- test/test_type_select.cpp | 102 +- test/test_type_traits.cpp | 783 +++++++++ test/test_unordered_map.cpp | 4 +- test/test_unordered_multimap.cpp | 12 +- test/test_unordered_multiset.cpp | 2 +- test/test_unordered_set.cpp | 2 +- test/test_user_type.cpp | 2 +- test/test_utility.cpp | 108 +- test/test_variant.cpp | 10 +- test/test_variant_pool.cpp | 2 +- test/test_vector.cpp | 2 +- test/test_vector_external_buffer.cpp | 2 +- test/test_vector_non_trivial.cpp | 2 +- test/test_vector_pointer.cpp | 2 +- test/test_vector_pointer_external_buffer.cpp | 2 +- test/test_visitor.cpp | 2 +- test/test_xor_checksum.cpp | 2 +- test/test_xor_rotate_checksum.cpp | 2 +- test/vs2017/.vs/etl/v15/.gitignore | 1 - test/vs2017/Debug LLVM/.gitignore | 7 - test/vs2017/Debug No Unit Tests/.gitignore | 1 - .../Debug No Unit Tests/etl.tlog/.gitignore | 1 - test/vs2017/cpp.hint | 12 +- test/vs2017/etl.sln | 6 + test/vs2017/etl.vcxproj | 126 +- test/vs2017/etl.vcxproj.filters | 35 +- 243 files changed, 6101 insertions(+), 5147 deletions(-) rename test/{no_stl_test_iterators.h => iterators_for_unit_tests.h} (95%) delete mode 100644 test/test_etlstd_algorithm.cpp delete mode 100644 test/test_etlstd_functional.cpp delete mode 100644 test/test_etlstd_iterator.cpp delete mode 100644 test/test_etlstd_type_traits.cpp delete mode 100644 test/test_etlstd_utility.cpp rename test/{test_etlstd_limits.cpp => test_limits.cpp} (85%) create mode 100644 test/test_type_traits.cpp delete mode 100644 test/vs2017/.vs/etl/v15/.gitignore delete mode 100644 test/vs2017/Debug LLVM/.gitignore delete mode 100644 test/vs2017/Debug No Unit Tests/.gitignore delete mode 100644 test/vs2017/Debug No Unit Tests/etl.tlog/.gitignore diff --git a/examples/ArmTimerCallbacks - C++/ArmTimerCallbacks.uvprojx b/examples/ArmTimerCallbacks - C++/ArmTimerCallbacks.uvprojx index f89a79e0..7b7077f4 100644 --- a/examples/ArmTimerCallbacks - C++/ArmTimerCallbacks.uvprojx +++ b/examples/ArmTimerCallbacks - C++/ArmTimerCallbacks.uvprojx @@ -11,7 +11,7 @@ 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG - 1 + 0 STM32F401RETx @@ -312,7 +312,7 @@ 1 - 7 + 1 0 0 1 @@ -321,7 +321,7 @@ 1 0 0 - 3 + 2 0 0 1 diff --git a/include/etl/absolute.h b/include/etl/absolute.h index ba7f69ea..165dba9c 100644 --- a/include/etl/absolute.h +++ b/include/etl/absolute.h @@ -39,7 +39,7 @@ namespace etl // For signed types. //*************************************************************************** template - typename etlstd::enable_if::value, T>::type + typename etl::enable_if::value, T>::type absolute(T value) { return (value < T(0)) ? -value : value; @@ -49,7 +49,7 @@ namespace etl // For unsigned types. //*************************************************************************** template - typename etlstd::enable_if::value, T>::type + typename etl::enable_if::value, T>::type absolute(T value) { return value; diff --git a/include/etl/algorithm.h b/include/etl/algorithm.h index 788223ec..7d6797ab 100644 --- a/include/etl/algorithm.h +++ b/include/etl/algorithm.h @@ -37,6 +37,7 @@ SOFTWARE. ///\ingroup utilities #include +#include #include "platform.h" #include "type_traits.h" @@ -55,20 +56,20 @@ SOFTWARE. //***************************************************************************** // Algorithms defined by the ETL //***************************************************************************** -#undef ETL_ALGORITHM - -namespace etlstd +namespace etl { -#if defined(ETL_NO_STL) +// We can't have std::swap and etl::swap templates coexisting in the unit tests +// as the compiler will be unable to decide of which one to use, due to ADL. +#if defined(ETL_NO_STL) && !defined(ETL_IN_UNIT_TEST) //*************************************************************************** // swap #if ETL_CPP11_SUPPORTED template void swap(T& a, T& b) { - T temp(etlstd::move(a)); - a = etlstd::move(b); - b = etlstd::move(temp); + T temp(etl::move(a)); + a = etl::move(b); + b = etl::move(temp); } #else template @@ -79,15 +80,6 @@ namespace etlstd b = temp; } #endif -#else - //*************************************************************************** - // swap - template - void swap(T& a, T& b) - { - using std::swap; - swap(a, b); - } #endif #if defined(ETL_NO_STL) @@ -96,7 +88,7 @@ namespace etlstd template void iter_swap(TIterator1 a, TIterator2 b) { - typename etlstd::iterator_traits::value_type c = *a; + typename etl::iterator_traits::value_type c = *a; *a = *b; *b = c; } @@ -142,13 +134,13 @@ namespace etlstd // copy // Pointer template - typename etlstd::enable_if::value && - etlstd::is_pointer::value && - etlstd::is_pod::value_type>::value, TIterator2>::type + typename etl::enable_if::value && + etl::is_pointer::value && + etl::is_pod::value_type>::value, TIterator2>::type copy(TIterator1 sb, TIterator1 se, TIterator2 db) { - typedef typename etlstd::iterator_traits::value_type value_t; - typedef typename etlstd::iterator_traits::difference_type difference_t; + typedef typename etl::iterator_traits::value_type value_t; + typedef typename etl::iterator_traits::difference_type difference_t; difference_t count = (se - sb); @@ -157,9 +149,9 @@ namespace etlstd // Other iterator template - typename etlstd::enable_if::value || - !etlstd::is_pointer::value || - !etlstd::is_pod::value_type>::value, TIterator2>::type + typename etl::enable_if::value || + !etl::is_pointer::value || + !etl::is_pod::value_type>::value, TIterator2>::type copy(TIterator1 sb, TIterator1 se, TIterator2 db) { while (sb != se) @@ -207,21 +199,21 @@ namespace etlstd // copy_n // Pointer template - typename etlstd::enable_if::value && - etlstd::is_pointer::value && - etlstd::is_pod::value_type>::value, TIterator2>::type + typename etl::enable_if::value && + etl::is_pointer::value && + etl::is_pod::value_type>::value, TIterator2>::type copy_n(TIterator1 sb, TSize count, TIterator2 db) { - typedef typename etlstd::iterator_traits::value_type value_t; + typedef typename etl::iterator_traits::value_type value_t; return TIterator2(memmove(db, sb, sizeof(value_t) * count)) + count; } // Other iterator template - typename etlstd::enable_if::value || - !etlstd::is_pointer::value || - !etlstd::is_pod::value_type>::value, TIterator2>::type + typename etl::enable_if::value || + !etl::is_pointer::value || + !etl::is_pod::value_type>::value, TIterator2>::type copy_n(TIterator1 sb, TSize count, TIterator2 db) { while (count != 0) @@ -252,12 +244,12 @@ namespace etlstd // copy_backward // Pointer template - typename etlstd::enable_if::value && - etlstd::is_pointer::value && - etlstd::is_pod::value_type>::value, TIterator2>::type + typename etl::enable_if::value && + etl::is_pointer::value && + etl::is_pod::value_type>::value, TIterator2>::type copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de) { - typedef typename etlstd::iterator_traits::value_type value_t; + typedef typename etl::iterator_traits::value_type value_t; const size_t length = (se - sb); @@ -266,9 +258,9 @@ namespace etlstd // Other iterator template - typename etlstd::enable_if::value || - !etlstd::is_pointer::value || - !etlstd::is_pod::value_type>::value, TIterator2>::type + typename etl::enable_if::value || + !etl::is_pointer::value || + !etl::is_pod::value_type>::value, TIterator2>::type copy_backward(TIterator1 sb, TIterator1 se, TIterator2 de) { while (se != sb) @@ -296,7 +288,7 @@ namespace etlstd { while (sb != se) { - *db++ = etlstd::move(*sb++); + *db++ = etl::move(*sb++); } return db; @@ -319,7 +311,7 @@ namespace etlstd { while (sb != se) { - *(--de) = etlstd::move(*(--se)); + *(--de) = etl::move(*(--se)); } return de; @@ -339,14 +331,14 @@ namespace etlstd // reverse // Pointers template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type reverse(TIterator b, TIterator e) { if (b != e) { while (b < --e) { - etlstd::iter_swap(b, e); + etl::iter_swap(b, e); ++b; } } @@ -354,12 +346,12 @@ namespace etlstd // Other template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type reverse(TIterator b, TIterator e) { while ((b != e) && (b != --e)) { - etlstd::iter_swap(b++, e); + etl::iter_swap(b++, e); } } #else @@ -376,18 +368,19 @@ namespace etlstd //*************************************************************************** // lower_bound template + ETL_NODISCARD TIterator lower_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) { - typedef typename etlstd::iterator_traits::difference_type difference_t; + typedef typename etl::iterator_traits::difference_type difference_t; - difference_t count = etlstd::distance(first, last); + difference_t count = etl::distance(first, last); while (count > 0) { TIterator itr = first; difference_t step = count / 2; - etlstd::advance(itr, step); + etl::advance(itr, step); if (compare(*itr, value)) { @@ -404,22 +397,25 @@ namespace etlstd } template + ETL_NODISCARD TIterator lower_bound(TIterator first, TIterator last, const TValue& value) { - typedef etlstd::less::value_type> compare; + typedef etl::less::value_type> compare; - return etlstd::lower_bound(first, last, value, compare()); + return etl::lower_bound(first, last, value, compare()); } #else //*************************************************************************** // lower_bound template + ETL_NODISCARD TIterator lower_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) { return std::lower_bound(first, last, value, compare); } template + ETL_NODISCARD TIterator lower_bound(TIterator first, TIterator last, const TValue& value) { return std::lower_bound(first, last, value); @@ -430,18 +426,19 @@ namespace etlstd //*************************************************************************** // upper_bound template + ETL_NODISCARD TIterator upper_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) { - typedef typename etlstd::iterator_traits::difference_type difference_t; + typedef typename etl::iterator_traits::difference_type difference_t; - difference_t count = etlstd::distance(first, last); + difference_t count = etl::distance(first, last); while (count > 0) { TIterator itr = first; difference_t step = count / 2; - etlstd::advance(itr, step); + etl::advance(itr, step); if (!compare(value, *itr)) { @@ -458,22 +455,25 @@ namespace etlstd } template + ETL_NODISCARD TIterator upper_bound(TIterator first, TIterator last, const TValue& value) { - typedef etlstd::less::value_type> compare; + typedef etl::less::value_type> compare; - return etlstd::upper_bound(first, last, value, compare()); + return etl::upper_bound(first, last, value, compare()); } #else //*************************************************************************** // upper_bound template + ETL_NODISCARD TIterator upper_bound(TIterator first, TIterator last, const TValue& value, TCompare compare) { return std::upper_bound(first, last, value, compare); } template + ETL_NODISCARD TIterator upper_bound(TIterator first, TIterator last, const TValue& value) { return std::upper_bound(first, last, value); @@ -484,30 +484,34 @@ namespace etlstd //*************************************************************************** // equal_range template + ETL_NODISCARD ETL_OR_STD::pair equal_range(TIterator first, TIterator last, const TValue& value, TCompare compare) { - return ETL_OR_STD::make_pair(etlstd::lower_bound(first, last, value, compare), - etlstd::upper_bound(first, last, value, compare)); + return ETL_OR_STD::make_pair(etl::lower_bound(first, last, value, compare), + etl::upper_bound(first, last, value, compare)); } template + ETL_NODISCARD ETL_OR_STD::pair equal_range(TIterator first, TIterator last, const TValue& value) { - typedef etlstd::less::value_type> compare; + typedef etl::less::value_type> compare; - return ETL_OR_STD::make_pair(etlstd::lower_bound(first, last, value, compare()), - etlstd::upper_bound(first, last, value, compare())); + return ETL_OR_STD::make_pair(etl::lower_bound(first, last, value, compare()), + etl::upper_bound(first, last, value, compare())); } #else //*************************************************************************** // equal_range template + ETL_NODISCARD std::pair equal_range(TIterator first, TIterator last, const TValue& value, TCompare compare) { return std::equal_range(first, last, value, compare); } template + ETL_NODISCARD std::pair equal_range(TIterator first, TIterator last, const TValue& value) { return std::equal_range(first, last, value); @@ -518,6 +522,7 @@ namespace etlstd //*************************************************************************** // find_if template + ETL_NODISCARD TIterator find_if(TIterator first, TIterator last, TUnaryPredicate predicate) { while (first != last) @@ -536,6 +541,7 @@ namespace etlstd //*************************************************************************** // find_if template + ETL_NODISCARD TIterator find_if(TIterator first, TIterator last, TUnaryPredicate predicate) { return std::find_if(first, last, predicate); @@ -546,6 +552,7 @@ namespace etlstd //*************************************************************************** // find template + ETL_NODISCARD TIterator find(TIterator first, TIterator last, const T& value) { while (first != last) @@ -564,6 +571,7 @@ namespace etlstd //*************************************************************************** // find template + ETL_NODISCARD TIterator find(TIterator first, TIterator last, const T& value) { return std::find(first, last, value); @@ -574,7 +582,7 @@ namespace etlstd //*************************************************************************** // fill template - typename etlstd::enable_if::value || etlstd::is_same::value) || !etlstd::is_pointer::value, void>::type + typename etl::enable_if::value || etl::is_same::value) || !etl::is_pointer::value, void>::type fill(TIterator first, TIterator last, const TValue& value) { while (first != last) @@ -584,7 +592,7 @@ namespace etlstd } template - typename etlstd::enable_if<(etlstd::is_same::value || etlstd::is_same::value) && etlstd::is_pointer::value, void>::type + typename etl::enable_if<(etl::is_same::value || etl::is_same::value) && etl::is_pointer::value, void>::type fill(TIterator first, TIterator last, const TValue& value) { memset(first, value, last - first); @@ -603,7 +611,7 @@ namespace etlstd //*************************************************************************** // fill_n template - typename etlstd::enable_if::value || etlstd::is_same::value) || !etlstd::is_pointer::value, TIterator>::type + typename etl::enable_if::value || etl::is_same::value) || !etl::is_pointer::value, TIterator>::type fill_n(TIterator first, TSize count, const TValue& value) { for (TSize i = 0; i < count; ++i) @@ -615,7 +623,7 @@ namespace etlstd } template - typename etlstd::enable_if<(etlstd::is_same::value || etlstd::is_same::value) && etlstd::is_pointer::value, void>::type + typename etl::enable_if<(etl::is_same::value || etl::is_same::value) && etl::is_pointer::value, void>::type fill_n(TIterator first, TSize count, const TValue& value) { memset(first, value, count); @@ -634,7 +642,8 @@ namespace etlstd //*************************************************************************** // count template - typename etlstd::iterator_traits::difference_type count(TIterator first, TIterator last, const T& value) + ETL_NODISCARD + typename etl::iterator_traits::difference_type count(TIterator first, TIterator last, const T& value) { typename iterator_traits::difference_type n = 0; @@ -654,6 +663,7 @@ namespace etlstd //*************************************************************************** // count template + ETL_NODISCARD typename std::iterator_traits::difference_type count(TIterator first, TIterator last, const T& value) { return std::count(first, last, value); @@ -664,7 +674,8 @@ namespace etlstd //*************************************************************************** // count_if template - typename etlstd::iterator_traits::difference_type count_if(TIterator first, TIterator last, TUnaryPredicate predicate) + ETL_NODISCARD + typename etl::iterator_traits::difference_type count_if(TIterator first, TIterator last, TUnaryPredicate predicate) { typename iterator_traits::difference_type n = 0; @@ -684,6 +695,7 @@ namespace etlstd //*************************************************************************** // count_if template + ETL_NODISCARD typename std::iterator_traits::difference_type count_if(TIterator first, TIterator last, TUnaryPredicate predicate) { return std::count_if(first, last, predicate); @@ -694,7 +706,8 @@ namespace etlstd //*************************************************************************** // equal template - typename etlstd::enable_if::value || !etlstd::is_pointer::value || !etlstd::is_pod::value_type>::value, bool>::type + ETL_NODISCARD + typename etl::enable_if::value || !etl::is_pointer::value || !etl::is_pod::value_type>::value, bool>::type equal(TIterator1 first1, TIterator1 last1, TIterator2 first2) { while (first1 != last1) @@ -709,10 +722,11 @@ namespace etlstd } template - typename etlstd::enable_if::value && etlstd::is_pointer::value && etlstd::is_pod::value_type>::value, bool>::type + ETL_NODISCARD + typename etl::enable_if::value && etl::is_pointer::value && etl::is_pod::value_type>::value, bool>::type equal(TIterator1 first1, TIterator1 last1, TIterator2 first2) { - typedef typename etlstd::iterator_traits::value_type value_t; + typedef typename etl::iterator_traits::value_type value_t; return (memcmp(first1, first2, sizeof(value_t) * (last1 - first1)) == 0); } @@ -720,6 +734,7 @@ namespace etlstd //*************************************************************************** // equal template + ETL_NODISCARD bool equal(TIterator1 first1, TIterator1 last1, TIterator2 first2) { return std::equal(first1, last1, first2); @@ -730,6 +745,7 @@ namespace etlstd //*************************************************************************** // lexicographical_compare template + ETL_NODISCARD bool lexicographical_compare(TIterator1 first1, TIterator1 last1, TIterator2 first2, TIterator2 last2, TCompare compare) @@ -756,17 +772,19 @@ namespace etlstd //*************************************************************************** // lexicographical_compare template + ETL_NODISCARD bool lexicographical_compare(TIterator1 first1, TIterator1 last1, TIterator2 first2, TIterator2 last2) { - typedef etlstd::less::value_type> compare; + typedef etl::less::value_type> compare; - return etlstd::lexicographical_compare(first1, last1, first2, last2, compare()); + return etl::lexicographical_compare(first1, last1, first2, last2, compare()); } #else //*************************************************************************** // lexicographical_compare template + ETL_NODISCARD bool lexicographical_compare(TIterator1 first1, TIterator1 last1, TIterator2 first2, TIterator2 last2, TCompare compare) @@ -777,6 +795,7 @@ namespace etlstd //*************************************************************************** // lexicographical_compare template + ETL_NODISCARD bool lexicographical_compare(TIterator1 first1, TIterator1 last1, TIterator2 first2, TIterator2 last2) { @@ -788,28 +807,32 @@ namespace etlstd //*************************************************************************** // min template + ETL_NODISCARD ETL_CONSTEXPR const T& min(const T& a, const T& b, TCompare compare) { return (compare(a, b)) ? a : b; } template + ETL_NODISCARD ETL_CONSTEXPR const T& min(const T& a, const T& b) { - typedef etlstd::less compare; + typedef etl::less compare; - return etlstd::min(a, b, compare()); + return etl::min(a, b, compare()); } #else //*************************************************************************** // min template + ETL_NODISCARD ETL_CONSTEXPR const T& min(const T& a, const T& b, TCompare compare) { return std::min(a, b, compare); } template + ETL_NODISCARD ETL_CONSTEXPR const T& min(const T& a, const T& b) { return std::min(a, b); @@ -820,28 +843,32 @@ namespace etlstd //*************************************************************************** // max template + ETL_NODISCARD ETL_CONSTEXPR const T& max(const T& a, const T& b, TCompare compare) { return (compare(a, b)) ? b : a; } template + ETL_NODISCARD ETL_CONSTEXPR const T& max(const T& a, const T& b) { - typedef etlstd::less compare; + typedef etl::less compare; - return etlstd::max(a, b, compare()); + return etl::max(a, b, compare()); } #else //*************************************************************************** // max template + ETL_NODISCARD ETL_CONSTEXPR const T& max(const T& a, const T& b, TCompare compare) { return std::max(a, b, compare); } template + ETL_NODISCARD ETL_CONSTEXPR const T& max(const T& a, const T& b) { return std::max(a, b); @@ -964,8 +991,8 @@ namespace etlstd template void pop_heap(TIterator first, TIterator last, TCompare compare) { - typedef typename etlstd::iterator_traits::value_type value_t; - typedef typename etlstd::iterator_traits::difference_type distance_t; + typedef typename etl::iterator_traits::value_type value_t; + typedef typename etl::iterator_traits::difference_type distance_t; value_t value = last[-1]; last[-1] = first[0]; @@ -977,17 +1004,17 @@ namespace etlstd template void pop_heap(TIterator first, TIterator last) { - typedef etlstd::less::value_type> compare; + typedef etl::less::value_type> compare; - etlstd::pop_heap(first, last, compare()); + etl::pop_heap(first, last, compare()); } // Push Heap template void push_heap(TIterator first, TIterator last, TCompare compare) { - typedef typename etlstd::iterator_traits::difference_type difference_t; - typedef typename etlstd::iterator_traits::value_type value_t; + typedef typename etl::iterator_traits::difference_type difference_t; + typedef typename etl::iterator_traits::value_type value_t; private_heap::push_heap(first, difference_t(last - first - 1), difference_t(0), value_t(*(last - 1)), compare); } @@ -996,16 +1023,16 @@ namespace etlstd template void push_heap(TIterator first, TIterator last) { - typedef etlstd::less::value_type> compare; + typedef etl::less::value_type> compare; - etlstd::push_heap(first, last, compare()); + etl::push_heap(first, last, compare()); } // Make Heap template void make_heap(TIterator first, TIterator last, TCompare compare) { - typedef typename etlstd::iterator_traits::difference_type difference_t; + typedef typename etl::iterator_traits::difference_type difference_t; if ((last - first) < 2) { @@ -1032,22 +1059,24 @@ namespace etlstd template void make_heap(TIterator first, TIterator last) { - typedef etlstd::less::value_type> compare; + typedef etl::less::value_type> compare; - etlstd::make_heap(first, last, compare()); + etl::make_heap(first, last, compare()); } // Is Heap template + ETL_NODISCARD bool is_heap(TIterator first, TIterator last) { - typedef etlstd::less::value_type> compare; + typedef etl::less::value_type> compare; return private_heap::is_heap(first, last - first, compare()); } // Is Heap template + ETL_NODISCARD bool is_heap(TIterator first, TIterator last, TCompare compare) { return private_heap::is_heap(first, last - first, compare); @@ -1099,6 +1128,7 @@ namespace etlstd // Is Heap template + ETL_NODISCARD bool is_heap(TIterator first, TIterator last) { return std::is_heap(first, last); @@ -1106,6 +1136,7 @@ namespace etlstd // Is Heap template + ETL_NODISCARD bool is_heap(TIterator first, TIterator last, TCompare compare) { return std::is_heap(first, last, compare); @@ -1116,6 +1147,7 @@ namespace etlstd //*************************************************************************** // Search template + ETL_NODISCARD TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last, TCompare compare) { while (true) @@ -1150,16 +1182,18 @@ namespace etlstd // Search template + ETL_NODISCARD TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last) { - typedef etlstd::equal_to::value_type> compare; + typedef etl::equal_to::value_type> compare; - return etlstd::search(first, last, search_first, search_last, compare()); + return etl::search(first, last, search_first, search_last, compare()); } #else //*************************************************************************** // Search template + ETL_NODISCARD TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last, TCompare compare) { return std::search(first, last, search_first, search_last, compare); @@ -1167,6 +1201,7 @@ namespace etlstd // Search template + ETL_NODISCARD TIterator1 search(TIterator1 first, TIterator1 last, TIterator2 search_first, TIterator2 search_last) { return std::search(first, last, search_first, search_last); @@ -1179,16 +1214,14 @@ namespace etlstd template TIterator rotate(TIterator first, TIterator middle, TIterator last) { -#if defined(ETL_NO_STL) - using etlstd::swap; -#else - using std::swap; -#endif + using ETL_OR_STD::swap; // Allow ADL TIterator next = middle; while (first != next) { + using ETL_OR_STD::swap; + swap(*first++, *next++); if (next == last) @@ -1218,6 +1251,7 @@ namespace etlstd // find_end // Predicate template + ETL_NODISCARD TIterator1 find_end(TIterator1 b, TIterator1 e, TIterator2 sb, TIterator2 se, TPredicate predicate) @@ -1231,7 +1265,7 @@ namespace etlstd while (true) { - TIterator1 new_result = etlstd::search(b, e, sb, se, predicate); + TIterator1 new_result = etl::search(b, e, sb, se, predicate); if (new_result == e) { @@ -1249,10 +1283,11 @@ namespace etlstd // Default template + ETL_NODISCARD TIterator1 find_end(TIterator1 b, TIterator1 e, TIterator2 sb, TIterator2 se) { - typedef etlstd::equal_to::value_type> predicate; + typedef etl::equal_to::value_type> predicate; return find_end(b, e, sb, se, predicate()); } @@ -1261,6 +1296,7 @@ namespace etlstd // find_end // Predicate template + ETL_NODISCARD TIterator1 find_end(TIterator1 b, TIterator1 e, TIterator2 sb, TIterator2 se, TPredicate predicate) @@ -1270,6 +1306,7 @@ namespace etlstd // Default template + ETL_NODISCARD TIterator1 find_end(TIterator1 b, TIterator1 e, TIterator2 sb, TIterator2 se) { @@ -1284,6 +1321,7 @@ namespace etlstd ///\ingroup algorithm //*************************************************************************** template + ETL_NODISCARD ETL_OR_STD::pair minmax_element(TIterator begin, TIterator end, TCompare compare) @@ -1315,12 +1353,13 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD ETL_OR_STD::pair minmax_element(TIterator begin, - TIterator end) + TIterator end) { - typedef typename etlstd::iterator_traits::value_type value_t; + typedef typename etl::iterator_traits::value_type value_t; - return etlstd::minmax_element(begin, end, etlstd::less()); + return etl::minmax_element(begin, end, etl::less()); } #else //*************************************************************************** @@ -1329,6 +1368,7 @@ namespace etlstd ///\ingroup algorithm //*************************************************************************** template + ETL_NODISCARD std::pair minmax_element(TIterator begin, TIterator end, TCompare compare) @@ -1343,6 +1383,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD std::pair minmax_element(TIterator begin, TIterator end) { @@ -1357,6 +1398,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD ETL_OR_STD::pair minmax(const T& a, const T& b) { @@ -1368,11 +1410,11 @@ namespace etlstd ///\ingroup algorithm /// //*************************************************************************** - template - ETL_OR_STD::pair minmax(const T& a, - const T& b, - TCompare compare) + template + ETL_NODISCARD + ETL_OR_STD::pair minmax(const T& a, + const T& b, + TCompare compare) { return compare(b, a) ? ETL_OR_STD::pair(b, a) : ETL_OR_STD::pair(a, b); } @@ -1383,6 +1425,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD std::pair minmax(const T& a, const T& b) { @@ -1395,6 +1438,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD std::pair minmax(const T& a, const T& b, TCompare compare) @@ -1410,6 +1454,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD TIterator is_sorted_until(TIterator begin, TIterator end) { @@ -1436,11 +1481,11 @@ namespace etlstd ///\ingroup algorithm /// //*************************************************************************** - template - TIterator is_sorted_until(TIterator begin, - TIterator end, - TCompare compare) + template + ETL_NODISCARD + TIterator is_sorted_until(TIterator begin, + TIterator end, + TCompare compare) { if (begin != end) { @@ -1466,6 +1511,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD TIterator is_sorted_until(TIterator begin, TIterator end) { @@ -1478,6 +1524,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD TIterator is_sorted_until(TIterator begin, TIterator end, TCompare compare) @@ -1493,10 +1540,11 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_sorted(TIterator begin, TIterator end) { - return etlstd::is_sorted_until(begin, end) == end; + return etl::is_sorted_until(begin, end) == end; } //*************************************************************************** @@ -1504,13 +1552,13 @@ namespace etlstd ///\ingroup algorithm /// //*************************************************************************** - template - bool is_sorted(TIterator begin, - TIterator end, - TCompare compare) + template + ETL_NODISCARD + bool is_sorted(TIterator begin, + TIterator end, + TCompare compare) { - return etlstd::is_sorted_until(begin, end, compare) == end; + return etl::is_sorted_until(begin, end, compare) == end; } #else //*************************************************************************** @@ -1519,6 +1567,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_sorted(TIterator begin, TIterator end) { @@ -1531,6 +1580,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_sorted(TIterator begin, TIterator end, TCompare compare) @@ -1546,6 +1596,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD TIterator find_if_not(TIterator begin, TIterator end, TUnaryPredicate predicate) @@ -1569,6 +1620,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD TIterator find_if_not(TIterator begin, TIterator end, TUnaryPredicate predicate) @@ -1584,6 +1636,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_permutation(TIterator1 begin1, TIterator1 end1, TIterator2 begin2) @@ -1592,15 +1645,15 @@ namespace etlstd { TIterator2 end2 = begin2; - etlstd::advance(end2, etlstd::distance(begin1, end1)); + etl::advance(end2, etl::distance(begin1, end1)); for (TIterator1 i = begin1; i != end1; ++i) { - if (i == etlstd::find(begin1, i, *i)) + if (i == etl::find(begin1, i, *i)) { - size_t n = etlstd::count(begin2, end2, *i); + size_t n = etl::count(begin2, end2, *i); - if (n == 0 || size_t(etlstd::count(i, end1, *i)) != n) + if (n == 0 || size_t(etl::count(i, end1, *i)) != n) { return false; } @@ -1617,6 +1670,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_permutation(TIterator1 begin1, TIterator1 end1, TIterator2 begin2, @@ -1626,15 +1680,15 @@ namespace etlstd { TIterator2 end2 = begin2; - etlstd::advance(end2, etlstd::distance(begin1, end1)); + etl::advance(end2, etl::distance(begin1, end1)); for (TIterator1 i = begin1; i != end1; ++i) { - if (i == etlstd::find_if(begin1, i, etlstd::bind1st(predicate, *i))) + if (i == etl::find_if(begin1, i, etl::bind1st(predicate, *i))) { - size_t n = etlstd::count(begin2, end2, *i); + size_t n = etl::count(begin2, end2, *i); - if (n == 0 || size_t(etlstd::count(i, end1, *i)) != n) + if (n == 0 || size_t(etl::count(i, end1, *i)) != n) { return false; } @@ -1651,6 +1705,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_permutation(TIterator1 begin1, TIterator1 end1, TIterator2 begin2, @@ -1660,11 +1715,11 @@ namespace etlstd { for (TIterator1 i = begin1; i != end1; ++i) { - if (i == etlstd::find(begin1, i, *i)) + if (i == etl::find(begin1, i, *i)) { - size_t n = etlstd::count(begin2, end2, *i); + size_t n = etl::count(begin2, end2, *i); - if (n == 0 || size_t(etlstd::count(i, end1, *i)) != n) + if (n == 0 || size_t(etl::count(i, end1, *i)) != n) { return false; } @@ -1681,6 +1736,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_permutation(TIterator1 begin1, TIterator1 end1, TIterator2 begin2, @@ -1691,11 +1747,11 @@ namespace etlstd { for (TIterator1 i = begin1; i != end1; ++i) { - if (i == etlstd::find_if(begin1, i, etlstd::bind1st(predicate, *i))) + if (i == etl::find_if(begin1, i, etl::bind1st(predicate, *i))) { - size_t n = etlstd::count(begin2, end2, *i); + size_t n = etl::count(begin2, end2, *i); - if (n == 0 || size_t(etlstd::count(i, end1, *i)) != n) + if (n == 0 || size_t(etl::count(i, end1, *i)) != n) { return false; } @@ -1712,6 +1768,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_permutation(TIterator1 begin1, TIterator1 end1, TIterator2 begin2) @@ -1725,6 +1782,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_permutation(TIterator1 begin1, TIterator1 end1, TIterator2 begin2, @@ -1739,6 +1797,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_permutation(TIterator1 begin1, TIterator1 end1, TIterator2 begin2, @@ -1753,6 +1812,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_permutation(TIterator1 begin1, TIterator1 end1, TIterator2 begin2, @@ -1770,6 +1830,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_partitioned(TIterator begin, TIterator end, TUnaryPredicate predicate) @@ -1799,6 +1860,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool is_partitioned(TIterator begin, TIterator end, TUnaryPredicate predicate) @@ -1814,6 +1876,7 @@ namespace etlstd ///\ingroup algorithm //*************************************************************************** template + ETL_NODISCARD TIterator partition_point(TIterator begin, TIterator end, TUnaryPredicate predicate) @@ -1837,6 +1900,7 @@ namespace etlstd ///\ingroup algorithm //*************************************************************************** template + ETL_NODISCARD TIterator partition_point(TIterator begin, TIterator end, TUnaryPredicate predicate) @@ -1938,11 +2002,12 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool all_of(TIterator begin, TIterator end, TUnaryPredicate predicate) { - return etlstd::find_if_not(begin, end, predicate) == end; + return etl::find_if_not(begin, end, predicate) == end; } #else //*************************************************************************** @@ -1951,6 +2016,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool all_of(TIterator begin, TIterator end, TUnaryPredicate predicate) @@ -1966,11 +2032,12 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool any_of(TIterator begin, TIterator end, TUnaryPredicate predicate) { - return etlstd::find_if(begin, end, predicate) != end; + return etl::find_if(begin, end, predicate) != end; } #else //*************************************************************************** @@ -1979,6 +2046,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool any_of(TIterator begin, TIterator end, TUnaryPredicate predicate) @@ -1994,11 +2062,12 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool none_of(TIterator begin, TIterator end, TUnaryPredicate predicate) { - return etlstd::find_if(begin, end, predicate) == end; + return etl::find_if(begin, end, predicate) == end; } #else //*************************************************************************** @@ -2007,6 +2076,7 @@ namespace etlstd /// //*************************************************************************** template + ETL_NODISCARD bool none_of(TIterator begin, TIterator end, TUnaryPredicate predicate) @@ -2034,18 +2104,18 @@ namespace etl //*************************************************************************** template - typename etlstd::enable_if::value && + typename etl::enable_if::value && etl::is_random_iterator::value, TOutputIterator>::type - copy(TInputIterator i_begin, - TInputIterator i_end, - TOutputIterator o_begin, - TOutputIterator o_end) + copy_s(TInputIterator i_begin, + TInputIterator i_end, + TOutputIterator o_begin, + TOutputIterator o_end) { - size_t s_size = etlstd::distance(i_begin, i_end); - size_t d_size = etlstd::distance(o_begin, o_end); + size_t s_size = etl::distance(i_begin, i_end); + size_t d_size = etl::distance(o_begin, o_end); size_t size = (s_size < d_size) ? s_size : d_size; - return etlstd::copy(i_begin, i_begin + size, o_begin); + return etl::copy(i_begin, i_begin + size, o_begin); } //*************************************************************************** @@ -2061,12 +2131,12 @@ namespace etl //*************************************************************************** template - typename etlstd::enable_if::value || + typename etl::enable_if::value || !etl::is_random_iterator::value, TOutputIterator>::type - copy(TInputIterator i_begin, - TInputIterator i_end, - TOutputIterator o_begin, - TOutputIterator o_end) + copy_s(TInputIterator i_begin, + TInputIterator i_end, + TOutputIterator o_begin, + TOutputIterator o_end) { while ((i_begin != i_end) && (o_begin != o_end)) { @@ -2084,10 +2154,10 @@ namespace etl template - TOutputIterator copy_n(TInputIterator i_begin, - TSize n, - TOutputIterator o_begin, - TOutputIterator o_end) + TOutputIterator copy_n_s(TInputIterator i_begin, + TSize n, + TOutputIterator o_begin, + TOutputIterator o_end) { while ((n-- > 0) && (o_begin != o_end)) { @@ -2106,10 +2176,10 @@ namespace etl typename TSize1, typename TOutputIterator, typename TSize2> - TOutputIterator copy_n(TInputIterator i_begin, - TSize1 n1, - TOutputIterator o_begin, - TSize2 n2) + TOutputIterator copy_n_s(TInputIterator i_begin, + TSize1 n1, + TOutputIterator o_begin, + TSize2 n2) { while ((n1-- > 0) && (n2-- > 0)) { @@ -2128,7 +2198,7 @@ namespace etl template - TOutputIterator copy_if(TInputIterator i_begin, + TOutputIterator copy_if_s(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TOutputIterator o_end, @@ -2179,13 +2249,13 @@ namespace etl ///\ingroup algorithm /// Does a binary search and returns an iterator to the value or end if not found. //*************************************************************************** - template + template + ETL_NODISCARD TIterator binary_find(TIterator begin, TIterator end, const TValue& value) { - TIterator it = etlstd::lower_bound(begin, end, value); + TIterator it = etl::lower_bound(begin, end, value); if ((it == end) || (*it != value)) { @@ -2204,13 +2274,14 @@ namespace etl typename TValue, typename TBinaryPredicate, typename TBinaryEquality> + ETL_NODISCARD TIterator binary_find(TIterator begin, TIterator end, const TValue& value, TBinaryPredicate predicate, TBinaryEquality equality) { - TIterator it = etlstd::lower_bound(begin, end, value, predicate); + TIterator it = etl::lower_bound(begin, end, value, predicate); if ((it == end) || !equality(*it, value)) { @@ -2296,14 +2367,12 @@ namespace etl /// There is currently no STL equivalent. ///\ingroup algorithm //*************************************************************************** - template - TOutputIterator transform(TInputIterator i_begin, - TInputIterator i_end, - TOutputIterator o_begin, - TOutputIterator o_end, - TUnaryFunction function) + template + TOutputIterator transform_s(TInputIterator i_begin, + TInputIterator i_end, + TOutputIterator o_begin, + TOutputIterator o_end, + TUnaryFunction function) { while ((i_begin != i_end) && (o_begin != o_end)) { @@ -2329,9 +2398,9 @@ namespace etl TUnaryFunction function) { TInputIterator i_end(i_begin); - etlstd::advance(i_end, n); + etl::advance(i_end, n); - etlstd::transform(i_begin, i_end, o_begin, function); + etl::transform(i_begin, i_end, o_begin, function); } //*************************************************************************** @@ -2351,10 +2420,10 @@ namespace etl TOutputIterator o_begin, TBinaryFunction function) { - TInputIterator i_end1(i_begin1); - etlstd::advance(i_end1, n); + TInputIterator1 i_end1(i_begin1); + etl::advance(i_end1, n); - etlstd::transform(i_begin1, i_end1, i_begin2, o_begin, function); + etl::transform(i_begin1, i_end1, i_begin2, o_begin, function); } //*************************************************************************** @@ -2553,9 +2622,9 @@ namespace etl return; } - typedef typename etlstd::iterator_traits::difference_type difference_t; + typedef typename etl::iterator_traits::difference_type difference_t; - difference_t n = etlstd::distance(first, last); + difference_t n = etl::distance(first, last); for (difference_t i = n / 2; i > 0; i /= 2) { @@ -2566,12 +2635,12 @@ namespace etl TIterator itr1 = first; TIterator itr2 = first; - etlstd::advance(itr1, k); - etlstd::advance(itr2, k + i); + etl::advance(itr1, k); + etl::advance(itr2, k + i); if (compare(*itr2, *itr1)) { - etlstd::iter_swap(itr1, itr2); + etl::iter_swap(itr1, itr2); } } } @@ -2585,7 +2654,7 @@ namespace etl template void shell_sort(TIterator first, TIterator last) { - etl::shell_sort(first, last, etlstd::less::value_type>()); + etl::shell_sort(first, last, etl::less::value_type>()); } //*************************************************************************** @@ -2598,7 +2667,7 @@ namespace etl { for (TIterator itr = first; itr != last; ++itr) { - etlstd::rotate(etlstd::upper_bound(first, itr, *itr, compare), itr, etlstd::next(itr)); + etl::rotate(etl::upper_bound(first, itr, *itr, compare), itr, etl::next(itr)); } } @@ -2609,7 +2678,7 @@ namespace etl template void insertion_sort(TIterator first, TIterator last) { - etl::insertion_sort(first, last, etlstd::less::value_type>()); + etl::insertion_sort(first, last, etl::less::value_type>()); } //*************************************************************************** @@ -2630,7 +2699,7 @@ namespace etl template void sort(TIterator first, TIterator last) { - etl::shell_sort(first, last, etlstd::less::value_type>()); + etl::shell_sort(first, last, etl::less::value_type>()); } //*************************************************************************** @@ -2653,132 +2722,164 @@ namespace etl template void stable_sort(TIterator first, TIterator last) { - etl::insertion_sort(first, last, etlstd::less::value_type>()); + etl::insertion_sort(first, last, etl::less::value_type>()); } //*************************************************************************** /// Returns the maximum value. //*************************************************************************** +#if ETL_CPP11_SUPPORTED template + ETL_NODISCARD constexpr const T& multimax(const T& a, const T& b) { return a < b ? b : a; } template + ETL_NODISCARD constexpr const T& multimax(const T& t, const Tx&... tx) { return multimax(t, multimax(tx...)); } +#endif //*************************************************************************** /// Returns the maximum value. /// User supplied compare function. //*************************************************************************** +#if ETL_CPP11_SUPPORTED template + ETL_NODISCARD constexpr const T& multimax_compare(TCompare compare, const T& a, const T& b) { return compare(a, b) ? b : a; } template + ETL_NODISCARD constexpr const T& multimax_compare(TCompare compare, const T& t, const Tx&... tx) { return multimax_compare(compare, t, multimax_compare(compare, tx...)); } +#endif //*************************************************************************** /// Returns the maximum value. //*************************************************************************** +#if ETL_CPP11_SUPPORTED template + ETL_NODISCARD constexpr const T& multimin(const T& a, const T& b) { return a < b ? a : b; } template + ETL_NODISCARD constexpr const T& multimin(const T& t, const Tx&... tx) { return multimin(t, multimin(tx...)); } +#endif //*************************************************************************** /// Returns the minimum value. /// User supplied compare function. //*************************************************************************** +#if ETL_CPP11_SUPPORTED template + ETL_NODISCARD constexpr const T& multimin_compare(TCompare compare, const T& a, const T& b) { return compare(a, b) ? a : b; } template + ETL_NODISCARD constexpr const T& multimin_compare(TCompare compare, const T& t, const Tx&... tx) { return multimin_compare(compare, t, multimin_compare(compare, tx...)); } +#endif //*************************************************************************** /// Returns the iterator to the maximum value. //*************************************************************************** +#if ETL_CPP11_SUPPORTED template + ETL_NODISCARD constexpr const TIterator& multimax_iter(const TIterator& a, const TIterator& b) { return *a < *b ? b : a; } template + ETL_NODISCARD constexpr const TIterator& multimax_iter(const TIterator& t, const TIteratorx&... tx) { return multimax_iter(t, multimax_iter(tx...)); } +#endif //*************************************************************************** /// Returns the iterator to the maximum value. /// User supplied compare function. //*************************************************************************** +#if ETL_CPP11_SUPPORTED template + ETL_NODISCARD constexpr const TIterator& multimax_iter_compare(TCompare compare, const TIterator& a, const TIterator& b) { return compare(*a, *b) ? b : a; } template + ETL_NODISCARD constexpr const TIterator& multimax_iter_compare(TCompare compare, const TIterator& t, const TIteratorx&... tx) { return multimax_iter_compare(compare, t, multimax_iter_compare(compare, tx...)); } +#endif //*************************************************************************** /// Returns the iterator to the minimum value. //*************************************************************************** +#if ETL_CPP11_SUPPORTED template + ETL_NODISCARD constexpr const TIterator& multimin_iter(const TIterator& a, const TIterator& b) { return *a < *b ? a : b; } template + ETL_NODISCARD constexpr const TIterator& multimin_iter(const TIterator& t, const Tx&... tx) { return multimin_iter(t, multimin_iter(tx...)); } +#endif //*************************************************************************** /// Returns the iterator to the minimum value. /// User supplied compare function. //*************************************************************************** +#if ETL_CPP11_SUPPORTED template + ETL_NODISCARD constexpr const TIterator& multimin_iter_compare(TCompare compare, const TIterator& a, const TIterator& b) { return compare(*a, *b) ? a : b; } template + ETL_NODISCARD constexpr const TIterator& multimin_iter_compare(TCompare compare, const TIterator& t, const Tx&... tx) { return multimin_iter_compare(compare, t, multimin_iter_compare(compare, tx...)); } +#endif } #endif diff --git a/include/etl/alignment.h b/include/etl/alignment.h index 0a0f2d91..b2e53866 100644 --- a/include/etl/alignment.h +++ b/include/etl/alignment.h @@ -66,7 +66,7 @@ namespace etl { public: - typedef typename type_with_alignment_matcher::value, ALIGNMENT, T2, T3, T4, T5, T6, T7, T8, void>::type type; + typedef typename type_with_alignment_matcher::value, ALIGNMENT, T2, T3, T4, T5, T6, T7, T8, void>::type type; }; // Non-matching alignment, none left. @@ -86,7 +86,7 @@ namespace etl { public: - typedef typename type_with_alignment_matcher::value, ALIGNMENT, T1, T2, T3, T4, T5, T6, T7, T8>::type type; + typedef typename type_with_alignment_matcher::value, ALIGNMENT, T1, T2, T3, T4, T5, T6, T7, T8>::type type; }; } @@ -116,7 +116,7 @@ namespace etl template operator T& () { - ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); T* t = *this; return *t; } @@ -125,7 +125,7 @@ namespace etl template operator const T& () const { - ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); const T* t = *this; return *t; } @@ -134,7 +134,7 @@ namespace etl template operator T* () { - ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); return reinterpret_cast(data); } @@ -142,7 +142,7 @@ namespace etl template operator const T* () const { - ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); return reinterpret_cast(data); } @@ -150,7 +150,7 @@ namespace etl template T& get_reference() { - ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); T* t = *this; return *t; } @@ -159,7 +159,7 @@ namespace etl template const T& get_reference() const { - ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); const T* t = *this; return *t; } @@ -168,7 +168,7 @@ namespace etl template T* get_address() { - ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); return reinterpret_cast(data); } @@ -176,7 +176,7 @@ namespace etl template const T* get_address() const { - ETL_STATIC_ASSERT((etlstd::is_same:: value || ((ALIGNMENT % etlstd::alignment_of::value) == 0)), "Incompatible alignment"); + ETL_STATIC_ASSERT((etl::is_same:: value || ((ALIGNMENT % etl::alignment_of::value) == 0)), "Incompatible alignment"); return reinterpret_cast(data); } @@ -197,7 +197,7 @@ namespace etl ///\ingroup alignment //*************************************************************************** template - struct aligned_storage_as : public etl::aligned_storage::value> + struct aligned_storage_as : public etl::aligned_storage::value> { }; } diff --git a/include/etl/array.h b/include/etl/array.h index a9205464..e0167dd7 100644 --- a/include/etl/array.h +++ b/include/etl/array.h @@ -342,7 +342,7 @@ namespace etl //************************************************************************* void fill(parameter_t value) { - etlstd::fill(begin(), end(), value); + etl::fill(begin(), end(), value); } //************************************************************************* @@ -351,11 +351,7 @@ namespace etl //************************************************************************* void swap(array& other) { -#if defined(ETL_NO_STL) - using etlstd::swap; -#else - using std::swap; -#endif + using ETL_OR_STD::swap; // Allow ADL for (size_t i = 0; i < SIZE; ++i) { @@ -373,7 +369,7 @@ namespace etl template void assign(TIterator first, const TIterator last) { - etlstd::copy(first, last, begin(), end()); + etl::copy_s(first, last, begin(), end()); } //************************************************************************* @@ -387,10 +383,10 @@ namespace etl void assign(TIterator first, const TIterator last, parameter_t value) { // Copy from the range. - iterator p = etlstd::copy(first, last, begin(), end()); + iterator p = etl::copy_s(first, last, begin(), end()); // Default initialise any that are left. - etlstd::fill(p, end(), value); + etl::fill(p, end(), value); } //************************************************************************* @@ -412,7 +408,7 @@ namespace etl { iterator p = const_cast(position); - etlstd::copy_backward(p, end() - 1, end()); + etl::copy_backward(p, end() - 1, end()); *p = value; return p; @@ -442,18 +438,18 @@ namespace etl iterator p = const_cast(position); iterator result(p); - size_t source_size = etlstd::distance(first, last); - size_t destination_space = etlstd::distance(position, cend()); + size_t source_size = etl::distance(first, last); + size_t destination_space = etl::distance(position, cend()); // Do we need to move anything? if (source_size < destination_space) { - size_t length = SIZE - (etlstd::distance(begin(), p) + source_size); - etlstd::copy_backward(p, p + length, end()); + size_t length = SIZE - (etl::distance(begin(), p) + source_size); + etl::copy_backward(p, p + length, end()); } // Copy from the range. - etlstd::copy(first, last, p, end()); + etl::copy_s(first, last, p, end()); return result; } @@ -476,7 +472,7 @@ namespace etl iterator erase(const_iterator position) { iterator p = const_cast(position); - etlstd::copy(p + 1, end(), p); + etl::copy(p + 1, end(), p); return p; } @@ -501,7 +497,7 @@ namespace etl iterator erase(const_iterator first, const_iterator last) { iterator p = const_cast(first); - etlstd::copy(last, cend(), p); + etl::copy(last, cend(), p); return p; } @@ -524,7 +520,7 @@ namespace etl { iterator p = const_cast(position); - etlstd::copy(p + 1, end(), p); + etl::copy(p + 1, end(), p); back() = value; return p; @@ -550,8 +546,8 @@ namespace etl { iterator p = const_cast(first); - p = etlstd::copy(last, cend(), p); - etlstd::fill(p, end(), value); + p = etl::copy(last, cend(), p); + etl::fill(p, end(), value); return const_cast(first); } @@ -580,7 +576,7 @@ namespace etl template bool operator ==(const etl::array& lhs, const etl::array& rhs) { - return etlstd::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin()); + return etl::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin()); } //************************************************************************* @@ -604,7 +600,7 @@ namespace etl template bool operator <(const etl::array& lhs, const etl::array& rhs) { - return etlstd::lexicographical_compare(lhs.cbegin(), + return etl::lexicographical_compare(lhs.cbegin(), lhs.cend(), rhs.cbegin(), rhs.cend()); diff --git a/include/etl/array_view.h b/include/etl/array_view.h index 48242b41..a682b665 100644 --- a/include/etl/array_view.h +++ b/include/etl/array_view.h @@ -137,7 +137,7 @@ namespace etl template ETL_CONSTEXPR array_view(const TIterator begin_, const TIterator end_) : mbegin(etl::addressof(*begin_)), - mend(etl::addressof(*begin_) + etlstd::distance(begin_, end_)) + mend(etl::addressof(*begin_) + etl::distance(begin_, end_)) { } @@ -356,7 +356,7 @@ namespace etl void assign(const TIterator begin_, const TIterator end_) { mbegin = etl::addressof(*begin_); - mend = etl::addressof(*begin_) + etlstd::distance(begin_, end_); + mend = etl::addressof(*begin_) + etl::distance(begin_, end_); } //************************************************************************* @@ -411,11 +411,7 @@ namespace etl //************************************************************************* void swap(array_view& other) { -#if defined(ETL_NO_STL) - using etlstd::swap; -#else - using std::swap; -#endif + using ETL_OR_STD::swap; // Allow ADL swap(mbegin, other.mbegin); swap(mend, other.mend); @@ -443,7 +439,7 @@ namespace etl friend bool operator == (const array_view& lhs, const array_view& rhs) { return (lhs.size() == rhs.size()) && - etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -459,7 +455,7 @@ namespace etl //************************************************************************* friend bool operator < (const array_view& lhs, const array_view& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/array_wrapper.h b/include/etl/array_wrapper.h index 2f784563..cf72edb2 100644 --- a/include/etl/array_wrapper.h +++ b/include/etl/array_wrapper.h @@ -310,21 +310,17 @@ namespace etl //************************************************************************* void fill(parameter_t value) { - etlstd::fill(begin(), end(), value); + etl::fill(begin(), end(), value); } //************************************************************************* /// Swaps the contents of arrays. //************************************************************************* template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type swap(etl::array_wrapper& other) { -#if defined(ETL_NO_STL) - using etlstd::swap; -#else - using std::swap; -#endif + using ETL_OR_STD::swap; // Allow ADL for (size_t i = 0; i < SIZE; ++i) { @@ -340,7 +336,7 @@ namespace etl bool operator == (const etl::array_wrapper& lhs, const etl::array_wrapper& rhs) { - return (SIZEL == SIZER) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (SIZEL == SIZER) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -360,7 +356,7 @@ namespace etl bool operator < (const etl::array_wrapper& lhs, const etl::array_wrapper& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/atomic/atomic_gcc_sync.h b/include/etl/atomic/atomic_gcc_sync.h index 70ba31e7..e2d51cd9 100644 --- a/include/etl/atomic/atomic_gcc_sync.h +++ b/include/etl/atomic/atomic_gcc_sync.h @@ -66,7 +66,7 @@ namespace etl { public: - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Only integral types are supported"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Only integral types are supported"); atomic() : value(0) diff --git a/include/etl/atomic/atomic_llvm_sync.h b/include/etl/atomic/atomic_llvm_sync.h index bf32ba5c..50e0be01 100644 --- a/include/etl/atomic/atomic_llvm_sync.h +++ b/include/etl/atomic/atomic_llvm_sync.h @@ -59,7 +59,7 @@ SOFTWARE. // { // public: // -// ETL_STATIC_ASSERT(etlstd::is_integral::value, "Only integral types are supported"); +// ETL_STATIC_ASSERT(etl::is_integral::value, "Only integral types are supported"); // // atomic() // : value(0) diff --git a/include/etl/basic_string.h b/include/etl/basic_string.h index 04a7fc0c..0e5c56e8 100644 --- a/include/etl/basic_string.h +++ b/include/etl/basic_string.h @@ -40,7 +40,6 @@ SOFTWARE. #include "algorithm.h" #include "iterator.h" #include "functional.h" - #include "char_traits.h" #include "container.h" #include "alignment.h" @@ -286,7 +285,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the string. @@ -418,12 +417,12 @@ namespace etl is_truncated = true; } - new_size = etlstd::min(new_size, CAPACITY); + new_size = etl::min(new_size, CAPACITY); // Size up? if (new_size > current_size) { - etlstd::fill(p_buffer + current_size, p_buffer + new_size, value); + etl::fill(p_buffer + current_size, p_buffer + new_size, value); } current_size = new_size; @@ -596,7 +595,7 @@ namespace etl is_truncated = (length_ > CAPACITY); - length_ = etlstd::min(length_, CAPACITY); + length_ = etl::min(length_, CAPACITY); etl::copy_n(other, length_, begin()); @@ -615,7 +614,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(string_iterator)); #endif @@ -643,9 +642,9 @@ namespace etl is_truncated = (n > CAPACITY); - n = etlstd::min(n, CAPACITY); + n = etl::min(n, CAPACITY); - etlstd::fill_n(begin(), n, value); + etl::fill_n(begin(), n, value); current_size = n; p_buffer[current_size] = 0; } @@ -780,7 +779,7 @@ namespace etl { // Insert in the middle. ++current_size; - etlstd::copy_backward(insert_position, end() - 1, end()); + etl::copy_backward(insert_position, end() - 1, end()); *insert_position = value; } else @@ -796,7 +795,7 @@ namespace etl if (position != end()) { // Insert in the middle. - etlstd::copy_backward(insert_position, end() - 1, end()); + etl::copy_backward(insert_position, end() - 1, end()); *insert_position = value; } @@ -823,7 +822,7 @@ namespace etl // Quick hack, as iterators are pointers. iterator insert_position = const_cast(position); - const size_t start = etlstd::distance(cbegin(), position); + const size_t start = etl::distance(cbegin(), position); // No effect. if (start >= CAPACITY) @@ -841,7 +840,7 @@ namespace etl } current_size = CAPACITY; - etlstd::fill(insert_position, end(), value); + etl::fill(insert_position, end(), value); } else { @@ -850,7 +849,7 @@ namespace etl const size_t to_position = start + shift_amount; const size_t remaining_characters = current_size - start; const size_t max_shift_characters = CAPACITY - start - shift_amount; - const size_t characters_to_shift = etlstd::min(max_shift_characters, remaining_characters); + const size_t characters_to_shift = etl::min(max_shift_characters, remaining_characters); // Will the string truncate? if ((start + shift_amount + remaining_characters) > CAPACITY) @@ -863,8 +862,8 @@ namespace etl current_size += shift_amount; } - etlstd::copy_backward(insert_position, insert_position + characters_to_shift, begin() + to_position + characters_to_shift); - etlstd::fill(insert_position, insert_position + shift_amount, value); + etl::copy_backward(insert_position, insert_position + characters_to_shift, begin() + to_position + characters_to_shift); + etl::fill(insert_position, insert_position + shift_amount, value); } p_buffer[current_size] = 0; @@ -885,8 +884,8 @@ namespace etl return; } - const size_t start = etlstd::distance(begin(), position); - const size_t n = etlstd::distance(first, last); + const size_t start = etl::distance(begin(), position); + const size_t n = etl::distance(first, last); // No effect. if (start >= CAPACITY) @@ -917,7 +916,7 @@ namespace etl const size_t to_position = start + shift_amount; const size_t remaining_characters = current_size - start; const size_t max_shift_characters = CAPACITY - start - shift_amount; - const size_t characters_to_shift = etlstd::min(max_shift_characters, remaining_characters); + const size_t characters_to_shift = etl::min(max_shift_characters, remaining_characters); // Will the string truncate? if ((start + shift_amount + remaining_characters) > CAPACITY) @@ -930,7 +929,7 @@ namespace etl current_size += shift_amount; } - etlstd::copy_backward(position, position + characters_to_shift, begin() + to_position + characters_to_shift); + etl::copy_backward(position, position + characters_to_shift, begin() + to_position + characters_to_shift); while (first != last) { @@ -1037,7 +1036,7 @@ namespace etl etl::ibasic_string& erase(size_t position, size_t length_ = npos) { // Limit the length. - length_ = etlstd::min(length_, size() - position); + length_ = etl::min(length_, size() - position); erase(begin() + position, begin() + position + length_); @@ -1051,7 +1050,7 @@ namespace etl //********************************************************************* iterator erase(iterator i_element) { - etlstd::copy(i_element + 1, end(), i_element); + etl::copy(i_element + 1, end(), i_element); p_buffer[--current_size] = 0; return i_element; @@ -1067,8 +1066,8 @@ namespace etl //********************************************************************* iterator erase(iterator first, iterator last) { - etlstd::copy(last, end(), first); - size_t n_delete = etlstd::distance(first, last); + etl::copy(last, end(), first); + size_t n_delete = etl::distance(first, last); current_size -= n_delete; p_buffer[current_size] = 0; @@ -1098,7 +1097,7 @@ namespace etl is_truncated = true; } - size_t endpos = etlstd::min(pos + len, size()); + size_t endpos = etl::min(pos + len, size()); for (size_t i = pos; i < endpos; ++i) { @@ -1120,7 +1119,7 @@ namespace etl return npos; } - const_iterator iposition = etlstd::search(begin() + pos, end(), str.begin(), str.end()); + const_iterator iposition = etl::search(begin() + pos, end(), str.begin(), str.end()); if (iposition == end()) { @@ -1128,7 +1127,7 @@ namespace etl } else { - return etlstd::distance(begin(), iposition); + return etl::distance(begin(), iposition); } } @@ -1146,7 +1145,7 @@ namespace etl } #endif - const_iterator iposition = etlstd::search(begin() + pos, end(), s, s + etl::strlen(s)); + const_iterator iposition = etl::search(begin() + pos, end(), s, s + etl::strlen(s)); if (iposition == end()) { @@ -1154,7 +1153,7 @@ namespace etl } else { - return etlstd::distance(begin(), iposition); + return etl::distance(begin(), iposition); } } @@ -1173,7 +1172,7 @@ namespace etl } #endif - const_iterator iposition = etlstd::search(begin() + pos, end(), s, s + n); + const_iterator iposition = etl::search(begin() + pos, end(), s, s + n); if (iposition == end()) { @@ -1181,7 +1180,7 @@ namespace etl } else { - return etlstd::distance(begin(), iposition); + return etl::distance(begin(), iposition); } } @@ -1192,11 +1191,11 @@ namespace etl //********************************************************************* size_t find(T c, size_t position = 0) const { - const_iterator i = etlstd::find(begin() + position, end(), c); + const_iterator i = etl::find(begin() + position, end(), c); if (i != end()) { - return etlstd::distance(begin(), i); + return etl::distance(begin(), i); } else { @@ -1223,7 +1222,7 @@ namespace etl position = size() - position; - const_reverse_iterator iposition = etlstd::search(rbegin() + position, rend(), str.rbegin(), str.rend()); + const_reverse_iterator iposition = etl::search(rbegin() + position, rend(), str.rbegin(), str.rend()); if (iposition == rend()) { @@ -1231,7 +1230,7 @@ namespace etl } else { - return size() - str.size() - etlstd::distance(rbegin(), iposition); + return size() - str.size() - etl::distance(rbegin(), iposition); } } @@ -1259,7 +1258,7 @@ namespace etl const_reverse_iterator srbegin(s + len); const_reverse_iterator srend(s); - const_reverse_iterator iposition = etlstd::search(rbegin() + position, rend(), srbegin, srend); + const_reverse_iterator iposition = etl::search(rbegin() + position, rend(), srbegin, srend); if (iposition == rend()) { @@ -1267,7 +1266,7 @@ namespace etl } else { - return size() - len - etlstd::distance(rbegin(), iposition); + return size() - len - etl::distance(rbegin(), iposition); } } @@ -1293,7 +1292,7 @@ namespace etl const_reverse_iterator srbegin(s + length_); const_reverse_iterator srend(s); - const_reverse_iterator iposition = etlstd::search(rbegin() + position, rend(), srbegin, srend); + const_reverse_iterator iposition = etl::search(rbegin() + position, rend(), srbegin, srend); if (iposition == rend()) { @@ -1301,7 +1300,7 @@ namespace etl } else { - return size() - length_ - etlstd::distance(rbegin(), iposition); + return size() - length_ - etl::distance(rbegin(), iposition); } } @@ -1319,11 +1318,11 @@ namespace etl position = size() - position; - const_reverse_iterator i = etlstd::find(rbegin() + position, rend(), c); + const_reverse_iterator i = etl::find(rbegin() + position, rend(), c); if (i != rend()) { - return size() - etlstd::distance(rbegin(), i) - 1; + return size() - etl::distance(rbegin(), i) - 1; } else { @@ -1342,7 +1341,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = etlstd::min(length_, size() - position); + length_ = etl::min(length_, size() - position); // Erase the bit we want to replace. erase(position, length_); @@ -1388,8 +1387,8 @@ namespace etl ETL_ASSERT(subposition <= str.size(), ETL_ERROR(string_out_of_bounds)); // Limit the lengths. - length_ = etlstd::min(length_, size() - position); - sublength = etlstd::min(sublength, str.size() - subposition); + length_ = etl::min(length_, size() - position); + sublength = etl::min(sublength, str.size() - subposition); // Erase the bit we want to replace. erase(position, length_); @@ -1413,7 +1412,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = etlstd::min(length_, size() - position); + length_ = etl::min(length_, size() - position); // Erase the bit we want to replace. erase(position, length_); @@ -1450,7 +1449,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = etlstd::min(length_, size() - position); + length_ = etl::min(length_, size() - position); // Erase the bit we want to replace. erase(position, length_); @@ -1487,7 +1486,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = etlstd::min(length_, size() - position); + length_ = etl::min(length_, size() - position); // Erase the bit we want to replace. erase(position, length_); @@ -1554,7 +1553,7 @@ namespace etl ETL_ASSERT(position <= size(), ETL_ERROR(string_out_of_bounds)); // Limit the length. - length_ = etlstd::min(length_, size() - position); + length_ = etl::min(length_, size() - position); return compare(p_buffer + position, p_buffer + position + length_, @@ -1571,8 +1570,8 @@ namespace etl ETL_ASSERT(subposition <= str.size(), ETL_ERROR(string_out_of_bounds)); // Limit the lengths. - length_ = etlstd::min(length_, size() - position); - sublength = etlstd::min(sublength, str.size() - subposition); + length_ = etl::min(length_, size() - position); + sublength = etl::min(sublength, str.size() - subposition); return compare(p_buffer + position, p_buffer + position + length_, @@ -1712,7 +1711,7 @@ namespace etl return npos; } - position = etlstd::min(position, size() - 1); + position = etl::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -1745,7 +1744,7 @@ namespace etl return npos; } - position = etlstd::min(position, size() - 1); + position = etl::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -1869,7 +1868,7 @@ namespace etl return npos; } - position = etlstd::min(position, size() - 1); + position = etl::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -1907,7 +1906,7 @@ namespace etl return npos; } - position = etlstd::min(position, size() - 1); + position = etl::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -2106,7 +2105,7 @@ namespace etl template bool operator ==(const etl::ibasic_string& lhs, const etl::ibasic_string& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2119,7 +2118,7 @@ namespace etl template bool operator ==(const etl::ibasic_string& lhs, const T* rhs) { - return (lhs.size() == etl::strlen(rhs)) && etlstd::equal(lhs.begin(), lhs.end(), rhs); + return (lhs.size() == etl::strlen(rhs)) && etl::equal(lhs.begin(), lhs.end(), rhs); } //*************************************************************************** @@ -2132,7 +2131,7 @@ namespace etl template bool operator ==(const T* lhs, const etl::ibasic_string& rhs) { - return (rhs.size() == etl::strlen(lhs)) && etlstd::equal(rhs.begin(), rhs.end(), lhs); + return (rhs.size() == etl::strlen(lhs)) && etl::equal(rhs.begin(), rhs.end(), lhs); } @@ -2185,7 +2184,7 @@ namespace etl template bool operator <(const etl::ibasic_string& lhs, const etl::ibasic_string& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //*************************************************************************** @@ -2198,7 +2197,7 @@ namespace etl template bool operator <(const etl::ibasic_string& lhs, const T* rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs, rhs + etl::strlen(rhs)); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs, rhs + etl::strlen(rhs)); } //*************************************************************************** @@ -2211,7 +2210,7 @@ namespace etl template bool operator <(const T* lhs, const etl::ibasic_string& rhs) { - return etlstd::lexicographical_compare(lhs, lhs + etl::strlen(lhs), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs, lhs + etl::strlen(lhs), rhs.begin(), rhs.end()); } diff --git a/include/etl/binary.h b/include/etl/binary.h index ff12ef7e..f81f3d05 100644 --- a/include/etl/binary.h +++ b/include/etl/binary.h @@ -110,7 +110,7 @@ namespace etl template T rotate_left(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); const size_t SHIFT = etl::integral_limits::type>::bits - 1; @@ -124,7 +124,7 @@ namespace etl template T rotate_left(T value, size_t distance) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); const size_t BITS = etl::integral_limits::type>::bits; distance %= BITS; @@ -140,7 +140,7 @@ namespace etl template T rotate_right(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); const size_t SHIFT = etl::integral_limits::type>::bits - 1; @@ -154,7 +154,7 @@ namespace etl template T rotate_right(T value, size_t distance) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); const size_t BITS = etl::integral_limits::type>::bits; distance %= BITS; @@ -171,7 +171,7 @@ namespace etl template T rotate(T value, typename etl::make_signed::type distance) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); T result; @@ -194,7 +194,7 @@ namespace etl template T binary_to_gray(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); return (value >> 1) ^ value; } @@ -235,10 +235,10 @@ namespace etl template TReturn sign_extend(TValue value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "TValue not an integral type"); - ETL_STATIC_ASSERT(etlstd::is_integral::value, "TReturn not an integral type"); - ETL_STATIC_ASSERT(etlstd::is_signed::value, "TReturn not a signed type"); - ETL_STATIC_ASSERT(NBITS <= etlstd::numeric_limits::digits, "NBITS too large for return type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); + ETL_STATIC_ASSERT(etl::is_signed::value, "TReturn not a signed type"); + ETL_STATIC_ASSERT(NBITS <= etl::numeric_limits::digits, "NBITS too large for return type"); struct S { @@ -257,11 +257,11 @@ namespace etl template TReturn sign_extend(TValue value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "TValue not an integral type"); - ETL_STATIC_ASSERT(etlstd::is_integral::value, "TReturn not an integral type"); - ETL_STATIC_ASSERT(etlstd::is_signed::value, "TReturn not a signed type"); - ETL_STATIC_ASSERT(NBITS <= etlstd::numeric_limits::digits, "NBITS too large for return type"); - ETL_STATIC_ASSERT(SHIFT <= etlstd::numeric_limits::digits, "SHIFT too large"); + ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); + ETL_STATIC_ASSERT(etl::is_signed::value, "TReturn not a signed type"); + ETL_STATIC_ASSERT(NBITS <= etl::numeric_limits::digits, "NBITS too large for return type"); + ETL_STATIC_ASSERT(SHIFT <= etl::numeric_limits::digits, "SHIFT too large"); struct S { @@ -279,11 +279,11 @@ namespace etl template TReturn sign_extend(TValue value, const size_t NBITS) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "TValue not an integral type"); - ETL_STATIC_ASSERT(etlstd::is_integral::value, "TReturn not an integral type"); - ETL_STATIC_ASSERT(etlstd::is_signed::value, "TReturn not a signed type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); + ETL_STATIC_ASSERT(etl::is_signed::value, "TReturn not a signed type"); - ETL_ASSERT((NBITS <= etlstd::numeric_limits::digits), ETL_ERROR(binary_out_of_range)); + ETL_ASSERT((NBITS <= etl::numeric_limits::digits), ETL_ERROR(binary_out_of_range)); TReturn mask = TReturn(1) << (NBITS - 1); value = value & static_cast((TReturn(1) << NBITS) - 1); @@ -300,11 +300,11 @@ namespace etl template TReturn sign_extend(TValue value, const size_t NBITS, const size_t SHIFT) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "TValue not an integral type"); - ETL_STATIC_ASSERT(etlstd::is_integral::value, "TReturn not an integral type"); - ETL_STATIC_ASSERT(etlstd::is_signed::value, "TReturn not a signed type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "TValue not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "TReturn not an integral type"); + ETL_STATIC_ASSERT(etl::is_signed::value, "TReturn not a signed type"); - ETL_ASSERT((NBITS <= etlstd::numeric_limits::digits), ETL_ERROR(binary_out_of_range)); + ETL_ASSERT((NBITS <= etl::numeric_limits::digits), ETL_ERROR(binary_out_of_range)); TReturn mask = TReturn(1) << (NBITS - 1); value = (value >> SHIFT) & static_cast((TReturn(1) << NBITS) - 1); @@ -1207,7 +1207,7 @@ namespace etl ///\ingroup binary //*************************************************************************** template - typename etlstd::enable_if::value, bool>::type + typename etl::enable_if::value, bool>::type is_odd(const T value) { return ((static_cast::type>(value) & 1U) != 0U); @@ -1218,7 +1218,7 @@ namespace etl ///\ingroup binary //*************************************************************************** template - typename etlstd::enable_if::value, bool>::type + typename etl::enable_if::value, bool>::type is_even(const T value) { return ((static_cast::type>(value) & 1U) == 0U); diff --git a/include/etl/bit_stream.h b/include/etl/bit_stream.h index 44acb860..c662edd0 100644 --- a/include/etl/bit_stream.h +++ b/include/etl/bit_stream.h @@ -67,7 +67,7 @@ namespace etl //*************************************************************************** bit_stream(char* begin_, char* end_) : pdata(reinterpret_cast(begin_)), - length(etlstd::distance(begin_, end_)) + length(etl::distance(begin_, end_)) { restart(); } @@ -77,7 +77,7 @@ namespace etl //*************************************************************************** bit_stream(unsigned char* begin_, unsigned char* end_) : pdata(begin_), - length(etlstd::distance(begin_, end_)) + length(etl::distance(begin_, end_)) { restart(); } @@ -127,7 +127,7 @@ namespace etl //*************************************************************************** void set_stream(char* begin_, char* end_) { - set_stream(begin_, etlstd::distance(begin_, end_)); + set_stream(begin_, etl::distance(begin_, end_)); } //*************************************************************************** @@ -135,7 +135,7 @@ namespace etl //*************************************************************************** void set_stream(unsigned char* begin_, unsigned char* end_) { - set_stream(begin_, etlstd::distance(begin_, end_)); + set_stream(begin_, etl::distance(begin_, end_)); } //*************************************************************************** @@ -180,7 +180,7 @@ namespace etl /// For integral types //*************************************************************************** template - typename etlstd::enable_if::value, bool>::type + typename etl::enable_if::value, bool>::type put(T value, uint_least8_t width = CHAR_BIT * sizeof(T)) { return put_integral(static_cast(value), width); @@ -206,7 +206,7 @@ namespace etl /// For floating point types //*************************************************************************** template - typename etlstd::enable_if::value, bool>::type + typename etl::enable_if::value, bool>::type put(T value) { bool success = true; @@ -249,7 +249,7 @@ namespace etl /// For integral types //*************************************************************************** template - typename etlstd::enable_if::value, bool>::type + typename etl::enable_if::value, bool>::type get(T& value, uint_least8_t width = CHAR_BIT * sizeof(T)) { bool success = false; @@ -265,7 +265,7 @@ namespace etl // Get the bits from the stream. while (width != 0) { - unsigned char mask_width = static_cast(etlstd::min(width, bits_in_byte)); + unsigned char mask_width = static_cast(etl::min(width, bits_in_byte)); unsigned char chunk = get_chunk(mask_width); width -= mask_width; @@ -277,7 +277,7 @@ namespace etl } // Sign extend if signed type and not already full bit width. - if (etlstd::is_signed::value && (bits != (CHAR_BIT * sizeof(T)))) + if (etl::is_signed::value && (bits != (CHAR_BIT * sizeof(T)))) { typedef typename etl::make_signed::type ST; value = etl::sign_extend(value, bits); @@ -290,7 +290,7 @@ namespace etl /// For floating point types //*************************************************************************** template - typename etlstd::enable_if::value, bool>::type + typename etl::enable_if::value, bool>::type get(T& value) { bool success = false; @@ -378,7 +378,7 @@ namespace etl // Send the bits to the stream. while (width != 0) { - unsigned char mask_width = static_cast(etlstd::min(width, bits_in_byte)); + unsigned char mask_width = static_cast(etl::min(width, bits_in_byte)); width -= mask_width; uint32_t mask = ((uint32_t(1U) << mask_width) - 1U) << width; @@ -411,7 +411,7 @@ namespace etl // Send the bits to the stream. while (width != 0) { - unsigned char mask_width = static_cast(etlstd::min(width, bits_in_byte)); + unsigned char mask_width = static_cast(etl::min(width, bits_in_byte)); width -= mask_width; uint64_t mask = ((uint64_t(1U) << mask_width) - 1U) << width; @@ -494,11 +494,11 @@ namespace etl // Network to host. if (etl::endianness::value() == etl::endian::little) { - etlstd::reverse_copy(data, data + sizeof(T), temp); + etl::reverse_copy(data, data + sizeof(T), temp); } else { - etlstd::copy(data, data + sizeof(T), temp); + etl::copy(data, data + sizeof(T), temp); } value = *reinterpret_cast(temp); @@ -515,11 +515,11 @@ namespace etl // Host to network. if (etl::endianness::value() == etl::endian::little) { - etlstd::reverse_copy(pf, pf + sizeof(T), data); + etl::reverse_copy(pf, pf + sizeof(T), data); } else { - etlstd::copy(pf, pf + sizeof(T), data); + etl::copy(pf, pf + sizeof(T), data); } } diff --git a/include/etl/bitset.h b/include/etl/bitset.h index f68a16e4..9d71f50d 100644 --- a/include/etl/bitset.h +++ b/include/etl/bitset.h @@ -312,7 +312,7 @@ namespace etl { reset(); - size_t i = etlstd::min(NBITS, etl::strlen(text)); + size_t i = etl::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -329,7 +329,7 @@ namespace etl { reset(); - size_t i = etlstd::min(NBITS, etl::strlen(text)); + size_t i = etl::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -346,7 +346,7 @@ namespace etl { reset(); - size_t i = etlstd::min(NBITS, etl::strlen(text)); + size_t i = etl::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -363,7 +363,7 @@ namespace etl { reset(); - size_t i = etlstd::min(NBITS, etl::strlen(text)); + size_t i = etl::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -380,7 +380,7 @@ namespace etl { reset(); - size_t i = etlstd::min(NBITS, etl::strlen(text)); + size_t i = etl::min(NBITS, etl::strlen(text)); while (i > 0) { @@ -394,7 +394,7 @@ namespace etl /// Put to a value. //************************************************************************* template - typename etlstd::enable_if::value, T>::type + typename etl::enable_if::value, T>::type value() const { T v = T(0); @@ -818,7 +818,7 @@ namespace etl //************************************************************************* static bool is_equal(const ibitset& lhs, const ibitset&rhs) { - return etlstd::equal(lhs.pdata, lhs.pdata + lhs.SIZE, rhs.pdata); + return etl::equal(lhs.pdata, lhs.pdata + lhs.SIZE, rhs.pdata); } element_t TOP_MASK; @@ -976,7 +976,7 @@ namespace etl /// Put to a value. //************************************************************************* template - typename etlstd::enable_if::value, T>::type + typename etl::enable_if::value, T>::type value() const { ETL_STATIC_ASSERT((sizeof(T) * CHAR_BIT) >= (ARRAY_SIZE * BITS_PER_ELEMENT), "Type too small"); diff --git a/include/etl/bloom_filter.h b/include/etl/bloom_filter.h index dc498d15..0ec97c38 100644 --- a/include/etl/bloom_filter.h +++ b/include/etl/bloom_filter.h @@ -104,12 +104,12 @@ namespace etl { flags.set(get_hash(key)); - if (!etlstd::is_same::value) + if (!etl::is_same::value) { flags.set(get_hash(key)); } - if (!etlstd::is_same::value) + if (!etl::is_same::value) { flags.set(get_hash(key)); } @@ -127,13 +127,13 @@ namespace etl bool exists3 = true; // Do we have a second hash? - if (!etlstd::is_same::value) + if (!etl::is_same::value) { exists2 = flags[get_hash(key)]; } // Do we have a third hash? - if (!etlstd::is_same::value) + if (!etl::is_same::value) { exists3 = flags[get_hash(key)]; } diff --git a/include/etl/char_traits.h b/include/etl/char_traits.h index cdbfe298..36cffb37 100644 --- a/include/etl/char_traits.h +++ b/include/etl/char_traits.h @@ -140,7 +140,7 @@ namespace etl { if (p != 0) { - etlstd::fill_n(p, n, c); + etl::fill_n(p, n, c); } return p; diff --git a/include/etl/compare.h b/include/etl/compare.h index fc23c418..90ceae28 100644 --- a/include/etl/compare.h +++ b/include/etl/compare.h @@ -47,7 +47,7 @@ namespace etl /// Defines <=, >, >= interms of < /// Default //*************************************************************************** - template > + template > struct compare { typedef typename etl::parameter_type::type first_argument_type; diff --git a/include/etl/container.h b/include/etl/container.h index 572a6286..efdea919 100644 --- a/include/etl/container.h +++ b/include/etl/container.h @@ -273,7 +273,7 @@ namespace etl char(&array_size(T(&array)[ARRAY_SIZE]))[ARRAY_SIZE]; } -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_FORCE_NO_ADVANCED_CPP) #define ETL_ARRAY_SIZE(a) (etl::size(a)) #else #define ETL_ARRAY_SIZE(a) sizeof(etl::array_size(a)) diff --git a/include/etl/cstring.h b/include/etl/cstring.h index 9479f394..9dee9685 100644 --- a/include/etl/cstring.h +++ b/include/etl/cstring.h @@ -191,7 +191,7 @@ namespace etl { ETL_ASSERT(position < this->size(), ETL_ERROR(string_out_of_bounds)); - length_ = etlstd::min(length_, this->size() - position); + length_ = etl::min(length_, this->size() - position); new_string.assign(buffer + position, buffer + position + length_); } diff --git a/include/etl/cumulative_moving_average.h b/include/etl/cumulative_moving_average.h index eedb774e..1480152d 100644 --- a/include/etl/cumulative_moving_average.h +++ b/include/etl/cumulative_moving_average.h @@ -44,8 +44,8 @@ namespace etl template ::value, - const bool IsFloat = etlstd::is_floating_point::value> + const bool IsIntegral = etl::is_integral::value, + const bool IsFloat = etl::is_floating_point::value> class cumulative_moving_average; //*************************************************************************** @@ -58,8 +58,8 @@ namespace etl template class cumulative_moving_average { - typedef typename etlstd::conditional::value, int32_t, uint32_t>::type scale_t; - typedef typename etlstd::conditional::value, int32_t, uint32_t>::type sample_t; + typedef typename etl::conditional::value, int32_t, uint32_t>::type scale_t; + typedef typename etl::conditional::value, int32_t, uint32_t>::type sample_t; static const sample_t SAMPLES = static_cast(SAMPLE_SIZE_); static const scale_t SCALE = static_cast(SCALING_); @@ -121,8 +121,8 @@ namespace etl template class cumulative_moving_average { - typedef typename etlstd::conditional::value, int32_t, uint32_t>::type scale_t; - typedef typename etlstd::conditional::value, int32_t, uint32_t>::type sample_t; + typedef typename etl::conditional::value, int32_t, uint32_t>::type scale_t; + typedef typename etl::conditional::value, int32_t, uint32_t>::type sample_t; static const scale_t SCALE = static_cast(SCALING_); diff --git a/include/etl/cyclic_value.h b/include/etl/cyclic_value.h index b4173bc6..78277bfb 100644 --- a/include/etl/cyclic_value.h +++ b/include/etl/cyclic_value.h @@ -257,11 +257,7 @@ namespace etl //************************************************************************* void swap(cyclic_value& other) { -#if defined(ETL_NO_STL) - using etlstd::swap; -#else - using std::swap; -#endif + using ETL_OR_STD::swap; // Allow ADL swap(value, other.value); } @@ -304,7 +300,7 @@ namespace etl ///\ingroup cyclic_value //*************************************************************************** template - class cyclic_value::type> + class cyclic_value::type> { public: @@ -537,11 +533,7 @@ namespace etl //************************************************************************* void swap(cyclic_value& other) { -#if defined(ETL_NO_STL) - using etlstd::swap; -#else - using std::swap; -#endif + using ETL_OR_STD::swap; // Allow ADL swap(first_value, other.first_value); swap(last_value, other.last_value); diff --git a/include/etl/deque.h b/include/etl/deque.h index 94bddb7e..522953e0 100644 --- a/include/etl/deque.h +++ b/include/etl/deque.h @@ -239,7 +239,7 @@ namespace etl #endif typedef T* pointer; typedef const T* const_pointer; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -247,7 +247,7 @@ namespace etl /// Test for an iterator. //************************************************************************* template - struct is_iterator : public etl::integral_constant::value && !etlstd::is_floating_point::value> + struct is_iterator : public etl::integral_constant::value && !etl::is_floating_point::value> { }; @@ -421,11 +421,7 @@ namespace etl //*************************************************** void swap(iterator& other) { -#if defined(ETL_NO_STL) - using etlstd::swap; -#else - using std::swap; -#endif + using ETL_OR_STD::swap; // Allow ADL swap(index, other.index); } @@ -647,7 +643,7 @@ namespace etl /// Assigns a range to the deque. //************************************************************************* template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type assign(TIterator range_begin, TIterator range_end) { initialise(); @@ -899,13 +895,13 @@ namespace etl else { // Are we closer to the front? - if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) + if (etl::distance(_begin, position) < etl::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - etlstd::copy(_begin + 1, position, _begin); + etl::copy(_begin + 1, position, _begin); // Write the new value. *--position = value; @@ -916,7 +912,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - etlstd::copy_backward(position, _end - 2, _end - 1); + etl::copy_backward(position, _end - 2, _end - 1); // Write the new value. *position = value; @@ -941,38 +937,38 @@ namespace etl if (insert_position == begin()) { - create_element_front(etlstd::move(value)); + create_element_front(etl::move(value)); position = _begin; } else if (insert_position == end()) { - create_element_back(etlstd::move(value)); + create_element_back(etl::move(value)); position = _end - 1; } else { // Are we closer to the front? - if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) + if (etl::distance(_begin, position) < etl::distance(position, _end - 1)) { // Construct the _begin. - create_element_front(etlstd::move(*_begin)); + create_element_front(etl::move(*_begin)); // Move the values. - etlstd::move(_begin + 1, position, _begin); + etl::move(_begin + 1, position, _begin); // Write the new value. - *--position = etlstd::move(value); + *--position = etl::move(value); } else { // Construct the _end. - create_element_back(etlstd::move(*(_end - 1))); + create_element_back(etl::move(*(_end - 1))); // Move the values. - etlstd::move_backward(position, _end - 2, _end - 1); + etl::move_backward(position, _end - 2, _end - 1); // Write the new value. - *position = etlstd::move(value); + *position = etl::move(value); } } @@ -1014,13 +1010,13 @@ namespace etl else { // Are we closer to the front? - if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) + if (etl::distance(_begin, position) < etl::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - etlstd::copy(_begin + 1, position, _begin); + etl::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1033,7 +1029,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - etlstd::copy_backward(position, _end - 2, _end - 1); + etl::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1041,7 +1037,7 @@ namespace etl } } - ::new (p) T(etlstd::forward(args)...); + ::new (p) T(etl::forward(args)...); return position; } @@ -1081,13 +1077,13 @@ namespace etl else { // Are we closer to the front? - if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) + if (etl::distance(_begin, position) < etl::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - etlstd::copy(_begin + 1, position, _begin); + etl::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1100,7 +1096,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - etlstd::copy_backward(position, _end - 2, _end - 1); + etl::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1146,13 +1142,13 @@ namespace etl else { // Are we closer to the front? - if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) + if (etl::distance(_begin, position) < etl::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - etlstd::copy(_begin + 1, position, _begin); + etl::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1165,7 +1161,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - etlstd::copy_backward(position, _end - 2, _end - 1); + etl::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1211,13 +1207,13 @@ namespace etl else { // Are we closer to the front? - if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) + if (etl::distance(_begin, position) < etl::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - etlstd::copy(_begin + 1, position, _begin); + etl::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1230,7 +1226,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - etlstd::copy_backward(position, _end - 2, _end - 1); + etl::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1276,13 +1272,13 @@ namespace etl else { // Are we closer to the front? - if (etlstd::distance(_begin, position) < etlstd::distance(position, _end - 1)) + if (etl::distance(_begin, position) < etl::distance(position, _end - 1)) { // Construct the _begin. create_element_front(*_begin); // Move the values. - etlstd::copy(_begin + 1, position, _begin); + etl::copy(_begin + 1, position, _begin); // Write the new value. --position; @@ -1295,7 +1291,7 @@ namespace etl create_element_back(*(_end - 1)); // Move the values. - etlstd::copy_backward(position, _end - 2, _end - 1); + etl::copy_backward(position, _end - 2, _end - 1); // Write the new value. (*position).~T(); @@ -1349,8 +1345,8 @@ namespace etl if (distance(_begin, insert_position) <= difference_type(current_size / 2)) { size_t n_insert = n; - size_t n_move = etlstd::distance(begin(), position); - size_t n_create_copy = etlstd::min(n_insert, n_move); + size_t n_move = etl::distance(begin(), position); + size_t n_create_copy = etl::min(n_insert, n_move); size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0; size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0; size_t n_copy_old = n_move - n_create_copy; @@ -1378,15 +1374,15 @@ namespace etl // Copy new. to = position - n_create_copy; - etlstd::fill_n(to, n_copy_new, value); + etl::fill_n(to, n_copy_new, value); position = _begin + n_move; } else { size_t n_insert = n; - size_t n_move = etlstd::distance(position, end()); - size_t n_create_copy = etlstd::min(n_insert, n_move); + size_t n_move = etl::distance(position, end()); + size_t n_create_copy = etl::min(n_insert, n_move); size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0; size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0; size_t n_copy_old = n_move - n_create_copy; @@ -1406,10 +1402,10 @@ namespace etl } // Copy old. - etlstd::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old); + etl::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old); // Copy new. - etlstd::fill_n(position, n_copy_new, value); + etl::fill_n(position, n_copy_new, value); } } @@ -1429,7 +1425,7 @@ namespace etl { iterator position; - difference_type n = etlstd::distance(range_begin, range_end); + difference_type n = etl::distance(range_begin, range_end); ETL_ASSERT((current_size + n) <= CAPACITY, ETL_ERROR(deque_full)); @@ -1457,8 +1453,8 @@ namespace etl if (distance(_begin, insert_position) < difference_type(current_size / 2)) { size_t n_insert = n; - size_t n_move = etlstd::distance(begin(), position); - size_t n_create_copy = etlstd::min(n_insert, n_move); + size_t n_move = etl::distance(begin(), position); + size_t n_create_copy = etl::min(n_insert, n_move); size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0; size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0; size_t n_copy_old = n_move - n_create_copy; @@ -1488,8 +1484,8 @@ namespace etl else { size_t n_insert = n; - size_t n_move = etlstd::distance(position, end()); - size_t n_create_copy = etlstd::min(n_insert, n_move); + size_t n_move = etl::distance(position, end()); + size_t n_create_copy = etl::min(n_insert, n_move); size_t n_create_new = (n_insert > n_create_copy) ? n_insert - n_create_copy : 0; size_t n_copy_new = (n_insert > n_create_new) ? n_insert - n_create_new : 0; size_t n_copy_old = n_move - n_create_copy; @@ -1510,7 +1506,7 @@ namespace etl } // Copy old. - etlstd::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old); + etl::copy_backward(position, position + n_copy_old, position + n_insert + n_copy_old); // Copy new. item = range_begin; @@ -1547,13 +1543,13 @@ namespace etl // Are we closer to the front? if (distance(_begin, position) < difference_type(current_size / 2)) { - etlstd::copy_backward(_begin, position, position + 1); + etl::copy_backward(_begin, position, position + 1); destroy_element_front(); ++position; } else { - etlstd::copy(position + 1, _end, position); + etl::copy(position + 1, _end, position); destroy_element_back(); } } @@ -1574,7 +1570,7 @@ namespace etl ETL_ASSERT((distance(range_begin) <= difference_type(current_size)) && (distance(range_end) <= difference_type(current_size)), ETL_ERROR(deque_out_of_bounds)); // How many to erase? - size_t length = etlstd::distance(range_begin, range_end); + size_t length = etl::distance(range_begin, range_end); // At the beginning? if (position == _begin) @@ -1603,7 +1599,7 @@ namespace etl if (distance(_begin, position) < difference_type(current_size / 2)) { // Move the items. - etlstd::copy_backward(_begin, position, position + length); + etl::copy_backward(_begin, position, position + length); for (size_t i = 0; i < length; ++i) { @@ -1616,7 +1612,7 @@ namespace etl // Must be closer to the back. { // Move the items. - etlstd::copy(position + length, _end, position); + etl::copy(position + length, _end, position); for (size_t i = 0; i < length; ++i) { @@ -1652,7 +1648,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(deque_full)); #endif - create_element_back(etlstd::move(item)); + create_element_back(etl::move(item)); } #endif @@ -1668,7 +1664,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(deque_full)); #endif - ::new (&(*_end)) T(etlstd::forward(args)...); + ::new (&(*_end)) T(etl::forward(args)...); ++_end; ++current_size; ETL_INCREMENT_DEBUG_COUNT @@ -1780,7 +1776,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(deque_full)); #endif - create_element_front(etlstd::move(item)); + create_element_front(etl::move(item)); } #endif @@ -1797,7 +1793,7 @@ namespace etl #endif --_begin; - ::new (&(*_begin)) T(etlstd::forward(args)...); + ::new (&(*_begin)) T(etl::forward(args)...); ++current_size; ETL_INCREMENT_DEBUG_COUNT } @@ -1971,7 +1967,7 @@ namespace etl iterator itr = rhs.begin(); while (itr != rhs.end()) { - push_back(etlstd::move(*itr)); + push_back(etl::move(*itr)); ++itr; } @@ -2123,7 +2119,7 @@ namespace etl void create_element_front(rvalue_reference value) { --_begin; - ::new (&(*_begin)) T(etlstd::move(value)); + ::new (&(*_begin)) T(etl::move(value)); ++current_size; ETL_INCREMENT_DEBUG_COUNT } @@ -2133,7 +2129,7 @@ namespace etl //********************************************************************* void create_element_back(rvalue_reference value) { - ::new (&(*_end)) T(etlstd::move(value)); + ::new (&(*_end)) T(etl::move(value)); ++_end; ++current_size; ETL_INCREMENT_DEBUG_COUNT @@ -2239,7 +2235,7 @@ namespace etl typedef T& reference; typedef const T& const_reference; typedef size_t size_type; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //************************************************************************* /// Default constructor. @@ -2284,7 +2280,7 @@ namespace etl typename etl::ideque::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -2348,7 +2344,7 @@ namespace etl typename etl::ideque::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -2377,7 +2373,7 @@ namespace etl private: /// The uninitialised buffer of T used in the deque. - typename etl::aligned_storage::value>::type buffer[BUFFER_SIZE]; + typename etl::aligned_storage::value>::type buffer[BUFFER_SIZE]; }; //*************************************************************************** @@ -2390,7 +2386,7 @@ namespace etl template bool operator ==(const etl::ideque& lhs, const etl::ideque& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2416,7 +2412,7 @@ namespace etl template bool operator <(const etl::ideque& lhs, const etl::ideque& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); diff --git a/include/etl/fixed_iterator.h b/include/etl/fixed_iterator.h index 8fdaf77e..ebe39467 100644 --- a/include/etl/fixed_iterator.h +++ b/include/etl/fixed_iterator.h @@ -45,7 +45,7 @@ namespace etl /// This can be useful when using STL algorithms to interact with fixed memory locations such as registers. ///\ingroup iterator template - class fixed_iterator : etl::iterator::iterator_category, typename etlstd::iterator_traits::value_type> + class fixed_iterator : etl::iterator::iterator_category, typename etl::iterator_traits::value_type> { public: @@ -100,7 +100,7 @@ namespace etl //*************************************************************************** /// Dereference operator. //*************************************************************************** - typename etlstd::iterator_traits::value_type operator *() + typename etl::iterator_traits::value_type operator *() { return *it; } @@ -108,7 +108,7 @@ namespace etl //*************************************************************************** /// Dereference operator. //*************************************************************************** - const typename etlstd::iterator_traits::value_type operator *() const + const typename etl::iterator_traits::value_type operator *() const { return *it; } @@ -140,7 +140,7 @@ namespace etl //*************************************************************************** /// += operator. //*************************************************************************** - fixed_iterator& operator +=(typename etlstd::iterator_traits::difference_type /*offset*/) + fixed_iterator& operator +=(typename etl::iterator_traits::difference_type /*offset*/) { return *this; } @@ -148,7 +148,7 @@ namespace etl //*************************************************************************** /// -= operator. //*************************************************************************** - fixed_iterator& operator -=(typename etlstd::iterator_traits::difference_type /*offset*/) + fixed_iterator& operator -=(typename etl::iterator_traits::difference_type /*offset*/) { return *this; } @@ -181,7 +181,7 @@ namespace etl //***************************************************************************** template etl::fixed_iterator& operator +(etl::fixed_iterator& lhs, - typename etlstd::iterator_traits::difference_type /*rhs*/) + typename etl::iterator_traits::difference_type /*rhs*/) { return lhs; } @@ -191,7 +191,7 @@ namespace etl //***************************************************************************** template etl::fixed_iterator& operator -(etl::fixed_iterator& lhs, - typename etlstd::iterator_traits::difference_type /*rhs*/) + typename etl::iterator_traits::difference_type /*rhs*/) { return lhs; } @@ -200,7 +200,7 @@ namespace etl /// - fixed_iterator operator. //***************************************************************************** template - typename etlstd::iterator_traits::difference_type operator -(etl::fixed_iterator& lhs, + typename etl::iterator_traits::difference_type operator -(etl::fixed_iterator& lhs, etl::fixed_iterator& rhs) { return TIterator(lhs) - TIterator(rhs); diff --git a/include/etl/flat_map.h b/include/etl/flat_map.h index 1e0e0200..66494873 100644 --- a/include/etl/flat_map.h +++ b/include/etl/flat_map.h @@ -60,7 +60,7 @@ namespace etl /// Can be used as a reference type for all flat_maps containing a specific type. ///\ingroup flat_map //*************************************************************************** - template > + template > class iflat_map : private etl::ireference_flat_map { private: @@ -87,7 +87,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -232,7 +232,7 @@ namespace etl //********************************************************************* mapped_type& operator [](key_parameter_t key) { - return insert(ETL_MAKE_PAIR(key, mapped_type())).first->second; + return insert(ETL_OR_STD::make_pair(key, mapped_type())).first->second; } //********************************************************************* @@ -268,7 +268,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_map_full)); #endif @@ -352,7 +352,7 @@ namespace etl // Create it. value_type* pvalue = storage.allocate(); ::new ((void*)etl::addressof(pvalue->first)) key_type(key); - ::new ((void*)etl::addressof(pvalue->second)) mapped_type(etlstd::forward(args)...); + ::new ((void*)etl::addressof(pvalue->second)) mapped_type(etl::forward(args)...); iterator i_element = lower_bound(key); @@ -793,7 +793,7 @@ namespace etl template bool operator ==(const etl::iflat_map& lhs, const etl::iflat_map& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -813,11 +813,11 @@ namespace etl /// A flat_map implementation that uses a fixed size buffer. ///\tparam TKey The key type. ///\tparam TValue The value type. - ///\tparam TCompare The type to compare keys. Default = etlstd::less + ///\tparam TCompare The type to compare keys. Default = etl::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup flat_map //*************************************************************************** - template > + template > class flat_map : public etl::iflat_map { public: diff --git a/include/etl/flat_multimap.h b/include/etl/flat_multimap.h index 67a739ad..d4066458 100644 --- a/include/etl/flat_multimap.h +++ b/include/etl/flat_multimap.h @@ -59,7 +59,7 @@ namespace etl /// Can be used as a reference type for all flat_multimaps containing a specific type. ///\ingroup flat_multimap //*************************************************************************** - template > + template > class iflat_multimap : public etl::ireference_flat_multimap { public: @@ -88,7 +88,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -237,7 +237,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multimap_full)); #endif @@ -334,7 +334,7 @@ namespace etl // Create it. value_type* pvalue = storage.allocate(); ::new ((void*)etl::addressof(pvalue->first)) key_type(key); - ::new ((void*)etl::addressof(pvalue->second)) mapped_type(etlstd::forward(args)...); + ::new ((void*)etl::addressof(pvalue->second)) mapped_type(etl::forward(args)...); iterator i_element = lower_bound(key); ETL_INCREMENT_DEBUG_COUNT @@ -431,7 +431,7 @@ namespace etl } else { - size_t d = etlstd::distance(range.first, range.second); + size_t d = etl::distance(range.first, range.second); erase(range.first, range.second); return d; } @@ -700,7 +700,7 @@ namespace etl template bool operator ==(const etl::iflat_multimap& lhs, const etl::iflat_multimap& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -720,11 +720,11 @@ namespace etl /// A flat_multimap implementation that uses a fixed size buffer. ///\tparam TKey The key type. ///\tparam TValue The value type. - ///\tparam TCompare The type to compare keys. Default = etlstd::less + ///\tparam TCompare The type to compare keys. Default = etl::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup flat_multimap //*************************************************************************** - template > + template > class flat_multimap : public etl::iflat_multimap { public: diff --git a/include/etl/flat_multiset.h b/include/etl/flat_multiset.h index 4bd21bf9..23a793c7 100644 --- a/include/etl/flat_multiset.h +++ b/include/etl/flat_multiset.h @@ -57,7 +57,7 @@ namespace etl /// Can be used as a reference type for all flat_multisets containing a specific type. ///\ingroup flat_multiset //*************************************************************************** - template > + template > class iflat_multiset : private etl::ireference_flat_multiset { private: @@ -82,7 +82,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -209,7 +209,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multiset_full)); #endif @@ -232,7 +232,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(flat_multiset_full)); - iterator i_element = etlstd::lower_bound(begin(), end(), value, compare); + iterator i_element = etl::lower_bound(begin(), end(), value, compare); value_type* pvalue = storage.allocate(); ::new (pvalue) value_type(value); @@ -289,7 +289,7 @@ namespace etl // Create it. value_type* pvalue = storage.allocate(); - ::new (pvalue) value_type(etlstd::forward(args)...); + ::new (pvalue) value_type(etl::forward(args)...); iterator i_element = lower_bound(*pvalue); @@ -385,7 +385,7 @@ namespace etl } else { - size_t d = etlstd::distance(range.first, range.second); + size_t d = etl::distance(range.first, range.second); erase(range.first, range.second); return d; } @@ -656,7 +656,7 @@ namespace etl template bool operator ==(const etl::iflat_multiset& lhs, const etl::iflat_multiset& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -675,11 +675,11 @@ namespace etl //*************************************************************************** /// A flat_multiset implementation that uses a fixed size buffer. ///\tparam T The value type. - ///\tparam TCompare The type to compare keys. Default = etlstd::less + ///\tparam TCompare The type to compare keys. Default = etl::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup flat_multiset //*************************************************************************** - template > + template > class flat_multiset : public etl::iflat_multiset { public: diff --git a/include/etl/flat_set.h b/include/etl/flat_set.h index 0b997420..ff2aac95 100644 --- a/include/etl/flat_set.h +++ b/include/etl/flat_set.h @@ -59,7 +59,7 @@ namespace etl /// Can be used as a reference type for all flat_sets containing a specific type. ///\ingroup flat_set //*************************************************************************** - template > + template > class iflat_set : private etl::ireference_flat_set { private: @@ -84,7 +84,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -211,7 +211,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_set_full)); #endif @@ -296,7 +296,7 @@ namespace etl // Create it. value_type* pvalue = storage.allocate(); - ::new (pvalue) value_type(etlstd::forward(args)...); + ::new (pvalue) value_type(etl::forward(args)...); iterator i_element = lower_bound(*pvalue); @@ -739,7 +739,7 @@ namespace etl template bool operator ==(const etl::iflat_set& lhs, const etl::iflat_set& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -758,11 +758,11 @@ namespace etl //*************************************************************************** /// A flat_set implementation that uses a fixed size buffer. ///\tparam T The value type. - ///\tparam TCompare The type to compare keys. Default = etlstd::less + ///\tparam TCompare The type to compare keys. Default = etl::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup flat_set //*************************************************************************** - template > + template > class flat_set : public etl::iflat_set { public: diff --git a/include/etl/forward_list.h b/include/etl/forward_list.h index 7cabec02..5a551d77 100644 --- a/include/etl/forward_list.h +++ b/include/etl/forward_list.h @@ -572,7 +572,7 @@ namespace etl const node_t* p_node; }; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //************************************************************************* /// Gets the beginning of the forward_list. @@ -671,7 +671,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(forward_list_iterator)); #endif @@ -735,7 +735,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(forward_list_full)); #endif - data_node_t& data_node = allocate_data_node(etlstd::move(value)); + data_node_t& data_node = allocate_data_node(etl::move(value)); insert_node_after(start_node, data_node); } #endif @@ -751,7 +751,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(forward_list_full)); #endif data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(etlstd::forward(args)...); + ::new (&(p_data_node->value)) T(etl::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node_after(start_node, *p_data_node); } @@ -907,7 +907,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(forward_list_full)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(etlstd::forward(args)...); + ::new (&(p_data_node->value)) T(etl::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node_after(*position.p_node, *p_data_node); @@ -1001,7 +1001,7 @@ namespace etl void insert_after(iterator position, TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT((d + size()) <= MAX_SIZE, ETL_ERROR(forward_list_full)); #endif @@ -1141,7 +1141,7 @@ namespace etl //************************************************************************* void unique() { - unique(etlstd::equal_to()); + unique(etl::equal_to()); } //************************************************************************* @@ -1182,7 +1182,7 @@ namespace etl //************************************************************************* void sort() { - sort(etlstd::less()); + sort(etl::less()); } //************************************************************************* @@ -1386,7 +1386,7 @@ namespace etl //************************************************************************* iforward_list& operator = (iforward_list&& rhs) { - move_container(etlstd::move(rhs)); + move_container(etl::move(rhs)); return *this; } @@ -1460,7 +1460,7 @@ namespace etl data_node_t& allocate_data_node(rvalue_reference value) { data_node_t* p_node = p_node_pool->allocate(); - ::new (&(p_node->value)) T(etlstd::move(value)); + ::new (&(p_node->value)) T(etl::move(value)); ETL_INCREMENT_DEBUG_COUNT return *p_node; @@ -1487,7 +1487,7 @@ namespace etl { ETL_ASSERT(!full(), ETL_ERROR(forward_list_full)); - data_node_t& data_node = this->allocate_data_node(etlstd::move(*first++)); + data_node_t& data_node = this->allocate_data_node(etl::move(*first++)); join(p_last_node, &data_node); data_node.next = nullptr; p_last_node = &data_node; @@ -1633,7 +1633,7 @@ namespace etl forward_list(forward_list&& other) : etl::iforward_list(node_pool, MAX_SIZE, false) { - this->move_container(etlstd::move(other)); + this->move_container(etl::move(other)); } #endif @@ -1686,7 +1686,7 @@ namespace etl forward_list& operator = (forward_list&& rhs) { - this->move_container(etlstd::move(rhs)); + this->move_container(etl::move(rhs)); return *this; } @@ -1774,7 +1774,7 @@ namespace etl typename etl::iforward_list::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -1831,7 +1831,7 @@ namespace etl //************************************************************************* forward_list& operator = (forward_list&& rhs) { - this->move_container(etlstd::move(rhs)); + this->move_container(etl::move(rhs)); return *this; } @@ -1862,7 +1862,7 @@ namespace etl bool operator ==(const etl::iforward_list& lhs, const etl::iforward_list& rhs) { return (lhs.size() == rhs.size()) && - etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -1887,7 +1887,7 @@ namespace etl template bool operator <(const etl::iforward_list& lhs, const etl::iforward_list& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/frame_check_sequence.h b/include/etl/frame_check_sequence.h index 7873d4e2..31168c59 100644 --- a/include/etl/frame_check_sequence.h +++ b/include/etl/frame_check_sequence.h @@ -56,7 +56,7 @@ namespace etl typedef TPolicy policy_type; typedef typename policy_type::value_type value_type; - ETL_STATIC_ASSERT(etlstd::is_unsigned::value, "Signed frame check type not supported"); + ETL_STATIC_ASSERT(etl::is_unsigned::value, "Signed frame check type not supported"); //************************************************************************* /// Default constructor. @@ -74,7 +74,7 @@ namespace etl template frame_check_sequence(TIterator begin, const TIterator end) { - ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Type not supported"); + ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits::value_type) == 1, "Type not supported"); reset(); add(begin, end); @@ -96,7 +96,7 @@ namespace etl template void add(TIterator begin, const TIterator end) { - ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Type not supported"); + ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits::value_type) == 1, "Type not supported"); while (begin != end) { diff --git a/include/etl/functional.h b/include/etl/functional.h index 46f1f5ac..a540f3a7 100644 --- a/include/etl/functional.h +++ b/include/etl/functional.h @@ -39,7 +39,7 @@ SOFTWARE. ///\defgroup reference_wrapper reference_wrapper ///\ingroup functional -namespace etlstd +namespace etl { //*************************************************************************** /// A definition of reference_wrapper for those that don't have C++ 0x11 support. @@ -110,6 +110,8 @@ namespace etlstd template struct less { + typedef T value_type; + ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const { return lhs < rhs; @@ -120,6 +122,8 @@ namespace etlstd template struct greater { + typedef T value_type; + ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const { return lhs > rhs; @@ -130,6 +134,8 @@ namespace etlstd template struct equal_to { + typedef T value_type; + ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const { return lhs == rhs; @@ -140,6 +146,8 @@ namespace etlstd template struct not_equal_to { + typedef T value_type; + ETL_CONSTEXPR bool operator()(const T &lhs, const T &rhs) const { return lhs != rhs; @@ -168,7 +176,7 @@ namespace etlstd //*************************************************************************** template - class binder1st : public etlstd::unary_function + class binder1st : public etl::unary_function { protected: @@ -202,7 +210,7 @@ namespace etlstd //*************************************************************************** template - class binder2nd : public etlstd::unary_function + class binder2nd : public etl::unary_function { protected: TFunction operation; diff --git a/include/etl/generate_type_traits.bat b/include/etl/generate_type_traits.bat index 39366a70..a1e5f97b 100644 --- a/include/etl/generate_type_traits.bat +++ b/include/etl/generate_type_traits.bat @@ -1 +1 @@ -python -m cogapp -d -e -otype_traits.h -DIsOneOf=17 type_traits_generator.h +python -m cogapp -d -e -otype_traits.h -DIsOneOf=16 type_traits_generator.h diff --git a/include/etl/indirect_vector.h b/include/etl/indirect_vector.h index 68e820bc..09511ddb 100644 --- a/include/etl/indirect_vector.h +++ b/include/etl/indirect_vector.h @@ -716,10 +716,10 @@ namespace etl template void assign(TIterator first, TIterator last) { - ETL_STATIC_ASSERT((etlstd::is_same::type, typename etlstd::remove_cv::value_type>::type>::value), "Iterator type does not match container type"); + ETL_STATIC_ASSERT((etl::is_same::type, typename etl::remove_cv::value_type>::type>::value), "Iterator type does not match container type"); #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(static_cast(d) <= capacity(), ETL_ERROR(vector_full)); #endif @@ -785,7 +785,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(size() != capacity(), ETL_ERROR(vector_full)); #endif - T* p = storage.create(etlstd::move(value)); + T* p = storage.create(etl::move(value)); lookup.push_back(p); } #endif @@ -799,7 +799,7 @@ namespace etl template void emplace_back(Args && ... args) { - T* p = storage.create(etlstd::forward(args)...); + T* p = storage.create(etl::forward(args)...); lookup.push_back(p); } #else @@ -891,7 +891,7 @@ namespace etl { ETL_ASSERT(size() + 1 <= capacity(), ETL_ERROR(vector_full)); - T* p = storage.create(T(etlstd::move(value))); + T* p = storage.create(T(etl::move(value))); position = iterator(lookup.insert(position.lookup_itr, p)); return position; @@ -907,7 +907,7 @@ namespace etl { ETL_ASSERT(!full(), ETL_ERROR(vector_full)); - T* p = storage.create(T(etlstd::forward(args)...)); + T* p = storage.create(T(etl::forward(args)...)); position = iterator(lookup.insert(position.lookup_itr, p)); return position; @@ -990,7 +990,7 @@ namespace etl template void insert(iterator position, TIterator first, TIterator last) { - size_t count = size_t(etlstd::distance(first, last)); + size_t count = size_t(etl::distance(first, last)); ETL_ASSERT((size() + count) <= capacity(), ETL_ERROR(vector_full)); @@ -1066,7 +1066,7 @@ namespace etl iterator itr = rhs.begin(); while (itr != rhs.end()) { - push_back(etlstd::move(*itr)); + push_back(etl::move(*itr)); ++itr; } @@ -1171,7 +1171,7 @@ namespace etl while (itr != other.end()) { - push_back(etlstd::move(*itr)); + push_back(etl::move(*itr)); ++itr; } @@ -1212,7 +1212,7 @@ namespace etl template bool operator ==(const etl::iindirect_vector& lhs, const etl::iindirect_vector& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1238,7 +1238,7 @@ namespace etl template bool operator <(const etl::iindirect_vector& lhs, const etl::iindirect_vector& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //*************************************************************************** @@ -1375,7 +1375,7 @@ namespace etl indirect_vector(indirect_vector&& other) : etl::iindirect_vector(lookup_vector, storage_pool) { - this->move_container(etlstd::move(other)); + this->move_container(etl::move(other)); } //************************************************************************* @@ -1383,7 +1383,7 @@ namespace etl //************************************************************************* indirect_vector& operator = (indirect_vector&& rhs) { - this->move_container(etlstd::move(rhs)); + this->move_container(etl::move(rhs)); return *this; } @@ -1503,7 +1503,7 @@ namespace etl : etl::iindirect_vector(lookup_, pool_) { ETL_ASSERT(lookup_.capacity() <= pool_.capacity(), ETL_ERROR(indirect_vector_buffer_missmatch)); - this->move_container(etlstd::move(other)); + this->move_container(etl::move(other)); } //************************************************************************* @@ -1511,7 +1511,7 @@ namespace etl //************************************************************************* indirect_vector& operator = (indirect_vector&& rhs) { - this->move_container(etlstd::move(rhs)); + this->move_container(etl::move(rhs)); return *this; } diff --git a/include/etl/integral_limits.h b/include/etl/integral_limits.h index 4d06c57b..3a33bbde 100644 --- a/include/etl/integral_limits.h +++ b/include/etl/integral_limits.h @@ -31,7 +31,6 @@ SOFTWARE. #ifndef ETL_INTEGRAL_LIMITS_INCLUDED #define ETL_INTEGRAL_LIMITS_INCLUDED -#include #include #include "platform.h" @@ -74,7 +73,7 @@ namespace etl static const signed char min = SCHAR_MIN; static const signed char max = SCHAR_MAX; static const int bits = CHAR_BIT; - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -86,7 +85,7 @@ namespace etl static const unsigned char min = 0; static const unsigned char max = UCHAR_MAX; static const int bits = CHAR_BIT; - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -95,10 +94,10 @@ namespace etl template <> struct integral_limits { - static const char min = (etlstd::is_signed::value) ? SCHAR_MIN : 0; - static const char max = (etlstd::is_signed::value) ? SCHAR_MAX : char(UCHAR_MAX); + static const char min = (etl::is_signed::value) ? SCHAR_MIN : 0; + static const char max = (etl::is_signed::value) ? SCHAR_MAX : char(UCHAR_MAX); static const int bits = CHAR_BIT; - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -110,7 +109,7 @@ namespace etl static const short min = SHRT_MIN; static const short max = SHRT_MAX; static const int bits = CHAR_BIT * (sizeof(short) / sizeof(char)); - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -122,7 +121,7 @@ namespace etl static const unsigned short min = 0; static const unsigned short max = USHRT_MAX; static const int bits = CHAR_BIT * (sizeof(unsigned short) / sizeof(char)); - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -134,7 +133,7 @@ namespace etl static const int min = INT_MIN; static const int max = INT_MAX; static const int bits = CHAR_BIT * (sizeof(int) / sizeof(char)); - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -146,7 +145,7 @@ namespace etl static const unsigned int min = 0; static const unsigned int max = UINT_MAX; static const int bits = CHAR_BIT * (sizeof(unsigned int) / sizeof(char)); - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -158,7 +157,7 @@ namespace etl static const long min = LONG_MIN; static const long max = LONG_MAX; static const int bits = CHAR_BIT * (sizeof(long) / sizeof(char)); - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -170,7 +169,7 @@ namespace etl static const unsigned long min = 0; static const unsigned long max = ULONG_MAX; static const int bits = CHAR_BIT * (sizeof(unsigned long) / sizeof(char)); - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; #ifndef LLONG_MAX @@ -194,7 +193,7 @@ namespace etl static const long long min = LLONG_MIN; static const long long max = LLONG_MAX; static const int bits = CHAR_BIT * (sizeof(long long) / sizeof(char)); - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; //*************************************************************************** @@ -206,7 +205,7 @@ namespace etl static const unsigned long long min = 0; static const unsigned long long max = ULLONG_MAX; static const int bits = CHAR_BIT * (sizeof(unsigned long long) / sizeof(char)); - static const bool is_signed = etlstd::is_signed::value; + static const bool is_signed = etl::is_signed::value; }; } diff --git a/include/etl/intrusive_forward_list.h b/include/etl/intrusive_forward_list.h index 253abba2..48ed3972 100644 --- a/include/etl/intrusive_forward_list.h +++ b/include/etl/intrusive_forward_list.h @@ -153,7 +153,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - intmax_t d = etlstd::distance(first, last); + intmax_t d = etl::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(intrusive_forward_list_iterator_exception)); #endif @@ -495,7 +495,7 @@ namespace etl const value_type* p_value; }; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. @@ -651,7 +651,7 @@ namespace etl { if (first != end() && (first != last)) { - this->current_size -= etlstd::distance(first, last) - 1; + this->current_size -= etl::distance(first, last) - 1; link_type* p_first = first.p_value; link_type* p_last = last.p_value; @@ -712,7 +712,7 @@ namespace etl //************************************************************************* void sort() { - sort(etlstd::less()); + sort(etl::less()); } //************************************************************************* @@ -958,7 +958,7 @@ namespace etl { if (&other != this) { - size_t n = etlstd::distance(begin_, end_) - 1; + size_t n = etl::distance(begin_, end_) - 1; this->current_size += n; other.current_size -= n; } @@ -987,7 +987,7 @@ namespace etl //************************************************************************* void merge(list_type& other) { - merge(other, etlstd::less()); + merge(other, etl::less()); } //************************************************************************* diff --git a/include/etl/intrusive_links.h b/include/etl/intrusive_links.h index 1a652f56..c8149514 100644 --- a/include/etl/intrusive_links.h +++ b/include/etl/intrusive_links.h @@ -110,7 +110,7 @@ namespace etl // Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink& lhs, TLink& rhs) { lhs.etl_next = &rhs; @@ -118,7 +118,7 @@ namespace etl // Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& rhs) { rhs.etl_next = lhs.etl_next; @@ -127,7 +127,7 @@ namespace etl // Pointer, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink* lhs, TLink* rhs) { if (lhs != nullptr) @@ -138,7 +138,7 @@ namespace etl // Pointer, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink* rhs) { if (lhs != nullptr) @@ -154,7 +154,7 @@ namespace etl // Reference, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink& lhs, TLink* rhs) { lhs.etl_next = rhs; @@ -162,7 +162,7 @@ namespace etl // Reference, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink* rhs) { if (rhs != nullptr) @@ -175,7 +175,7 @@ namespace etl // Pointer, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -186,7 +186,7 @@ namespace etl // Pointer, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -198,7 +198,7 @@ namespace etl // Reference, Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& first, TLink& last) { last.etl_next = lhs.etl_next; @@ -207,7 +207,7 @@ namespace etl // Pointer, Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& first, TLink& last) { if (lhs != nullptr) @@ -223,7 +223,7 @@ namespace etl // Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type unlink_after(TLink& node) { if (node.etl_next != nullptr) @@ -235,7 +235,7 @@ namespace etl // Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type unlink_after(TLink& before, TLink& last) { before.etl_next = last.etl_next; @@ -265,11 +265,7 @@ namespace etl void reverse() { -#if defined(ETL_NO_STL) - using etlstd::swap; -#else - using std::swap; -#endif + using ETL_OR_STD::swap; // Allow ADL swap(etl_previous, etl_next); } @@ -295,7 +291,7 @@ namespace etl // Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink& lhs, TLink& rhs) { lhs.etl_next = &rhs; @@ -304,7 +300,7 @@ namespace etl // Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& rhs) { rhs.etl_next = lhs.etl_next; @@ -320,7 +316,7 @@ namespace etl // Pointer, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink* lhs, TLink* rhs) { if (lhs != nullptr) @@ -336,7 +332,7 @@ namespace etl // Pointer, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink* rhs) { if (rhs != nullptr) @@ -362,7 +358,7 @@ namespace etl // Reference, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink& lhs, TLink* rhs) { lhs.etl_next = rhs; @@ -375,7 +371,7 @@ namespace etl // Reference, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink* rhs) { if (rhs != nullptr) @@ -394,7 +390,7 @@ namespace etl // Pointer, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -407,7 +403,7 @@ namespace etl // Pointer, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& rhs) { if (lhs != nullptr) @@ -430,7 +426,7 @@ namespace etl // Reference, Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink& lhs, TLink& first, TLink& last) { last.etl_next = lhs.etl_next; @@ -446,7 +442,7 @@ namespace etl // Pointer, Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_splice(TLink* lhs, TLink& first, TLink& last) { if (lhs != nullptr) @@ -473,7 +469,7 @@ namespace etl // Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type unlink(TLink& node) { node.unlink(); @@ -481,7 +477,7 @@ namespace etl // Reference Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type unlink(TLink& first, TLink& last) { if (&first == &last) @@ -532,7 +528,7 @@ namespace etl // Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_left(TLink& parent, TLink& leaf) { parent.etl_left = &leaf; @@ -540,7 +536,7 @@ namespace etl } template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_right(TLink& parent, TLink& leaf) { parent.etl_right = &leaf; @@ -549,7 +545,7 @@ namespace etl // Pointer, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_left(TLink* parent, TLink* leaf) { if (parent != nullptr) @@ -564,7 +560,7 @@ namespace etl } template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_right(TLink* parent, TLink* leaf) { if (parent != nullptr) @@ -580,7 +576,7 @@ namespace etl // Reference, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_left(TLink& parent, TLink* leaf) { parent.etl_left = leaf; @@ -592,7 +588,7 @@ namespace etl } template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_right(TLink& parent, TLink* leaf) { parent.etl_right = leaf; @@ -605,7 +601,7 @@ namespace etl // Pointer, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_left(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -617,7 +613,7 @@ namespace etl } template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_right(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -630,7 +626,7 @@ namespace etl // Reference, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate_left(TLink& parent, TLink& leaf) { parent.etl_right = leaf.etl_left; @@ -646,7 +642,7 @@ namespace etl } template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate_right(TLink& parent, TLink& leaf) { parent.etl_left = leaf.etl_right; @@ -663,7 +659,7 @@ namespace etl // Pointer, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate_left(TLink* parent, TLink* leaf) { if ((parent != nullptr) && (leaf != nullptr)) @@ -673,7 +669,7 @@ namespace etl } template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate_right(TLink* parent, TLink* leaf) { if ((parent != nullptr) && (leaf != nullptr)) @@ -684,7 +680,7 @@ namespace etl // Reference, Pointer template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate_left(TLink& parent, TLink* leaf) { if (leaf != nullptr) @@ -694,7 +690,7 @@ namespace etl } template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate_right(TLink& parent, TLink* leaf) { if (leaf != nullptr) @@ -705,7 +701,7 @@ namespace etl // Pointer, Reference template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate_left(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -715,7 +711,7 @@ namespace etl } template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate_right(TLink* parent, TLink& leaf) { if (parent != nullptr) @@ -727,7 +723,7 @@ namespace etl // Reference, Reference /// Automatically detects whether a left or right rotate is expected. template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate(TLink& parent, TLink& leaf) { if (parent.etl_left == &leaf) @@ -743,7 +739,7 @@ namespace etl // Pointer, Pointer /// Automatically detects whether a left or right rotate is expected. template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate(TLink* parent, TLink* leaf) { if ((parent != nullptr) && (leaf != nullptr)) @@ -762,7 +758,7 @@ namespace etl // Reference, Pointer /// Automatically detects whether a left or right rotate is expected. template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate(TLink& parent, TLink* leaf) { if (leaf != nullptr) @@ -781,7 +777,7 @@ namespace etl // Pointer, Reference /// Automatically detects whether a left or right rotate is expected. template - typename etlstd::enable_if >::value, void>::type + typename etl::enable_if >::value, void>::type link_rotate(TLink* parent, TLink& leaf) { if (parent != nullptr) diff --git a/include/etl/intrusive_list.h b/include/etl/intrusive_list.h index ddc691ce..f618ef9b 100644 --- a/include/etl/intrusive_list.h +++ b/include/etl/intrusive_list.h @@ -133,7 +133,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - intmax_t d = etlstd::distance(first, last); + intmax_t d = etl::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(intrusive_list_iterator_exception)); #endif @@ -580,7 +580,7 @@ namespace etl const value_type* p_value; }; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //************************************************************************* /// Constructor. @@ -734,7 +734,7 @@ namespace etl // Join the ends. etl::link(p_first->etl_previous, p_last); - this->current_size -= etlstd::distance(first, last); + this->current_size -= etl::distance(first, last); if (p_last == &this->terminal_link) { @@ -781,7 +781,7 @@ namespace etl //************************************************************************* void sort() { - sort(etlstd::less()); + sort(etl::less()); } //************************************************************************* @@ -1013,7 +1013,7 @@ namespace etl { if (&other != this) { - size_t n = etlstd::distance(begin_, end_); + size_t n = etl::distance(begin_, end_); this->current_size += n; other.current_size -= n; } @@ -1036,7 +1036,7 @@ namespace etl //************************************************************************* void merge(list_type& other) { - merge(other, etlstd::less()); + merge(other, etl::less()); } //************************************************************************* diff --git a/include/etl/iterator.h b/include/etl/iterator.h index 4f7665c2..5ca901c6 100644 --- a/include/etl/iterator.h +++ b/include/etl/iterator.h @@ -41,7 +41,7 @@ SOFTWARE. ///\defgroup iterator iterator ///\ingroup utilities -namespace etlstd +namespace etl { //*************************************************************************** // iterator tags @@ -133,7 +133,7 @@ namespace etlstd template ETL_CONSTEXPR17 void advance(TIterator& itr, TDistance n) { - typedef typename etlstd::iterator_traits::iterator_category tag; + typedef typename etl::iterator_traits::iterator_category tag; advance_helper(itr, n, tag()); } @@ -152,9 +152,9 @@ namespace etlstd // distance #if defined(ETL_NO_STL) template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::input_iterator_tag) + ETL_CONSTEXPR17 typename etl::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::input_iterator_tag) { - typename etlstd::iterator_traits::difference_type d = 0; + typename etl::iterator_traits::difference_type d = 0; while (first != last) { @@ -166,9 +166,9 @@ namespace etlstd } template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::forward_iterator_tag) + ETL_CONSTEXPR17 typename etl::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::forward_iterator_tag) { - typename etlstd::iterator_traits::difference_type d = 0; + typename etl::iterator_traits::difference_type d = 0; while (first != last) { @@ -180,9 +180,9 @@ namespace etlstd } template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::bidirectional_iterator_tag) + ETL_CONSTEXPR17 typename etl::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::bidirectional_iterator_tag) { - typename etlstd::iterator_traits::difference_type d = 0; + typename etl::iterator_traits::difference_type d = 0; while (first != last) { @@ -194,15 +194,15 @@ namespace etlstd } template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::random_access_iterator_tag) + ETL_CONSTEXPR17 typename etl::iterator_traits::difference_type distance_helper(TIterator first, TIterator last, ETL_OR_STD::random_access_iterator_tag) { return last - first; } template - ETL_CONSTEXPR17 typename etlstd::iterator_traits::difference_type distance(TIterator first, TIterator last) + ETL_CONSTEXPR17 typename etl::iterator_traits::difference_type distance(TIterator first, TIterator last) { - typedef typename etlstd::iterator_traits::iterator_category tag; + typedef typename etl::iterator_traits::iterator_category tag; return distance_helper(first, last, tag()); } @@ -220,10 +220,10 @@ namespace etlstd //*************************************************************************** // Previous template - ETL_CONSTEXPR17 TIterator prev(TIterator itr, typename etlstd::iterator_traits::difference_type n = 1) + ETL_CONSTEXPR17 TIterator prev(TIterator itr, typename etl::iterator_traits::difference_type n = 1) { #if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED - etlstd::advance(itr, -n); + etl::advance(itr, -n); #else std::advance(itr, -n); #endif @@ -233,10 +233,10 @@ namespace etlstd //*************************************************************************** // Next template - ETL_CONSTEXPR17 TIterator next(TIterator itr, typename etlstd::iterator_traits::difference_type n = 1) + ETL_CONSTEXPR17 TIterator next(TIterator itr, typename etl::iterator_traits::difference_type n = 1) { #if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED - etlstd::advance(itr, n); + etl::advance(itr, n); #else std::advance(itr, n); #endif @@ -436,31 +436,31 @@ namespace etl template struct is_input_iterator { - static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::input_iterator_tag>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same::iterator_category, ETL_OR_STD::input_iterator_tag>::value; }; template struct is_output_iterator { - static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::output_iterator_tag>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same::iterator_category, ETL_OR_STD::output_iterator_tag>::value; }; template struct is_forward_iterator { - static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::forward_iterator_tag>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same::iterator_category, ETL_OR_STD::forward_iterator_tag>::value; }; template struct is_bidirectional_iterator { - static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::bidirectional_iterator_tag>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same::iterator_category, ETL_OR_STD::bidirectional_iterator_tag>::value; }; template struct is_random_iterator { - static ETL_CONST_OR_CONSTEXPR bool value = etlstd::is_same::iterator_category, ETL_OR_STD::random_access_iterator_tag>::value; + static ETL_CONST_OR_CONSTEXPR bool value = etl::is_same::iterator_category, ETL_OR_STD::random_access_iterator_tag>::value; }; template diff --git a/include/etl/largest.h b/include/etl/largest.h index 0ebdc414..5880d907 100644 --- a/include/etl/largest.h +++ b/include/etl/largest.h @@ -82,7 +82,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - using type = typename etlstd::conditional<(etl::size_of::value > etl::size_of::value), // Boolean + using type = typename etl::conditional<(etl::size_of::value > etl::size_of::value), // Boolean T1, // TrueType largest_other> // FalseType ::type; // The largest type of the two. @@ -128,7 +128,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - typedef typename etlstd::conditional<(sizeof(T1) > sizeof(largest_other)), // Boolean + typedef typename etl::conditional<(sizeof(T1) > sizeof(largest_other)), // Boolean T1, // TrueType largest_other> // FalseType ::type type; // The largest type of the two. @@ -170,7 +170,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - using type = typename etlstd::conditional<(etlstd::alignment_of::value > etlstd::alignment_of::value), // Boolean + using type = typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean T1, // TrueType largest_other> // FalseType ::type; // The largest type of the two. @@ -178,7 +178,7 @@ namespace etl // The largest alignment. enum { - value = etlstd::alignment_of::value + value = etl::alignment_of::value }; }; @@ -192,7 +192,7 @@ namespace etl enum { - value = etlstd::alignment_of::value + value = etl::alignment_of::value }; }; #else @@ -213,7 +213,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - typedef typename etlstd::conditional<(etlstd::alignment_of::value > etlstd::alignment_of::value), // Boolean + typedef typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean T1, // TrueType largest_other> // FalseType ::type type; // The largest type of the two. @@ -221,7 +221,7 @@ namespace etl // The largest alignment. enum { - value = etlstd::alignment_of::value + value = etl::alignment_of::value }; }; @@ -236,7 +236,7 @@ namespace etl enum { - value = etlstd::alignment_of::value + value = etl::alignment_of::value }; }; #endif @@ -249,7 +249,7 @@ namespace etl template struct larger_int_type { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_int_for_bits::type>::bits + 1>::type type; }; @@ -262,7 +262,7 @@ namespace etl template struct larger_uint_type { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_uint_for_bits::type>::bits + 1>::type type; }; @@ -273,13 +273,13 @@ namespace etl /// The returned type will be of the same sign. ///\ingroup largest //*************************************************************************** - template ::value> + template ::value> struct larger_type; template struct larger_type { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_uint_for_bits::bits + 1>::type type; }; @@ -287,7 +287,7 @@ namespace etl template struct larger_type { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_int_for_bits::bits + 1>::type type; }; diff --git a/include/etl/largest_generator.h b/include/etl/largest_generator.h index bfe55b50..dfd05dd7 100644 --- a/include/etl/largest_generator.h +++ b/include/etl/largest_generator.h @@ -94,7 +94,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - using type = typename etlstd::conditional<(etl::size_of::value > etl::size_of::value), // Boolean + using type = typename etl::conditional<(etl::size_of::value > etl::size_of::value), // Boolean T1, // TrueType largest_other> // FalseType ::type; // The largest type of the two. @@ -151,7 +151,7 @@ namespace etl cog.outl("") cog.outl(" // Set 'type' to be the largest of the first parameter and any of the others.") cog.outl(" // This is recursive.") - cog.outl(" typedef typename etlstd::conditional<(sizeof(T1) > sizeof(largest_other)), // Boolean") + cog.outl(" typedef typename etl::conditional<(sizeof(T1) > sizeof(largest_other)), // Boolean") cog.outl(" T1, // TrueType") cog.outl(" largest_other> // FalseType") cog.outl(" ::type type; // The largest type of the two.") @@ -200,7 +200,7 @@ namespace etl // Set 'type' to be the largest of the first parameter and any of the others. // This is recursive. - using type = typename etlstd::conditional<(etlstd::alignment_of::value > etlstd::alignment_of::value), // Boolean + using type = typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean T1, // TrueType largest_other> // FalseType ::type; // The largest type of the two. @@ -208,7 +208,7 @@ namespace etl // The largest alignment. enum { - value = etlstd::alignment_of::value + value = etl::alignment_of::value }; }; @@ -222,7 +222,7 @@ namespace etl enum { - value = etlstd::alignment_of::value + value = etl::alignment_of::value }; }; #else @@ -254,7 +254,7 @@ namespace etl cog.outl("") cog.outl(" // Set 'type' to be the largest of the first parameter and any of the others.") cog.outl(" // This is recursive.") - cog.outl(" typedef typename etlstd::conditional<(etlstd::alignment_of::value > etlstd::alignment_of::value), // Boolean") + cog.outl(" typedef typename etl::conditional<(etl::alignment_of::value > etl::alignment_of::value), // Boolean") cog.outl(" T1, // TrueType") cog.outl(" largest_other> // FalseType") cog.outl(" ::type type; // The largest type of the two.") @@ -262,7 +262,7 @@ namespace etl cog.outl(" // The largest alignment.") cog.outl(" enum") cog.outl(" {") - cog.outl(" value = etlstd::alignment_of::value") + cog.outl(" value = etl::alignment_of::value") cog.outl(" };") cog.outl("};") cog.outl("") @@ -282,7 +282,7 @@ namespace etl cog.outl("") cog.outl(" enum") cog.outl(" {") - cog.outl(" value = etlstd::alignment_of::value") + cog.outl(" value = etl::alignment_of::value") cog.outl(" };") cog.outl("};") ]]]*/ @@ -297,7 +297,7 @@ namespace etl template struct larger_int_type { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_int_for_bits::type>::bits + 1>::type type; }; @@ -310,7 +310,7 @@ namespace etl template struct larger_uint_type { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_uint_for_bits::type>::bits + 1>::type type; }; @@ -321,13 +321,13 @@ namespace etl /// The returned type will be of the same sign. ///\ingroup largest //*************************************************************************** - template ::value> + template ::value> struct larger_type; template struct larger_type { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_uint_for_bits::bits + 1>::type type; }; @@ -335,7 +335,7 @@ namespace etl template struct larger_type { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Must be an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Must be an integral type"); typedef typename etl::smallest_int_for_bits::bits + 1>::type type; }; diff --git a/include/etl/limits.h b/include/etl/limits.h index 5ee6c417..a934e292 100644 --- a/include/etl/limits.h +++ b/include/etl/limits.h @@ -43,10 +43,8 @@ SOFTWARE. #if defined(ETL_NO_STL) #define ETL_LOG2(x) (((x) * 301) / 1000) -namespace etlstd +namespace etl { - template class numeric_limits; - enum float_round_style { round_indeterminate = -1, @@ -63,87 +61,6 @@ namespace etlstd denorm_present = 1 }; - //*************************************************************************** - // Base for integral types. - template - class etl_integral_type - { - public: - static ETL_CONST_OR_CONSTEXPR bool is_specialized = true; - - static ETL_CONST_OR_CONSTEXPR int max_digits10 = 0; - - static ETL_CONST_OR_CONSTEXPR bool is_integer = true; - static ETL_CONST_OR_CONSTEXPR bool is_exact = true; - - static ETL_CONST_OR_CONSTEXPR int radix = 2; - static ETL_CONSTEXPR T epsilon() { return 0; } - static ETL_CONSTEXPR T round_error() { return 0; } - - static ETL_CONST_OR_CONSTEXPR int digits = (CHAR_BIT * sizeof(T)) - (etlstd::is_signed::value ? 1 : 0); - static ETL_CONST_OR_CONSTEXPR int digits10 = ETL_LOG2(digits); - - static ETL_CONST_OR_CONSTEXPR bool is_signed = etlstd::is_signed::value; - - static ETL_CONST_OR_CONSTEXPR int min_exponent = 0; - static ETL_CONST_OR_CONSTEXPR int min_exponent10 = 0; - static ETL_CONST_OR_CONSTEXPR int max_exponent = 0; - static ETL_CONST_OR_CONSTEXPR int max_exponent10 = 0; - - static ETL_CONST_OR_CONSTEXPR bool has_infinity = false; - static ETL_CONST_OR_CONSTEXPR bool has_quiet_NaN = false; - static ETL_CONST_OR_CONSTEXPR bool has_signaling_NaN = false; - static ETL_CONST_OR_CONSTEXPR float_denorm_style has_denorm = denorm_absent; - static ETL_CONST_OR_CONSTEXPR bool has_denorm_loss = false; - - 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 ETL_CONST_OR_CONSTEXPR bool is_iec559 = false; - static ETL_CONST_OR_CONSTEXPR bool is_bounded = true; - static ETL_CONST_OR_CONSTEXPR bool is_modulo = etlstd::is_unsigned::value; - - static ETL_CONST_OR_CONSTEXPR bool traps = false; - static ETL_CONST_OR_CONSTEXPR bool tinyness_before = false; - static ETL_CONST_OR_CONSTEXPR float_round_style round_style = round_toward_zero; - }; - - //*************************************************************************** - // Base for floating point types. - template - class etl_floating_point_type - { - public: - static ETL_CONST_OR_CONSTEXPR bool is_specialized = true; - - static ETL_CONST_OR_CONSTEXPR bool is_signed = true; - static ETL_CONST_OR_CONSTEXPR bool is_integer = false; - static ETL_CONST_OR_CONSTEXPR bool is_exact = false; - - static ETL_CONST_OR_CONSTEXPR int radix = 2; - - static ETL_CONST_OR_CONSTEXPR bool has_infinity = false; - static ETL_CONST_OR_CONSTEXPR bool has_quiet_NaN = false; - static ETL_CONST_OR_CONSTEXPR bool has_signaling_NaN = false; - static ETL_CONST_OR_CONSTEXPR float_denorm_style has_denorm = denorm_present; - static ETL_CONST_OR_CONSTEXPR bool has_denorm_loss = true; - - static ETL_CONST_OR_CONSTEXPR bool is_iec559 = true; - static ETL_CONST_OR_CONSTEXPR bool is_bounded = true; - static ETL_CONST_OR_CONSTEXPR bool is_modulo = false; - - 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 ETL_CONST_OR_CONSTEXPR bool traps = false; - static ETL_CONST_OR_CONSTEXPR bool tinyness_before = true; - static ETL_CONST_OR_CONSTEXPR float_round_style round_style = round_to_nearest; - }; - //*************************************************************************** // Default template @@ -165,296 +82,1355 @@ namespace etlstd { public: - static ETL_CONST_OR_CONSTEXPR bool is_specialized = true; + static const bool is_specialized = true; - 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 = 1; + static const int digits10 = 0; + static const int max_digits10 = 0; - static ETL_CONST_OR_CONSTEXPR int digits = 1; - static ETL_CONST_OR_CONSTEXPR int digits10 = 0; - static ETL_CONST_OR_CONSTEXPR int max_digits10 = 0; + static const bool is_signed = false; + static const bool is_integer = true; + static const bool is_exact = true; - static ETL_CONST_OR_CONSTEXPR bool is_signed = false; - static ETL_CONST_OR_CONSTEXPR bool is_integer = true; - static ETL_CONST_OR_CONSTEXPR bool is_exact = true; + static const int radix = 2; + static const bool epsilon() { return false; } + static const bool round_error() { return false; } - static ETL_CONST_OR_CONSTEXPR int radix = 2; - static ETL_CONST_OR_CONSTEXPR bool epsilon() { return false; } - static ETL_CONST_OR_CONSTEXPR bool round_error() { return false; } + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; - static ETL_CONST_OR_CONSTEXPR int min_exponent = 0; - static ETL_CONST_OR_CONSTEXPR int min_exponent10 = 0; - static ETL_CONST_OR_CONSTEXPR int max_exponent = 0; - static ETL_CONST_OR_CONSTEXPR int max_exponent10 = 0; + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; - static ETL_CONST_OR_CONSTEXPR bool has_infinity = false; - static ETL_CONST_OR_CONSTEXPR bool has_quiet_NaN = false; - static ETL_CONST_OR_CONSTEXPR bool has_signaling_NaN = false; - static ETL_CONST_OR_CONSTEXPR float_denorm_style has_denorm = denorm_absent; - static ETL_CONST_OR_CONSTEXPR bool has_denorm_loss = false; + static const bool infinity() { return false; } + static const bool quiet_NaN() { return false; } + static const bool signaling_NaN() { return false; } + static const bool denorm_min() { return false; } - static ETL_CONSTEXPR bool infinity() { return false; } - static ETL_CONSTEXPR bool quiet_NaN() { return false; } - static ETL_CONSTEXPR bool signaling_NaN() { return false; } - static ETL_CONSTEXPR bool denorm_min() { return false; } + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = false; - static ETL_CONST_OR_CONSTEXPR bool is_iec559 = false; - static ETL_CONST_OR_CONSTEXPR bool is_bounded = true; - static ETL_CONST_OR_CONSTEXPR bool is_modulo = false; + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; - static ETL_CONST_OR_CONSTEXPR bool traps = false; - static ETL_CONST_OR_CONSTEXPR bool tinyness_before = false; - static ETL_CONST_OR_CONSTEXPR float_round_style round_style = round_toward_zero; + static const bool min() { return false; } + static const bool max() { return true; } + static const bool lowest() { return false; } }; //*************************************************************************** // char template<> - class numeric_limits : public etl_integral_type + class numeric_limits { public: - static ETL_CONSTEXPR char min() { return char(CHAR_MIN); } - static ETL_CONSTEXPR char max() { return char(CHAR_MAX); } - static ETL_CONSTEXPR char lowest() { return char(CHAR_MIN); } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(char)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const char infinity() { return 0; } + static const char quiet_NaN() { return 0; } + static const char signaling_NaN() { return 0; } + static const char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const char min() { return char(CHAR_MIN); } + static const char max() { return char(CHAR_MAX); } + static const char lowest() { return char(CHAR_MIN); } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // unsigned char template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(unsigned char)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const unsigned char min() { return 0; } + static const unsigned char max() { return UCHAR_MAX; } + static const unsigned char lowest() { return 0; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // signed char template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(char)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const char infinity() { return 0; } + static const char quiet_NaN() { return 0; } + static const char signaling_NaN() { return 0; } + static const char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const signed char min() { return SCHAR_MIN; } + static const signed char max() { return SCHAR_MAX; } + static const signed char lowest() { return SCHAR_MIN; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + #if (ETL_NO_LARGE_CHAR_SUPPORT == false) //*************************************************************************** // char16_t template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } - static ETL_CONST_OR_CONSTEXPR bool is_modulo = true; + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(char16_t)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const char16_t min() { return 0; } + static const char16_t max() { return UINT_LEAST16_MAX; } + static const char16_t lowest() { return 0; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // char32_t template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } - static ETL_CONST_OR_CONSTEXPR bool is_modulo = true; + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(char32_t)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const char32_t min() { return 0; } + static const char32_t max() { return UINT_LEAST32_MAX; } + static const char32_t lowest() { return 0; } }; + + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + #endif //*************************************************************************** // wchar_t template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(wchar_t)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const wchar_t min() { return WCHAR_MIN; } + static const wchar_t max() { return WCHAR_MAX; } + static const wchar_t lowest() { return WCHAR_MIN; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // short template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(short)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const short min() { return SHRT_MIN; } + static const short max() { return SHRT_MAX; } + static const short lowest() { return SHRT_MIN; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // unsigned short template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(unsigned short)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const unsigned short min() { return 0; } + static const unsigned short max() { return USHRT_MAX; } + static const unsigned short lowest() { return 0; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // int template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(int)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const int min() { return INT_MIN; } + static const int max() { return INT_MAX; } + static const int lowest() { return INT_MIN; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // unsigned int template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(unsigned int)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const unsigned int min() { return 0; } + static const unsigned int max() { return UINT_MAX; } + static const unsigned int lowest() { return 0; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // long template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(long)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const long min() { return LONG_MIN; } + static const long max() { return LONG_MAX; } + static const long lowest() { return LONG_MIN; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // unsigned long template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(unsigned long)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const unsigned long min() { return 0; } + static const unsigned long max() { return ULONG_MAX; } + static const unsigned long lowest() { return 0; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // long long template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(long long)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const long long min() { return LLONG_MIN; } + static const long long max() { return LLONG_MAX; } + static const long long lowest() { return LLONG_MIN; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // unsigned long long template<> - class numeric_limits : public etl_integral_type + class numeric_limits { 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; } + static const bool is_specialized = true; + + static const bool is_integer = true; + static const bool is_exact = true; + + static const int radix = 2; + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + + static const int digits = (CHAR_BIT * sizeof(unsigned long long)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG2(digits); + static const int max_digits10 = 0; + + static const bool is_signed = etl::is_signed::value; + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static const unsigned char infinity() { return 0; } + static const unsigned char quiet_NaN() { return 0; } + static const unsigned char signaling_NaN() { return 0; } + static const unsigned char denorm_min() { return 0; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = etl::is_unsigned::value; + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + + static const unsigned long long min() { return 0; } + static const unsigned long long max() { return ULLONG_MAX; } + static const unsigned long long lowest() { return 0; } }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + #endif + //*************************************************************************** // float template<> - class numeric_limits : public etl_floating_point_type + class numeric_limits { 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 bool is_specialized = true; - static ETL_CONST_OR_CONSTEXPR int digits = FLT_MANT_DIG; - static ETL_CONST_OR_CONSTEXPR int digits10 = FLT_DIG; - static ETL_CONST_OR_CONSTEXPR int max_digits10 = ETL_LOG2(FLT_MANT_DIG) + 2; + static const bool is_signed = true; + static const bool is_integer = false; + static const bool is_exact = false; - static ETL_CONST_OR_CONSTEXPR int min_exponent = FLT_MIN_EXP; - static ETL_CONST_OR_CONSTEXPR int min_exponent10 = FLT_MIN_10_EXP; - static ETL_CONST_OR_CONSTEXPR int max_exponent = FLT_MAX_EXP; - static ETL_CONST_OR_CONSTEXPR int max_exponent10 = FLT_MAX_10_EXP; + static const int radix = 2; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_indeterminate; + static const bool has_denorm_loss = false; + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = false; + + static const float round_error() { return float(0.5); } + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_indeterminate; + + static const float min() { return FLT_MIN; } + static const float max() { return FLT_MAX; } + static const float lowest() { return -FLT_MAX; } + static const float epsilon() { return FLT_EPSILON; } + static const float denorm_min() { return FLT_MIN; } + + static const int digits = FLT_MANT_DIG; + static const int digits10 = FLT_DIG; + static const int max_digits10 = ETL_LOG2(FLT_MANT_DIG) + 2; + + static const int min_exponent = FLT_MIN_EXP; + static const int min_exponent10 = FLT_MIN_10_EXP; + static const int max_exponent = FLT_MAX_EXP; + static const int max_exponent10 = FLT_MAX_10_EXP; }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + #endif + //*************************************************************************** // double template<> - class numeric_limits : public etl_floating_point_type + class numeric_limits { 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 bool is_specialized = true; - static ETL_CONST_OR_CONSTEXPR int digits = DBL_MANT_DIG; - static ETL_CONST_OR_CONSTEXPR int digits10 = DBL_DIG; - static ETL_CONST_OR_CONSTEXPR int max_digits10 = ETL_LOG2(DBL_MANT_DIG) + 2; + static const bool is_signed = true; + static const bool is_integer = false; + static const bool is_exact = false; - static ETL_CONST_OR_CONSTEXPR int min_exponent = DBL_MIN_EXP; - static ETL_CONST_OR_CONSTEXPR int min_exponent10 = DBL_MIN_10_EXP; - static ETL_CONST_OR_CONSTEXPR int max_exponent = DBL_MAX_EXP; - static ETL_CONST_OR_CONSTEXPR int max_exponent10 = DBL_MAX_10_EXP; + static const int radix = 2; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_indeterminate; + static const bool has_denorm_loss = false; + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = false; + + static const float round_error() { return double(0.5); } + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_indeterminate; + + static const double min() { return DBL_MIN; } + static const double max() { return DBL_MAX; } + static const double lowest() { return -DBL_MAX; } + static const double epsilon() { return DBL_EPSILON; } + static const double denorm_min() { return DBL_MIN; } + + static const int digits = DBL_MANT_DIG; + static const int digits10 = DBL_DIG; + static const int max_digits10 = ETL_LOG2(DBL_MANT_DIG) + 2; + + static const int min_exponent = DBL_MIN_EXP; + static const int min_exponent10 = DBL_MIN_10_EXP; + static const int max_exponent = DBL_MAX_EXP; + static const int max_exponent10 = DBL_MAX_10_EXP; }; + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + #endif + //*************************************************************************** // long double template<> - class numeric_limits : public etl_floating_point_type + class numeric_limits { 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 bool is_specialized = true; - static ETL_CONST_OR_CONSTEXPR int digits = LDBL_MANT_DIG; - static ETL_CONST_OR_CONSTEXPR int digits10 = LDBL_DIG; - static ETL_CONST_OR_CONSTEXPR int max_digits10 = ETL_LOG2(LDBL_MANT_DIG) + 2; + static const bool is_signed = true; + static const bool is_integer = false; + static const bool is_exact = false; - static ETL_CONST_OR_CONSTEXPR int min_exponent = LDBL_MIN_EXP; - static ETL_CONST_OR_CONSTEXPR int min_exponent10 = LDBL_MIN_10_EXP; - static ETL_CONST_OR_CONSTEXPR int max_exponent = LDBL_MAX_EXP; - static ETL_CONST_OR_CONSTEXPR int max_exponent10 = LDBL_MAX_10_EXP; + static const int radix = 2; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_indeterminate; + static const bool has_denorm_loss = false; + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = false; + + static const float round_error() { return (long double)(0.5); } + + static const bool traps = false; + static const bool tinyness_before = false; + static const float_round_style round_style = round_indeterminate; + + static const long double min() { return LDBL_MIN; } + static const long double max() { return LDBL_MAX; } + static const long double lowest() { return -LDBL_MAX; } + static const long double epsilon() { return LDBL_EPSILON; } + static const long double denorm_min() { return LDBL_MIN; } + + static const int digits = LDBL_MANT_DIG; + static const int digits10 = LDBL_DIG; + static const int max_digits10 = ETL_LOG2(LDBL_MANT_DIG) + 2; + + static const int min_exponent = LDBL_MIN_EXP; + static const int min_exponent10 = LDBL_MIN_10_EXP; + static const int max_exponent = LDBL_MAX_EXP; + static const int max_exponent10 = LDBL_MAX_10_EXP; }; + + #if !defined(ETL_COMPILER_MICROSOFT) + const bool numeric_limits::is_specialized; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + #endif } #else #include -namespace etlstd +namespace etl { enum float_round_style { diff --git a/include/etl/list.h b/include/etl/list.h index 2147daa8..6225d011 100644 --- a/include/etl/list.h +++ b/include/etl/list.h @@ -182,6 +182,8 @@ namespace etl //*********************************************************************** inline void reverse() { + using ETL_OR_STD::swap; // Allow ADL + swap(previous, next); } @@ -676,7 +678,7 @@ namespace etl const node_t* p_node; }; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; @@ -810,7 +812,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(list_iterator)); ETL_ASSERT(size_t(d) <= MAX_SIZE, ETL_ERROR(list_full)); #endif @@ -866,7 +868,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(list_full)); #endif - insert_node(get_head(), allocate_data_node(etlstd::move(value))); + insert_node(get_head(), allocate_data_node(etl::move(value))); } #endif @@ -883,7 +885,7 @@ namespace etl ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(etlstd::forward(args)...); + ::new (&(p_data_node->value)) T(etl::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node(get_head(), *p_data_node); } @@ -989,7 +991,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(list_full)); #endif - insert_node(terminal_node, allocate_data_node(etlstd::move(value))); + insert_node(terminal_node, allocate_data_node(etl::move(value))); } #endif @@ -1006,7 +1008,7 @@ namespace etl ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(etlstd::forward(args)...); + ::new (&(p_data_node->value)) T(etl::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node(terminal_node, *p_data_node); } @@ -1101,7 +1103,7 @@ namespace etl { ETL_ASSERT(!full(), ETL_ERROR(list_full)); - data_node_t& data_node = allocate_data_node(etlstd::move(value)); + data_node_t& data_node = allocate_data_node(etl::move(value)); insert_node(*position.p_node, data_node); return iterator(data_node); @@ -1119,7 +1121,7 @@ namespace etl ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(etlstd::forward(args)...); + ::new (&(p_data_node->value)) T(etl::forward(args)...); ETL_INCREMENT_DEBUG_COUNT insert_node(*position.p_node, *p_data_node); @@ -1269,7 +1271,7 @@ namespace etl else if (n < size()) { iterator i_start = end(); - etlstd::advance(i_start, -difference_type(size() - n)); + etl::advance(i_start, -difference_type(size() - n)); erase(i_start, end()); } // Larger? @@ -1334,7 +1336,7 @@ namespace etl //************************************************************************* void unique() { - unique(etlstd::equal_to()); + unique(etl::equal_to()); } //************************************************************************* @@ -1390,7 +1392,7 @@ namespace etl typename ilist::iterator itr = other.begin(); while (itr != other.end()) { - to = insert(to, etlstd::move(*itr++)); + to = insert(to, etl::move(*itr++)); } other.erase(other.begin(), other.end()); @@ -1430,7 +1432,7 @@ namespace etl else { // From another list. - insert(to, etlstd::move(*from)); + insert(to, etl::move(*from)); other.erase(from); } } @@ -1471,7 +1473,7 @@ namespace etl ilist::iterator itr = first; while (itr != last) { - to = insert(to, etlstd::move(*itr++)); + to = insert(to, etl::move(*itr++)); ++to; } @@ -1485,7 +1487,7 @@ namespace etl //************************************************************************* void merge(ilist& other) { - merge(other, etlstd::less()); + merge(other, etl::less()); } //************************************************************************* @@ -1542,7 +1544,7 @@ namespace etl //************************************************************************* void merge(ilist&& other) { - merge(etlstd::move(other), etlstd::less()); + merge(etl::move(other), etl::less()); } //************************************************************************* @@ -1577,7 +1579,7 @@ namespace etl { while ((other_begin != other_end) && (compare(*other_begin, *this_begin))) { - insert(this_begin, etlstd::move(*other_begin)); + insert(this_begin, etl::move(*other_begin)); ++other_begin; } } @@ -1588,7 +1590,7 @@ namespace etl { while (other_begin != other_end) { - insert(this_end, etlstd::move(*other_begin++)); + insert(this_end, etl::move(*other_begin++)); } } @@ -1603,7 +1605,7 @@ namespace etl //************************************************************************* void sort() { - sort(etlstd::less()); + sort(etl::less()); } //************************************************************************* @@ -1765,7 +1767,7 @@ namespace etl iterator itr = rhs.begin(); while (itr != rhs.end()) { - push_back(etlstd::move(*itr)); + push_back(etl::move(*itr)); ++itr; } @@ -1917,7 +1919,7 @@ namespace etl ETL_ASSERT(p_node_pool != nullptr, ETL_ERROR(list_no_pool)); data_node_t* p_data_node = p_node_pool->allocate(); - ::new (&(p_data_node->value)) T(etlstd::move(value)); + ::new (&(p_data_node->value)) T(etl::move(value)); ETL_INCREMENT_DEBUG_COUNT return *p_data_node; @@ -2033,7 +2035,7 @@ namespace etl typename etl::ilist::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -2089,7 +2091,7 @@ namespace etl typename etl::ilist::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -2191,7 +2193,7 @@ namespace etl typename etl::ilist::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -2247,7 +2249,7 @@ namespace etl typename etl::ilist::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -2282,7 +2284,7 @@ namespace etl template bool operator ==(const etl::ilist& lhs, const etl::ilist& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -2307,7 +2309,7 @@ namespace etl template bool operator <(const etl::ilist& lhs, const etl::ilist& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/map.h b/include/etl/map.h index 131e3dd1..b068888f 100755 --- a/include/etl/map.h +++ b/include/etl/map.h @@ -462,7 +462,7 @@ namespace etl /// A templated base for all etl::map types. ///\ingroup map //*************************************************************************** - template > + template > class imap : public etl::map_base { public: @@ -804,7 +804,7 @@ namespace etl friend class const_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; @@ -917,7 +917,7 @@ namespace etl if (!i_element.p_node) { // Doesn't exist, so create a new one. - i_element = insert(ETL_MAKE_PAIR(key, mapped_type())).first; + i_element = insert(ETL_OR_STD::make_pair(key, mapped_type())).first; } return i_element->second; @@ -991,7 +991,7 @@ namespace etl //************************************************************************* ETL_OR_STD::pair equal_range(key_parameter_t key) { - return ETL_MAKE_PAIR( + return ETL_OR_STD::make_pair( iterator(*this, find_lower_node(root_node, key)), iterator(*this, find_upper_node(root_node, key))); } @@ -1002,7 +1002,7 @@ namespace etl //************************************************************************* ETL_OR_STD::pair equal_range(key_parameter_t key) const { - return ETL_MAKE_PAIR( + return ETL_OR_STD::make_pair( const_iterator(*this, find_lower_node(root_node, key)), const_iterator(*this, find_upper_node(root_node, key))); } @@ -1109,7 +1109,7 @@ namespace etl inserted = inserted_node == &node; // Insert node into tree and return iterator to new node location in tree - return ETL_MAKE_PAIR(iterator(*this, inserted_node), inserted); + return ETL_OR_STD::make_pair(iterator(*this, inserted_node), inserted); } //********************************************************************* @@ -2042,7 +2042,7 @@ namespace etl //************************************************************************* /// A templated map implementation that uses a fixed size buffer. //************************************************************************* - template > + template > class map : public etl::imap { public: @@ -2129,7 +2129,7 @@ namespace etl template bool operator ==(const etl::imap& lhs, const etl::imap& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2155,7 +2155,7 @@ namespace etl template bool operator <(const etl::imap& lhs, const etl::imap& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/memory.h b/include/etl/memory.h index 53623b2b..8d9c1aa1 100644 --- a/include/etl/memory.h +++ b/include/etl/memory.h @@ -48,9 +48,9 @@ SOFTWARE. #endif ///\defgroup memory memory -///\ingroup etlstd +///\ingroup etl -namespace etlstd +namespace etl { //***************************************************************************** /// Gets the address of an object. @@ -74,10 +74,10 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value) { - etlstd::fill(o_begin, o_end, value); + etl::fill(o_begin, o_end, value); return o_end; } @@ -88,10 +88,10 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value) { - typedef typename etlstd::iterator_traits::value_type value_type; + typedef typename etl::iterator_traits::value_type value_type; while (o_begin != o_end) { @@ -109,12 +109,12 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) { - count += int32_t(etlstd::distance(o_begin, o_end)); + count += int32_t(etl::distance(o_begin, o_end)); - etlstd::fill(o_begin, o_end, value); + etl::fill(o_begin, o_end, value); return o_end; } @@ -126,12 +126,12 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) { - count += int32_t(etlstd::distance(o_begin, o_end)); + count += int32_t(etl::distance(o_begin, o_end)); - etlstd::uninitialized_fill(o_begin, o_end, value); + etl::uninitialized_fill(o_begin, o_end, value); return o_end; } @@ -159,7 +159,7 @@ namespace etlstd template TOutputIterator uninitialized_fill(TOutputIterator o_begin, TOutputIterator o_end, const T& value, TCounter& count) { - count += int32_t(etlstd::distance(o_begin, o_end)); + count += int32_t(etl::distance(o_begin, o_end)); std::uninitialized_fill(o_begin, o_end, value); @@ -176,7 +176,7 @@ namespace etlstd template TOutputIterator uninitialized_fill_n(TOutputIterator o_begin, TSize n, const T& value) { - return etlstd::uninitialized_fill(o_begin, o_begin + n, value); + return etl::uninitialized_fill(o_begin, o_begin + n, value); } //***************************************************************************** @@ -190,7 +190,7 @@ namespace etlstd { count += n; - return etlstd::uninitialized_fill(o_begin, o_begin + n, value); + return etl::uninitialized_fill(o_begin, o_begin + n, value); } #else //***************************************************************************** @@ -226,10 +226,10 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin) { - return etlstd::copy(i_begin, i_end, o_begin); + return etl::copy(i_begin, i_end, o_begin); } //***************************************************************************** @@ -238,10 +238,10 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin) { - typedef typename etlstd::iterator_traits::value_type value_type; + typedef typename etl::iterator_traits::value_type value_type; TOutputIterator o_end = o_begin; @@ -262,11 +262,11 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count) { - TOutputIterator o_end = etlstd::copy(i_begin, i_end, o_begin); - count += int32_t(etlstd::distance(o_begin, o_end)); + TOutputIterator o_end = etl::copy(i_begin, i_end, o_begin); + count += int32_t(etl::distance(o_begin, o_end)); return o_end; } @@ -278,12 +278,12 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_copy(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TCounter& count) { - TOutputIterator o_end = etlstd::uninitialized_copy(i_begin, i_end, o_begin); + TOutputIterator o_end = etl::uninitialized_copy(i_begin, i_end, o_begin); - count += int32_t(etlstd::distance(o_begin, o_end)); + count += int32_t(etl::distance(o_begin, o_end)); return o_end; } @@ -321,7 +321,7 @@ namespace etlstd template TOutputIterator uninitialized_copy_n(TInputIterator i_begin, TSize n, TOutputIterator o_begin) { - return etlstd::uninitialized_copy(i_begin, i_begin + n, o_begin); + return etl::uninitialized_copy(i_begin, i_begin + n, o_begin); } //***************************************************************************** @@ -335,7 +335,7 @@ namespace etlstd { count += n; - return etlstd::uninitialized_copy(i_begin, i_begin + n, o_begin); + return etl::uninitialized_copy(i_begin, i_begin + n, o_begin); } #else //***************************************************************************** @@ -371,7 +371,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type uninitialized_default_construct(TOutputIterator /*o_begin*/, TOutputIterator /*o_end*/) { // Do nothing @@ -383,11 +383,11 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end) { - typedef typename etlstd::iterator_traits::value_type value_type; + typedef typename etl::iterator_traits::value_type value_type; while (o_begin != o_end) { @@ -403,10 +403,10 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count = int32_t(etlstd::distance(o_begin, o_end)); + count = int32_t(etl::distance(o_begin, o_end)); } //***************************************************************************** @@ -416,12 +416,12 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count += int32_t(etlstd::distance(o_begin, o_end)); + count += int32_t(etl::distance(o_begin, o_end)); - etlstd::uninitialized_default_construct(o_begin, o_end); + etl::uninitialized_default_construct(o_begin, o_end); } #else //***************************************************************************** @@ -430,7 +430,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end) { std::uninitialized_default_construct(o_begin, o_end); @@ -443,10 +443,10 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type uninitialized_default_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count = int32_t(etlstd::distance(o_begin, o_end)); + count = int32_t(etl::distance(o_begin, o_end)); std::uninitialized_default_construct(o_begin, o_end); } @@ -459,7 +459,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_default_construct_n(TOutputIterator o_begin, TSize n) { TOutputIterator o_end = o_begin + n; @@ -472,12 +472,12 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_default_construct_n(TOutputIterator o_begin, TSize n) { TOutputIterator o_end = o_begin + n; - etlstd::uninitialized_default_construct(o_begin, o_end); + etl::uninitialized_default_construct(o_begin, o_end); return o_end; } @@ -489,7 +489,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_default_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) { TOutputIterator o_end = o_begin + n; @@ -506,12 +506,12 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type + typename etl::enable_if::value_type>::value, TOutputIterator>::type uninitialized_default_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) { TOutputIterator o_end = o_begin + n; - etlstd::uninitialized_default_construct(o_begin, o_end); + etl::uninitialized_default_construct(o_begin, o_end); count += n; @@ -524,13 +524,11 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_default_construct_n(TOutputIterator o_begin, TSize n) + TOutputIterator uninitialized_default_construct_n(TOutputIterator o_begin, TSize n) { return std::uninitialized_default_construct_n(o_begin, n); } - //***************************************************************************** /// Default initialises N objects to uninitialised memory. /// https://en.cppreference.com/w/cpp/memory/uninitialized_default_construct_n @@ -538,8 +536,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TOutputIterator>::type - uninitialized_default_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) + TOutputIterator uninitialized_default_construct_n(TOutputIterator o_begin, TSize n, TCounter& count) { count += n; @@ -554,12 +551,12 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end) { - typedef typename etlstd::iterator_traits::value_type value_type; + typedef typename etl::iterator_traits::value_type value_type; - etlstd::fill(o_begin, o_end, value_type()); + etl::fill(o_begin, o_end, value_type()); } //***************************************************************************** @@ -568,10 +565,10 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end) { - typedef typename etlstd::iterator_traits::value_type value_type; + typedef typename etl::iterator_traits::value_type value_type; while (o_begin != o_end) { @@ -589,9 +586,9 @@ namespace etlstd template void uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count += int32_t(etlstd::distance(o_begin, o_end)); + count += int32_t(etl::distance(o_begin, o_end)); - etlstd::uninitialized_value_construct(o_begin, o_end); + etl::uninitialized_value_construct(o_begin, o_end); } #else //***************************************************************************** @@ -614,7 +611,7 @@ namespace etlstd template void uninitialized_value_construct(TOutputIterator o_begin, TOutputIterator o_end, TCounter& count) { - count += int32_t(etlstd::distance(o_begin, o_end)); + count += int32_t(etl::distance(o_begin, o_end)); std::uninitialized_value_construct(o_begin, o_end); } @@ -632,7 +629,7 @@ namespace etlstd { TOutputIterator o_end = o_begin + n; - etlstd::uninitialized_value_construct(o_begin, o_end); + etl::uninitialized_value_construct(o_begin, o_end); return o_end; } @@ -648,7 +645,7 @@ namespace etlstd { TOutputIterator o_end = o_begin + n; - etlstd::uninitialized_value_construct(o_begin, o_end); + etl::uninitialized_value_construct(o_begin, o_end); count += n; @@ -688,7 +685,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type destroy_at(T* /*p*/) { } @@ -699,7 +696,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type destroy_at(T* p) { p->~T(); @@ -712,7 +709,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type destroy_at(T* /*p*/, TCounter& count) { --count; @@ -725,7 +722,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type destroy_at(T* p, TCounter& count) { p->~T(); @@ -750,7 +747,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - void destroy_at(T* /*p*/, TCounter& count) + void destroy_at(T* p, TCounter& count) { --count; std::destroy_at(p); @@ -764,7 +761,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type destroy(TIterator /*i_begin*/, TIterator /*i_end*/) { } @@ -775,12 +772,12 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type destroy(TIterator i_begin, TIterator i_end) { while (i_begin != i_end) { - etlstd::destroy_at(etl::addressof(*i_begin)); + etl::destroy_at(etl::addressof(*i_begin)); ++i_begin; } } @@ -792,10 +789,10 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type destroy(TIterator i_begin, TIterator i_end, TCounter& count) { - count -= int32_t(etlstd::distance(i_begin, i_end)); + count -= int32_t(etl::distance(i_begin, i_end)); } //***************************************************************************** @@ -805,14 +802,14 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, void>::type + typename etl::enable_if::value_type>::value, void>::type destroy(TIterator i_begin, TIterator i_end, TCounter& count) { - count -= int32_t(etlstd::distance(i_begin, i_end)); + count -= int32_t(etl::distance(i_begin, i_end)); while (i_begin != i_end) { - etlstd::destroy_at(etl::addressof(*i_begin)); + etl::destroy_at(etl::addressof(*i_begin)); ++i_begin; } } @@ -837,7 +834,7 @@ namespace etlstd template void destroy(TIterator i_begin, TIterator i_end, TCounter& count) { - count -= int32_t(etlstd::distance(i_begin, i_end)); + count -= int32_t(etl::distance(i_begin, i_end)); std::destroy(i_begin, i_end); } @@ -850,7 +847,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TIterator>::type + typename etl::enable_if::value_type>::value, TIterator>::type destroy_n(TIterator i_begin, TSize n) { return i_begin + n; @@ -862,7 +859,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TIterator>::type + typename etl::enable_if::value_type>::value, TIterator>::type destroy_n(TIterator i_begin, TSize n) { while (n > 0) @@ -882,7 +879,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TIterator>::type + typename etl::enable_if::value_type>::value, TIterator>::type destroy_n(TIterator i_begin, TSize n, TCounter& count) { count -= n; @@ -896,7 +893,7 @@ namespace etlstd ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value_type>::value, TIterator>::type + typename etl::enable_if::value_type>::value, TIterator>::type destroy_n(TIterator i_begin, TSize n, TCounter& count) { count -= n; @@ -974,7 +971,7 @@ namespace etlstd /// https://en.cppreference.com/w/cpp/memory/unique_ptr ///\ingroup memory //***************************************************************************** - template > + template > class unique_ptr { public: @@ -1247,7 +1244,7 @@ namespace etl ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type create_default_at(T* /*p*/) { } @@ -1257,7 +1254,7 @@ namespace etl ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type create_default_at(T* /*p*/, TCounter& count) { ++count; @@ -1268,7 +1265,7 @@ namespace etl ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type create_default_at(T* p) { ::new (p) T; @@ -1279,7 +1276,7 @@ namespace etl ///\ingroup memory //***************************************************************************** template - typename etlstd::enable_if::value, void>::type + typename etl::enable_if::value, void>::type create_default_at(T* p, TCounter& count) { ::new (p) T; @@ -1325,7 +1322,7 @@ namespace etl template void create_copy_at(T* p, T&& value) { - ::new (p) T(etlstd::move(value)); + ::new (p) T(etl::move(value)); } #endif @@ -1382,7 +1379,7 @@ namespace etl template T& make_copy_at(T* p, T&& other) { - ::new (p) T(etlstd::move(other)); + ::new (p) T(etl::move(other)); return *reinterpret_cast(p); } #endif @@ -1418,7 +1415,7 @@ namespace etl template T& make_value_at(T* p, TParameter&& value) { - ::new (p) T(etlstd::move(value)); + ::new (p) T(etl::move(value)); return *reinterpret_cast(p); } #endif @@ -1519,7 +1516,7 @@ namespace etl template void memory_clear_range(volatile T* begin, volatile T* end) { - const size_t n = static_cast(etlstd::distance(begin, end)); + const size_t n = static_cast(etl::distance(begin, end)); memory_clear_range(begin, n); } @@ -1577,7 +1574,7 @@ namespace etl template void memory_set_range(volatile T* begin, volatile T* end, const char value) { - const size_t n = static_cast(etlstd::distance(begin, end)); + const size_t n = static_cast(etl::distance(begin, end)); memory_set_range(begin, n, value); } diff --git a/include/etl/message_bus.h b/include/etl/message_bus.h index 32e4eb7f..12e75c8f 100644 --- a/include/etl/message_bus.h +++ b/include/etl/message_bus.h @@ -102,7 +102,7 @@ namespace etl if (ok) { - router_list_t::iterator irouter = etlstd::upper_bound(router_list.begin(), + router_list_t::iterator irouter = etl::upper_bound(router_list.begin(), router_list.end(), router.get_message_router_id(), compare_router_id()); @@ -125,7 +125,7 @@ namespace etl } else { - ETL_OR_STD::pair range = etlstd::equal_range(router_list.begin(), + ETL_OR_STD::pair range = etl::equal_range(router_list.begin(), router_list.end(), id, compare_router_id()); @@ -137,7 +137,7 @@ namespace etl //******************************************* void unsubscribe(etl::imessage_router& router) { - router_list_t::iterator irouter = etlstd::find(router_list.begin(), + router_list_t::iterator irouter = etl::find(router_list.begin(), router_list.end(), &router); @@ -212,7 +212,7 @@ namespace etl router_list_t::iterator irouter = router_list.begin(); // Find routers with the id. - ETL_OR_STD::pair range = etlstd::equal_range(router_list.begin(), + ETL_OR_STD::pair range = etl::equal_range(router_list.begin(), router_list.end(), destination_router_id, compare_router_id()); @@ -230,7 +230,7 @@ namespace etl // Do any message buses. // These are always at the end of the list. - irouter = etlstd::lower_bound(router_list.begin(), + irouter = etl::lower_bound(router_list.begin(), router_list.end(), etl::imessage_bus::MESSAGE_BUS, compare_router_id()); diff --git a/include/etl/multimap.h b/include/etl/multimap.h index e9b88f50..37ca3902 100644 --- a/include/etl/multimap.h +++ b/include/etl/multimap.h @@ -624,7 +624,7 @@ namespace etl /// A templated base for all etl::multimap types. ///\ingroup map //*************************************************************************** - template > + template > class imultimap : public etl::multimap_base { public: @@ -960,7 +960,7 @@ namespace etl }; friend class const_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; @@ -1099,7 +1099,7 @@ namespace etl //************************************************************************* ETL_OR_STD::pair equal_range(key_parameter_t key) { - return ETL_MAKE_PAIR( + return ETL_OR_STD::make_pair( iterator(*this, find_lower_node(root_node, key)), iterator(*this, find_upper_node(root_node, key))); } @@ -1110,7 +1110,7 @@ namespace etl //************************************************************************* ETL_OR_STD::pair equal_range(key_parameter_t key) const { - return ETL_MAKE_PAIR( + return ETL_OR_STD::make_pair( const_iterator(*this, find_lower_node(root_node, key)), const_iterator(*this, find_upper_node(root_node, key))); } @@ -1931,7 +1931,7 @@ namespace etl //************************************************************************* /// A templated multimap implementation that uses a fixed size buffer. //************************************************************************* - template > + template > class multimap : public etl::imultimap { public: @@ -2018,7 +2018,7 @@ namespace etl template bool operator ==(const etl::imultimap& lhs, const etl::imultimap& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2044,7 +2044,7 @@ namespace etl template bool operator <(const etl::imultimap& lhs, const etl::imultimap& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/multiset.h b/include/etl/multiset.h index 72111914..ffc63709 100644 --- a/include/etl/multiset.h +++ b/include/etl/multiset.h @@ -925,7 +925,7 @@ namespace etl }; friend class const_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; @@ -1064,7 +1064,7 @@ namespace etl //************************************************************************* ETL_OR_STD::pair equal_range(const value_type& key) { - return ETL_MAKE_PAIR( + return ETL_OR_STD::make_pair( iterator(*this, find_lower_node(root_node, key)), iterator(*this, find_upper_node(root_node, key))); } @@ -1075,7 +1075,7 @@ namespace etl //************************************************************************* ETL_OR_STD::pair equal_range(const value_type& key) const { - return ETL_MAKE_PAIR( + return ETL_OR_STD::make_pair( const_iterator(*this, find_lower_node(root_node, key)), const_iterator(*this, find_upper_node(root_node, key))); } diff --git a/include/etl/murmur3.h b/include/etl/murmur3.h index 6b869c7b..bb15c259 100644 --- a/include/etl/murmur3.h +++ b/include/etl/murmur3.h @@ -57,7 +57,7 @@ namespace etl { public: - ETL_STATIC_ASSERT((etlstd::is_same::value || etlstd::is_same::value), "Only 32 & 64 bit types supported"); + ETL_STATIC_ASSERT((etl::is_same::value || etl::is_same::value), "Only 32 & 64 bit types supported"); typedef THash value_type; @@ -81,7 +81,7 @@ namespace etl murmur3(TIterator begin, const TIterator end, value_type seed_ = 0) : seed(seed_) { - ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Incompatible type"); + ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits::value_type) == 1, "Incompatible type"); reset(); while (begin != end) @@ -119,7 +119,7 @@ namespace etl template void add(TIterator begin, const TIterator end) { - ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Incompatible type"); + ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits::value_type) == 1, "Incompatible type"); ETL_ASSERT(!is_finalised, ETL_ERROR(hash_finalised)); while (begin != end) diff --git a/include/etl/negative.h b/include/etl/negative.h index eecf73a8..7b2a6b33 100644 --- a/include/etl/negative.h +++ b/include/etl/negative.h @@ -39,7 +39,7 @@ namespace etl // For signed types. //*************************************************************************** template - typename etlstd::enable_if::value, bool>::type + typename etl::enable_if::value, bool>::type is_negative(const T value) { return (value < T(0)); @@ -49,7 +49,7 @@ namespace etl // For unsigned types. //*************************************************************************** template - typename etlstd::enable_if::value, T>::type + typename etl::enable_if::value, T>::type is_negative(const T) { return false; diff --git a/include/etl/observer.h b/include/etl/observer.h index 9441f07c..188ecc87 100644 --- a/include/etl/observer.h +++ b/include/etl/observer.h @@ -115,7 +115,7 @@ namespace etl void add_observer(TObserver& observer) { // See if we already have it in our list. - typename Observer_List::const_iterator i_observer = etlstd::find(observer_list.begin(), + typename Observer_List::const_iterator i_observer = etl::find(observer_list.begin(), observer_list.end(), &observer); @@ -138,7 +138,7 @@ namespace etl bool remove_observer(TObserver& observer) { // See if we have it in our list. - typename Observer_List::iterator i_observer = etlstd::find(observer_list.begin(), + typename Observer_List::iterator i_observer = etl::find(observer_list.begin(), observer_list.end(), &observer); diff --git a/include/etl/packet.h b/include/etl/packet.h index b25e55fe..35390315 100644 --- a/include/etl/packet.h +++ b/include/etl/packet.h @@ -64,9 +64,9 @@ namespace etl template explicit packet(const T& value) { - ETL_STATIC_ASSERT((etlstd::is_base_of::value), "Unsupported type"); + ETL_STATIC_ASSERT((etl::is_base_of::value), "Unsupported type"); ETL_STATIC_ASSERT(sizeof(T) <= SIZE, "Unsupported size"); - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Unsupported alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Unsupported alignment"); ::new (static_cast(data)) T(value); } @@ -86,9 +86,9 @@ namespace etl template packet& operator =(const T& value) { - ETL_STATIC_ASSERT((etlstd::is_base_of::value), "Unsupported type"); + ETL_STATIC_ASSERT((etl::is_base_of::value), "Unsupported type"); ETL_STATIC_ASSERT(sizeof(T) <= SIZE, "Unsupported size"); - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Unsupported alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Unsupported alignment"); static_cast(data)->~TBase(); ::new (static_cast(data)) T(value); diff --git a/include/etl/parameter_type.h b/include/etl/parameter_type.h index a8587c71..1150c86b 100644 --- a/include/etl/parameter_type.h +++ b/include/etl/parameter_type.h @@ -43,7 +43,7 @@ namespace etl struct parameter_type { /// By default fundamental and pointer types are passed by value. - typedef typename etlstd::conditional::value || is_pointer::value, + typedef typename etl::conditional::value || etl::is_pointer::value, T, const T&>::type type; }; diff --git a/include/etl/pearson.h b/include/etl/pearson.h index eebcec57..d7379c78 100644 --- a/include/etl/pearson.h +++ b/include/etl/pearson.h @@ -81,7 +81,7 @@ namespace etl pearson(TIterator begin, const TIterator end) : first(true) { - ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Type not supported"); + ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits::value_type) == 1, "Type not supported"); reset(); add(begin, end); @@ -103,7 +103,7 @@ namespace etl template void add(TIterator begin, const TIterator end) { - ETL_STATIC_ASSERT(sizeof(typename etlstd::iterator_traits::value_type) == 1, "Type not supported"); + ETL_STATIC_ASSERT(sizeof(typename etl::iterator_traits::value_type) == 1, "Type not supported"); while (begin != end) { diff --git a/include/etl/platform.h b/include/etl/platform.h index e5a21937..eaf3ae58 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -72,7 +72,7 @@ SOFTWARE. #endif // The macros below are dependent on the profile. -#if ETL_CPP11_SUPPORTED +#if ETL_CPP11_SUPPORTED && !defined(ETL_FORCE_NO_ADVANCED_CPP) #define ETL_CONSTEXPR constexpr #define ETL_CONST_OR_CONSTEXPR constexpr #define ETL_DELETE = delete @@ -86,7 +86,7 @@ SOFTWARE. #define ETL_NOEXCEPT_EXPR(expression) #endif -#if ETL_CPP17_SUPPORTED +#if ETL_CPP17_SUPPORTED && !defined(ETL_FORCE_NO_ADVANCED_CPP) #define ETL_CONSTEXPR17 constexpr #define ETL_IF_CONSTEXPR constexpr #define ETL_NODISCARD [[nodiscard]] @@ -102,7 +102,7 @@ SOFTWARE. #define ETL_EXPLICIT_STRING_FROM_CHAR #endif -// Sort out names for STL/No STL options. +// Sort out namespaces for STL/No STL options. #include "private/choose_namespace.h" #endif diff --git a/include/etl/pool.h b/include/etl/pool.h index 232f504a..8f051420 100644 --- a/include/etl/pool.h +++ b/include/etl/pool.h @@ -224,7 +224,7 @@ namespace etl if (p) { - ::new (p) T(etlstd::forward(args)...); + ::new (p) T(etl::forward(args)...); } return p; @@ -492,7 +492,7 @@ namespace etl template U* allocate() { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::allocate(); } @@ -506,7 +506,7 @@ namespace etl template U* create() { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(); } @@ -519,7 +519,7 @@ namespace etl template U* create(const T1& value1) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(value1); } @@ -532,7 +532,7 @@ namespace etl template U* create(const T1& value1, const T2& value2) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(value1, value2); } @@ -545,7 +545,7 @@ namespace etl template U* create(const T1& value1, const T2& value2, const T3& value3) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(value1, value2, value3); } @@ -558,7 +558,7 @@ namespace etl template U* create(const T1& value1, const T2& value2, const T3& value3, const T4& value4) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return ipool::create(value1, value2, value3, value4); } @@ -569,9 +569,9 @@ namespace etl template U* create(Args&&... args) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); - return ipool::create(etlstd::forward(args)...); + return ipool::create(etl::forward(args)...); } #endif @@ -583,7 +583,7 @@ namespace etl template void destroy(const void* const p_object) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT_, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); reinterpret_cast((const_cast(p_object)))->~U(); ipool::release(p_object); @@ -600,7 +600,7 @@ namespace etl }; ///< The memory for the pool of objects. - typename etl::aligned_storage::value>::type buffer[SIZE]; + typename etl::aligned_storage::value>::type buffer[SIZE]; static const uint32_t ELEMENT_SIZE = sizeof(Element); @@ -614,11 +614,11 @@ namespace etl ///\ingroup pool //************************************************************************* template - class pool : public etl::generic_pool::value, SIZE_> + class pool : public etl::generic_pool::value, SIZE_> { private: - typedef etl::generic_pool::value, SIZE_> base_t; + typedef etl::generic_pool::value, SIZE_> base_t; public: @@ -643,7 +643,7 @@ namespace etl template U* allocate() { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template allocate(); } @@ -657,7 +657,7 @@ namespace etl template U* create() { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(); } @@ -670,7 +670,7 @@ namespace etl template U* create(const T1& value1) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(value1); } @@ -683,7 +683,7 @@ namespace etl template U* create(const T1& value1, const T2& value2) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(value1, value2); } @@ -696,7 +696,7 @@ namespace etl template U* create(const T1& value1, const T2& value2, const T3& value3) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(value1, value2, value3); } @@ -709,7 +709,7 @@ namespace etl template U* create(const T1& value1, const T2& value2, const T3& value3, const T4& value4) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); return base_t::template create(value1, value2, value3, value4); } @@ -722,9 +722,9 @@ namespace etl template U* create(Args&&... args) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); - return base_t::template create(etlstd::forward(args)...); + return base_t::template create(etl::forward(args)...); } #endif @@ -736,7 +736,7 @@ namespace etl template void destroy(const void* const p_object) { - ETL_STATIC_ASSERT(etlstd::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); + ETL_STATIC_ASSERT(etl::alignment_of::value <= ALIGNMENT, "Type has incompatible alignment"); ETL_STATIC_ASSERT(sizeof(U) <= TYPE_SIZE, "Type too large for pool"); reinterpret_cast((const_cast(p_object)))->~U(); base_t::release(p_object); diff --git a/include/etl/priority_queue.h b/include/etl/priority_queue.h index 5a232a4d..8f1174ed 100644 --- a/include/etl/priority_queue.h +++ b/include/etl/priority_queue.h @@ -115,7 +115,7 @@ namespace etl /// \tparam TContainer to hold the T queue values /// \tparam TCompare to use in comparing T values //*************************************************************************** - template > + template > class ipriority_queue { public: @@ -126,7 +126,7 @@ namespace etl typedef T& reference; ///< A reference to the type used in the queue. typedef const T& const_reference; ///< A const reference to the type used in the queue. typedef typename TContainer::size_type size_type; ///< The type used for determining the size of the queue. - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; private: @@ -165,7 +165,7 @@ namespace etl // Put element at end container.push_back(value); // Make elements in container into heap - etlstd::push_heap(container.begin(), container.end(), compare); + etl::push_heap(container.begin(), container.end(), compare); } #if ETL_CPP11_SUPPORTED && !defined(ETL_STLPORT) && !defined(ETL_PRIORITY_QUEUE_FORCE_CPP03) @@ -181,9 +181,9 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(etl::priority_queue_full)); // Put element at end - container.emplace_back(etlstd::forward(args)...); + container.emplace_back(etl::forward(args)...); // Make elements in container into heap - etlstd::push_heap(container.begin(), container.end(), compare); + etl::push_heap(container.begin(), container.end(), compare); } #else //************************************************************************* @@ -200,7 +200,7 @@ namespace etl // Put element at end container.emplace_back(value1); // Make elements in container into heap - etlstd::push_heap(container.begin(), container.end(), compare); + etl::push_heap(container.begin(), container.end(), compare); } //************************************************************************* @@ -217,7 +217,7 @@ namespace etl // Put element at end container.emplace_back(value1, value2); // Make elements in container into heap - etlstd::push_heap(container.begin(), container.end(), compare); + etl::push_heap(container.begin(), container.end(), compare); } //************************************************************************* @@ -234,7 +234,7 @@ namespace etl // Put element at end container.emplace_back(value1, value2, value3); // Make elements in container into heap - etlstd::push_heap(container.begin(), container.end(), compare); + etl::push_heap(container.begin(), container.end(), compare); } //************************************************************************* @@ -251,7 +251,7 @@ namespace etl // Put element at end container.emplace_back(value1, value2, value3, value4); // Make elements in container into heap - etlstd::push_heap(container.begin(), container.end(), compare); + etl::push_heap(container.begin(), container.end(), compare); } #endif @@ -268,14 +268,14 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d >= 0, ETL_ERROR(etl::priority_queue_iterator)); ETL_ASSERT(static_cast(d) <= max_size(), ETL_ERROR(etl::priority_queue_full)); #endif clear(); container.assign(first, last); - etlstd::make_heap(container.begin(), container.end(), compare); + etl::make_heap(container.begin(), container.end(), compare); } //************************************************************************* @@ -285,7 +285,7 @@ namespace etl void pop() { // Move largest element to end - etlstd::pop_heap(container.begin(), container.end(), compare); + etl::pop_heap(container.begin(), container.end(), compare); // Actually remove largest element at end container.pop_back(); } @@ -386,7 +386,7 @@ namespace etl /// \tparam T The type this queue should support. /// \tparam SIZE The maximum capacity of the queue. //*************************************************************************** - template , typename TCompare = etlstd::less > + template , typename TCompare = etl::less > class priority_queue : public etl::ipriority_queue { public: diff --git a/include/etl/private/choose_namespace.h b/include/etl/private/choose_namespace.h index c8271715..a36a0984 100644 --- a/include/etl/private/choose_namespace.h +++ b/include/etl/private/choose_namespace.h @@ -36,8 +36,8 @@ SOFTWARE. #undef ETL_OR_STD #if defined(ETL_NO_STL) && !defined(ETL_IN_UNIT_TEST) - // If we're not using the STL and we are not unit testing, then use the ETL's definitions under the etlstd namespace - #define ETL_OR_STD etlstd + // If we're not using the STL and we are not unit testing, then use the ETL's definitions under the etl namespace + #define ETL_OR_STD etl #else // We will use the STL's definitions under the std namespace #define ETL_OR_STD std diff --git a/include/etl/private/ivectorpointer.h b/include/etl/private/ivectorpointer.h index 3497cf2c..9093eaf1 100644 --- a/include/etl/private/ivectorpointer.h +++ b/include/etl/private/ivectorpointer.h @@ -59,7 +59,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -441,7 +441,7 @@ namespace etl //********************************************************************* void initialise_source_external_buffer_after_move() { - ETL_SUBTRACT_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) + ETL_SUBTRACT_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end))) p_end = p_buffer; } @@ -451,7 +451,7 @@ namespace etl //********************************************************************* void initialise_destination_external_buffer_after_move() { - ETL_ADD_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) + ETL_ADD_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end))) } }; @@ -470,7 +470,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -852,7 +852,7 @@ namespace etl //********************************************************************* void initialise_source_external_buffer_after_move() { - ETL_SUBTRACT_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) + ETL_SUBTRACT_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end))) p_end = p_buffer; } @@ -862,7 +862,7 @@ namespace etl //********************************************************************* void initialise_destination_external_buffer_after_move() { - ETL_ADD_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) + ETL_ADD_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end))) } }; diff --git a/include/etl/private/minmax_pop.h b/include/etl/private/minmax_pop.h index 778f63b4..f46e46a1 100644 --- a/include/etl/private/minmax_pop.h +++ b/include/etl/private/minmax_pop.h @@ -33,7 +33,7 @@ SOFTWARE. * This file is intended to evaluated multiple times by design. */ -#ifdef ETL_COMPILER_MICROSOFT -#pragma pop_macro("min") -#pragma pop_macro("max") +#if defined(ETL_COMPILER_MICROSOFT) + #pragma pop_macro("min") + #pragma pop_macro("max") #endif diff --git a/include/etl/private/minmax_push.h b/include/etl/private/minmax_push.h index 4b009771..290a2024 100644 --- a/include/etl/private/minmax_push.h +++ b/include/etl/private/minmax_push.h @@ -33,9 +33,9 @@ SOFTWARE. * This file is intended to evaluated multiple times by design. */ -#ifdef ETL_COMPILER_MICROSOFT -#pragma push_macro("min") -#pragma push_macro("max") -#undef min -#undef max +#if defined(ETL_COMPILER_MICROSOFT) + #pragma push_macro("min") + #pragma push_macro("max") + #undef min + #undef max #endif diff --git a/include/etl/private/pvoidvector.h b/include/etl/private/pvoidvector.h index 172dd41b..58963d8a 100644 --- a/include/etl/private/pvoidvector.h +++ b/include/etl/private/pvoidvector.h @@ -70,7 +70,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef etlstd::iterator_traits::difference_type difference_type; + typedef etl::iterator_traits::difference_type difference_type; public: @@ -211,7 +211,7 @@ namespace etl // Size up if necessary. if (p_end < p_new_end) { - etlstd::fill(p_end, p_new_end, value); + etl::fill(p_end, p_new_end, value); } p_end = p_new_end; @@ -326,7 +326,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); #endif @@ -402,7 +402,7 @@ namespace etl if (position != end()) { ++p_end; - etlstd::copy_backward(position, end() - 1, end()); + etl::copy_backward(position, end() - 1, end()); *position = value; } else @@ -424,8 +424,8 @@ namespace etl { ETL_ASSERT((size() + 1) <= CAPACITY, ETL_ERROR(vector_full)); - etlstd::copy_backward(position, p_end, p_end + n); - etlstd::fill_n(position, n, value); + etl::copy_backward(position, p_end, p_end + n); + etl::fill_n(position, n, value); p_end += n; } @@ -441,12 +441,12 @@ namespace etl template void insert(iterator position, TIterator first, TIterator last) { - size_t count = etlstd::distance(first, last); + size_t count = etl::distance(first, last); ETL_ASSERT((size() + count) <= CAPACITY, ETL_ERROR(vector_full)); - etlstd::copy_backward(position, p_end, p_end + count); - etlstd::copy(first, last, position); + etl::copy_backward(position, p_end, p_end + count); + etl::copy(first, last, position); p_end += count; } @@ -457,7 +457,7 @@ namespace etl //********************************************************************* iterator erase(iterator i_element) { - etlstd::copy(i_element + 1, end(), i_element); + etl::copy(i_element + 1, end(), i_element); --p_end; return i_element; @@ -473,8 +473,8 @@ namespace etl //********************************************************************* iterator erase(iterator first, iterator last) { - etlstd::copy(last, end(), first); - size_t n_delete = etlstd::distance(first, last); + etl::copy(last, end(), first); + size_t n_delete = etl::distance(first, last); // Just adjust the count. p_end -= n_delete; @@ -580,7 +580,7 @@ namespace etl //*************************************************************************** inline bool operator ==(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -604,7 +604,7 @@ namespace etl //*************************************************************************** inline bool operator <(const etl::pvoidvector& lhs, const etl::pvoidvector& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //*************************************************************************** diff --git a/include/etl/private/to_string_helper.h b/include/etl/private/to_string_helper.h index f2102f41..42514d68 100644 --- a/include/etl/private/to_string_helper.h +++ b/include/etl/private/to_string_helper.h @@ -56,7 +56,7 @@ namespace etl template void add_alignment(TIString& str, typename TIString::iterator position, const etl::basic_format_spec& format) { - uint32_t length = static_cast(etlstd::distance(position, str.end())); + uint32_t length = static_cast(etl::distance(position, str.end())); if (length < format.get_width()) { @@ -165,7 +165,7 @@ namespace etl } // Reverse the string we appended. - etlstd::reverse(start, str.end()); + etl::reverse(start, str.end()); } etl::private_to_string::add_alignment(str, start, format); @@ -241,7 +241,7 @@ namespace etl else { // Make sure we format the two halves correctly. - uint32_t max_precision = etlstd::numeric_limits::digits10; + uint32_t max_precision = etl::numeric_limits::digits10; etl::basic_format_spec integral_format = format; integral_format.decimal().width(0).precision(format.get_precision() > max_precision ? max_precision : format.get_precision()); @@ -354,10 +354,10 @@ namespace etl /// For signed integrals less than 64 bits. Default format spec. //*************************************************************************** template - typename etlstd::enable_if::value && - etlstd::is_signed::value && - !etlstd::is_same::value && - !etlstd::is_same::value, const TIString&>::type + typename etl::enable_if::value && + etl::is_signed::value && + !etl::is_same::value && + !etl::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -371,10 +371,10 @@ namespace etl /// For signed integrals less than 64 bits. Supplied format spec. //*************************************************************************** template - typename etlstd::enable_if::value && - etlstd::is_signed::value && - !etlstd::is_same::value && - !etlstd::is_same::value, const TIString&>::type + typename etl::enable_if::value && + etl::is_signed::value && + !etl::is_same::value && + !etl::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_integral(int32_t(value), str, format, append); @@ -386,10 +386,10 @@ namespace etl /// For unsigned integrals less then 64 bits. Default format spec. //*************************************************************************** template - typename etlstd::enable_if::value && - etlstd::is_unsigned::value && - !etlstd::is_same::value && - !etlstd::is_same::value, const TIString&>::type + typename etl::enable_if::value && + etl::is_unsigned::value && + !etl::is_same::value && + !etl::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -403,10 +403,10 @@ namespace etl /// For unsigned integrals less than 64 bits. Supplied format spec. //*************************************************************************** template - typename etlstd::enable_if::value && - etlstd::is_unsigned::value && - !etlstd::is_same::value && - !etlstd::is_same::value, const TIString&>::type + typename etl::enable_if::value && + etl::is_unsigned::value && + !etl::is_same::value && + !etl::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_integral(uint32_t(value), str, format, append); @@ -418,10 +418,10 @@ namespace etl /// For signed 64 bit integrals. Default format spec. //*************************************************************************** template - typename etlstd::enable_if::value && - etlstd::is_signed::value && - !etlstd::is_same::value && - etlstd::is_same::value, const TIString&>::type + typename etl::enable_if::value && + etl::is_signed::value && + !etl::is_same::value && + etl::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -435,10 +435,10 @@ namespace etl /// For signed 64 bit integrals. Supplied format spec. //*************************************************************************** template - typename etlstd::enable_if::value && - etlstd::is_signed::value && - !etlstd::is_same::value && - etlstd::is_same::value, const TIString&>::type + typename etl::enable_if::value && + etl::is_signed::value && + !etl::is_same::value && + etl::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_integral(int64_t(value), str, format, append); @@ -450,10 +450,10 @@ namespace etl /// For unsigned 64 bit integrals. Default format spec. //*************************************************************************** template - typename etlstd::enable_if::value && - etlstd::is_unsigned::value && - !etlstd::is_same::value && - etlstd::is_same::value, const TIString&>::type + typename etl::enable_if::value && + etl::is_unsigned::value && + !etl::is_same::value && + etl::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -467,10 +467,10 @@ namespace etl /// For unsigned 64 bit integrals. Supplied format spec. //*************************************************************************** template - typename etlstd::enable_if::value && - etlstd::is_unsigned::value && - !etlstd::is_same::value && - etlstd::is_same::value, const TIString&>::type + typename etl::enable_if::value && + etl::is_unsigned::value && + !etl::is_same::value && + etl::is_same::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_integral(uint64_t(value), str, format, append); @@ -482,7 +482,7 @@ namespace etl /// For floating point. Default format spec. //*************************************************************************** template - typename etlstd::enable_if::value, const TIString&>::type + typename etl::enable_if::value, const TIString&>::type to_string(const T value, TIString& str, const bool append = false) { etl::basic_format_spec format; @@ -496,7 +496,7 @@ namespace etl /// For floating point. Supplied format spec. //*************************************************************************** template - typename etlstd::enable_if::value, const TIString&>::type + typename etl::enable_if::value, const TIString&>::type to_string(const T value, TIString& str, const etl::basic_format_spec& format, const bool append = false) { etl::private_to_string::add_floating_point(value, str, format, append); diff --git a/include/etl/queue.h b/include/etl/queue.h index a251690b..f669be1d 100644 --- a/include/etl/queue.h +++ b/include/etl/queue.h @@ -330,7 +330,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(!full(), ETL_ERROR(queue_full)); #endif - ::new (&p_buffer[in]) T(etlstd::forward(args)...); + ::new (&p_buffer[in]) T(etl::forward(args)...); add_in(); } #else @@ -582,7 +582,7 @@ namespace etl private: /// The uninitialised buffer of T used in the stack. - typename etl::aligned_storage::value>::type buffer[SIZE]; + typename etl::aligned_storage::value>::type buffer[SIZE]; }; } diff --git a/include/etl/queue_mpmc_mutex.h b/include/etl/queue_mpmc_mutex.h index e71de49f..b8d220d1 100644 --- a/include/etl/queue_mpmc_mutex.h +++ b/include/etl/queue_mpmc_mutex.h @@ -179,7 +179,7 @@ namespace etl { access.lock(); - bool result = emplace_implementation(etlstd::forward(args)...); + bool result = emplace_implementation(etl::forward(args)...); access.unlock(); @@ -392,7 +392,7 @@ namespace etl { if (current_size != MAX_SIZE) { - ::new (&p_buffer[write_index]) T(etlstd::forward(args)...); + ::new (&p_buffer[write_index]) T(etl::forward(args)...); write_index = get_next_index(write_index, MAX_SIZE); @@ -585,7 +585,7 @@ namespace etl queue_mpmc_mutex& operator = (const queue_mpmc_mutex&); /// The uninitialised buffer of T used in the queue_mpmc_mutex. - typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; + typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; }; } diff --git a/include/etl/queue_spsc_atomic.h b/include/etl/queue_spsc_atomic.h index 98f681b8..f0490385 100644 --- a/include/etl/queue_spsc_atomic.h +++ b/include/etl/queue_spsc_atomic.h @@ -239,7 +239,7 @@ namespace etl if (next_index != read.load(etl::memory_order_acquire)) { - ::new (&p_buffer[write_index]) T(etlstd::forward(args)...); + ::new (&p_buffer[write_index]) T(etl::forward(args)...); write.store(next_index, etl::memory_order_release); @@ -469,7 +469,7 @@ namespace etl private: /// The uninitialised buffer of T used in the queue_spsc. - typename etl::aligned_storage::value>::type buffer[RESERVED_SIZE]; + typename etl::aligned_storage::value>::type buffer[RESERVED_SIZE]; }; } diff --git a/include/etl/queue_spsc_isr.h b/include/etl/queue_spsc_isr.h index 87ae3c98..aadd8420 100644 --- a/include/etl/queue_spsc_isr.h +++ b/include/etl/queue_spsc_isr.h @@ -82,7 +82,7 @@ namespace etl template bool emplace_from_isr(Args&&... args) { - return emplace_implementation(etlstd::forward(args)...); + return emplace_implementation(etl::forward(args)...); } #endif @@ -207,7 +207,7 @@ namespace etl { if (current_size != MAX_SIZE) { - ::new (&p_buffer[write_index]) T(etlstd::forward(args)...); + ::new (&p_buffer[write_index]) T(etl::forward(args)...); write_index = get_next_index(write_index, MAX_SIZE); @@ -440,7 +440,7 @@ namespace etl { TAccess::lock(); - bool result = this->emplace_implementation(etlstd::forward(args)...); + bool result = this->emplace_implementation(etl::forward(args)...); TAccess::unlock(); @@ -676,7 +676,7 @@ namespace etl queue_spsc_isr& operator = (const queue_spsc_isr&); /// The uninitialised buffer of T used in the queue_spsc_isr. - typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; + typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; }; } diff --git a/include/etl/queue_spsc_locked.h b/include/etl/queue_spsc_locked.h index 52f7e5f5..75053fd1 100644 --- a/include/etl/queue_spsc_locked.h +++ b/include/etl/queue_spsc_locked.h @@ -83,7 +83,7 @@ namespace etl template bool emplace_from_unlocked(Args&&... args) { - return emplace_implementation(etlstd::forward(args)...); + return emplace_implementation(etl::forward(args)...); } #endif @@ -208,7 +208,7 @@ namespace etl { if (current_size != MAX_SIZE) { - ::new (&p_buffer[write_index]) T(etlstd::forward(args)...); + ::new (&p_buffer[write_index]) T(etl::forward(args)...); write_index = get_next_index(write_index, MAX_SIZE); @@ -437,7 +437,7 @@ namespace etl { lock(); - bool result = this->emplace_implementation(etlstd::forward(args)...); + bool result = this->emplace_implementation(etl::forward(args)...); unlock(); @@ -677,7 +677,7 @@ namespace etl queue_spsc_locked& operator = (const queue_spsc_locked&); /// The uninitialised buffer of T used in the queue_spsc_locked. - typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; + typename etl::aligned_storage::value>::type buffer[MAX_SIZE]; }; } diff --git a/include/etl/reference_flat_map.h b/include/etl/reference_flat_map.h index 2293fe7e..c5ac11c8 100644 --- a/include/etl/reference_flat_map.h +++ b/include/etl/reference_flat_map.h @@ -103,7 +103,7 @@ namespace etl /// Can be used as a reference type for all reference_flat_maps containing a specific type. ///\ingroup reference_flat_map //*************************************************************************** - template > + template > class ireference_flat_map { public: @@ -319,7 +319,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -525,10 +525,10 @@ namespace etl template void assign(TIterator first, TIterator last) { - ETL_STATIC_ASSERT((etlstd::is_same::value_type>::value), "Incompatible data for assign"); + ETL_STATIC_ASSERT((etl::is_same::value_type>::value), "Incompatible data for assign"); #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_map_full)); #endif @@ -693,7 +693,7 @@ namespace etl //********************************************************************* iterator lower_bound(key_parameter_t key) { - return etlstd::lower_bound(begin(), end(), key, compare); + return etl::lower_bound(begin(), end(), key, compare); } //********************************************************************* @@ -703,7 +703,7 @@ namespace etl //********************************************************************* const_iterator lower_bound(key_parameter_t key) const { - return etlstd::lower_bound(cbegin(), cend(), key, compare); + return etl::lower_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -713,7 +713,7 @@ namespace etl //********************************************************************* iterator upper_bound(key_parameter_t key) { - return etlstd::upper_bound(begin(), end(), key, compare); + return etl::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -723,7 +723,7 @@ namespace etl //********************************************************************* const_iterator upper_bound(key_parameter_t key) const { - return etlstd::upper_bound(begin(), end(), key, compare); + return etl::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -733,9 +733,9 @@ namespace etl //********************************************************************* ETL_OR_STD::pair equal_range(key_parameter_t key) { - iterator i_lower = etlstd::lower_bound(begin(), end(), key, compare); + iterator i_lower = etl::lower_bound(begin(), end(), key, compare); - return ETL_MAKE_PAIR(i_lower, etlstd::upper_bound(i_lower, end(), key, compare)); + return ETL_OR_STD::make_pair(i_lower, etl::upper_bound(i_lower, end(), key, compare)); } //********************************************************************* @@ -745,9 +745,9 @@ namespace etl //********************************************************************* ETL_OR_STD::pair equal_range(key_parameter_t key) const { - const_iterator i_lower = etlstd::lower_bound(cbegin(), cend(), key, compare); + const_iterator i_lower = etl::lower_bound(cbegin(), cend(), key, compare); - return ETL_MAKE_PAIR(i_lower, etlstd::upper_bound(i_lower, cend(), key, compare)); + return ETL_OR_STD::make_pair(i_lower, etl::upper_bound(i_lower, cend(), key, compare)); } //************************************************************************* @@ -886,7 +886,7 @@ namespace etl template bool operator ==(const etl::ireference_flat_map& lhs, const etl::ireference_flat_map& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -906,11 +906,11 @@ namespace etl /// A reference_flat_map implementation that uses a fixed size buffer. ///\tparam TKey The key type. ///\tparam TValue The value type. - ///\tparam TCompare The type to compare keys. Default = etlstd::less + ///\tparam TCompare The type to compare keys. Default = etl::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup reference_flat_map //*************************************************************************** - template > + template > class reference_flat_map : public ireference_flat_map { public: diff --git a/include/etl/reference_flat_multimap.h b/include/etl/reference_flat_multimap.h index 08afd781..8a170cfa 100644 --- a/include/etl/reference_flat_multimap.h +++ b/include/etl/reference_flat_multimap.h @@ -78,7 +78,7 @@ namespace etl /// Can be used as a reference type for all reference_flat_multimaps containing a specific type. ///\ingroup reference_flat_multimap //*************************************************************************** - template > + template > class ireference_flat_multimap { public: @@ -294,7 +294,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -443,7 +443,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multimap_full)); #endif @@ -513,7 +513,7 @@ namespace etl } else { - size_t d = etlstd::distance(range.first, range.second); + size_t d = etl::distance(range.first, range.second); erase(range.first, range.second); return d; } @@ -605,7 +605,7 @@ namespace etl { ETL_OR_STD::pair range = equal_range(key); - return etlstd::distance(range.first, range.second); + return etl::distance(range.first, range.second); } //********************************************************************* @@ -615,7 +615,7 @@ namespace etl //********************************************************************* iterator lower_bound(key_parameter_t key) { - return etlstd::lower_bound(begin(), end(), key, compare); + return etl::lower_bound(begin(), end(), key, compare); } //********************************************************************* @@ -625,7 +625,7 @@ namespace etl //********************************************************************* const_iterator lower_bound(key_parameter_t key) const { - return etlstd::lower_bound(cbegin(), cend(), key, compare); + return etl::lower_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -635,7 +635,7 @@ namespace etl //********************************************************************* iterator upper_bound(key_parameter_t key) { - return etlstd::upper_bound(begin(), end(), key, compare); + return etl::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -645,7 +645,7 @@ namespace etl //********************************************************************* const_iterator upper_bound(key_parameter_t key) const { - return etlstd::upper_bound(begin(), end(), key, compare); + return etl::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -655,9 +655,9 @@ namespace etl //********************************************************************* ETL_OR_STD::pair equal_range(key_parameter_t key) { - iterator i_lower = etlstd::lower_bound(begin(), end(), key, compare); + iterator i_lower = etl::lower_bound(begin(), end(), key, compare); - return ETL_MAKE_PAIR(i_lower, etlstd::upper_bound(i_lower, end(), key, compare)); + return ETL_OR_STD::make_pair(i_lower, etl::upper_bound(i_lower, end(), key, compare)); } //********************************************************************* @@ -667,9 +667,9 @@ namespace etl //********************************************************************* ETL_OR_STD::pair equal_range(key_parameter_t key) const { - const_iterator i_lower = etlstd::lower_bound(cbegin(), cend(), key, compare); + const_iterator i_lower = etl::lower_bound(cbegin(), cend(), key, compare); - return ETL_MAKE_PAIR(i_lower, etlstd::upper_bound(i_lower, cend(), key, compare)); + return ETL_OR_STD::make_pair(i_lower, etl::upper_bound(i_lower, cend(), key, compare)); } //************************************************************************* @@ -799,7 +799,7 @@ namespace etl template bool operator ==(const etl::ireference_flat_multimap& lhs, const etl::ireference_flat_multimap& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -819,11 +819,11 @@ namespace etl /// A reference_flat_multimap implementation that uses a fixed size buffer. ///\tparam TKey The key type. ///\tparam TValue The value type. - ///\tparam TCompare The type to compare keys. Default = etlstd::less + ///\tparam TCompare The type to compare keys. Default = etl::less ///\tparam MAX_SIZE_ The maximum number of elements that can be stored. ///\ingroup reference_flat_multimap //*************************************************************************** - template > + template > class reference_flat_multimap : public ireference_flat_multimap { public: diff --git a/include/etl/reference_flat_multiset.h b/include/etl/reference_flat_multiset.h index 48decc45..47d390e6 100644 --- a/include/etl/reference_flat_multiset.h +++ b/include/etl/reference_flat_multiset.h @@ -98,7 +98,7 @@ namespace etl /// Can be used as a reference type for all reference_flat_multisets containing a specific type. ///\ingroup reference_flat_multiset //*************************************************************************** - template > + template > class ireference_flat_multiset { public: @@ -318,7 +318,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the reference_flat_multiset. @@ -439,7 +439,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_multiset_full)); #endif @@ -462,7 +462,7 @@ namespace etl ETL_ASSERT(!lookup.full(), ETL_ERROR(flat_multiset_full)); - iterator i_element = etlstd::lower_bound(begin(), end(), value, compare); + iterator i_element = etl::lower_bound(begin(), end(), value, compare); if (i_element == end()) { @@ -524,7 +524,7 @@ namespace etl } else { - size_t d = etlstd::distance(range.first, range.second); + size_t d = etl::distance(range.first, range.second); erase(range.first, range.second); return d; } @@ -566,7 +566,7 @@ namespace etl //********************************************************************* iterator find(parameter_t key) { - iterator itr = etlstd::lower_bound(begin(), end(), key, compare); + iterator itr = etl::lower_bound(begin(), end(), key, compare); if (itr != end()) { @@ -590,7 +590,7 @@ namespace etl //********************************************************************* const_iterator find(parameter_t key) const { - const_iterator itr = etlstd::lower_bound(begin(), end(), key, compare); + const_iterator itr = etl::lower_bound(begin(), end(), key, compare); if (itr != end()) { @@ -616,7 +616,7 @@ namespace etl { ETL_OR_STD::pair range = equal_range(key); - return etlstd::distance(range.first, range.second); + return etl::distance(range.first, range.second); } //********************************************************************* @@ -626,7 +626,7 @@ namespace etl //********************************************************************* iterator lower_bound(parameter_t key) { - return etlstd::lower_bound(begin(), end(), key, compare); + return etl::lower_bound(begin(), end(), key, compare); } //********************************************************************* @@ -636,7 +636,7 @@ namespace etl //********************************************************************* const_iterator lower_bound(parameter_t key) const { - return etlstd::lower_bound(cbegin(), cend(), key, compare); + return etl::lower_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -646,7 +646,7 @@ namespace etl //********************************************************************* iterator upper_bound(parameter_t key) { - return etlstd::upper_bound(begin(), end(), key, compare); + return etl::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -656,7 +656,7 @@ namespace etl //********************************************************************* const_iterator upper_bound(parameter_t key) const { - return etlstd::upper_bound(cbegin(), cend(), key, compare); + return etl::upper_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -666,7 +666,7 @@ namespace etl //********************************************************************* ETL_OR_STD::pair equal_range(parameter_t key) { - return etlstd::equal_range(begin(), end(), key, compare); + return etl::equal_range(begin(), end(), key, compare); } //********************************************************************* @@ -676,7 +676,7 @@ namespace etl //********************************************************************* ETL_OR_STD::pair equal_range(parameter_t key) const { - return etlstd::equal_range(begin(), end(), key, compare); + return etl::equal_range(begin(), end(), key, compare); } //************************************************************************* @@ -805,7 +805,7 @@ namespace etl /// An reference flat set ///\ingroup reference_flat_multiset //*************************************************************************** - template > + template > class reference_flat_multiset : public ireference_flat_multiset { public: @@ -868,7 +868,7 @@ namespace etl template bool operator ==(const etl::ireference_flat_multiset& lhs, const etl::ireference_flat_multiset& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** diff --git a/include/etl/reference_flat_set.h b/include/etl/reference_flat_set.h index a8b5faf9..94003f97 100644 --- a/include/etl/reference_flat_set.h +++ b/include/etl/reference_flat_set.h @@ -99,7 +99,7 @@ namespace etl /// Can be used as a reference type for all reference_flat_sets containing a specific type. ///\ingroup reference_flat_set //*************************************************************************** - template > + template > class ireference_flat_set { public: @@ -319,7 +319,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the reference_flat_set. @@ -440,7 +440,7 @@ namespace etl void assign(TIterator first, TIterator last) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(d <= difference_type(capacity()), ETL_ERROR(flat_set_full)); #endif @@ -547,7 +547,7 @@ namespace etl //********************************************************************* iterator find(parameter_t key) { - iterator itr = etlstd::lower_bound(begin(), end(), key, compare); + iterator itr = etl::lower_bound(begin(), end(), key, compare); if (itr != end()) { @@ -571,7 +571,7 @@ namespace etl //********************************************************************* const_iterator find(parameter_t key) const { - const_iterator itr = etlstd::lower_bound(begin(), end(), key, compare); + const_iterator itr = etl::lower_bound(begin(), end(), key, compare); if (itr != end()) { @@ -605,7 +605,7 @@ namespace etl //********************************************************************* iterator lower_bound(parameter_t key) { - return etlstd::lower_bound(begin(), end(), key, compare); + return etl::lower_bound(begin(), end(), key, compare); } //********************************************************************* @@ -615,7 +615,7 @@ namespace etl //********************************************************************* const_iterator lower_bound(parameter_t key) const { - return etlstd::lower_bound(cbegin(), cend(), key, compare); + return etl::lower_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -625,7 +625,7 @@ namespace etl //********************************************************************* iterator upper_bound(parameter_t key) { - return etlstd::upper_bound(begin(), end(), key, compare); + return etl::upper_bound(begin(), end(), key, compare); } //********************************************************************* @@ -635,7 +635,7 @@ namespace etl //********************************************************************* const_iterator upper_bound(parameter_t key) const { - return etlstd::upper_bound(cbegin(), cend(), key, compare); + return etl::upper_bound(cbegin(), cend(), key, compare); } //********************************************************************* @@ -645,7 +645,7 @@ namespace etl //********************************************************************* ETL_OR_STD::pair equal_range(parameter_t key) { - return etlstd::equal_range(begin(), end(), key, compare); + return etl::equal_range(begin(), end(), key, compare); } //********************************************************************* @@ -655,7 +655,7 @@ namespace etl //********************************************************************* ETL_OR_STD::pair equal_range(parameter_t key) const { - return etlstd::upper_bound(cbegin(), cend(), key, compare); + return etl::upper_bound(cbegin(), cend(), key, compare); } //************************************************************************* @@ -788,7 +788,7 @@ namespace etl /// An reference flat set ///\ingroup reference_flat_set //*************************************************************************** - template > + template > class reference_flat_set : public ireference_flat_set { public: @@ -851,7 +851,7 @@ namespace etl template bool operator ==(const etl::ireference_flat_set& lhs, const etl::ireference_flat_set& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** diff --git a/include/etl/scaled_rounding.h b/include/etl/scaled_rounding.h index c2a27cdb..bef1d15a 100644 --- a/include/etl/scaled_rounding.h +++ b/include/etl/scaled_rounding.h @@ -41,7 +41,7 @@ namespace etl template struct scaled_rounding_t { - typedef typename etlstd::conditional::value, int32_t, uint32_t>::type type; + typedef typename etl::conditional::value, int32_t, uint32_t>::type type; }; //***************************************************************************** @@ -67,7 +67,7 @@ namespace etl template T round_ceiling_unscaled(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; if (value >= 0) @@ -101,7 +101,7 @@ namespace etl template T round_floor_unscaled(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; if (value >= 0) @@ -136,7 +136,7 @@ namespace etl template T round_half_up_unscaled(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); ETL_STATIC_ASSERT((((SCALING / 2U) * 2U) == SCALING), "Scaling must be divisible by 2"); typedef typename scaled_rounding_t::type scale_t; @@ -173,7 +173,7 @@ namespace etl template T round_half_down_unscaled(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); ETL_STATIC_ASSERT((((SCALING / 2U) * 2U) == SCALING), "Scaling must be divisible by 2"); typedef typename scaled_rounding_t::type scale_t; @@ -209,7 +209,7 @@ namespace etl template T round_zero_unscaled(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; return T(value / scale_t(SCALING)); @@ -236,7 +236,7 @@ namespace etl template T round_infinity_unscaled(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; if (value >= 0) @@ -271,7 +271,7 @@ namespace etl template T round_half_even_unscaled(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; // Half? @@ -316,7 +316,7 @@ namespace etl template T round_half_odd_unscaled(T value) { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Type must be an integral"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Type must be an integral"); typedef typename scaled_rounding_t::type scale_t; // Half? diff --git a/include/etl/scheduler.h b/include/etl/scheduler.h index ade7fc20..3a6f9e85 100644 --- a/include/etl/scheduler.h +++ b/include/etl/scheduler.h @@ -285,7 +285,7 @@ namespace etl if (!task_list.full()) { - typename task_list_t::iterator itask = etlstd::upper_bound(task_list.begin(), + typename task_list_t::iterator itask = etl::upper_bound(task_list.begin(), task_list.end(), task.get_task_priority(), compare_priority()); diff --git a/include/etl/set.h b/include/etl/set.h index 566781c2..92b24109 100755 --- a/include/etl/set.h +++ b/include/etl/set.h @@ -457,7 +457,7 @@ namespace etl /// A templated base for all etl::set types. ///\ingroup set //*************************************************************************** - template > + template > class iset : public etl::set_base { public: @@ -761,7 +761,7 @@ namespace etl }; friend class const_iterator; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; @@ -913,7 +913,7 @@ namespace etl //************************************************************************* ETL_OR_STD::pair equal_range(const value_type& value) { - return ETL_MAKE_PAIR( + return ETL_OR_STD::make_pair( iterator(*this, find_lower_node(root_node, value)), iterator(*this, find_upper_node(root_node, value))); } @@ -924,7 +924,7 @@ namespace etl //************************************************************************* ETL_OR_STD::pair equal_range(const value_type& value) const { - return ETL_MAKE_PAIR( + return ETL_OR_STD::make_pair( const_iterator(*this, find_lower_node(root_node, value)), const_iterator(*this, find_upper_node(root_node, value))); } @@ -1031,7 +1031,7 @@ namespace etl inserted = inserted_node == &node; // Insert node into tree and return iterator to new node location in tree - return ETL_MAKE_PAIR(iterator(*this, inserted_node), inserted); + return ETL_OR_STD::make_pair(iterator(*this, inserted_node), inserted); } //********************************************************************* @@ -1950,7 +1950,7 @@ namespace etl //************************************************************************* /// A templated set implementation that uses a fixed size buffer. //************************************************************************* - template > + template > class set : public etl::iset { public: @@ -2037,7 +2037,7 @@ namespace etl template bool operator ==(const etl::iset& lhs, const etl::iset& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -2063,7 +2063,7 @@ namespace etl template bool operator <(const etl::iset& lhs, const etl::iset& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/smallest.h b/include/etl/smallest.h index 0301376c..87a59af0 100644 --- a/include/etl/smallest.h +++ b/include/etl/smallest.h @@ -82,7 +82,7 @@ namespace etl // Set 'type' to be the smallest of the first parameter and any of the others. // This is recursive. - using type = typename etlstd::conditional<(etl::size_of::value < etl::size_of::value), // Boolean + using type = typename etl::conditional<(etl::size_of::value < etl::size_of::value), // Boolean T1, // TrueType smallest_other> // FalseType ::type; // The smallest type of the two. diff --git a/include/etl/smallest_generator.h b/include/etl/smallest_generator.h index 54142e44..6290b65d 100644 --- a/include/etl/smallest_generator.h +++ b/include/etl/smallest_generator.h @@ -94,7 +94,7 @@ namespace etl // Set 'type' to be the smallest of the first parameter and any of the others. // This is recursive. - using type = typename etlstd::conditional<(etl::size_of::value < etl::size_of::value), // Boolean + using type = typename etl::conditional<(etl::size_of::value < etl::size_of::value), // Boolean T1, // TrueType smallest_other> // FalseType ::type; // The smallest type of the two. diff --git a/include/etl/sqrt.h b/include/etl/sqrt.h index d23da550..9fda08bf 100644 --- a/include/etl/sqrt.h +++ b/include/etl/sqrt.h @@ -45,7 +45,7 @@ namespace etl template struct sqrt { - typedef typename etlstd::conditional<((I * I) > VALUE), + typedef typename etl::conditional<((I * I) > VALUE), etl::constant, etl::sqrt >::type type; diff --git a/include/etl/stack.h b/include/etl/stack.h index 84c99360..a12618c1 100644 --- a/include/etl/stack.h +++ b/include/etl/stack.h @@ -278,7 +278,7 @@ namespace etl ETL_ASSERT(!full(), ETL_ERROR(stack_full)); #endif base_t::add_in(); - ::new (&p_buffer[top_index]) T(etlstd::forward(args)...); + ::new (&p_buffer[top_index]) T(etl::forward(args)...); } #else //************************************************************************* @@ -408,7 +408,7 @@ namespace etl //************************************************************************* void reverse() { - etlstd::reverse(p_buffer, p_buffer + current_size); + etl::reverse(p_buffer, p_buffer + current_size); } //************************************************************************* @@ -527,7 +527,7 @@ namespace etl private: /// The unintitialised buffer of T used in the stack. - typename etl::aligned_storage::value>::type buffer[SIZE]; + typename etl::aligned_storage::value>::type buffer[SIZE]; }; } diff --git a/include/etl/state_chart.h b/include/etl/state_chart.h index 09aebb4c..449e5aa0 100644 --- a/include/etl/state_chart.h +++ b/include/etl/state_chart.h @@ -235,7 +235,7 @@ namespace etl } else { - return etlstd::find_if(state_table.begin(), + return etl::find_if(state_table.begin(), state_table.end(), is_state(state_id)); } @@ -280,7 +280,7 @@ namespace etl while (t != transition_table.end()) { // Scan the transition table from the latest position. - t = etlstd::find_if(t, + t = etl::find_if(t, transition_table.end(), is_transition(event_id, current_state_id)); diff --git a/include/etl/string_view.h b/include/etl/string_view.h index 40acb1b6..5a690632 100644 --- a/include/etl/string_view.h +++ b/include/etl/string_view.h @@ -155,7 +155,7 @@ namespace etl //************************************************************************* /// Construct from iterator/size. //************************************************************************* - template ::value, void>::type> + template ::value, void>::type> ETL_CONSTEXPR17 basic_string_view(const T* begin_, TSize size_) : mbegin(begin_), mend(begin_ + size_) @@ -309,11 +309,11 @@ namespace etl /// Assign from iterators //************************************************************************* template ::value, void>::type> + typename TDummy = typename etl::enable_if::value, void>::type> void assign(TIterator begin_, TIterator end_) { mbegin = etl::addressof(*begin_); - mend = etl::addressof(*begin_) + etlstd::distance(begin_, end_); + mend = etl::addressof(*begin_) + etl::distance(begin_, end_); } //************************************************************************* @@ -321,7 +321,7 @@ namespace etl //************************************************************************* template ::value, void>::type> + typename TDummy = typename etl::enable_if::value, void>::type> void assign(TIterator begin_, TSize size_) { mbegin = etl::addressof(*begin_); @@ -351,11 +351,7 @@ namespace etl //************************************************************************* void swap(basic_string_view& other) { -#if defined(ETL_NO_STL) - using etlstd::swap; -#else - using std::swap; -#endif + using ETL_OR_STD::swap; // Allow ADL swap(mbegin, other.mbegin); swap(mend, other.mend); @@ -370,9 +366,9 @@ namespace etl if (position < size()) { - n = etlstd::min(count, size() - position); + n = etl::min(count, size() - position); - etlstd::copy(mbegin + position, mbegin + position + n, destination); + etl::copy(mbegin + position, mbegin + position + n, destination); } return n; @@ -387,7 +383,7 @@ namespace etl if (position < size()) { - size_t n = etlstd::min(count, size() - position); + size_t n = etl::min(count, size() - position); view = basic_string_view(mbegin + position, mbegin + position + n); } @@ -501,7 +497,7 @@ namespace etl return npos; } - const_iterator iposition = etlstd::search(begin() + position, end(), view.begin(), view.end()); + const_iterator iposition = etl::search(begin() + position, end(), view.begin(), view.end()); if (iposition == end()) { @@ -509,7 +505,7 @@ namespace etl } else { - return etlstd::distance(begin(), iposition); + return etl::distance(begin(), iposition); } } @@ -538,9 +534,9 @@ namespace etl return npos; } - position = etlstd::min(position, size()); + position = etl::min(position, size()); - const_iterator iposition = etlstd::find_end(begin(), + const_iterator iposition = etl::find_end(begin(), begin() + position, view.begin(), view.end()); @@ -551,7 +547,7 @@ namespace etl } else { - return etlstd::distance(begin(), iposition); + return etl::distance(begin(), iposition); } } @@ -621,7 +617,7 @@ namespace etl return npos; } - position = etlstd::min(position, size() - 1); + position = etl::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -717,7 +713,7 @@ namespace etl return npos; } - position = etlstd::min(position, size() - 1); + position = etl::min(position, size() - 1); const_reverse_iterator it = rbegin() + size() - position - 1; @@ -768,7 +764,7 @@ namespace etl friend bool operator == (const etl::basic_string_view& lhs, const etl::basic_string_view& rhs) { return (lhs.size() == rhs.size()) && - etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //************************************************************************* @@ -784,7 +780,7 @@ namespace etl //************************************************************************* friend bool operator < (const etl::basic_string_view& lhs, const etl::basic_string_view& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //************************************************************************* diff --git a/include/etl/type_lookup.h b/include/etl/type_lookup.h index 4a583a24..4d5b780b 100644 --- a/include/etl/type_lookup.h +++ b/include/etl/type_lookup.h @@ -101,28 +101,28 @@ namespace etl struct type_from_id { typedef - typename etlstd::conditional >::type>::type>::type>::type> ::type>::type>::type>::type> ::type>::type>::type>::type> ::type>::type>::type>::type type; - ETL_STATIC_ASSERT(!(etlstd::is_same, type>::value), "Invalid id"); + ETL_STATIC_ASSERT(!(etl::is_same, type>::value), "Invalid id"); }; //************************************ @@ -137,22 +137,22 @@ namespace etl enum { value = - (unsigned int) etlstd::is_same::value ? T1::ID : - (unsigned int) etlstd::is_same::value ? T2::ID : - (unsigned int) etlstd::is_same::value ? T3::ID : - (unsigned int) etlstd::is_same::value ? T4::ID : - (unsigned int) etlstd::is_same::value ? T5::ID : - (unsigned int) etlstd::is_same::value ? T6::ID : - (unsigned int) etlstd::is_same::value ? T7::ID : - (unsigned int) etlstd::is_same::value ? T8::ID : - (unsigned int) etlstd::is_same::value ? T9::ID : - (unsigned int) etlstd::is_same::value ? T10::ID : - (unsigned int) etlstd::is_same::value ? T11::ID : - (unsigned int) etlstd::is_same::value ? T12::ID : - (unsigned int) etlstd::is_same::value ? T13::ID : - (unsigned int) etlstd::is_same::value ? T14::ID : - (unsigned int) etlstd::is_same::value ? T15::ID : - (unsigned int) etlstd::is_same::value ? T16::ID : + (unsigned int) etl::is_same::value ? T1::ID : + (unsigned int) etl::is_same::value ? T2::ID : + (unsigned int) etl::is_same::value ? T3::ID : + (unsigned int) etl::is_same::value ? T4::ID : + (unsigned int) etl::is_same::value ? T5::ID : + (unsigned int) etl::is_same::value ? T6::ID : + (unsigned int) etl::is_same::value ? T7::ID : + (unsigned int) etl::is_same::value ? T8::ID : + (unsigned int) etl::is_same::value ? T9::ID : + (unsigned int) etl::is_same::value ? T10::ID : + (unsigned int) etl::is_same::value ? T11::ID : + (unsigned int) etl::is_same::value ? T12::ID : + (unsigned int) etl::is_same::value ? T13::ID : + (unsigned int) etl::is_same::value ? T14::ID : + (unsigned int) etl::is_same::value ? T15::ID : + (unsigned int) etl::is_same::value ? T16::ID : (unsigned int) UNKNOWN }; @@ -202,26 +202,26 @@ namespace etl struct type_from_type { typedef - typename etlstd::conditional::value, typename T1::type2, - typename etlstd::conditional::value, typename T2::type2, - typename etlstd::conditional::value, typename T3::type2, - typename etlstd::conditional::value, typename T4::type2, - typename etlstd::conditional::value, typename T5::type2, - typename etlstd::conditional::value, typename T6::type2, - typename etlstd::conditional::value, typename T7::type2, - typename etlstd::conditional::value, typename T8::type2, - typename etlstd::conditional::value, typename T9::type2, - typename etlstd::conditional::value, typename T10::type2, - typename etlstd::conditional::value, typename T11::type2, - typename etlstd::conditional::value, typename T12::type2, - typename etlstd::conditional::value, typename T13::type2, - typename etlstd::conditional::value, typename T14::type2, - typename etlstd::conditional::value, typename T15::type2, - typename etlstd::conditional::value, typename T16::type2, + typename etl::conditional::value, typename T1::type2, + typename etl::conditional::value, typename T2::type2, + typename etl::conditional::value, typename T3::type2, + typename etl::conditional::value, typename T4::type2, + typename etl::conditional::value, typename T5::type2, + typename etl::conditional::value, typename T6::type2, + typename etl::conditional::value, typename T7::type2, + typename etl::conditional::value, typename T8::type2, + typename etl::conditional::value, typename T9::type2, + typename etl::conditional::value, typename T10::type2, + typename etl::conditional::value, typename T11::type2, + typename etl::conditional::value, typename T12::type2, + typename etl::conditional::value, typename T13::type2, + typename etl::conditional::value, typename T14::type2, + typename etl::conditional::value, typename T15::type2, + typename etl::conditional::value, typename T16::type2, etl::null_type<0> >::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type>::type>::type>::type type; - ETL_STATIC_ASSERT(!(etlstd::is_same, type>::value), "Invalid type"); + ETL_STATIC_ASSERT(!(etl::is_same, type>::value), "Invalid type"); }; }; } diff --git a/include/etl/type_lookup_generator.h b/include/etl/type_lookup_generator.h index 8a814ca5..1e5a785f 100644 --- a/include/etl/type_lookup_generator.h +++ b/include/etl/type_lookup_generator.h @@ -104,7 +104,7 @@ namespace etl cog.outl(" {") cog.outl(" typedef ") for n in range(1, int(NTypes) + 1): - cog.outl(" typename etlstd::conditional >") for n in range(1, int(NTypes) + 1): if n == int(NTypes): @@ -116,7 +116,7 @@ namespace etl cog.outl("") cog.out(" ") cog.outl("") - cog.outl(" ETL_STATIC_ASSERT(!(etlstd::is_same, type>::value), \"Invalid id\");") + cog.outl(" ETL_STATIC_ASSERT(!(etl::is_same, type>::value), \"Invalid id\");") cog.outl(" };") cog.outl("") cog.outl(" //************************************") @@ -132,7 +132,7 @@ namespace etl cog.outl(" {") cog.outl(" value =") for n in range(1, int(NTypes) + 1) : - cog.outl(" (unsigned int) etlstd::is_same::value ? T%s::ID :" % (n, n)) + cog.outl(" (unsigned int) etl::is_same::value ? T%s::ID :" % (n, n)) cog.outl(" (unsigned int) UNKNOWN") cog.outl(" };") cog.outl("") @@ -171,7 +171,7 @@ namespace etl cog.outl(" {") cog.outl(" typedef ") for n in range(1, int(NTypes) + 1): - cog.outl(" typename etlstd::conditional::value, typename T%s::type2," %(n, n)) + cog.outl(" typename etl::conditional::value, typename T%s::type2," %(n, n)) cog.out(" etl::null_type<0> >") for n in range(1, int(NTypes) + 1): if n == int(NTypes): @@ -183,7 +183,7 @@ namespace etl cog.outl("") cog.out(" ") cog.outl("") - cog.outl(" ETL_STATIC_ASSERT(!(etlstd::is_same, type>::value), \"Invalid type\");") + cog.outl(" ETL_STATIC_ASSERT(!(etl::is_same, type>::value), \"Invalid type\");") cog.outl(" };") cog.outl("};") ]]]*/ diff --git a/include/etl/type_select.h b/include/etl/type_select.h index 94b70004..894b642d 100644 --- a/include/etl/type_select.h +++ b/include/etl/type_select.h @@ -73,22 +73,22 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type>::type>::type>::type type; @@ -121,21 +121,21 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type>::type>::type type; @@ -167,20 +167,20 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type>::type type; @@ -211,19 +211,19 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type>::type type; @@ -253,18 +253,18 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type>::type type; @@ -293,17 +293,17 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type>::type type; @@ -331,16 +331,16 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type>::type type; @@ -367,15 +367,15 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type>::type> ::type type; @@ -401,14 +401,14 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type>::type type; @@ -432,13 +432,13 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type>::type type; @@ -461,12 +461,12 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type>::type type; @@ -488,11 +488,11 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type>::type type; @@ -513,10 +513,10 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type>::type type; @@ -536,9 +536,9 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type>::type type; @@ -557,8 +557,8 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type>::type type; @@ -576,7 +576,7 @@ namespace etl template struct select { - typedef typename etlstd::conditional > ::type type; diff --git a/include/etl/type_select_generator.h b/include/etl/type_select_generator.h index 7b3f1fc2..70880f9c 100644 --- a/include/etl/type_select_generator.h +++ b/include/etl/type_select_generator.h @@ -75,9 +75,9 @@ namespace etl cog.outl(" template ") cog.outl(" struct select") cog.outl(" {") - cog.outl(" typedef typename etlstd::conditional >") cog.out(" ") for n in range(1, int(NTypes)) : @@ -110,9 +110,9 @@ namespace etl cog.outl(" template ") cog.outl(" struct select") cog.outl(" {") - cog.outl(" typedef typename etlstd::conditional >") cog.out(" ") for n in range(1, s) : diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index d4dac3c6..617b2f75 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -65,13 +65,17 @@ SOFTWARE. /// Derived from either the standard or alternate definitions, dependant on whether or not ETL_NO_STL is defined. /// \ingroup utilities -#if defined(ETL_NO_STL) +#if !defined(ETL_NO_STL) && ETL_CPP11_SUPPORTED + #include +#endif -//***************************************************************************** -// Traits are defined by the ETL -//***************************************************************************** -namespace etlstd +namespace etl { +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + + //***************************************************************************** + // Traits are defined by the ETL + //***************************************************************************** //*************************************************************************** /// integral_constant template @@ -92,6 +96,9 @@ namespace etlstd typedef integral_constant false_type; typedef integral_constant true_type; + template + const T integral_constant::value; + #if ETL_CPP17_SUPPORTED template using bool_constant = integral_constant; @@ -248,7 +255,7 @@ namespace etlstd /// is_signed template struct is_signed : false_type {}; template <> struct is_signed : integral_constant {}; - template <> struct is_signed : public etlstd::integral_constant(wchar_t(-1) < wchar_t(0))> {}; + template <> struct is_signed : public etl::integral_constant(wchar_t(-1) < wchar_t(0))> {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; template <> struct is_signed : true_type {}; @@ -272,7 +279,7 @@ namespace etlstd template <> struct is_unsigned : true_type {}; template <> struct is_unsigned : integral_constant 0)> {}; template <> struct is_unsigned : true_type {}; - template <> struct is_unsigned : public etlstd::integral_constant wchar_t(0))> {}; + template <> struct is_unsigned : public etl::integral_constant wchar_t(0))> {}; template <> struct is_unsigned : true_type {}; template <> struct is_unsigned : true_type {}; template <> struct is_unsigned : true_type {}; @@ -391,7 +398,7 @@ namespace etlstd #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_lvalue_reference_v = etlstd::is_lvalue_reference::value; + inline constexpr bool is_lvalue_reference_v = etl::is_lvalue_reference::value; #endif //*************************************************************************** @@ -402,67 +409,67 @@ namespace etlstd #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_rvalue_reference_v = etlstd::is_rvalue_reference::value; + inline constexpr bool is_rvalue_reference_v = etl::is_rvalue_reference::value; #endif //*************************************************************************** /// is_pod /// Only fundamental and pointers types are recognised. - template struct is_pod : etlstd::integral_constant::value || etlstd::is_pointer::value> {}; + template struct is_pod : etl::integral_constant::value || etl::is_pointer::value> {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_pod_v = etlstd::is_pod::value; + inline constexpr bool is_pod_v = etl::is_pod::value; #endif //*************************************************************************** /// is_trivially_constructible /// Only POD types are recognised. - template struct is_trivially_constructible : etlstd::is_pod {}; + template struct is_trivially_constructible : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_constructible_v = etlstd::is_trivially_constructible::value; + inline constexpr bool is_trivially_constructible_v = etl::is_trivially_constructible::value; #endif //*************************************************************************** /// is_trivially_copy_constructible /// Only POD types are recognised. - template struct is_trivially_copy_constructible : etlstd::is_pod {}; + template struct is_trivially_copy_constructible : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_constructible_v = etlstd::is_trivially_copy_constructible::value; + inline constexpr bool is_trivially_copy_constructible_v = etl::is_trivially_copy_constructible::value; #endif //*************************************************************************** /// is_trivially_destructible /// Only POD types are recognised. - template struct is_trivially_destructible : etlstd::is_pod {}; + template struct is_trivially_destructible : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_destructible_v = etlstd::is_trivially_destructible::value; + inline constexpr bool is_trivially_destructible_v = etl::is_trivially_destructible::value; #endif //*************************************************************************** /// is_trivially_copy_assignable /// Only POD types are recognised. - template struct is_trivially_copy_assignable : etlstd::is_pod {}; + template struct is_trivially_copy_assignable : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_assignable_v = etlstd::is_trivially_copy_assignable::value; + inline constexpr bool is_trivially_copy_assignable_v = etl::is_trivially_copy_assignable::value; #endif //*************************************************************************** /// is_trivially_copyable /// Only POD types are recognised. - template struct is_trivially_copyable : etlstd::is_pod {}; + template struct is_trivially_copyable : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copyable_v = etlstd::is_trivially_copyable::value; + inline constexpr bool is_trivially_copyable_v = etl::is_trivially_copyable::value; #endif //*************************************************************************** @@ -478,9 +485,9 @@ namespace etlstd template <> struct make_signed { - typedef etlstd::conditional::type>::type type; }; @@ -507,9 +514,9 @@ namespace etlstd template <> struct make_unsigned { - typedef etlstd::conditional::type>::type type; }; @@ -596,10 +603,10 @@ namespace etlstd template struct decay { - typedef typename etlstd::remove_reference::type U; - typedef typename etlstd::conditional::value, - typename etlstd::remove_extent::type*, - typename etlstd::remove_cv::type>::type type; + typedef typename etl::remove_reference::type U; + typedef typename etl::conditional::value, + typename etl::remove_extent::type*, + typename etl::remove_cv::type>::type type; }; #if ETL_CPP14_SUPPORTED @@ -611,7 +618,7 @@ namespace etlstd /// is_base_of template::value || etlstd::is_fundamental::value)> + const bool IsFundamental = (etl::is_fundamental::value || etl::is_fundamental::value)> struct is_base_of { private: @@ -650,7 +657,7 @@ namespace etlstd #if ETL_CPP14_SUPPORTED template - using add_lvalue_reference_t = typename etlstd::add_lvalue_reference::type; + using add_lvalue_reference_t = typename etl::add_lvalue_reference::type; #endif //*************************************************************************** @@ -666,14 +673,14 @@ namespace etlstd #if ETL_CPP14_SUPPORTED template - using add_rvalue_reference_t = typename etlstd::add_rvalue_reference::type; + using add_rvalue_reference_t = typename etl::add_rvalue_reference::type; #endif //*************************************************************************** /// decval #if ETL_CPP11_SUPPORTED template - typename etlstd::add_rvalue_reference::type declval() ETL_NOEXCEPT; + typename etl::add_rvalue_reference::type declval() ETL_NOEXCEPT; #endif //*************************************************************************** @@ -682,30 +689,30 @@ namespace etlstd namespace private_type_traits { template - using true_type_for = etlstd::true_type; + using true_type_for = etl::true_type; template auto returnable(int)->true_type_for; template - auto returnable(...)->etlstd::false_type; + auto returnable(...)->etl::false_type; template - auto nonvoid_convertible(int)->true_type_for()(etlstd::declval())) + auto nonvoid_convertible(int)->true_type_for()(etl::declval())) >; template - auto nonvoid_convertible(...)->etlstd::false_type; + auto nonvoid_convertible(...)->etl::false_type; } template - struct is_convertible : etlstd::integral_constant(0))::value && - decltype(private_type_traits::nonvoid_convertible(0))::value) || - (etlstd::is_void::value && etlstd::is_void::value)> {}; + struct is_convertible : etl::integral_constant(0))::value && + decltype(private_type_traits::nonvoid_convertible(0))::value) || + (etl::is_void::value && etl::is_void::value)> {}; #endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_convertible_v = etlstd::is_convertible::value; + inline constexpr bool is_convertible_v = etl::is_convertible::value; #endif //*************************************************************************** @@ -725,19 +732,15 @@ namespace etlstd #if ETL_CPP17_SUPPORTED template - inline constexpr size_t alignment_of_v = etlstd::alignment_of::value; + inline constexpr size_t alignment_of_v = etl::alignment_of::value; #endif -} -#else +#else // defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED -//***************************************************************************** -// Traits are derived from the STL -//***************************************************************************** -#include + //***************************************************************************** + // Traits are derived from the STL + //***************************************************************************** -namespace etlstd -{ //*************************************************************************** /// integral_constant ///\ingroup type_traits @@ -751,7 +754,7 @@ namespace etlstd #if ETL_CPP17_SUPPORTED template - using bool_constant = std::integral_constant; + using bool_constant = std::bool_constant; #endif //*************************************************************************** @@ -1017,105 +1020,105 @@ namespace etlstd #endif #if !defined(ARDUINO) && !defined(ETL_STLPORT) + //*************************************************************************** + /// is_trivially_constructible + ///\ingroup type_traits + template struct is_trivially_constructible : std::is_trivially_constructible {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_constructible_v = std::is_trivially_constructible_v; +#endif + + //*************************************************************************** + /// is_trivially_copy_constructible + ///\ingroup type_traits + template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_constructible_v = std::is_trivially_copy_constructible_v; +#endif + + //*************************************************************************** + /// is_trivially_destructible + ///\ingroup type_traits + template struct is_trivially_destructible : std::is_trivially_destructible {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_destructible_v = std::is_trivially_destructible_v; +#endif + + //*************************************************************************** + /// is_trivially_copy_assignable + ///\ingroup type_traits + template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_assignable_v = std::is_trivially_copy_assignable_v; +#endif + + //*************************************************************************** + /// is_trivially_copyable + ///\ingroup type_traits + template struct is_trivially_copyable : std::is_trivially_copyable {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copyable_v = std::is_trivially_copyable_v; +#endif +#else //*************************************************************************** /// is_trivially_constructible ///\ingroup type_traits - template struct is_trivially_constructible : std::is_trivially_constructible {}; + template struct is_trivially_constructible : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_constructible_v = std::is_trivially_constructible_v; + inline constexpr bool is_trivially_constructible_v = std::is_pod_v; #endif //*************************************************************************** /// is_trivially_copy_constructible ///\ingroup type_traits - template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; + template struct is_trivially_copy_constructible : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_constructible_v = std::is_trivially_copy_constructible_v; + inline constexpr bool is_trivially_copy_constructible_v = std::is_pod_v; #endif //*************************************************************************** /// is_trivially_destructible ///\ingroup type_traits - template struct is_trivially_destructible : std::is_trivially_destructible {}; + template struct is_trivially_destructible : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_destructible_v = std::is_trivially_destructible_v; + inline constexpr bool is_trivially_destructible_v = std::is_pod_v; #endif //*************************************************************************** /// is_trivially_copy_assignable ///\ingroup type_traits - template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; + template struct is_trivially_copy_assignable : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_assignable_v = std::is_trivially_copy_assignable_v; + inline constexpr bool is_trivially_copy_assignable_v = std::is_pod_v; #endif //*************************************************************************** /// is_trivially_copyable ///\ingroup type_traits - template struct is_trivially_copyable : std::is_trivially_copyable {}; + template struct is_trivially_copyable : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copyable_v = std::is_trivially_copyable_v; + inline constexpr bool is_trivially_copyable_v = std::is_pod_v; #endif -#else - // //*************************************************************************** - // /// is_trivially_constructible - // ///\ingroup type_traits - // template struct is_trivially_constructible : etlstd::is_trivially_constructible {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_constructible_v = typename etlstd::::is_trivially_constructible_v; - //#endif - - // //*************************************************************************** - // /// is_trivially_copy_constructible - // ///\ingroup type_traits - // template struct is_trivially_copy_constructible : etlstd::::is_trivially_copy_constructible {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_copy_constructible_v = typename etlstd::::is_trivially_copy_constructible_v; - //#endif - - // //*************************************************************************** - // /// is_trivially_destructible - // ///\ingroup type_traits - // template struct is_trivially_destructible : etlstd::::is_trivially_destructible {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_destructible_v = typename etlstd::::is_trivially_destructible_v; - //#endif - - // //*************************************************************************** - // /// is_trivially_copy_assignable - // ///\ingroup type_traits - // template struct is_trivially_copy_assignable : etlstd::::is_trivially_copy_assignable {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_copy_assignable_v = typename etlstd::::is_trivially_copy_assignable_v; - //#endif - - // //*************************************************************************** - // /// is_trivially_copyable - // ///\ingroup type_traits - // template struct is_trivially_copyable : etlstd::::is_trivially_copyable {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_copyable_v = typename etlstd::::is_trivially_copyable_v; - //#endif #endif //*************************************************************************** @@ -1265,14 +1268,13 @@ namespace etlstd template inline constexpr size_t alignment_of_v = std::alignment_of_v; #endif -} -#endif -//*************************************************************************** -// ETL specific type traits. -//*************************************************************************** -namespace etl -{ +#endif // defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + + //*************************************************************************** + // ETL extended type traits. + //*************************************************************************** + //*************************************************************************** /// conditional_integral_constant // /\ingroup type_traits @@ -1282,14 +1284,14 @@ namespace etl template struct conditional_integral_constant { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); static const T value = TRUE_VALUE; }; template struct conditional_integral_constant { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); static const T value = FALSE_VALUE; }; @@ -1301,18 +1303,16 @@ namespace etl template struct is_one_of { - static const bool value = etlstd::is_same::value || - etl::is_one_of::value; + static const bool value = etl::is_same::value || + etl::is_one_of::value; }; template struct is_one_of { - static const bool value = etlstd::is_same::value; + static const bool value = etl::is_same::value; }; - #else - //*************************************************************************** /// Template to determine if a type is one of a specified list. ///\ingroup types @@ -1320,8 +1320,7 @@ namespace etl typename T1, typename T2 = void, typename T3 = void, typename T4 = void, typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void, typename T9 = void, typename T10 = void, typename T11 = void, typename T12 = void, - typename T13 = void, typename T14 = void, typename T15 = void, typename T16 = void, - typename T17 = void> + typename T13 = void, typename T14 = void, typename T15 = void, typename T16 = void> struct is_one_of { static const bool value = @@ -1340,10 +1339,8 @@ namespace etl etlstd::is_same::value || etlstd::is_same::value || etlstd::is_same::value || - etlstd::is_same::value || - etlstd::is_same::value; + etlstd::is_same::value; }; - #endif #if ETL_CPP17_SUPPORTED @@ -1361,7 +1358,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1379,7 +1376,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1397,7 +1394,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1415,7 +1412,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1434,7 +1431,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1470,8 +1467,8 @@ namespace etl //*************************************************************************** /// size_of ///\ingroup types - template struct size_of : etlstd::integral_constant {}; - template <> struct size_of : etlstd::integral_constant {}; + template struct size_of : etl::integral_constant {}; + template <> struct size_of : etl::integral_constant {}; #if ETL_CPP17_SUPPORTED template @@ -1479,5 +1476,4 @@ namespace etl #endif } - -#endif +#endif // ETL_TYPE_TRAITS_INCLUDED diff --git a/include/etl/type_traits_generator.h b/include/etl/type_traits_generator.h index 1da6f67a..78a42254 100644 --- a/include/etl/type_traits_generator.h +++ b/include/etl/type_traits_generator.h @@ -77,13 +77,17 @@ cog.outl("//******************************************************************** /// Derived from either the standard or alternate definitions, dependant on whether or not ETL_NO_STL is defined. /// \ingroup utilities -#if defined(ETL_NO_STL) +#if !defined(ETL_NO_STL) && ETL_CPP11_SUPPORTED + #include +#endif -//***************************************************************************** -// Traits are defined by the ETL -//***************************************************************************** -namespace etlstd +namespace etl { +#if defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + + //***************************************************************************** + // Traits are defined by the ETL + //***************************************************************************** //*************************************************************************** /// integral_constant template @@ -104,6 +108,9 @@ namespace etlstd typedef integral_constant false_type; typedef integral_constant true_type; + template + const T integral_constant::value; + #if ETL_CPP17_SUPPORTED template using bool_constant = integral_constant; @@ -420,27 +427,27 @@ namespace etlstd //*************************************************************************** /// is_pod /// Only fundamental and pointers types are recognised. - template struct is_pod : etl::integral_constant::value || etlstd::is_pointer::value> {}; + template struct is_pod : etl::integral_constant::value || etl::is_pointer::value> {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_pod_v = etlstd::is_pod::value; + inline constexpr bool is_pod_v = etl::is_pod::value; #endif //*************************************************************************** /// is_trivially_constructible /// Only POD types are recognised. - template struct is_trivially_constructible : etlstd::is_pod {}; + template struct is_trivially_constructible : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_constructible_v = etlstd::is_trivially_constructible::value; + inline constexpr bool is_trivially_constructible_v = etl::is_trivially_constructible::value; #endif //*************************************************************************** /// is_trivially_copy_constructible /// Only POD types are recognised. - template struct is_trivially_copy_constructible : etlstd::is_pod {}; + template struct is_trivially_copy_constructible : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template @@ -450,7 +457,7 @@ namespace etlstd //*************************************************************************** /// is_trivially_destructible /// Only POD types are recognised. - template struct is_trivially_destructible : etlstd::is_pod {}; + template struct is_trivially_destructible : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template @@ -460,7 +467,7 @@ namespace etlstd //*************************************************************************** /// is_trivially_copy_assignable /// Only POD types are recognised. - template struct is_trivially_copy_assignable : etlstd::is_pod {}; + template struct is_trivially_copy_assignable : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template @@ -470,7 +477,7 @@ namespace etlstd //*************************************************************************** /// is_trivially_copyable /// Only POD types are recognised. - template struct is_trivially_copyable : etlstd::is_pod {}; + template struct is_trivially_copyable : etl::is_pod {}; #if ETL_CPP17_SUPPORTED template @@ -490,9 +497,9 @@ namespace etlstd template <> struct make_signed { - typedef etlstd::conditional::type>::type type; }; @@ -519,9 +526,9 @@ namespace etlstd template <> struct make_unsigned { - typedef etlstd::conditional::type>::type type; }; @@ -608,10 +615,10 @@ namespace etlstd template struct decay { - typedef typename etlstd::remove_reference::type U; - typedef typename etlstd::conditional::value, - typename etlstd::remove_extent::type*, - typename etlstd::remove_cv::type>::type type; + typedef typename etl::remove_reference::type U; + typedef typename etl::conditional::value, + typename etl::remove_extent::type*, + typename etl::remove_cv::type>::type type; }; #if ETL_CPP14_SUPPORTED @@ -623,7 +630,7 @@ namespace etlstd /// is_base_of template::value || etlstd::is_fundamental::value)> + const bool IsFundamental = (etl::is_fundamental::value || etl::is_fundamental::value)> struct is_base_of { private: @@ -662,7 +669,7 @@ namespace etlstd #if ETL_CPP14_SUPPORTED template - using add_lvalue_reference_t = typename etlstd::add_lvalue_reference::type; + using add_lvalue_reference_t = typename etl::add_lvalue_reference::type; #endif //*************************************************************************** @@ -678,14 +685,14 @@ namespace etlstd #if ETL_CPP14_SUPPORTED template - using add_rvalue_reference_t = typename etlstd::add_rvalue_reference::type; + using add_rvalue_reference_t = typename etl::add_rvalue_reference::type; #endif //*************************************************************************** /// decval #if ETL_CPP11_SUPPORTED template - typename etlstd::add_rvalue_reference::type declval() ETL_NOEXCEPT; + typename etl::add_rvalue_reference::type declval() ETL_NOEXCEPT; #endif //*************************************************************************** @@ -694,30 +701,30 @@ namespace etlstd namespace private_type_traits { template - using true_type_for = etlstd::true_type; + using true_type_for = etl::true_type; template auto returnable(int)->true_type_for; template - auto returnable(...)->etlstd::false_type; + auto returnable(...)->etl::false_type; template auto nonvoid_convertible(int)->true_type_for()(etl::declval())) >; template - auto nonvoid_convertible(...)->etlstd::false_type; + auto nonvoid_convertible(...)->etl::false_type; } template struct is_convertible : etl::integral_constant(0))::value && - decltype(private_type_traits::nonvoid_convertible(0))::value) || - (etl::is_void::value && etl::is_void::value)> {}; + decltype(private_type_traits::nonvoid_convertible(0))::value) || + (etl::is_void::value && etl::is_void::value)> {}; #endif #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_convertible_v = etlstd::is_convertible::value; + inline constexpr bool is_convertible_v = etl::is_convertible::value; #endif //*************************************************************************** @@ -737,19 +744,15 @@ namespace etlstd #if ETL_CPP17_SUPPORTED template - inline constexpr size_t alignment_of_v = etlstd::alignment_of::value; + inline constexpr size_t alignment_of_v = etl::alignment_of::value; #endif -} -#else +#else // defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED -//***************************************************************************** -// Traits are derived from the STL -//***************************************************************************** -#include + //***************************************************************************** + // Traits are derived from the STL + //***************************************************************************** -namespace etlstd -{ //*************************************************************************** /// integral_constant ///\ingroup type_traits @@ -763,7 +766,7 @@ namespace etlstd #if ETL_CPP17_SUPPORTED template - using bool_constant = std::integral_constant; + using bool_constant = std::bool_constant; #endif //*************************************************************************** @@ -1029,105 +1032,105 @@ namespace etlstd #endif #if !defined(ARDUINO) && !defined(ETL_STLPORT) + //*************************************************************************** + /// is_trivially_constructible + ///\ingroup type_traits + template struct is_trivially_constructible : std::is_trivially_constructible {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_constructible_v = std::is_trivially_constructible_v; +#endif + + //*************************************************************************** + /// is_trivially_copy_constructible + ///\ingroup type_traits + template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_constructible_v = std::is_trivially_copy_constructible_v; +#endif + + //*************************************************************************** + /// is_trivially_destructible + ///\ingroup type_traits + template struct is_trivially_destructible : std::is_trivially_destructible {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_destructible_v = std::is_trivially_destructible_v; +#endif + + //*************************************************************************** + /// is_trivially_copy_assignable + ///\ingroup type_traits + template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copy_assignable_v = std::is_trivially_copy_assignable_v; +#endif + + //*************************************************************************** + /// is_trivially_copyable + ///\ingroup type_traits + template struct is_trivially_copyable : std::is_trivially_copyable {}; + +#if ETL_CPP17_SUPPORTED + template + inline constexpr bool is_trivially_copyable_v = std::is_trivially_copyable_v; +#endif +#else //*************************************************************************** /// is_trivially_constructible ///\ingroup type_traits - template struct is_trivially_constructible : std::is_trivially_constructible {}; + template struct is_trivially_constructible : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_constructible_v = std::is_trivially_constructible_v; + inline constexpr bool is_trivially_constructible_v = std::is_pod_v; #endif //*************************************************************************** /// is_trivially_copy_constructible ///\ingroup type_traits - template struct is_trivially_copy_constructible : std::is_trivially_copy_constructible {}; + template struct is_trivially_copy_constructible : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_constructible_v = std::is_trivially_copy_constructible_v; + inline constexpr bool is_trivially_copy_constructible_v = std::is_pod_v; #endif //*************************************************************************** /// is_trivially_destructible ///\ingroup type_traits - template struct is_trivially_destructible : std::is_trivially_destructible {}; + template struct is_trivially_destructible : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_destructible_v = std::is_trivially_destructible_v; + inline constexpr bool is_trivially_destructible_v = std::is_pod_v; #endif //*************************************************************************** /// is_trivially_copy_assignable ///\ingroup type_traits - template struct is_trivially_copy_assignable : std::is_trivially_copy_assignable {}; + template struct is_trivially_copy_assignable : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copy_assignable_v = std::is_trivially_copy_assignable_v; + inline constexpr bool is_trivially_copy_assignable_v = std::is_pod_v; #endif //*************************************************************************** /// is_trivially_copyable ///\ingroup type_traits - template struct is_trivially_copyable : std::is_trivially_copyable {}; + template struct is_trivially_copyable : std::is_pod {}; #if ETL_CPP17_SUPPORTED template - inline constexpr bool is_trivially_copyable_v = std::is_trivially_copyable_v; + inline constexpr bool is_trivially_copyable_v = std::is_pod_v; #endif -#else - // //*************************************************************************** - // /// is_trivially_constructible - // ///\ingroup type_traits - // template struct is_trivially_constructible : etlstd::is_trivially_constructible {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_constructible_v = typename etl::::is_trivially_constructible_v; - //#endif - - // //*************************************************************************** - // /// is_trivially_copy_constructible - // ///\ingroup type_traits - // template struct is_trivially_copy_constructible : etl::::is_trivially_copy_constructible {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_copy_constructible_v = typename etl::::is_trivially_copy_constructible_v; - //#endif - - // //*************************************************************************** - // /// is_trivially_destructible - // ///\ingroup type_traits - // template struct is_trivially_destructible : etl::::is_trivially_destructible {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_destructible_v = typename etl::::is_trivially_destructible_v; - //#endif - - // //*************************************************************************** - // /// is_trivially_copy_assignable - // ///\ingroup type_traits - // template struct is_trivially_copy_assignable : etl::::is_trivially_copy_assignable {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_copy_assignable_v = typename etl::::is_trivially_copy_assignable_v; - //#endif - - // //*************************************************************************** - // /// is_trivially_copyable - // ///\ingroup type_traits - // template struct is_trivially_copyable : etl::::is_trivially_copyable {}; - - //#if ETL_CPP17_SUPPORTED - // template - // inline constexpr bool is_trivially_copyable_v = typename etl::::is_trivially_copyable_v; - //#endif #endif //*************************************************************************** @@ -1277,14 +1280,13 @@ namespace etlstd template inline constexpr size_t alignment_of_v = std::alignment_of_v; #endif -} -#endif -//*************************************************************************** -// ETL specific type traits. -//*************************************************************************** -namespace etl -{ +#endif // defined(ETL_NO_STL) || !ETL_CPP11_SUPPORTED + + //*************************************************************************** + // ETL extended type traits. + //*************************************************************************** + //*************************************************************************** /// conditional_integral_constant // /\ingroup type_traits @@ -1294,14 +1296,14 @@ namespace etl template struct conditional_integral_constant { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); static const T value = TRUE_VALUE; }; template struct conditional_integral_constant { - ETL_STATIC_ASSERT(etlstd::is_integral::value, "Not an integral type"); + ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); static const T value = FALSE_VALUE; }; @@ -1313,18 +1315,16 @@ namespace etl template struct is_one_of { - static const bool value = etlstd::is_same::value || + static const bool value = etl::is_same::value || etl::is_one_of::value; }; template struct is_one_of { - static const bool value = etlstd::is_same::value; + static const bool value = etl::is_same::value; }; - #else - /*[[[cog import cog cog.outl("//***************************************************************************") @@ -1348,7 +1348,6 @@ namespace etl cog.outl("};") ]]]*/ /*[[[end]]]*/ - #endif #if ETL_CPP17_SUPPORTED @@ -1366,7 +1365,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1384,7 +1383,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1402,7 +1401,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1420,7 +1419,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1439,7 +1438,7 @@ namespace etl { private: - typedef typename etlstd::remove_cv::type type_t; + typedef typename etl::remove_cv::type type_t; public: @@ -1475,8 +1474,8 @@ namespace etl //*************************************************************************** /// size_of ///\ingroup types - template struct size_of : etlstd::integral_constant {}; - template <> struct size_of : etlstd::integral_constant {}; + template struct size_of : etl::integral_constant {}; + template <> struct size_of : etl::integral_constant {}; #if ETL_CPP17_SUPPORTED template @@ -1484,5 +1483,4 @@ namespace etl #endif } - -#endif +#endif // ETL_TYPE_TRAITS_INCLUDED diff --git a/include/etl/u16string.h b/include/etl/u16string.h index 4da9ff67..377d29e8 100644 --- a/include/etl/u16string.h +++ b/include/etl/u16string.h @@ -191,7 +191,7 @@ namespace etl { ETL_ASSERT(position < size(), ETL_ERROR(string_out_of_bounds)); - length_ = etlstd::min(length_, size() - position); + length_ = etl::min(length_, size() - position); new_string.assign(buffer + position, buffer + position + length_); } diff --git a/include/etl/u32string.h b/include/etl/u32string.h index 4606fe21..ee4ebabd 100644 --- a/include/etl/u32string.h +++ b/include/etl/u32string.h @@ -191,7 +191,7 @@ namespace etl { ETL_ASSERT(position < size(), ETL_ERROR(string_out_of_bounds)); - length_ = etlstd::min(length_, size() - position); + length_ = etl::min(length_, size() - position); new_string.assign(buffer + position, buffer + position + length_); } diff --git a/include/etl/unordered_map.h b/include/etl/unordered_map.h index eda2a631..c0a3bbf7 100644 --- a/include/etl/unordered_map.h +++ b/include/etl/unordered_map.h @@ -127,7 +127,7 @@ namespace etl /// Can be used as a reference type for all unordered_map containing a specific type. ///\ingroup unordered_map //*************************************************************************** - template , typename TKeyEqual = etlstd::equal_to > + template , typename TKeyEqual = etl::equal_to > class iunordered_map { public: @@ -482,7 +482,7 @@ namespace etl local_iterator inode; }; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the unordered_map. @@ -609,7 +609,7 @@ namespace etl { size_t index = bucket(key); - return etlstd::distance(pbuckets[index].begin(), pbuckets[index].end()); + return etl::distance(pbuckets[index].begin(), pbuckets[index].end()); } //********************************************************************* @@ -752,7 +752,7 @@ namespace etl void assign(TIterator first_, TIterator last_) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first_, last_); + difference_type d = etl::distance(first_, last_); ETL_ASSERT(d >= 0, ETL_ERROR(unordered_map_iterator)); ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_map_full)); #endif @@ -1370,7 +1370,7 @@ namespace etl template bool operator ==(const etl::iunordered_map& lhs, const etl::iunordered_map& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1389,7 +1389,7 @@ namespace etl //************************************************************************* /// A templated unordered_map implementation that uses a fixed size buffer. //************************************************************************* - template , typename TKeyEqual = etlstd::equal_to > + template , typename TKeyEqual = etl::equal_to > class unordered_map : public etl::iunordered_map { private: diff --git a/include/etl/unordered_multimap.h b/include/etl/unordered_multimap.h index 9f96a7a8..2e622058 100644 --- a/include/etl/unordered_multimap.h +++ b/include/etl/unordered_multimap.h @@ -127,7 +127,7 @@ namespace etl /// Can be used as a reference type for all unordered_multimap containing a specific type. ///\ingroup unordered_multimap //*************************************************************************** - template , typename TKeyEqual = etlstd::equal_to > + template , typename TKeyEqual = etl::equal_to > class iunordered_multimap { public: @@ -482,7 +482,7 @@ namespace etl local_iterator inode; }; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the unordered_multimap. @@ -609,7 +609,7 @@ namespace etl { size_t index = bucket(key); - return etlstd::distance(pbuckets[index].begin(), pbuckets[index].end()); + return etl::distance(pbuckets[index].begin(), pbuckets[index].end()); } //********************************************************************* @@ -641,7 +641,7 @@ namespace etl void assign(TIterator first_, TIterator last_) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first_, last_); + difference_type d = etl::distance(first_, last_); ETL_ASSERT(d >= 0, ETL_ERROR(unordered_multimap_iterator)); ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_multimap_full)); #endif @@ -1279,7 +1279,7 @@ namespace etl template bool operator ==(const etl::iunordered_multimap& lhs, const etl::iunordered_multimap& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1298,7 +1298,7 @@ namespace etl //************************************************************************* /// A templated unordered_multimap implementation that uses a fixed size buffer. //************************************************************************* - template , typename TKeyEqual = etlstd::equal_to > + template , typename TKeyEqual = etl::equal_to > class unordered_multimap : public etl::iunordered_multimap { private: diff --git a/include/etl/unordered_multiset.h b/include/etl/unordered_multiset.h index 2e03f02a..b8793407 100644 --- a/include/etl/unordered_multiset.h +++ b/include/etl/unordered_multiset.h @@ -126,7 +126,7 @@ namespace etl /// Can be used as a reference type for all unordered_multiset containing a specific type. ///\ingroup unordered_multiset //*************************************************************************** - template , typename TKeyEqual = etlstd::equal_to > + template , typename TKeyEqual = etl::equal_to > class iunordered_multiset { public: @@ -477,7 +477,7 @@ namespace etl local_iterator inode; }; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the unordered_multiset. @@ -604,7 +604,7 @@ namespace etl { size_t index = bucket(key); - return etlstd::distance(pbuckets[index].begin(), pbuckets[index].end()); + return etl::distance(pbuckets[index].begin(), pbuckets[index].end()); } //********************************************************************* @@ -636,7 +636,7 @@ namespace etl void assign(TIterator first_, TIterator last_) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first_, last_); + difference_type d = etl::distance(first_, last_); ETL_ASSERT(d >= 0, ETL_ERROR(unordered_multiset_iterator)); ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_multiset_full)); #endif @@ -1274,7 +1274,7 @@ namespace etl template bool operator ==(const etl::iunordered_multiset& lhs, const etl::iunordered_multiset& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1293,7 +1293,7 @@ namespace etl //************************************************************************* /// A templated unordered_multiset implementation that uses a fixed size buffer. //************************************************************************* - template , typename TKeyEqual = etlstd::equal_to > + template , typename TKeyEqual = etl::equal_to > class unordered_multiset : public etl::iunordered_multiset { private: diff --git a/include/etl/unordered_set.h b/include/etl/unordered_set.h index c16772de..9fbc3586 100644 --- a/include/etl/unordered_set.h +++ b/include/etl/unordered_set.h @@ -127,7 +127,7 @@ namespace etl /// Can be used as a reference type for all unordered_set containing a specific type. ///\ingroup unordered_set //*************************************************************************** - template , typename TKeyEqual = etlstd::equal_to > + template , typename TKeyEqual = etl::equal_to > class iunordered_set { public: @@ -169,7 +169,7 @@ namespace etl typedef typename bucket_t::const_iterator local_const_iterator; //********************************************************************* - class iterator : public etl::iterator + class iterator : public etl::iterator { public: @@ -328,7 +328,7 @@ namespace etl }; //********************************************************************* - class const_iterator : public etl::iterator + class const_iterator : public etl::iterator { public: @@ -478,7 +478,7 @@ namespace etl local_iterator inode; }; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; //********************************************************************* /// Returns an iterator to the beginning of the unordered_set. @@ -605,7 +605,7 @@ namespace etl { size_t index = bucket(key); - return etlstd::distance(pbuckets[index].begin(), pbuckets[index].end()); + return etl::distance(pbuckets[index].begin(), pbuckets[index].end()); } //********************************************************************* @@ -637,7 +637,7 @@ namespace etl void assign(TIterator first_, TIterator last_) { #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first_, last_); + difference_type d = etl::distance(first_, last_); ETL_ASSERT(d >= 0, ETL_ERROR(unordered_set_iterator)); ETL_ASSERT(size_t(d) <= max_size(), ETL_ERROR(unordered_set_full)); #endif @@ -1251,7 +1251,7 @@ namespace etl template bool operator ==(const etl::iunordered_set& lhs, const etl::iunordered_set& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1270,7 +1270,7 @@ namespace etl //************************************************************************* /// A templated unordered_set implementation that uses a fixed size buffer. //************************************************************************* - template , typename TKeyEqual = etlstd::equal_to > + template , typename TKeyEqual = etl::equal_to > class unordered_set : public etl::iunordered_set { private: diff --git a/include/etl/utility.h b/include/etl/utility.h index 6bec4c24..5f600f2f 100644 --- a/include/etl/utility.h +++ b/include/etl/utility.h @@ -41,7 +41,7 @@ SOFTWARE. ///\defgroup utility utility ///\ingroup utilities -namespace etlstd +namespace etl { //****************************************************************************** template @@ -144,20 +144,20 @@ namespace etlstd #if ETL_CPP11_SUPPORTED //****************************************************************************** template - constexpr typename etlstd::remove_reference::type&& move(T&& t) noexcept + constexpr typename etl::remove_reference::type&& move(T&& t) noexcept { - return static_cast::type&&>(t); + return static_cast::type&&>(t); } //****************************************************************************** template - constexpr T&& forward(typename etlstd::remove_reference::type& t) noexcept + constexpr T&& forward(typename etl::remove_reference::type& t) noexcept { return static_cast(t); } template - constexpr T&& forward(typename etlstd::remove_reference::type&& t) noexcept + constexpr T&& forward(typename etl::remove_reference::type&& t) noexcept { return static_cast(t); } @@ -189,7 +189,7 @@ namespace etlstd /// as_const //*************************************************************************** template - typename etlstd::add_const::type& as_const(T& t) + typename etl::add_const::type& as_const(T& t) { return t; } diff --git a/include/etl/variant.h b/include/etl/variant.h index 82f06e35..624c2310 100644 --- a/include/etl/variant.h +++ b/include/etl/variant.h @@ -164,14 +164,14 @@ namespace etl template struct Type_Id_Lookup { - static const uint_least8_t type_id = etlstd::is_same::value ? 0 : - etlstd::is_same::value ? 1 : - etlstd::is_same::value ? 2 : - etlstd::is_same::value ? 3 : - etlstd::is_same::value ? 4 : - etlstd::is_same::value ? 5 : - etlstd::is_same::value ? 6 : - etlstd::is_same::value ? 7 : + static const uint_least8_t type_id = etl::is_same::value ? 0 : + etl::is_same::value ? 1 : + etl::is_same::value ? 2 : + etl::is_same::value ? 3 : + etl::is_same::value ? 4 : + etl::is_same::value ? 5 : + etl::is_same::value ? 6 : + etl::is_same::value ? 7 : UNSUPPORTED_TYPE_ID; }; @@ -723,7 +723,7 @@ namespace etl ETL_STATIC_ASSERT(Type_Is_Supported::value, "Unsupported type"); destruct_current(); - ::new (static_cast(data)) T(etlstd::forward(args)...); + ::new (static_cast(data)) T(etl::forward(args)...); type_id = Type_Id_Lookup::type_id; return *static_cast(data); diff --git a/include/etl/variant_pool.h b/include/etl/variant_pool.h index ae53934f..48c34a62 100644 --- a/include/etl/variant_pool.h +++ b/include/etl/variant_pool.h @@ -290,7 +290,7 @@ namespace etl if (p != nullptr) { - new (p) T(etlstd::forward(args)...); + new (p) T(etl::forward(args)...); } } @@ -305,22 +305,22 @@ namespace etl bool destroy(const T* const p) { ETL_STATIC_ASSERT((etl::is_one_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value || - etlstd::is_base_of::value), "Invalid type"); + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value || + etl::is_base_of::value), "Invalid type"); p->~T(); diff --git a/include/etl/variant_pool_generator.h b/include/etl/variant_pool_generator.h index d6f785e3..a00f1748 100644 --- a/include/etl/variant_pool_generator.h +++ b/include/etl/variant_pool_generator.h @@ -382,8 +382,8 @@ namespace etl cog.outl("T%s>::value ||" % int(NTypes)) for n in range(1, int(NTypes)): - cog.outl(" etlstd::is_base_of::value ||" % n) - cog.outl(" etlstd::is_base_of::value), \"Invalid type\");" % int(NTypes)) + cog.outl(" etl::is_base_of::value ||" % n) + cog.outl(" etl::is_base_of::value), \"Invalid type\");" % int(NTypes)) ]]]*/ /*[[[end]]]*/ diff --git a/include/etl/vector.h b/include/etl/vector.h index 77d23d8a..03305767 100644 --- a/include/etl/vector.h +++ b/include/etl/vector.h @@ -95,7 +95,7 @@ namespace etl typedef ETL_OR_STD::reverse_iterator reverse_iterator; typedef ETL_OR_STD::reverse_iterator const_reverse_iterator; typedef size_t size_type; - typedef typename etlstd::iterator_traits::difference_type difference_type; + typedef typename etl::iterator_traits::difference_type difference_type; protected: @@ -365,17 +365,17 @@ namespace etl template void assign(TIterator first, TIterator last) { - ETL_STATIC_ASSERT((etlstd::is_same::type, typename etlstd::remove_cv::value_type>::type>::value), "Iterator type does not match container type"); + ETL_STATIC_ASSERT((etl::is_same::type, typename etl::remove_cv::value_type>::type>::value), "Iterator type does not match container type"); #if defined(ETL_DEBUG) - difference_type d = etlstd::distance(first, last); + difference_type d = etl::distance(first, last); ETL_ASSERT(static_cast(d) <= CAPACITY, ETL_ERROR(vector_full)); #endif initialise(); p_end = etl::uninitialized_copy(first, last, p_buffer); - ETL_ADD_DEBUG_COUNT(uint32_t(etlstd::distance(first, last))) + ETL_ADD_DEBUG_COUNT(uint32_t(etl::distance(first, last))) } //********************************************************************* @@ -426,7 +426,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full)); #endif - create_back(etlstd::move(value)); + create_back(etl::move(value)); } #endif @@ -442,7 +442,7 @@ namespace etl #if defined(ETL_CHECK_PUSH_POP) ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full)); #endif - ::new (p_end) T(etlstd::forward(args)...); + ::new (p_end) T(etl::forward(args)...); ++p_end; ETL_INCREMENT_DEBUG_COUNT } @@ -541,7 +541,7 @@ namespace etl else { create_back(back()); - etlstd::copy_backward(position, p_end - 2, p_end - 1); + etl::copy_backward(position, p_end - 2, p_end - 1); *position = value; } @@ -561,13 +561,13 @@ namespace etl if (position == end()) { - create_back(etlstd::move(value)); + create_back(etl::move(value)); } else { - create_back(etlstd::move(back())); - etlstd::move_backward(position, p_end - 2, p_end - 1); - *position = etlstd::move(value); + create_back(etl::move(back())); + etl::move_backward(position, p_end - 2, p_end - 1); + *position = etl::move(value); } return position; @@ -594,11 +594,11 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - etlstd::copy_backward(position, p_end - 2, p_end - 1); + etl::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } - ::new (p) T(etlstd::forward(args)...); + ::new (p) T(etl::forward(args)...); return position; } @@ -619,7 +619,7 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - etlstd::copy_backward(position, p_end - 2, p_end - 1); + etl::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } @@ -644,7 +644,7 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - etlstd::copy_backward(position, p_end - 2, p_end - 1); + etl::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } @@ -669,7 +669,7 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - etlstd::copy_backward(position, p_end - 2, p_end - 1); + etl::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } @@ -694,7 +694,7 @@ namespace etl { p = etl::addressof(*position); create_back(back()); - etlstd::copy_backward(position, p_end - 2, p_end - 1); + etl::copy_backward(position, p_end - 2, p_end - 1); (*position).~T(); } @@ -716,7 +716,7 @@ namespace etl ETL_ASSERT((size() + n) <= CAPACITY, ETL_ERROR(vector_full)); size_t insert_n = n; - size_t insert_begin = etlstd::distance(begin(), position); + size_t insert_begin = etl::distance(begin(), position); size_t insert_end = insert_begin + insert_n; // Copy old data. @@ -745,14 +745,14 @@ namespace etl ETL_ADD_DEBUG_COUNT(construct_old_n) // Copy old. - etlstd::copy_backward(p_buffer + insert_begin, p_buffer + insert_begin + copy_old_n, p_buffer + insert_end + copy_old_n); + etl::copy_backward(p_buffer + insert_begin, p_buffer + insert_begin + copy_old_n, p_buffer + insert_end + copy_old_n); // Construct new. etl::uninitialized_fill_n(p_end, construct_new_n, value); ETL_ADD_DEBUG_COUNT(construct_new_n) // Copy new. - etlstd::fill_n(p_buffer + insert_begin, copy_new_n, value); + etl::fill_n(p_buffer + insert_begin, copy_new_n, value); p_end += n; } @@ -768,12 +768,12 @@ namespace etl template void insert(iterator position, TIterator first, TIterator last) { - size_t count = etlstd::distance(first, last); + size_t count = etl::distance(first, last); ETL_ASSERT((size() + count) <= CAPACITY, ETL_ERROR(vector_full)); size_t insert_n = count; - size_t insert_begin = etlstd::distance(begin(), position); + size_t insert_begin = etl::distance(begin(), position); size_t insert_end = insert_begin + insert_n; // Copy old data. @@ -802,7 +802,7 @@ namespace etl ETL_ADD_DEBUG_COUNT(construct_old_n) // Copy old. - etlstd::copy_backward(p_buffer + insert_begin, p_buffer + insert_begin + copy_old_n, p_buffer + insert_end + copy_old_n); + etl::copy_backward(p_buffer + insert_begin, p_buffer + insert_begin + copy_old_n, p_buffer + insert_end + copy_old_n); // Construct new. etl::uninitialized_copy_n(first + copy_new_n, construct_new_n, p_end); @@ -821,7 +821,7 @@ namespace etl //********************************************************************* iterator erase(iterator i_element) { - etlstd::copy(i_element + 1, end(), i_element); + etl::copy(i_element + 1, end(), i_element); destroy_back(); return i_element; @@ -843,8 +843,8 @@ namespace etl } else { - etlstd::copy(last, end(), first); - size_t n_delete = etlstd::distance(first, last); + etl::copy(last, end(), first); + size_t n_delete = etl::distance(first, last); // Destroy the elements left over at the end. etl::destroy(p_end - n_delete, p_end); @@ -880,7 +880,7 @@ namespace etl iterator itr = rhs.begin(); while (itr != rhs.end()) { - push_back(etlstd::move(*itr)); + push_back(etl::move(*itr)); ++itr; } @@ -952,7 +952,7 @@ namespace etl void initialise() { etl::destroy(p_buffer, p_end); - ETL_SUBTRACT_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) + ETL_SUBTRACT_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end))) p_end = p_buffer; } @@ -962,7 +962,7 @@ namespace etl //********************************************************************* void initialise_source_external_buffer_after_move() { - ETL_SUBTRACT_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) + ETL_SUBTRACT_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end))) p_end = p_buffer; } @@ -972,7 +972,7 @@ namespace etl //********************************************************************* void initialise_destination_external_buffer_after_move() { - ETL_ADD_DEBUG_COUNT(int32_t(etlstd::distance(p_buffer, p_end))) + ETL_ADD_DEBUG_COUNT(int32_t(etl::distance(p_buffer, p_end))) } //************************************************************************* @@ -1018,7 +1018,7 @@ namespace etl //********************************************************************* inline void create_back(rvalue_reference value) { - etl::create_copy_at(p_end, etlstd::move(value)); + etl::create_copy_at(p_end, etl::move(value)); ETL_INCREMENT_DEBUG_COUNT ++p_end; @@ -1065,7 +1065,7 @@ namespace etl template bool operator ==(const etl::ivector& lhs, const etl::ivector& rhs) { - return (lhs.size() == rhs.size()) && etlstd::equal(lhs.begin(), lhs.end(), rhs.begin()); + return (lhs.size() == rhs.size()) && etl::equal(lhs.begin(), lhs.end(), rhs.begin()); } //*************************************************************************** @@ -1091,7 +1091,7 @@ namespace etl template bool operator <(const etl::ivector& lhs, const etl::ivector& rhs) { - return etlstd::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); + return etl::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); } //*************************************************************************** @@ -1243,7 +1243,7 @@ namespace etl typename etl::ivector::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -1262,7 +1262,7 @@ namespace etl typename etl::ivector::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -1298,7 +1298,7 @@ namespace etl private: - typename etl::aligned_storage::value>::type buffer; + typename etl::aligned_storage::value>::type buffer; }; //*************************************************************************** @@ -1560,7 +1560,7 @@ namespace etl typename etl::ivector::iterator itr = other.begin(); while (itr != other.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -1579,7 +1579,7 @@ namespace etl typename etl::ivector::iterator itr = rhs.begin(); while (itr != rhs.end()) { - this->push_back(etlstd::move(*itr)); + this->push_back(etl::move(*itr)); ++itr; } @@ -1600,7 +1600,7 @@ namespace etl private: - typename etl::aligned_storage::value>::type buffer; + typename etl::aligned_storage::value>::type buffer; }; //*************************************************************************** diff --git a/include/etl/wstring.h b/include/etl/wstring.h index df0ac6d0..7447d962 100644 --- a/include/etl/wstring.h +++ b/include/etl/wstring.h @@ -192,7 +192,7 @@ namespace etl { ETL_ASSERT(position < size(), ETL_ERROR(string_out_of_bounds)); - length_ = etlstd::min(length_, size() - position); + length_ = etl::min(length_, size() - position); new_string.assign(buffer + position, buffer + position + length_); } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index af18f98b..0aaac6e9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,15 +8,6 @@ if(NOT UnitTest++_FOUND) # Add unittest-cpp as an ExternalProject include(cmake/unit-test_external_project.cmake) add_unittest_cpp() -else() - include(${UnitTest++_CONFIG}) - # The CMake install of UnitTest++ puts the include directory to ${CMAKE_INSTALL_PREFIX}/include - # under the assumptions that clients will consume the headers via - # #include - # However the tests in etl include the headers directly, e.g. - # #include "UnitTest++.h" - # Therefore we update the provide UTPP_INCLUDE_DIRS here - set(UTPP_INCLUDE_DIRS "${UTPP_INCLUDE_DIRS}/UnitTest++") endif() include_directories(${UTPP_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/../include) diff --git a/test/ExtraCheckMacros.h b/test/ExtraCheckMacros.h index 17fcd51a..be2df4c1 100644 --- a/test/ExtraCheckMacros.h +++ b/test/ExtraCheckMacros.h @@ -1,14 +1,14 @@ -#ifndef UNITTEST_EXTRA_CHECKMACROS_H +#ifndef UNITTEST_EXTRA_CHECKMACROS_H #define UNITTEST_EXTRA_CHECKMACROS_H -#include "HelperMacros.h" -#include "ExceptionMacros.h" -#include "Checks.h" -#include "AssertException.h" -#include "MemoryOutStream.h" -#include "TestDetails.h" -#include "CurrentTest.h" -#include "ReportAssertImpl.h" +#include "UnitTest++/HelperMacros.h" +#include "UnitTest++/ExceptionMacros.h" +#include "UnitTest++/Checks.h" +#include "UnitTest++/AssertException.h" +#include "UnitTest++/MemoryOutStream.h" +#include "UnitTest++/TestDetails.h" +#include "UnitTest++/CurrentTest.h" +#include "UnitTest++/ReportAssertImpl.h" #ifndef CHECK_NO_THROW #define CHECK_NO_THROW(expression) \ diff --git a/test/codeblocks/ETL.cbp b/test/codeblocks/ETL.cbp index 52a08930..e0014fc3 100644 --- a/test/codeblocks/ETL.cbp +++ b/test/codeblocks/ETL.cbp @@ -100,16 +100,37 @@ + + + + - - - + @@ -183,12 +204,14 @@ + @@ -214,13 +237,24 @@ + + + + + + + + + + + @@ -266,11 +300,14 @@ + + + @@ -282,6 +319,7 @@ + @@ -296,8 +334,6 @@ - - @@ -340,6 +376,7 @@ + @@ -347,6 +384,7 @@ + @@ -359,16 +397,6 @@ - - - - - - - - - - @@ -381,6 +409,8 @@ + + @@ -403,12 +433,11 @@ - + - @@ -429,6 +458,7 @@ + @@ -451,6 +481,7 @@ + @@ -462,6 +493,7 @@ + @@ -475,10 +507,6 @@ - - - - diff --git a/test/data.h b/test/data.h index 972aff3c..271c7fa3 100644 --- a/test/data.h +++ b/test/data.h @@ -30,6 +30,7 @@ SOFTWARE. #define ETL_TEST_DATA_INCLUDED #include +#include #include "etl/instance_count.h" @@ -258,5 +259,4 @@ std::ostream& operator << (std::ostream& s, const TestDataM& rhs) return s; } - #endif diff --git a/test/no_stl_test_iterators.h b/test/iterators_for_unit_tests.h similarity index 95% rename from test/no_stl_test_iterators.h rename to test/iterators_for_unit_tests.h index b2084de9..84d86e7c 100644 --- a/test/no_stl_test_iterators.h +++ b/test/iterators_for_unit_tests.h @@ -35,7 +35,7 @@ SOFTWARE. #include "etl/iterator.h" template -struct non_random_iterator : public etlstd::iterator +struct non_random_iterator : public etl::iterator { non_random_iterator() : ptr(nullptr) @@ -114,7 +114,7 @@ bool operator !=(const non_random_iterator& lhs, const non_random_iterator } template -struct random_iterator : public etlstd::iterator +struct random_iterator : public etl::iterator { random_iterator() : ptr(nullptr) diff --git a/test/main.cpp b/test/main.cpp index 9014a36b..8ad99a3f 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" int main() { diff --git a/test/maincpp03check.cpp b/test/maincpp03check.cpp index 2dbd8927..7d2036a8 100644 --- a/test/maincpp03check.cpp +++ b/test/maincpp03check.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/absolute.h" #include "etl/algorithm.h" diff --git a/test/test_algorithm.cpp b/test/test_algorithm.cpp index e0fa0a91..bdabd4ce 100644 --- a/test/test_algorithm.cpp +++ b/test/test_algorithm.cpp @@ -26,19 +26,22 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/algorithm.h" #include "etl/container.h" #include "data.h" +#include "iterators_for_unit_tests.h" #include +#include #include #include #include #include #include +#include namespace { @@ -46,42 +49,79 @@ namespace std::random_device rng; std::mt19937 urng(rng()); - typedef std::vector Data; - Data data = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; + typedef std::vector Vector; + Vector data = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; constexpr size_t SIZE = 10; + int dataA[SIZE] = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; + int dataS[SIZE] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; std::list dataSL = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - struct StructData + typedef std::list List; + List dataL = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; + + int dataEQ[SIZE] = { 1, 1, 3, 3, 5, 5, 7, 7, 9, 9 }; + std::list dataEQL = { 1, 1, 3, 3, 5, 5, 7, 7, 9, 9 }; + + Vector dataV = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; + + int dataD1[SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int dataD2[SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + class Data { + public: + + Data() + : a(0) + , b(0) + { + } + + Data(int a, int b) + : a(a) + , b(b) + { + } + int a; int b; }; - bool operator ==(const StructData& lhs, const StructData& rhs) + bool operator ==(const Data& lhs, const Data& rhs) { return (lhs.a == rhs.a) && (lhs.b == rhs.b); } - struct StructDataPredicate + struct DataPredicate { - bool operator ()(const StructData& lhs, const StructData& rhs) const + bool operator ()(const Data& lhs, const Data& rhs) const { return lhs.a < rhs.a; } }; - struct StructDataEquality + struct DataEquality { - bool operator ()(const StructData& lhs, const StructData& rhs) const + bool operator ()(const Data& lhs, const Data& rhs) const { return lhs.a == rhs.a; } }; - std::ostream& operator << (std::ostream& os, const StructData& data_) + Data dataD[10] = { Data(1, 2), Data(2, 1), Data(3, 4), Data(4, 3), Data(5, 6), Data(6, 5), Data(7, 8), Data(8, 7), Data(9, 10), Data(10, 9) }; + + struct Greater : public etl::binary_function + { + bool operator()(int a, int b) const + { + return a > b; + } + }; + + std::ostream& operator << (std::ostream& os, const Data& data_) { os << data_.a << "," << data_.b; return os; @@ -89,6 +129,1028 @@ namespace SUITE(test_algorithm) { + //************************************************************************* + TEST(min) + { + int a = 1; + int b = 2; + + CHECK_EQUAL((std::min(a, b)), (etl::min(a, b))); + CHECK_EQUAL((std::min(b, a)), (etl::min(b, a))); + } + + //************************************************************************* + TEST(min_compare) + { + int a = 1; + int b = 2; + + CHECK_EQUAL((std::min(a, b, Greater())), (etl::min(a, b, Greater()))); + CHECK_EQUAL((std::min(b, a, Greater())), (etl::min(b, a, Greater()))); + } + + //************************************************************************* + TEST(max) + { + int a = 1; + int b = 2; + + CHECK_EQUAL((std::max(a, b)), (etl::max(a, b))); + CHECK_EQUAL((std::max(b, a)), (etl::max(b, a))); + } + + //************************************************************************* + TEST(max_compare) + { + int a = 1; + int b = 2; + + CHECK_EQUAL((std::max(a, b, Greater())), (etl::max(a, b, Greater()))); + CHECK_EQUAL((std::max(b, a, Greater())), (etl::max(b, a, Greater()))); + } + + //************************************************************************* + TEST(minmax_element) + { + std::pair expected = std::minmax_element(data.begin(), data.end()); + std::pair result = etl::minmax_element(data.begin(), data.end()); + CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); + CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); + } + + //************************************************************************* + TEST(minmax_element_compare) + { + std::pair expected = std::minmax_element(data.begin(), data.end(), std::greater()); + std::pair result = etl::minmax_element(data.begin(), data.end(), std::greater()); + CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); + CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); + } + + //************************************************************************* + TEST(minmax) + { + int a = 1; + int b = 2; + + std::pair expected = std::minmax(a, b); + std::pair result = etl::minmax(a, b); + CHECK_EQUAL(expected.first, result.first); + CHECK_EQUAL(expected.second, result.second); + + result = etl::minmax(b, a); + expected = std::minmax(b, a); + CHECK_EQUAL(expected.first, result.first); + CHECK_EQUAL(expected.second, result.second); + } + + //************************************************************************* + TEST(minmax_compare) + { + int a = 1; + int b = 2; + + std::pair expected = std::minmax(a, b, std::greater()); + std::pair result = etl::minmax(a, b, std::greater()); + CHECK_EQUAL(expected.first, result.first); + CHECK_EQUAL(expected.second, result.second); + + result = etl::minmax(b, a, std::greater()); + expected = std::minmax(b, a, std::greater()); + CHECK_EQUAL(expected.first, result.first); + CHECK_EQUAL(expected.second, result.second); + } + + //************************************************************************* + TEST(is_sorted_until) + { + int data[] = { 1, 2, 3, 4, 6, 5, 7, 8, 9, 10 }; + + int* p1 = std::is_sorted_until(std::begin(data), std::end(data)); + int* p2 = etl::is_sorted_until(std::begin(data), std::end(data)); + CHECK_EQUAL(std::distance(std::begin(data), p1), std::distance(std::begin(data), p2)); + } + + //************************************************************************* + TEST(is_sorted_until_compare) + { + int data[] = { 10, 9, 8, 7, 5, 6, 4, 3, 4, 2, 1 }; + + int* p1 = std::is_sorted_until(std::begin(data), std::end(data), std::greater()); + int* p2 = etl::is_sorted_until(std::begin(data), std::end(data), std::greater()); + CHECK_EQUAL(std::distance(etl::begin(data), p1), std::distance(std::begin(data), p2)); + } + + //************************************************************************* + TEST(is_sorted) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + bool is_sorted = etl::is_sorted(std::begin(data1), std::end(data1)); + CHECK(is_sorted); + + int data2[] = { 1, 2, 3, 4, 6, 5, 7, 8 , 9, 10 }; + + is_sorted = etl::is_sorted(std::begin(data2), std::end(data2)); + CHECK(!is_sorted); + } + + //************************************************************************* + TEST(is_sorted_compare) + { + int data1[] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; + + bool is_sorted = etl::is_sorted(std::begin(data1), std::end(data1), std::greater()); + CHECK(is_sorted); + + int data2[] = { 10, 9, 8, 7, 5, 6, 4, 3, 2, 1 }; + + is_sorted = etl::is_sorted(std::begin(data2), std::end(data2), std::greater()); + CHECK(!is_sorted); + } + + //************************************************************************* + TEST(copy_pod_pointer) + { + int data1[10]; + int data2[10]; + + int* pstl = std::copy(std::begin(dataA), std::end(dataA), std::begin(data1)); + int* petl = etl::copy(std::begin(dataA), std::end(dataA), std::begin(data2)); + + using difference_type_t = std::iterator_traits::difference_type; + + difference_type_t dstl = std::distance(data1, pstl); + difference_type_t detl = std::distance(data2, petl); + + CHECK_EQUAL(dstl, detl); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(copy_non_pod_pointer) + { + Data data1[10]; + Data data2[10]; + + Data* pstl = std::copy(std::begin(dataD), std::end(dataD), std::begin(data1)); + Data* petl = etl::copy(std::begin(dataD), std::end(dataD), std::begin(data2)); + + using difference_type_t = std::iterator_traits::difference_type; + + difference_type_t dstl = std::distance(data1, pstl); + difference_type_t detl = std::distance(data2, petl); + + CHECK_EQUAL(dstl, detl); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(copy_non_random_iterator) + { + List data1(dataL.size()); + List data2(dataL.size()); + + List::iterator pstl = std::copy(std::begin(dataA), std::end(dataA), std::begin(data1)); + List::iterator petl = etl::copy(std::begin(dataA), std::end(dataA), std::begin(data2)); + + using difference_type_t = List::difference_type; + + difference_type_t dstl = std::distance(data1.begin(), pstl); + difference_type_t detl = std::distance(data2.begin(), petl); + + CHECK_EQUAL(dstl, detl); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(copy_n_random_iterator) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + int* result; + + std::copy_n(std::begin(data1), 4, std::begin(data2)); + result = etl::copy_n(std::begin(data1), 4, std::begin(data3)); + + CHECK_EQUAL(std::begin(data3) + 4, result); + + bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); + CHECK(is_same); + } + + //************************************************************************* + TEST(copy_n_non_random_iterator) + { + std::list data1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + int* result; + + std::copy_n(std::begin(data1), 4, std::begin(data2)); + result = etl::copy_n(std::begin(data1), 4, std::begin(data3)); + + CHECK_EQUAL(std::begin(data3) + 4, result); + + bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); + CHECK(is_same); + } + + //************************************************************************* + TEST(copy_if) + { + int data1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; + int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + // Copy everything less than 5. + std::copy_if(std::begin(data1), std::end(data1), std::begin(data2), std::bind(std::less(), std::placeholders::_1, 5)); + etl::copy_if(std::begin(data1), std::end(data1), std::begin(data3), std::bind(std::less(), std::placeholders::_1, 5)); + + bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); + CHECK(is_same); + } + + //************************************************************************* + TEST(reverse_copy_pod_pointer) + { + int data1[10]; + int data2[10]; + + int* pstl = std::reverse_copy(std::begin(dataA), std::end(dataA), std::begin(data1)); + int* petl = etl::reverse_copy(std::begin(dataA), std::end(dataA), std::begin(data2)); + + using difference_type_t = std::iterator_traits::difference_type; + + difference_type_t dstl = std::distance(data1, pstl); + difference_type_t detl = std::distance(data2, petl); + + CHECK_EQUAL(dstl, detl); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(copy_n_pod_pointer) + { + int data1[10]; + int data2[10]; + + int* pstl = std::copy_n(std::begin(dataA), 10, std::begin(data1)); + int* petl = etl::copy_n(std::begin(dataA), 10, std::begin(data2)); + + using difference_type_t = std::iterator_traits::difference_type; + + difference_type_t dstl = std::distance(data1, pstl); + difference_type_t detl = std::distance(data2, petl); + + CHECK_EQUAL(dstl, detl); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(copy_n_non_pod_pointer) + { + Data data1[10]; + Data data2[10]; + + Data* pstl = std::copy_n(std::begin(dataD), 10, std::begin(data1)); + Data* petl = etl::copy_n(std::begin(dataD), 10, std::begin(data2)); + + using difference_type_t = std::iterator_traits::difference_type; + + difference_type_t dstl = std::distance(data1, pstl); + difference_type_t detl = std::distance(data2, petl); + + CHECK_EQUAL(dstl, detl); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(copy_backward_pod_pointer) + { + int data1[10]; + int data2[10]; + + int* pstl = std::copy_backward(std::begin(dataA), std::end(dataA), std::end(data1)); + int* petl = etl::copy_backward(std::begin(dataA), std::end(dataA), std::end(data2)); + + using difference_type_t = std::iterator_traits::difference_type; + + difference_type_t dstl = std::distance(data1, pstl); + difference_type_t detl = std::distance(data2, petl); + + CHECK_EQUAL(dstl, detl); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(copy_backward_non_pod_pointer) + { + Data data1[10]; + Data data2[10]; + + Data* pstl = std::copy_backward(std::begin(dataD), std::end(dataD), std::end(data1)); + Data* petl = etl::copy_backward(std::begin(dataD), std::end(dataD), std::end(data2)); + + using difference_type_t = std::iterator_traits::difference_type; + + difference_type_t dstl = std::distance(data1, pstl); + difference_type_t detl = std::distance(data2, petl); + + CHECK_EQUAL(dstl, detl); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(copy_backward_non_random_iterator) + { + List data1(dataL.size()); + List data2(dataL.size()); + + List::iterator pstl = copy_backward(std::begin(dataA), std::end(dataA), std::end(data1)); + List::iterator petl = etl::copy_backward(std::begin(dataA), std::end(dataA), std::end(data2)); + + using difference_type_t = std::iterator_traits::difference_type; + + difference_type_t dstl = std::distance(data1.begin(), pstl); + difference_type_t detl = std::distance(data2.begin(), petl); + + CHECK_EQUAL(dstl, detl); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(test_reverse_even_non_pointer) + { + std::array data1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + std::array data2 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + std::reverse(data1.begin(), data1.end()); + etl::reverse(data2.begin(), data2.end()); + + bool isEqual = std::equal(data1.begin(), data1.end(), data2.begin()); + CHECK(isEqual); + } + + //************************************************************************* + TEST(test_reverse_odd_non_pointer) + { + std::array data1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; + std::array data2 = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; + + std::reverse(data1.begin(), data1.end()); + etl::reverse(data2.begin(), data2.end()); + + bool isEqual = std::equal(data1.begin(), data1.end(), data2.begin()); + CHECK(isEqual); + } + + //************************************************************************* + TEST(test_reverse_even_pointer) + { + int data1[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + int data2[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + std::reverse(std::begin(data1), std::end(data1)); + etl::reverse(std::begin(data2), std::end(data2)); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(test_reverse_odd_pointer) + { + int data1[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; + int data2[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; + + std::reverse(std::begin(data1), std::end(data1)); + etl::reverse(std::begin(data2), std::end(data2)); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(lower_bound_random_iterator) + { + for (int i = 0; i < 11; ++i) + { + int* lb1 = std::lower_bound(std::begin(dataS), std::end(dataS), i); + int* lb2 = etl::lower_bound(random_iterator(std::begin(dataS)), random_iterator(std::end(dataS)), i); + + CHECK_EQUAL(lb1, lb2); + } + } + + //************************************************************************* + TEST(lower_bound_non_random_iterator) + { + for (int i = 0; i < 11; ++i) + { + int* lb1 = std::lower_bound(std::begin(dataS), std::end(dataS), i); + int* lb2 = etl::lower_bound(non_random_iterator(std::begin(dataS)), non_random_iterator(std::end(dataS)), i); + + CHECK_EQUAL(std::distance(std::begin(dataS), lb1), std::distance(std::begin(dataS), lb2)); + } + } + + //************************************************************************* + TEST(upper_bound_random_iterator) + { + for (int i = 0; i < 11; ++i) + { + int* lb1 = std::upper_bound(std::begin(dataS), std::end(dataS), i); + int* lb2 = etl::upper_bound(random_iterator(std::begin(dataS)), random_iterator(std::end(dataS)), i); + + CHECK_EQUAL(std::distance(std::begin(dataS), lb1), std::distance(std::begin(dataS), lb2)); + } + } + + //************************************************************************* + TEST(upper_bound_non_random_iterator) + { + for (int i = 0; i < 11; ++i) + { + int* lb1 = std::upper_bound(std::begin(dataS), std::end(dataS), i); + int* lb2 = etl::upper_bound(non_random_iterator(std::begin(dataS)), non_random_iterator(std::end(dataS)), i); + + CHECK_EQUAL(std::distance(std::begin(dataS), lb1), std::distance(std::begin(dataS), lb2)); + } + } + + //************************************************************************* + TEST(equal_range_random_iterator) + { + for (int i = 0; i < 11; ++i) + { + ETL_OR_STD::pair lb1 = std::equal_range(std::begin(dataEQ), std::end(dataEQ), i); + ETL_OR_STD::pair, random_iterator> lb2 = etl::equal_range(random_iterator(std::begin(dataEQ)), random_iterator(std::end(dataEQ)), i); + + CHECK_EQUAL(std::distance(std::begin(dataEQ), lb1.first), std::distance(std::begin(dataEQ), lb2.first)); + CHECK_EQUAL(std::distance(lb1.first, lb1.second), std::distance(lb2.first, lb2.second)); + } + } + + //************************************************************************* + TEST(equal_range_non_random_iterator) + { + for (int i = 0; i < 11; ++i) + { + ETL_OR_STD::pair lb1 = std::equal_range(std::begin(dataEQ), std::end(dataEQ), i); + ETL_OR_STD::pair, non_random_iterator> lb2 = etl::equal_range(non_random_iterator(std::begin(dataEQ)), non_random_iterator(std::end(dataEQ)), i); + + CHECK_EQUAL(std::distance(std::begin(dataEQ), lb1.first), std::distance(std::begin(dataEQ), lb2.first)); + CHECK_EQUAL(std::distance(lb1.first, lb1.second), std::distance(lb2.first, lb2.second)); + } + } + + //************************************************************************* + TEST(fill_non_char) + { + int data1[10]; + int data2[10]; + + std::fill(std::begin(data1), std::end(data1), 0x12345678); + etl::fill(std::begin(data2), std::end(data2), 0x12345678); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(fill_char) + { + unsigned char data1[10]; + unsigned char data2[10]; + + std::fill(std::begin(data1), std::end(data1), char(0x12)); + etl::fill(std::begin(data2), std::end(data2), char(0x12)); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(iter_swap) + { + int a = 1; + int b = 2; + + etl::iter_swap(&a, &b); + CHECK_EQUAL(2, a); + CHECK_EQUAL(1, b); + } + + //************************************************************************* + TEST(equal) + { + CHECK(etl::equal(std::begin(dataV), std::end(dataV), std::begin(dataL))); + CHECK(!etl::equal(std::begin(dataSL), std::end(dataSL), std::begin(dataL))); + } + + //************************************************************************* + TEST(lexicographical_compare) + { + std::string text1("Hello World"); + std::string text2("Hello Xorld"); + + bool t1 = std::lexicographical_compare(text1.begin(), text1.end(), text2.begin(), text2.begin() + 7); + bool t2 = etl::lexicographical_compare(text1.begin(), text1.end(), text2.begin(), text2.begin() + 7); + + CHECK(t1 == t2); + } + + //************************************************************************* + TEST(lexicographical_compare_greater) + { + std::string text1("Hello World"); + std::string text2("Hello Xorld"); + + bool t1 = std::lexicographical_compare(text1.begin(), text1.end(), text2.begin(), text2.begin() + 7, Greater()); + bool t2 = etl::lexicographical_compare(text1.begin(), text1.end(), text2.begin(), text2.begin() + 7, Greater()); + + CHECK(t1 == t2); + } + + //************************************************************************* + TEST(search) + { + std::string haystack = "ABCDFEGHIJKLMNOPQRSTUVWXYZ"; + std::string needle = "KLMNO"; + + std::string::iterator itr1 = std::search(haystack.begin(), haystack.end(), needle.begin(), needle.begin()); + std::string::iterator itr2 = etl::search(haystack.begin(), haystack.end(), needle.begin(), needle.begin()); + + CHECK(itr1 == itr2); + } + + //************************************************************************* + TEST(search_predicate) + { + std::string haystack = "ABCDFEGHIJKLMNOPQRSTUVWXYZ"; + std::string needle = "KLMNO"; + + std::string::iterator itr1 = std::search(haystack.begin(), haystack.end(), needle.begin(), needle.begin(), std::equal_to()); + std::string::iterator itr2 = etl::search(haystack.begin(), haystack.end(), needle.begin(), needle.begin(), std::equal_to()); + + CHECK(itr1 == itr2); + } + + //************************************************************************* + TEST(heap) + { + Vector data1 = dataV; + Vector data2 = dataV; + + std::make_heap(data1.begin(), data1.end()); + etl::make_heap(data2.begin(), data2.end()); + + bool isEqual; + + CHECK(std::is_heap(data2.begin(), data2.end())); + + isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + + std::pop_heap(data1.begin(), data1.end()); + etl::pop_heap(data2.begin(), data2.end()); + + data1.pop_back(); + data2.pop_back(); + + CHECK(std::is_heap(data1.begin(), data1.end())); + CHECK(std::is_heap(data2.begin(), data2.end())); + + isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + + CHECK(std::is_heap(data2.begin(), data2.end())); + + isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + + data1.push_back(5); + data2.push_back(5); + + std::push_heap(data1.begin(), data1.end()); + etl::push_heap(data2.begin(), data2.end()); + + CHECK(std::is_heap(data2.begin(), data2.end())); + + isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(heap_greater) + { + Vector data1 = dataV; + Vector data2 = dataV; + + std::make_heap(data1.begin(), data1.end(), Greater()); + etl::make_heap(data2.begin(), data2.end(), Greater()); + + bool isEqual; + + CHECK(std::is_heap(data2.begin(), data2.end(), Greater())); + + isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + + std::pop_heap(data1.begin(), data1.end(), Greater()); + etl::pop_heap(data2.begin(), data2.end(), Greater()); + + data1.pop_back(); + data2.pop_back(); + + CHECK(std::is_heap(data1.begin(), data1.end(), Greater())); + CHECK(std::is_heap(data2.begin(), data2.end(), Greater())); + + isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + + CHECK(std::is_heap(data2.begin(), data2.end(), Greater())); + + isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + + data1.push_back(5); + data2.push_back(5); + + std::push_heap(data1.begin(), data1.end(), Greater()); + etl::push_heap(data2.begin(), data2.end(), Greater()); + + CHECK(std::is_heap(data2.begin(), data2.end(), Greater())); + + isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(find) + { + int* itr1 = std::find(std::begin(dataA), std::end(dataA), 5); + int* itr2 = etl::find(std::begin(dataA), std::end(dataA), 5); + + CHECK(itr1 == itr2); + } + + //************************************************************************* + TEST(find_if) + { + struct predicate + { + bool operator()(int i) const + { + return (i == 5); + } + }; + + int* itr1 = std::find_if(std::begin(dataA), std::end(dataA), predicate()); + int* itr2 = etl::find_if(std::begin(dataA), std::end(dataA), predicate()); + + CHECK(itr1 == itr2); + } + + //************************************************************************* + TEST(count) + { + size_t c1 = std::count(std::begin(dataEQ), std::end(dataEQ), 5); + size_t c2 = etl::count(std::begin(dataEQ), std::end(dataEQ), 5); + + CHECK(c1 == c2); + } + + //************************************************************************* + TEST(count_if) + { + struct predicate + { + bool operator()(int i) const + { + return (i == 5); + } + }; + + size_t c1 = std::count_if(std::begin(dataEQ), std::end(dataEQ), predicate()); + size_t c2 = etl::count_if(std::begin(dataEQ), std::end(dataEQ), predicate()); + + CHECK(c1 == c2); + } + + //************************************************************************* + TEST(fill_n) + { + int* p1 = std::fill_n(std::begin(dataD1), SIZE, 5); + int* p2 = etl::fill_n(std::begin(dataD2), SIZE, 5); + + CHECK(p2 == std::end(dataD2)); + + bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(transform1) + { + struct Function + { + int operator()(int d) const + { + return d * 2; + } + }; + + int* p1 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataD1), Function()); + int* p2 = etl::transform(std::begin(dataS), std::end(dataS), std::begin(dataD2), Function()); + + CHECK(p2 == std::end(dataD2)); + + bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2)); + CHECK(isEqual); + } + + //************************************************************************* + TEST(move) + { + typedef std::vector> Data; + + Data data1; + + // Create some data. + std::unique_ptr p1(new uint32_t(1U)); + std::unique_ptr p2(new uint32_t(2U)); + std::unique_ptr p3(new uint32_t(3U)); + std::unique_ptr p4(new uint32_t(4U)); + std::unique_ptr p5(new uint32_t(5U)); + + // Fill data1. + data1.push_back(std::move(p1)); + data1.push_back(std::move(p2)); + data1.push_back(std::move(p3)); + data1.push_back(std::move(p4)); + data1.push_back(std::move(p5)); + + Data data2; + + // Move to data2. + etl::move(data1.begin(), data1.end(), std::back_inserter(data2)); + + // Old data now empty. + CHECK(!bool(p1)); + CHECK(!bool(p2)); + CHECK(!bool(p3)); + CHECK(!bool(p4)); + CHECK(!bool(p5)); + + CHECK_EQUAL(1U, *(data2[0])); + CHECK_EQUAL(2U, *(data2[1])); + CHECK_EQUAL(3U, *(data2[2])); + CHECK_EQUAL(4U, *(data2[3])); + CHECK_EQUAL(5U, *(data2[4])); + } + + //************************************************************************* + TEST(move_backward) + { + typedef std::vector> Data; + + Data data1; + + // Create some data. + std::unique_ptr p1(new uint32_t(1U)); + std::unique_ptr p2(new uint32_t(2U)); + std::unique_ptr p3(new uint32_t(3U)); + std::unique_ptr p4(new uint32_t(4U)); + std::unique_ptr p5(new uint32_t(5U)); + + // Fill data1. + data1.push_back(std::move(p1)); + data1.push_back(std::move(p2)); + data1.push_back(std::move(p3)); + data1.push_back(std::move(p4)); + data1.push_back(std::move(p5)); + + Data data2; + + // Create some data. + std::unique_ptr p6(new uint32_t(6U)); + std::unique_ptr p7(new uint32_t(7U)); + std::unique_ptr p8(new uint32_t(8U)); + std::unique_ptr p9(new uint32_t(9U)); + std::unique_ptr p10(new uint32_t(10U)); + + // Fill data2. + data2.push_back(std::move(p6)); + data2.push_back(std::move(p7)); + data2.push_back(std::move(p8)); + data2.push_back(std::move(p9)); + data2.push_back(std::move(p10)); + + // Overwrite data2 with data1. + etl::move_backward(data1.begin(), data1.end(), data2.end()); + + // Old data now empty. + CHECK(!bool(p1)); + CHECK(!bool(p2)); + CHECK(!bool(p3)); + CHECK(!bool(p4)); + CHECK(!bool(p5)); + + CHECK_EQUAL(1U, *(data2[0])); + CHECK_EQUAL(2U, *(data2[1])); + CHECK_EQUAL(3U, *(data2[2])); + CHECK_EQUAL(4U, *(data2[3])); + CHECK_EQUAL(5U, *(data2[4])); + } + + //************************************************************************* + TEST(rotate) + { + std::vector initial_data = { 1, 2, 3, 4, 5, 6, 7 }; + + for (size_t i = 0; i < initial_data.size(); ++i) + { + std::vector data1(initial_data); + std::vector data2(initial_data); + + std::rotate(data1.data(), data1.data() + i, data1.data() + data1.size()); + etl::rotate(data2.data(), data2.data() + i, data2.data() + data2.size()); + + bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); + CHECK(isEqual); + } + } + + //************************************************************************* + TEST(any_of) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + bool expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + bool result = etl::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + + expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + result = etl::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + CHECK_EQUAL(expected, result); + } + + //************************************************************************* + TEST(all_of) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + bool expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + bool result = etl::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + CHECK_EQUAL(expected, result); + + expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + result = etl::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + } + + //************************************************************************* + TEST(none_of) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + + bool expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); + bool result = etl::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); + CHECK_EQUAL(expected, result); + + expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + result = etl::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + } + + struct Compare + { + bool operator()(int a, int b) const + { + return a == b; + } + }; + + //************************************************************************* + TEST(is_permutation) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + int permutation[] = { 1, 3, 2, 4, 7, 6, 5, 8 }; + int not_permutation[] = { 1, 2, 3, 4, 5, 6, 7, 7 }; + + bool is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation)); + CHECK(is_permutation); + + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation)); + CHECK(!is_permutation); + + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::equal_to()); + CHECK(is_permutation); + + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::equal_to()); + CHECK(!is_permutation); + + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation)); + CHECK(is_permutation); + + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation)); + CHECK(!is_permutation); + + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation), std::equal_to()); + CHECK(is_permutation); + + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation), std::equal_to()); + CHECK(!is_permutation); + } + + //************************************************************************* + TEST(is_partitioned) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + + bool expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + bool result = etl::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + + std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + + expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + result = etl::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(expected, result); + } + + //************************************************************************* + TEST(partition_point) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + + std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + + int* partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + int* partition2 = etl::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); + CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); + + std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); + + partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + partition2 = etl::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); + CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); + } + + //************************************************************************* + TEST(partition_copy) + { + int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; + int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + int data4[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + int data5[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + std::partition_copy(std::begin(data1), std::end(data1), std::begin(data2), std::begin(data3), std::bind(std::greater(), std::placeholders::_1, 4)); + etl::partition_copy(std::begin(data1), std::end(data1), std::begin(data4), std::begin(data5), std::bind(std::greater(), std::placeholders::_1, 4)); + + bool are_equal; + + are_equal = std::equal(std::begin(data2), std::end(data2), std::begin(data4)); + CHECK(are_equal); + + are_equal = std::equal(std::begin(data3), std::end(data3), std::begin(data5)); + CHECK(are_equal); + } + + //************************************************************************* + TEST(find_if_not) + { + int data1[] = { 1, 2, 3, 5, 6, 7, 8 }; + + // Find the element not less than 4. + int* p = etl::find_if_not(std::begin(data1), std::end(data1), std::bind(std::less(), std::placeholders::_1, 4)); + CHECK_EQUAL(5, *p); + } + //************************************************************************* TEST(copy_4_parameter_random_iterator) { @@ -106,21 +1168,21 @@ namespace // Same size. std::fill(std::begin(out1), std::end(out1), 0); - result = etl::copy(std::begin(data1), std::end(data1), std::begin(out1), std::end(out1)); + result = etl::copy_s(std::begin(data1), std::end(data1), std::begin(out1), std::end(out1)); CHECK_EQUAL(std::end(out1), result); bool is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check1)); CHECK(is_same); // Destination smaller. std::fill(std::begin(out2), std::end(out2), 0); - result = etl::copy(std::begin(data1), std::end(data1), std::begin(out2), std::end(out2)); + result = etl::copy_s(std::begin(data1), std::end(data1), std::begin(out2), std::end(out2)); CHECK_EQUAL(std::end(out2), result); is_same = std::equal(std::begin(out2), std::end(out2), std::begin(check2)); CHECK(is_same); // Source smaller. std::fill(std::begin(out1), std::end(out1), 0); - result = etl::copy(std::begin(data2), std::end(data2), std::begin(out1), std::end(out1)); + result = etl::copy_s(std::begin(data2), std::end(data2), std::begin(out1), std::end(out1)); CHECK_EQUAL(std::begin(out1) + 5, result); is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check3)); CHECK(is_same); @@ -143,21 +1205,21 @@ namespace // Same size. std::fill(std::begin(out1), std::end(out1), 0); - result = etl::copy(std::begin(data1), std::end(data1), std::begin(out1), std::end(out1)); + result = etl::copy_s(std::begin(data1), std::end(data1), std::begin(out1), std::end(out1)); CHECK_EQUAL(std::end(out1), result); bool is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check1)); CHECK(is_same); // Destination smaller. std::fill(std::begin(out2), std::end(out2), 0); - result = etl::copy(std::begin(data1), std::end(data1), std::begin(out2), std::end(out2)); + result = etl::copy_s(std::begin(data1), std::end(data1), std::begin(out2), std::end(out2)); CHECK_EQUAL(std::end(out2), result); is_same = std::equal(std::begin(out2), std::end(out2), std::begin(check2)); CHECK(is_same); // Source smaller. std::fill(std::begin(out1), std::end(out1), 0); - result = etl::copy(std::begin(data2), std::end(data2), std::begin(out1), std::end(out1)); + result = etl::copy_s(std::begin(data2), std::end(data2), std::begin(out1), std::end(out1)); CHECK_EQUAL(std::begin(out1) + 5, result); is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check3)); CHECK(is_same); @@ -179,21 +1241,21 @@ namespace // Same size. std::fill(std::begin(out1), std::end(out1), 0); - result = etl::copy_n(std::begin(data1), 10, std::begin(out1), std::end(out1)); + result = etl::copy_n_s(std::begin(data1), 10, std::begin(out1), std::end(out1)); CHECK_EQUAL(std::end(out1), result); bool is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check1)); CHECK(is_same); // Destination smaller. std::fill(std::begin(out2), std::end(out2), 0); - result = etl::copy_n(std::begin(data1), 10, std::begin(out2), std::end(out2)); + result = etl::copy_n_s(std::begin(data1), 10, std::begin(out2), std::end(out2)); CHECK_EQUAL(std::end(out2), result); is_same = std::equal(std::begin(out2), std::end(out2), std::begin(check2)); CHECK(is_same); // Source smaller. std::fill(std::begin(out1), std::end(out1), 0); - result = etl::copy_n(std::begin(data1), 5, std::begin(out1), std::end(out1)); + result = etl::copy_n_s(std::begin(data1), 5, std::begin(out1), std::end(out1)); CHECK_EQUAL(std::begin(out1) + 5, result); is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check3)); CHECK(is_same); @@ -215,21 +1277,21 @@ namespace // Same size. std::fill(std::begin(out1), std::end(out1), 0); - result = etl::copy_n(std::begin(data1), 10, std::begin(out1), 10); + result = etl::copy_n_s(std::begin(data1), 10, std::begin(out1), 10); CHECK_EQUAL(std::end(out1), result); bool is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check1)); CHECK(is_same); // Destination smaller. std::fill(std::begin(out2), std::end(out2), 0); - result = etl::copy_n(std::begin(data1), 10, std::begin(out2), 5); + result = etl::copy_n_s(std::begin(data1), 10, std::begin(out2), 5); CHECK_EQUAL(std::end(out2), result); is_same = std::equal(std::begin(out2), std::end(out2), std::begin(check2)); CHECK(is_same); // Source smaller. std::fill(std::begin(out1), std::end(out1), 0); - result = etl::copy_n(std::begin(data1), 5, std::begin(out1), 10); + result = etl::copy_n_s(std::begin(data1), 5, std::begin(out1), 10); CHECK_EQUAL(std::begin(out1) + 5, result); is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check3)); CHECK(is_same); @@ -274,21 +1336,21 @@ namespace // Exact size. std::fill(std::begin(out1), std::end(out1), 0); - result = etl::copy_if(std::begin(data1), std::end(data1), std::begin(out1), std::end(out1), std::bind(std::less(), std::placeholders::_1, 5)); + result = etl::copy_if_s(std::begin(data1), std::end(data1), std::begin(out1), std::end(out1), std::bind(std::less(), std::placeholders::_1, 5)); CHECK_EQUAL(std::end(out1), result); bool is_same = std::equal(std::begin(out1), std::end(out1), std::begin(check1)); CHECK(is_same); // Destination smaller. std::fill(std::begin(out2), std::end(out2), 0); - result = etl::copy_if(std::begin(data1), std::end(data1), std::begin(out2), std::end(out2), std::bind(std::less(), std::placeholders::_1, 5)); + result = etl::copy_if_s(std::begin(data1), std::end(data1), std::begin(out2), std::end(out2), std::bind(std::less(), std::placeholders::_1, 5)); CHECK_EQUAL(std::end(out2), result); is_same = std::equal(std::begin(out2), std::end(out2), std::begin(check2)); CHECK(is_same); // Destination larger. std::fill(std::begin(out3), std::end(out3), 0); - result = etl::copy_if(std::begin(data1), std::end(data1), std::begin(out3), std::end(out3), std::bind(std::less(), std::placeholders::_1, 5)); + result = etl::copy_if_s(std::begin(data1), std::end(data1), std::begin(out3), std::end(out3), std::bind(std::less(), std::placeholders::_1, 5)); CHECK_EQUAL(std::begin(out3) + 4, result); is_same = std::equal(std::begin(out3), std::end(out3), std::begin(check3)); CHECK(is_same); @@ -311,16 +1373,16 @@ namespace //************************************************************************* TEST(binary_find_StructDataPredicate_StructDataEquality) { - StructData data1[] = { { 1, 8 }, { 2, 7 }, { 3, 6 },{ 4, 5 },{ 5, 4 },{ 6, 3 },{ 7, 2 },{ 8, 1 } }; - StructData test1 = { 4, 5 }; - StructData test2 = { 9, 0 }; + Data data1[] = { { 1, 8 }, { 2, 7 }, { 3, 6 },{ 4, 5 },{ 5, 4 },{ 6, 3 },{ 7, 2 },{ 8, 1 } }; + Data test1 = { 4, 5 }; + Data test2 = { 9, 0 }; // Find the element of value 5. - StructData* p = etl::binary_find(std::begin(data1), std::end(data1), test1, StructDataPredicate(), StructDataEquality()); + Data* p = etl::binary_find(std::begin(data1), std::end(data1), test1, DataPredicate(), DataEquality()); CHECK_EQUAL(test1, *p); // Find the element of value 4. - p = etl::binary_find(std::begin(data1), std::end(data1), test2, StructDataPredicate(), StructDataEquality()); + p = etl::binary_find(std::begin(data1), std::end(data1), test2, DataPredicate(), DataEquality()); CHECK_EQUAL(std::end(data1), p); } @@ -400,22 +1462,22 @@ namespace int compare[] = { 2, 16, 4, 14, 6, 0, 0, 0, 0, 0 }; // Double everything and copy to output. - etlstd::transform(std::begin(input), - std::end(input), - std::begin(output), - std::begin(output) + (etl::size(output) / 2), - std::bind(std::multiplies(), std::placeholders::_1, 2)); + etl::transform_s(std::begin(input), + std::end(input), + std::begin(output), + std::begin(output) + (etl::size(output) / 2), + std::bind(std::multiplies(), std::placeholders::_1, 2)); bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare)); CHECK(is_same); std::fill(std::begin(output), std::end(output), 0); - etlstd::transform(std::begin(input), - std::begin(input) + (etl::size(input) / 2), - std::begin(output), - std::end(output), - std::bind(std::multiplies(), std::placeholders::_1, 2)); + etl::transform_s(std::begin(input), + std::begin(input) + (etl::size(input) / 2), + std::begin(output), + std::end(output), + std::bind(std::multiplies(), std::placeholders::_1, 2)); is_same = std::equal(std::begin(output), std::end(output), std::begin(compare)); CHECK(is_same); @@ -453,6 +1515,42 @@ namespace CHECK(is_same); } + //************************************************************************* + TEST(transform_n_two_ranges_random_iterator) + { + int input1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; + int input2[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; + int output[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int compare[] = { 2, 16, 4, 14, 6, 12, 8, 0, 0, 0 }; + + etl::transform_n(std::begin(input1), + std::begin(input2), + 7, + std::begin(output), + std::plus()); + + bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare)); + CHECK(is_same); + } + + //************************************************************************* + TEST(transform_n_two_ranges_non_random_iterator) + { + std::list input1 = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; + std::list input2 = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; + int output[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int compare[] = { 2, 16, 4, 14, 6, 12, 8, 0, 0, 0 }; + + etl::transform_n(std::begin(input1), + std::begin(input2), + 7, + std::begin(output), + std::plus()); + + bool is_same = std::equal(std::begin(output), std::end(output), std::begin(compare)); + CHECK(is_same); + } + //************************************************************************* TEST(transform_if) { @@ -732,6 +1830,8 @@ namespace CHECK_EQUAL(8, etl::multimax(1, 2, 3, 4, 5, 6, 7, 8)); CHECK_EQUAL(8, etl::multimax_compare(std::less(), 1, 2, 3, 4, 5, 6, 7, 8)); CHECK_EQUAL(1, etl::multimax_compare(std::greater(), 1, 2, 3, 4, 5, 6, 7, 8)); + + int temp[etl::multimax(1, 2, 3, 4, 5, 6, 7, 8)] = { 1, 2, 3, 4, 5, 6, 7, 8 }; } //************************************************************************* diff --git a/test/test_alignment.cpp b/test/test_alignment.cpp index 3d069a1e..7f817ee8 100644 --- a/test/test_alignment.cpp +++ b/test/test_alignment.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/alignment.h" #include "etl/type_traits.h" @@ -50,10 +50,10 @@ namespace size_t alignment; size_t expected; - typedef etl::aligned_storage::value>::type storage32_t; + typedef etl::aligned_storage::value>::type storage32_t; static storage32_t data32[10]; - alignment = etlstd::alignment_of::value; + alignment = etl::alignment_of::value; expected = std::alignment_of::value; CHECK_EQUAL(expected, alignment); @@ -70,7 +70,7 @@ namespace //************************************************************************* TEST(test_aligned_storage_conversion_operators) { - typedef etl::aligned_storage::value>::type storage32_t; + typedef etl::aligned_storage::value>::type storage32_t; static storage32_t data; void* pdata = &data.data; @@ -105,7 +105,7 @@ namespace typedef etl::aligned_storage_as::type storage32_t; static storage32_t data32[10]; - alignment = etlstd::alignment_of::value; + alignment = etl::alignment_of::value; expected = std::alignment_of::value; CHECK_EQUAL(expected, alignment); diff --git a/test/test_array.cpp b/test/test_array.cpp index 28024f19..6d5600e6 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/array.h" diff --git a/test/test_array_view.cpp b/test/test_array_view.cpp index 125ba521..f3bf7d05 100644 --- a/test/test_array_view.cpp +++ b/test/test_array_view.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/array_view.h" #include "etl/array.h" diff --git a/test/test_array_wrapper.cpp b/test/test_array_wrapper.cpp index b907a0c2..9ba573e3 100644 --- a/test/test_array_wrapper.cpp +++ b/test/test_array_wrapper.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/array_wrapper.h" diff --git a/test/test_atomic_gcc_sync.cpp b/test/test_atomic_gcc_sync.cpp index db6c7b0e..ec6cee80 100644 --- a/test/test_atomic_gcc_sync.cpp +++ b/test/test_atomic_gcc_sync.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/platform.h" #include "etl/atomic/atomic_gcc_sync.h" diff --git a/test/test_atomic_std.cpp b/test/test_atomic_std.cpp index 23b19d71..d34d491d 100644 --- a/test/test_atomic_std.cpp +++ b/test/test_atomic_std.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/platform.h" #include "etl/atomic/atomic_std.h" diff --git a/test/test_binary.cpp b/test/test_binary.cpp index 304ca419..f3c0db0e 100644 --- a/test/test_binary.cpp +++ b/test/test_binary.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include @@ -36,6 +36,7 @@ SOFTWARE. #include "etl/bitset.h" #include "etl/fnv_1.h" #include "etl/integral_limits.h" +#include "etl/type_traits.h" // Count bits the easy way. template @@ -939,71 +940,71 @@ namespace CHECK_EQUAL(18446744073709551615U, etl::max_value_for_nbits<64>::value); // Check that the value types are correct. - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); - CHECK((etlstd::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); } //************************************************************************* diff --git a/test/test_bit_stream.cpp b/test/test_bit_stream.cpp index 61d949f7..cdf4672b 100644 --- a/test/test_bit_stream.cpp +++ b/test/test_bit_stream.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/bit_stream.h" diff --git a/test/test_bitset.cpp b/test/test_bitset.cpp index f877727c..2da08654 100644 --- a/test/test_bitset.cpp +++ b/test/test_bitset.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_bloom_filter.cpp b/test/test_bloom_filter.cpp index 77853300..d6de2680 100644 --- a/test/test_bloom_filter.cpp +++ b/test/test_bloom_filter.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_bsd_checksum.cpp b/test/test_bsd_checksum.cpp index 0197d3cf..4a60ec91 100644 --- a/test/test_bsd_checksum.cpp +++ b/test/test_bsd_checksum.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_callback_service.cpp b/test/test_callback_service.cpp index 1173c3f5..a2784e14 100644 --- a/test/test_callback_service.cpp +++ b/test/test_callback_service.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/function.h" #include "etl/callback_service.h" diff --git a/test/test_callback_timer.cpp b/test/test_callback_timer.cpp index 67e248e8..cb877fbb 100644 --- a/test/test_callback_timer.cpp +++ b/test/test_callback_timer.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/callback_timer.h" diff --git a/test/test_checksum.cpp b/test/test_checksum.cpp index 60add3e0..eb4ba823 100644 --- a/test/test_checksum.cpp +++ b/test/test_checksum.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_compare.cpp b/test/test_compare.cpp index b09d3c8d..fec1eece 100644 --- a/test/test_compare.cpp +++ b/test/test_compare.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/compare.h" diff --git a/test/test_compiler_settings.cpp b/test/test_compiler_settings.cpp index 41bf5c79..4fb22f35 100644 --- a/test/test_compiler_settings.cpp +++ b/test/test_compiler_settings.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/platform.h" diff --git a/test/test_constant.cpp b/test/test_constant.cpp index 6ce02f35..353f9d33 100644 --- a/test/test_constant.cpp +++ b/test/test_constant.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/constant.h" #include "etl/integral_limits.h" @@ -51,15 +51,15 @@ namespace CHECK_EQUAL((char)etl::integral_limits::max, c1.value); CHECK_EQUAL((char)etl::integral_limits::max, C1::value); - CHECK((etlstd::is_same::value)); + CHECK((etl::is_same::value)); CHECK_EQUAL((uint32_t)etl::integral_limits::max, c2.value); CHECK_EQUAL((uint32_t)etl::integral_limits::max, C2::value); - CHECK((etlstd::is_same::value)); + CHECK((etl::is_same::value)); CHECK_EQUAL((int64_t)etl::integral_limits::max, c3.value); CHECK_EQUAL((int64_t)etl::integral_limits::max, C3::value); - CHECK((etlstd::is_same::value)); + CHECK((etl::is_same::value)); } }; } diff --git a/test/test_container.cpp b/test/test_container.cpp index d78e460b..9a7b3057 100644 --- a/test/test_container.cpp +++ b/test/test_container.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/container.h" diff --git a/test/test_crc.cpp b/test/test_crc.cpp index 59108323..370f6a46 100644 --- a/test/test_crc.cpp +++ b/test/test_crc.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_cumulative_moving_average.cpp b/test/test_cumulative_moving_average.cpp index 59261963..c017f21a 100644 --- a/test/test_cumulative_moving_average.cpp +++ b/test/test_cumulative_moving_average.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/cumulative_moving_average.h" #include "etl/scaled_rounding.h" diff --git a/test/test_cyclic_value.cpp b/test/test_cyclic_value.cpp index 04220491..5753b8d6 100644 --- a/test/test_cyclic_value.cpp +++ b/test/test_cyclic_value.cpp @@ -28,7 +28,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/cyclic_value.h" diff --git a/test/test_debounce.cpp b/test/test_debounce.cpp index 8424e77e..6634a2cb 100644 --- a/test/test_debounce.cpp +++ b/test/test_debounce.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/debounce.h" diff --git a/test/test_delegate.cpp b/test/test_delegate.cpp index faf21321..c97590b6 100644 --- a/test/test_delegate.cpp +++ b/test/test_delegate.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/delegate.h" diff --git a/test/test_delegate_service.cpp b/test/test_delegate_service.cpp index 96f8a4f2..7b0e69e2 100644 --- a/test/test_delegate_service.cpp +++ b/test/test_delegate_service.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/delegate.h" #include "etl/delegate_service.h" diff --git a/test/test_deque.cpp b/test/test_deque.cpp index 7d9f7a50..f9532ebf 100644 --- a/test/test_deque.cpp +++ b/test/test_deque.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/deque.h" diff --git a/test/test_endian.cpp b/test/test_endian.cpp index fa174a85..fa10d53b 100644 --- a/test/test_endian.cpp +++ b/test/test_endian.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include "etl/endianness.h" diff --git a/test/test_enum_type.cpp b/test/test_enum_type.cpp index e59e8ff5..f3278edd 100644 --- a/test/test_enum_type.cpp +++ b/test/test_enum_type.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include "etl/enum_type.h" diff --git a/test/test_error_handler.cpp b/test/test_error_handler.cpp index 9dc07f9d..17bff6a0 100644 --- a/test/test_error_handler.cpp +++ b/test/test_error_handler.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #if defined(_WINDOWS) #include #endif diff --git a/test/test_etlstd_algorithm.cpp b/test/test_etlstd_algorithm.cpp deleted file mode 100644 index c69565a3..00000000 --- a/test/test_etlstd_algorithm.cpp +++ /dev/null @@ -1,1155 +0,0 @@ -/****************************************************************************** -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. -******************************************************************************/ - -#include "UnitTest++.h" - -#undef min -#undef max - -#include "etl/algorithm.h" - -#include -#include -#include -#include -#include -#include - -#include "no_stl_test_iterators.h" - -namespace -{ - constexpr size_t SIZE = 10; - - typedef std::vector Vector; - Vector data = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; - - int dataEQ[SIZE] = { 1, 1, 3, 3, 5, 5, 7, 7, 9, 9 }; - std::list dataEQL = { 1, 1, 3, 3, 5, 5, 7, 7, 9, 9 }; - - int dataS[SIZE] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - std::list dataSL = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - int dataA[SIZE] = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; - - typedef std::vector Vector; - Vector dataV = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; - - typedef std::list List; - List dataL = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; - - int dataD1[SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int dataD2[SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - class Data - { - public: - - Data() - : a(0), - b(0) - { - } - - Data(int a, int b) - : a(a), - b(b) - { - } - - int a; - int b; - }; - - Data dataD[10] = { Data(1, 2), Data(2, 1), Data(3, 4), Data(4, 3), Data(5, 6), Data(6, 5), Data(7, 8), Data(8, 7), Data(9, 10), Data(10, 9) }; - - bool operator ==(const Data& lhs, const Data& rhs) - { - return (lhs.a == rhs.a) && (lhs.b == rhs.b); - } - - struct StructDataPredicate - { - bool operator ()(const Data& lhs, const Data& rhs) const - { - return lhs.a < rhs.a; - } - }; - - struct StructDataEquality - { - bool operator ()(const Data& lhs, const Data& rhs) const - { - return lhs.a == rhs.a; - } - }; - - struct Greater : public etlstd::binary_function - { - bool operator()(int a, int b) const - { - return a > b; - } - }; - - SUITE(test_no_stl_algorithm) - { - //************************************************************************* - TEST(min) - { - int a = 1; - int b = 2; - - CHECK_EQUAL((std::min(a, b)), (etlstd::min(a, b))); - CHECK_EQUAL((std::min(b, a)), (etlstd::min(b, a))); - } - - //************************************************************************* - TEST(min_compare) - { - int a = 1; - int b = 2; - - CHECK_EQUAL((std::min(a, b, Greater())), (etlstd::min(a, b, Greater()))); - CHECK_EQUAL((std::min(b, a, Greater())), (etlstd::min(b, a, Greater()))); - } - - //************************************************************************* - TEST(max) - { - int a = 1; - int b = 2; - - CHECK_EQUAL((std::max(a, b)), (etlstd::max(a, b))); - CHECK_EQUAL((std::max(b, a)), (etlstd::max(b, a))); - } - - //************************************************************************* - TEST(max_compare) - { - int a = 1; - int b = 2; - - CHECK_EQUAL((std::max(a, b, Greater())), (etlstd::max(a, b, Greater()))); - CHECK_EQUAL((std::max(b, a, Greater())), (etlstd::max(b, a, Greater()))); - } - - //************************************************************************* - TEST(minmax_element) - { - std::pair expected = std::minmax_element(data.begin(), data.end()); - std::pair result = etlstd::minmax_element(data.begin(), data.end()); - CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); - CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); - } - - //************************************************************************* - TEST(minmax_element_compare) - { - std::pair expected = std::minmax_element(data.begin(), data.end(), std::greater()); - std::pair result = etlstd::minmax_element(data.begin(), data.end(), std::greater()); - CHECK_EQUAL(std::distance(data.begin(), expected.first), std::distance(data.begin(), result.first)); - CHECK_EQUAL(std::distance(data.begin(), expected.second), std::distance(data.begin(), result.second)); - } - - //************************************************************************* - TEST(minmax) - { - int a = 1; - int b = 2; - - std::pair expected = std::minmax(a, b); - std::pair result = etlstd::minmax(a, b); - CHECK_EQUAL(expected.first, result.first); - CHECK_EQUAL(expected.second, result.second); - - result = etlstd::minmax(b, a); - expected = std::minmax(b, a); - CHECK_EQUAL(expected.first, result.first); - CHECK_EQUAL(expected.second, result.second); - } - - //************************************************************************* - TEST(minmax_compare) - { - int a = 1; - int b = 2; - - std::pair expected = std::minmax(a, b, std::greater()); - std::pair result = etlstd::minmax(a, b, std::greater()); - CHECK_EQUAL(expected.first, result.first); - CHECK_EQUAL(expected.second, result.second); - - result = etlstd::minmax(b, a, std::greater()); - expected = std::minmax(b, a, std::greater()); - CHECK_EQUAL(expected.first, result.first); - CHECK_EQUAL(expected.second, result.second); - } - - //************************************************************************* - TEST(is_sorted_until) - { - int data[] = { 1, 2, 3, 4, 6, 5, 7, 8, 9, 10 }; - - int* p1 = std::is_sorted_until(std::begin(data), std::end(data)); - int* p2 = etlstd::is_sorted_until(std::begin(data), std::end(data)); - CHECK_EQUAL(std::distance(std::begin(data), p1), std::distance(std::begin(data), p2)); - } - - //************************************************************************* - TEST(is_sorted_until_compare) - { - int data[] = { 10, 9, 8, 7, 5, 6, 4, 3, 4, 2, 1 }; - - int* p1 = std::is_sorted_until(std::begin(data), std::end(data), std::greater()); - int* p2 = etlstd::is_sorted_until(std::begin(data), std::end(data), std::greater()); - CHECK_EQUAL(std::distance(etl::begin(data), p1), std::distance(std::begin(data), p2)); - } - - //************************************************************************* - TEST(is_sorted) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - bool is_sorted = etlstd::is_sorted(std::begin(data1), std::end(data1)); - CHECK(is_sorted); - - int data2[] = { 1, 2, 3, 4, 6, 5, 7, 8 , 9, 10 }; - - is_sorted = etlstd::is_sorted(std::begin(data2), std::end(data2)); - CHECK(!is_sorted); - } - - //************************************************************************* - TEST(is_sorted_compare) - { - int data1[] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; - - bool is_sorted = etlstd::is_sorted(std::begin(data1), std::end(data1), std::greater()); - CHECK(is_sorted); - - int data2[] = { 10, 9, 8, 7, 5, 6, 4, 3, 2, 1 }; - - is_sorted = etlstd::is_sorted(std::begin(data2), std::end(data2), std::greater()); - CHECK(!is_sorted); - } - - //************************************************************************* - TEST(copy_pod_pointer) - { - int data1[10]; - int data2[10]; - - int* pstl = std::copy(std::begin(dataA), std::end(dataA), std::begin(data1)); - int* petl = etlstd::copy(std::begin(dataA), std::end(dataA), std::begin(data2)); - - using difference_type_t = std::iterator_traits::difference_type; - - difference_type_t dstl = std::distance(data1, pstl); - difference_type_t detl = std::distance(data2, petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(copy_non_pod_pointer) - { - Data data1[10]; - Data data2[10]; - - Data* pstl = std::copy(std::begin(dataD), std::end(dataD), std::begin(data1)); - Data* petl = etlstd::copy(std::begin(dataD), std::end(dataD), std::begin(data2)); - - using difference_type_t = std::iterator_traits::difference_type; - - difference_type_t dstl = std::distance(data1, pstl); - difference_type_t detl = std::distance(data2, petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(copy_non_random_iterator) - { - List data1(dataL.size()); - List data2(dataL.size()); - - List::iterator pstl = std::copy(std::begin(dataA), std::end(dataA), std::begin(data1)); - List::iterator petl = etlstd::copy(std::begin(dataA), std::end(dataA), std::begin(data2)); - - using difference_type_t = List::difference_type; - - difference_type_t dstl = std::distance(data1.begin(), pstl); - difference_type_t detl = std::distance(data2.begin(), petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(copy_n_random_iterator) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - int* result; - - std::copy_n(std::begin(data1), 4, std::begin(data2)); - result = etlstd::copy_n(std::begin(data1), 4, std::begin(data3)); - - CHECK_EQUAL(std::begin(data3) + 4, result); - - bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); - CHECK(is_same); - } - - //************************************************************************* - TEST(copy_n_non_random_iterator) - { - std::list data1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - int* result; - - std::copy_n(std::begin(data1), 4, std::begin(data2)); - result = etlstd::copy_n(std::begin(data1), 4, std::begin(data3)); - - CHECK_EQUAL(std::begin(data3) + 4, result); - - bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); - CHECK(is_same); - } - - //************************************************************************* - TEST(copy_if) - { - int data1[] = { 1, 8, 2, 7, 3, 6, 4, 5, 10, 9 }; - int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Copy everything less than 5. - std::copy_if(std::begin(data1), std::end(data1), std::begin(data2), std::bind(std::less(), std::placeholders::_1, 5)); - etlstd::copy_if(std::begin(data1), std::end(data1), std::begin(data3), std::bind(std::less(), std::placeholders::_1, 5)); - - bool is_same = std::equal(std::begin(data2), std::end(data2), std::begin(data3)); - CHECK(is_same); - } - - //************************************************************************* - TEST(reverse_copy_pod_pointer) - { - int data1[10]; - int data2[10]; - - int* pstl = std::reverse_copy(std::begin(dataA), std::end(dataA), std::begin(data1)); - int* petl = etlstd::reverse_copy(std::begin(dataA), std::end(dataA), std::begin(data2)); - - using difference_type_t = std::iterator_traits::difference_type; - - difference_type_t dstl = std::distance(data1, pstl); - difference_type_t detl = std::distance(data2, petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(copy_n_pod_pointer) - { - int data1[10]; - int data2[10]; - - int* pstl = std::copy_n(std::begin(dataA), 10, std::begin(data1)); - int* petl = etlstd::copy_n(std::begin(dataA), 10, std::begin(data2)); - - using difference_type_t = std::iterator_traits::difference_type; - - difference_type_t dstl = std::distance(data1, pstl); - difference_type_t detl = std::distance(data2, petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(copy_n_non_pod_pointer) - { - Data data1[10]; - Data data2[10]; - - Data* pstl = std::copy_n(std::begin(dataD), 10, std::begin(data1)); - Data* petl = etlstd::copy_n(std::begin(dataD), 10, std::begin(data2)); - - using difference_type_t = std::iterator_traits::difference_type; - - difference_type_t dstl = std::distance(data1, pstl); - difference_type_t detl = std::distance(data2, petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(copy_backward_pod_pointer) - { - int data1[10]; - int data2[10]; - - int* pstl = std::copy_backward(std::begin(dataA), std::end(dataA), std::end(data1)); - int* petl = etlstd::copy_backward(std::begin(dataA), std::end(dataA), std::end(data2)); - - using difference_type_t = std::iterator_traits::difference_type; - - difference_type_t dstl = std::distance(data1, pstl); - difference_type_t detl = std::distance(data2, petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(copy_backward_non_pod_pointer) - { - Data data1[10]; - Data data2[10]; - - Data* pstl = std::copy_backward(std::begin(dataD), std::end(dataD), std::end(data1)); - Data* petl = etlstd::copy_backward(std::begin(dataD), std::end(dataD), std::end(data2)); - - using difference_type_t = std::iterator_traits::difference_type; - - difference_type_t dstl = std::distance(data1, pstl); - difference_type_t detl = std::distance(data2, petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(copy_backward_non_random_iterator) - { - List data1(dataL.size()); - List data2(dataL.size()); - - List::iterator pstl = copy_backward(std::begin(dataA), std::end(dataA), std::end(data1)); - List::iterator petl = etlstd::copy_backward(std::begin(dataA), std::end(dataA), std::end(data2)); - - using difference_type_t = std::iterator_traits::difference_type; - - difference_type_t dstl = std::distance(data1.begin(), pstl); - difference_type_t detl = std::distance(data2.begin(), petl); - - CHECK_EQUAL(dstl, detl); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(test_reverse_even_non_pointer) - { - std::array data1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - std::array data2 = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - - std::reverse(data1.begin(), data1.end()); - etlstd::reverse(data2.begin(), data2.end()); - - bool isEqual = std::equal(data1.begin(), data1.end(), data2.begin()); - CHECK(isEqual); - } - - //************************************************************************* - TEST(test_reverse_odd_non_pointer) - { - std::array data1 = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - std::array data2 = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - - std::reverse(data1.begin(), data1.end()); - etlstd::reverse(data2.begin(), data2.end()); - - bool isEqual = std::equal(data1.begin(), data1.end(), data2.begin()); - CHECK(isEqual); - } - - //************************************************************************* - TEST(test_reverse_even_pointer) - { - int data1[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - int data2[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - - std::reverse(std::begin(data1), std::end(data1)); - etlstd::reverse(std::begin(data2), std::end(data2)); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(test_reverse_odd_pointer) - { - int data1[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - int data2[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - - std::reverse(std::begin(data1), std::end(data1)); - etlstd::reverse(std::begin(data2), std::end(data2)); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(lower_bound_random_iterator) - { - for (int i = 0; i < 11; ++i) - { - int* lb1 = std::lower_bound(std::begin(dataS), std::end(dataS), i); - int* lb2 = etlstd::lower_bound(random_iterator(std::begin(dataS)), random_iterator(std::end(dataS)), i); - - CHECK_EQUAL(lb1, lb2); - } - } - - //************************************************************************* - TEST(lower_bound_non_random_iterator) - { - for (int i = 0; i < 11; ++i) - { - int* lb1 = std::lower_bound(std::begin(dataS), std::end(dataS), i); - int* lb2 = etlstd::lower_bound(non_random_iterator(std::begin(dataS)), non_random_iterator(std::end(dataS)), i); - - CHECK_EQUAL(std::distance(std::begin(dataS), lb1), std::distance(std::begin(dataS), lb2)); - } - } - - //************************************************************************* - TEST(upper_bound_random_iterator) - { - for (int i = 0; i < 11; ++i) - { - int* lb1 = std::upper_bound(std::begin(dataS), std::end(dataS), i); - int* lb2 = etlstd::upper_bound(random_iterator(std::begin(dataS)), random_iterator(std::end(dataS)), i); - - CHECK_EQUAL(std::distance(std::begin(dataS), lb1), std::distance(std::begin(dataS), lb2)); - } - } - - //************************************************************************* - TEST(upper_bound_non_random_iterator) - { - for (int i = 0; i < 11; ++i) - { - int* lb1 = std::upper_bound(std::begin(dataS), std::end(dataS), i); - int* lb2 = etlstd::upper_bound(non_random_iterator(std::begin(dataS)), non_random_iterator(std::end(dataS)), i); - - CHECK_EQUAL(std::distance(std::begin(dataS), lb1), std::distance(std::begin(dataS), lb2)); - } - } - - //************************************************************************* - TEST(equal_range_random_iterator) - { - for (int i = 0; i < 11; ++i) - { - ETL_OR_STD::pair lb1 = std::equal_range(std::begin(dataEQ), std::end(dataEQ), i); - ETL_OR_STD::pair, random_iterator> lb2 = etlstd::equal_range(random_iterator(std::begin(dataEQ)), random_iterator(std::end(dataEQ)), i); - - CHECK_EQUAL(std::distance(std::begin(dataEQ), lb1.first), std::distance(std::begin(dataEQ), lb2.first)); - CHECK_EQUAL(std::distance(lb1.first, lb1.second), std::distance(lb2.first, lb2.second)); - } - } - - //************************************************************************* - TEST(equal_range_non_random_iterator) - { - for (int i = 0; i < 11; ++i) - { - ETL_OR_STD::pair lb1 = std::equal_range(std::begin(dataEQ), std::end(dataEQ), i); - ETL_OR_STD::pair, non_random_iterator> lb2 = etlstd::equal_range(non_random_iterator(std::begin(dataEQ)), non_random_iterator(std::end(dataEQ)), i); - - CHECK_EQUAL(std::distance(std::begin(dataEQ), lb1.first), std::distance(std::begin(dataEQ), lb2.first)); - CHECK_EQUAL(std::distance(lb1.first, lb1.second), std::distance(lb2.first, lb2.second)); - } - } - - //************************************************************************* - TEST(fill_non_char) - { - int data1[10]; - int data2[10]; - - std::fill(std::begin(data1), std::end(data1), 0x12345678); - etlstd::fill(std::begin(data2), std::end(data2), 0x12345678); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(fill_char) - { - unsigned char data1[10]; - unsigned char data2[10]; - - std::fill(std::begin(data1), std::end(data1), char(0x12)); - etlstd::fill(std::begin(data2), std::end(data2), char(0x12)); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(swap) - { - int a = 1; - int b = 2; - - etlstd::swap(a, b); - CHECK_EQUAL(2, a); - CHECK_EQUAL(1, b); - } - - //************************************************************************* - TEST(iter_swap) - { - int a = 1; - int b = 2; - - etlstd::iter_swap(&a, &b); - CHECK_EQUAL(2, a); - CHECK_EQUAL(1, b); - } - - //************************************************************************* - TEST(equal) - { - CHECK(etlstd::equal(std::begin(dataV), std::end(dataV), std::begin(dataL))); - CHECK(!etlstd::equal(std::begin(dataSL), std::end(dataSL), std::begin(dataL))); - } - - //************************************************************************* - TEST(lexicographical_compare) - { - std::string text1("Hello World"); - std::string text2("Hello Xorld"); - - bool t1 = std::lexicographical_compare(text1.begin(), text1.end(), text2.begin(), text2.begin() + 7); - bool t2 = etlstd::lexicographical_compare(text1.begin(), text1.end(), text2.begin(), text2.begin() + 7); - - CHECK(t1 == t2); - } - - //************************************************************************* - TEST(lexicographical_compare_greater) - { - std::string text1("Hello World"); - std::string text2("Hello Xorld"); - - bool t1 = std::lexicographical_compare(text1.begin(), text1.end(), text2.begin(), text2.begin() + 7, Greater()); - bool t2 = etlstd::lexicographical_compare(text1.begin(), text1.end(), text2.begin(), text2.begin() + 7, Greater()); - - CHECK(t1 == t2); - } - - //************************************************************************* - TEST(search) - { - std::string haystack = "ABCDFEGHIJKLMNOPQRSTUVWXYZ"; - std::string needle = "KLMNO"; - - std::string::iterator itr1 = std::search(haystack.begin(), haystack.end(), needle.begin(), needle.begin()); - std::string::iterator itr2 = etlstd::search(haystack.begin(), haystack.end(), needle.begin(), needle.begin()); - - CHECK(itr1 == itr2); - } - - //************************************************************************* - TEST(search_predicate) - { - std::string haystack = "ABCDFEGHIJKLMNOPQRSTUVWXYZ"; - std::string needle = "KLMNO"; - - std::string::iterator itr1 = std::search(haystack.begin(), haystack.end(), needle.begin(), needle.begin(), std::equal_to()); - std::string::iterator itr2 = etlstd::search(haystack.begin(), haystack.end(), needle.begin(), needle.begin(), std::equal_to()); - - CHECK(itr1 == itr2); - } - - //************************************************************************* - TEST(heap) - { - Vector data1 = dataV; - Vector data2 = dataV; - - std::make_heap(data1.begin(), data1.end()); - etlstd::make_heap(data2.begin(), data2.end()); - - bool isEqual; - - CHECK(std::is_heap(data2.begin(), data2.end())); - - isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - - std::pop_heap(data1.begin(), data1.end()); - etlstd::pop_heap(data2.begin(), data2.end()); - - data1.pop_back(); - data2.pop_back(); - - CHECK(std::is_heap(data1.begin(), data1.end())); - CHECK(std::is_heap(data2.begin(), data2.end())); - - isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - - CHECK(std::is_heap(data2.begin(), data2.end())); - - isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - - data1.push_back(5); - data2.push_back(5); - - std::push_heap(data1.begin(), data1.end()); - etlstd::push_heap(data2.begin(), data2.end()); - - CHECK(std::is_heap(data2.begin(), data2.end())); - - isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(heap_greater) - { - Vector data1 = dataV; - Vector data2 = dataV; - - std::make_heap(data1.begin(), data1.end(), Greater()); - etlstd::make_heap(data2.begin(), data2.end(), Greater()); - - bool isEqual; - - CHECK(std::is_heap(data2.begin(), data2.end(), Greater())); - - isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - - std::pop_heap(data1.begin(), data1.end(), Greater()); - etlstd::pop_heap(data2.begin(), data2.end(), Greater()); - - data1.pop_back(); - data2.pop_back(); - - CHECK(std::is_heap(data1.begin(), data1.end(), Greater())); - CHECK(std::is_heap(data2.begin(), data2.end(), Greater())); - - isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - - CHECK(std::is_heap(data2.begin(), data2.end(), Greater())); - - isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - - data1.push_back(5); - data2.push_back(5); - - std::push_heap(data1.begin(), data1.end(), Greater()); - etlstd::push_heap(data2.begin(), data2.end(), Greater()); - - CHECK(std::is_heap(data2.begin(), data2.end(), Greater())); - - isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(find) - { - int* itr1 = std::find(std::begin(dataA), std::end(dataA), 5); - int* itr2 = etlstd::find(std::begin(dataA), std::end(dataA), 5); - - CHECK(itr1 == itr2); - } - - //************************************************************************* - TEST(find_if) - { - struct predicate - { - bool operator()(int i) const - { - return (i == 5); - } - }; - - int* itr1 = std::find_if(std::begin(dataA), std::end(dataA), predicate()); - int* itr2 = etlstd::find_if(std::begin(dataA), std::end(dataA), predicate()); - - CHECK(itr1 == itr2); - } - - //************************************************************************* - TEST(count) - { - size_t c1 = std::count(std::begin(dataEQ), std::end(dataEQ), 5); - size_t c2 = etlstd::count(std::begin(dataEQ), std::end(dataEQ), 5); - - CHECK(c1 == c2); - } - - //************************************************************************* - TEST(count_if) - { - struct predicate - { - bool operator()(int i) const - { - return (i == 5); - } - }; - - size_t c1 = std::count_if(std::begin(dataEQ), std::end(dataEQ), predicate()); - size_t c2 = etlstd::count_if(std::begin(dataEQ), std::end(dataEQ), predicate()); - - CHECK(c1 == c2); - } - - //************************************************************************* - TEST(fill_n) - { - int* p1 = std::fill_n(std::begin(dataD1), SIZE, 5); - int* p2 = etlstd::fill_n(std::begin(dataD2), SIZE, 5); - - CHECK(p2 == std::end(dataD2)); - - bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(transform1) - { - struct Function - { - int operator()(int d) const - { - return d * 2; - } - }; - - int* p1 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataD1), Function()); - int* p2 = etlstd::transform(std::begin(dataS), std::end(dataS), std::begin(dataD2), Function()); - - CHECK(p2 == std::end(dataD2)); - - bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2)); - CHECK(isEqual); - } - - //************************************************************************* - TEST(move) - { - typedef std::vector> Data; - - Data data1; - - // Create some data. - std::unique_ptr p1(new uint32_t(1U)); - std::unique_ptr p2(new uint32_t(2U)); - std::unique_ptr p3(new uint32_t(3U)); - std::unique_ptr p4(new uint32_t(4U)); - std::unique_ptr p5(new uint32_t(5U)); - - // Fill data1. - data1.push_back(std::move(p1)); - data1.push_back(std::move(p2)); - data1.push_back(std::move(p3)); - data1.push_back(std::move(p4)); - data1.push_back(std::move(p5)); - - Data data2; - - // Move to data2. - etlstd::move(data1.begin(), data1.end(), std::back_inserter(data2)); - - // Old data now empty. - CHECK(!bool(p1)); - CHECK(!bool(p2)); - CHECK(!bool(p3)); - CHECK(!bool(p4)); - CHECK(!bool(p5)); - - CHECK_EQUAL(1U, *(data2[0])); - CHECK_EQUAL(2U, *(data2[1])); - CHECK_EQUAL(3U, *(data2[2])); - CHECK_EQUAL(4U, *(data2[3])); - CHECK_EQUAL(5U, *(data2[4])); - } - - //************************************************************************* - TEST(move_backward) - { - typedef std::vector> Data; - - Data data1; - - // Create some data. - std::unique_ptr p1(new uint32_t(1U)); - std::unique_ptr p2(new uint32_t(2U)); - std::unique_ptr p3(new uint32_t(3U)); - std::unique_ptr p4(new uint32_t(4U)); - std::unique_ptr p5(new uint32_t(5U)); - - // Fill data1. - data1.push_back(std::move(p1)); - data1.push_back(std::move(p2)); - data1.push_back(std::move(p3)); - data1.push_back(std::move(p4)); - data1.push_back(std::move(p5)); - - Data data2; - - // Create some data. - std::unique_ptr p6(new uint32_t(6U)); - std::unique_ptr p7(new uint32_t(7U)); - std::unique_ptr p8(new uint32_t(8U)); - std::unique_ptr p9(new uint32_t(9U)); - std::unique_ptr p10(new uint32_t(10U)); - - // Fill data2. - data2.push_back(std::move(p6)); - data2.push_back(std::move(p7)); - data2.push_back(std::move(p8)); - data2.push_back(std::move(p9)); - data2.push_back(std::move(p10)); - - // Overwrite data2 with data1. - etlstd::move_backward(data1.begin(), data1.end(), data2.end()); - - // Old data now empty. - CHECK(!bool(p1)); - CHECK(!bool(p2)); - CHECK(!bool(p3)); - CHECK(!bool(p4)); - CHECK(!bool(p5)); - - CHECK_EQUAL(1U, *(data2[0])); - CHECK_EQUAL(2U, *(data2[1])); - CHECK_EQUAL(3U, *(data2[2])); - CHECK_EQUAL(4U, *(data2[3])); - CHECK_EQUAL(5U, *(data2[4])); - } - - //************************************************************************* - TEST(rotate) - { - std::vector initial_data = { 1, 2, 3, 4, 5, 6, 7 }; - - for (size_t i = 0; i < initial_data.size(); ++i) - { - std::vector data1(initial_data); - std::vector data2(initial_data); - - std::rotate(data1.data(), data1.data() + i, data1.data() + data1.size()); - etlstd::rotate(data2.data(), data2.data() + i, data2.data() + data2.size()); - - bool isEqual = std::equal(std::begin(data1), std::end(data1), std::begin(data2)); - CHECK(isEqual); - } - } - - //************************************************************************* - TEST(any_of) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - bool expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - bool result = etlstd::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - - expected = std::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - result = etlstd::any_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - CHECK_EQUAL(expected, result); - } - - //************************************************************************* - TEST(all_of) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - bool expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - bool result = etlstd::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - CHECK_EQUAL(expected, result); - - expected = std::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - result = etlstd::all_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - } - - //************************************************************************* - TEST(none_of) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; - - bool expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); - bool result = etlstd::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); - CHECK_EQUAL(expected, result); - - expected = std::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - result = etlstd::none_of(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - } - - struct Compare - { - bool operator()(int a, int b) const - { - return a == b; - } - }; - - //************************************************************************* - TEST(is_permutation) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - int permutation[] = { 1, 3, 2, 4, 7, 6, 5, 8 }; - int not_permutation[] = { 1, 2, 3, 4, 5, 6, 7, 7 }; - - bool is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation)); - CHECK(is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation)); - CHECK(!is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::equal_to()); - CHECK(is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::equal_to()); - CHECK(!is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation)); - CHECK(is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation)); - CHECK(!is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation), std::equal_to()); - CHECK(is_permutation); - - is_permutation = etlstd::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation), std::equal_to()); - CHECK(!is_permutation); - } - - //************************************************************************* - TEST(is_partitioned) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - - bool expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - bool result = etlstd::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - - std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - - expected = std::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - result = etlstd::is_partitioned(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(expected, result); - } - - //************************************************************************* - TEST(partition_point) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - - std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - - int* partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - int* partition2 = etlstd::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 4)); - CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); - - std::partition(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 8)); - - partition1 = std::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - partition2 = etlstd::partition_point(std::begin(data1), std::end(data1), std::bind(std::greater(), std::placeholders::_1, 0)); - CHECK_EQUAL(std::distance(std::begin(data1), partition1), std::distance(std::begin(data1), partition2)); - } - - //************************************************************************* - TEST(partition_copy) - { - int data1[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - int data2[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int data3[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int data4[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - int data5[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - std::partition_copy(std::begin(data1), std::end(data1), std::begin(data2), std::begin(data3), std::bind(std::greater(), std::placeholders::_1, 4)); - etlstd::partition_copy(std::begin(data1), std::end(data1), std::begin(data4), std::begin(data5), std::bind(std::greater(), std::placeholders::_1, 4)); - - bool are_equal; - - are_equal = std::equal(std::begin(data2), std::end(data2), std::begin(data4)); - CHECK(are_equal); - - are_equal = std::equal(std::begin(data3), std::end(data3), std::begin(data5)); - CHECK(are_equal); - } - - //************************************************************************* - TEST(find_if_not) - { - int data1[] = { 1, 2, 3, 5, 6, 7, 8 }; - - // Find the element not less than 4. - int* p = etlstd::find_if_not(std::begin(data1), std::end(data1), std::bind(std::less(), std::placeholders::_1, 4)); - CHECK_EQUAL(5, *p); - } - }; -} diff --git a/test/test_etlstd_functional.cpp b/test/test_etlstd_functional.cpp deleted file mode 100644 index d2b14230..00000000 --- a/test/test_etlstd_functional.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/****************************************************************************** -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. -******************************************************************************/ - -#include "UnitTest++.h" - -#undef min -#undef max - -#include "etl/functional.h" - -namespace -{ - template - bool compare(int a, int b) - { - return TCompare()(a, b); - } - - struct test : etlstd::binary_function - { - bool operator()(int a, int b) const - { - return a < b; - } - }; - - SUITE(test_no_stl_functional) - { - //************************************************************************* - TEST(test_less) - { - CHECK((compare>(1, 2))); - CHECK(!(compare>(2, 1))); - CHECK(!(compare>(1, 1))); - } - - //************************************************************************* - TEST(test_greater) - { - CHECK(!(compare>(1, 2))); - CHECK((compare>(2, 1))); - CHECK(!(compare>(1, 1))); - } - - //************************************************************************* - TEST(test_equal_to) - { - CHECK((compare>(1, 1))); - CHECK(!(compare>(1, 2))); - CHECK(!(compare>(2, 1))); - } - - //************************************************************************* - TEST(test_not_equal_to) - { - CHECK(!(compare>(1, 1))); - CHECK((compare>(1, 2))); - CHECK((compare>(2, 1))); - } - - //************************************************************************* - TEST(test_bind1st) - { - CHECK((etlstd::bind1st(test(), 1)(2))); - CHECK(!(etlstd::bind1st(test(), 2)(1))); - } - - //************************************************************************* - TEST(test_bind2nd) - { - CHECK(!(etlstd::bind2nd(test(), 1)(2))); - CHECK((etlstd::bind2nd(test(), 2)(1))); - } - }; -} diff --git a/test/test_etlstd_iterator.cpp b/test/test_etlstd_iterator.cpp deleted file mode 100644 index 52e4dee9..00000000 --- a/test/test_etlstd_iterator.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/****************************************************************************** -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. -******************************************************************************/ - -#include "UnitTest++.h" - -#undef min -#undef max - -#include "etl/iterator.h" - -#include -#include -#include - -#include "no_stl_test_iterators.h" - -namespace -{ - const size_t SIZE = 10; - - int dataA[SIZE] = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; - - SUITE(test_no_stl_iterator) - { - //************************************************************************* - TEST(distance_non_random) - { - ptrdiff_t d = etlstd::distance(non_random_iterator(&dataA[0]), non_random_iterator(&dataA[SIZE])); - - CHECK_EQUAL(SIZE, d); - } - - //************************************************************************* - TEST(distance_random) - { - ptrdiff_t d = etlstd::distance(random_iterator(&dataA[0]), random_iterator(&dataA[SIZE])); - - CHECK_EQUAL(SIZE, d); - } - - //************************************************************************* - TEST(advance_non_random) - { - int* itr1 = std::begin(dataA); - non_random_iterator itr2 = std::begin(dataA); - - std::advance(itr1, 4); - etlstd::advance(itr2, 4); - CHECK_EQUAL(*itr1, *itr2); - - std::advance(itr1, -3); - etlstd::advance(itr2, -3); - CHECK_EQUAL(*itr1, *itr2); - } - - //************************************************************************* - TEST(advance_random) - { - int* itr1 = std::begin(dataA); - random_iterator itr2 = std::begin(dataA); - - std::advance(itr1, 4); - etlstd::advance(itr2, 4); - CHECK_EQUAL(*itr1, *itr2); - - std::advance(itr1, -3); - etlstd::advance(itr2, -3); - CHECK_EQUAL(*itr1, *itr2); - } - - //************************************************************************* - TEST(prev) - { - int data[] = { 1, 2, 3, 4, 5, 6, 7 }; - - size_t length = 6U; - - int* itr = &data[0] + length; - - for (size_t i = 1; i <= length; ++i) - { - CHECK_EQUAL(data[length - i], *etlstd::prev(itr, i)); - } - } - - //************************************************************************* - TEST(next) - { - int data[] = { 1, 2, 3, 4, 5, 6, 7 }; - - size_t length = 6U; - - int* itr = &data[0]; - - for (size_t i = 1; i <= length; ++i) - { - CHECK_EQUAL(data[i], *etlstd::next(itr, i)); - } - } - - //************************************************************************* - TEST(reverse_iterator) - { - int data[] = { 1, 2, 3, 4, 5, 6, 7 }; - - std::reverse_iterator sri(&data[7]); - etlstd::reverse_iterator eri(&data[7]); - - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri++, *eri++); - - CHECK(etlstd::reverse_iterator(&data[5]) < eri); - CHECK(etlstd::reverse_iterator(&data[3]) > eri); - CHECK(etlstd::reverse_iterator(&data[4]) <= eri); - CHECK(etlstd::reverse_iterator(&data[5]) <= eri); - CHECK(etlstd::reverse_iterator(&data[4]) >= eri); - CHECK(etlstd::reverse_iterator(&data[3]) >= eri); - - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri, *eri); - - CHECK(etlstd::reverse_iterator(&data[1]) == eri); - CHECK(etlstd::reverse_iterator(&data[2]) != eri); - CHECK(etlstd::reverse_iterator(&data[3]) != eri); - CHECK(etlstd::reverse_iterator(&data[4]) != eri); - CHECK(etlstd::reverse_iterator(&data[5]) != eri); - CHECK(etlstd::reverse_iterator(&data[6]) != eri); - CHECK(etlstd::reverse_iterator(&data[7]) != eri); - - sri = std::reverse_iterator(&data[7]); - eri = etlstd::reverse_iterator(&data[7]); - CHECK_EQUAL(sri[0], eri[0]); - CHECK_EQUAL(sri[1], eri[1]); - CHECK_EQUAL(sri[2], eri[2]); - CHECK_EQUAL(sri[3], eri[3]); - CHECK_EQUAL(sri[4], eri[4]); - CHECK_EQUAL(sri[5], eri[5]); - CHECK_EQUAL(sri[6], eri[6]); - - sri += 4; - eri += 4; - CHECK_EQUAL(*sri, *eri); - - sri -= 2; - eri -= 2; - CHECK_EQUAL(*sri, *eri); - - std::reverse_iterator sri2 = sri + 3; - etlstd::reverse_iterator eri2 = eri + 3; - CHECK_EQUAL(*sri, *eri); - - sri2 = sri - 3; - eri2 = eri - 3; - CHECK_EQUAL(*sri, *eri); - } - - //************************************************************************* - TEST(reverse_iterator_const) - { - const int data[] = { 1, 2, 3, 4, 5, 6, 7 }; - - std::reverse_iterator sri(&data[7]); - etlstd::reverse_iterator eri(&data[7]); - - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri++, *eri++); - - CHECK(etlstd::reverse_iterator(&data[5]) < eri); - CHECK(etlstd::reverse_iterator(&data[3]) > eri); - CHECK(etlstd::reverse_iterator(&data[4]) <= eri); - CHECK(etlstd::reverse_iterator(&data[5]) <= eri); - CHECK(etlstd::reverse_iterator(&data[4]) >= eri); - CHECK(etlstd::reverse_iterator(&data[3]) >= eri); - - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri++, *eri++); - CHECK_EQUAL(*sri, *eri); - - CHECK(etlstd::reverse_iterator(&data[1]) == eri); - CHECK(etlstd::reverse_iterator(&data[2]) != eri); - CHECK(etlstd::reverse_iterator(&data[3]) != eri); - CHECK(etlstd::reverse_iterator(&data[4]) != eri); - CHECK(etlstd::reverse_iterator(&data[5]) != eri); - CHECK(etlstd::reverse_iterator(&data[6]) != eri); - CHECK(etlstd::reverse_iterator(&data[7]) != eri); - - sri = std::reverse_iterator(&data[7]); - eri = etlstd::reverse_iterator(&data[7]); - CHECK_EQUAL(sri[0], eri[0]); - CHECK_EQUAL(sri[1], eri[1]); - CHECK_EQUAL(sri[2], eri[2]); - CHECK_EQUAL(sri[3], eri[3]); - CHECK_EQUAL(sri[4], eri[4]); - CHECK_EQUAL(sri[5], eri[5]); - CHECK_EQUAL(sri[6], eri[6]); - - CHECK_EQUAL(*sri, *eri); - CHECK_EQUAL(*(sri + 1), *(eri + 1)); - CHECK_EQUAL(*(sri + 2), *(eri + 2)); - CHECK_EQUAL(*(sri + 3), *(eri + 3)); - CHECK_EQUAL(*(sri + 4), *(eri + 4)); - CHECK_EQUAL(*(sri + 5), *(eri + 5)); - CHECK_EQUAL(*(sri + 6), *(eri + 6)); - - sri += 4; - eri += 4; - CHECK_EQUAL(*sri, *eri); - - sri -= 2; - eri -= 2; - CHECK_EQUAL(*sri, *eri); - - std::reverse_iterator sri2 = sri + 3; - etlstd::reverse_iterator eri2 = eri + 3; - CHECK_EQUAL(*sri, *eri); - - sri2 = sri - 3; - eri2 = eri - 3; - CHECK_EQUAL(*sri, *eri); - } - }; -} diff --git a/test/test_etlstd_type_traits.cpp b/test/test_etlstd_type_traits.cpp deleted file mode 100644 index 459ec0fa..00000000 --- a/test/test_etlstd_type_traits.cpp +++ /dev/null @@ -1,785 +0,0 @@ -/****************************************************************************** -The MIT License(MIT) - -Embedded Template Library. -https://github.com/ETLCPP/etl -http://www.etlcpp.com - -Copyright(c) 2014 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. -******************************************************************************/ - -#include "UnitTest++.h" - -#define IN_TYPE_TRAITS_TEST - -#include "etl/type_traits.h" -#include - -namespace -{ - struct TestData { }; -} - -namespace etl -{ - template <> - struct size_of : etlstd::integral_constant {}; -} - -namespace -{ - // A class to test non-fundamental types. - struct Test - { - int a; - }; - - // A class to test etl::is_one_of - template - struct Type - { - }; - - SUITE(test_type_traits) - { - //************************************************************************* - TEST(test_is_integral) - { - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - CHECK(etlstd::is_integral::value == std::is_integral::value); - } - - //************************************************************************* - TEST(test_is_signed) - { - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - CHECK(etlstd::is_signed::value == std::is_signed::value); - } - - //************************************************************************* - TEST(test_is_unsigned) - { - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - CHECK(etlstd::is_unsigned::value == std::is_unsigned::value); - } - - //************************************************************************* - TEST(test_is_floating_point) - { - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_floating_point::value); - CHECK(etlstd::is_floating_point::value == std::is_signed::value); - } - - //************************************************************************* - TEST(test_is_pointer) - { - CHECK(etlstd::is_pointer::value == std::is_pointer::value); - CHECK(etlstd::is_pointer::value == std::is_pointer::value); - CHECK(etlstd::is_pointer::value == std::is_pointer::value); - CHECK(etlstd::is_pointer::value == std::is_pointer::value); - CHECK(etlstd::is_pointer::value == std::is_pointer::value); - } - - //************************************************************************* - TEST(test_is_reference) - { - CHECK(etlstd::is_reference::value == std::is_reference::value); - CHECK(etlstd::is_reference::value == std::is_reference::value); - CHECK(etlstd::is_reference::value == std::is_reference::value); - CHECK(etlstd::is_reference::value == std::is_reference::value); - CHECK(etlstd::is_reference::value == std::is_reference::value); - } - - //************************************************************************* - TEST(test_is_same) - { - CHECK((etlstd::is_same::value == etlstd::is_same::value)); - CHECK((etlstd::is_same::value == etlstd::is_same::value)); - } - - //************************************************************************* - TEST(test_is_array) - { - CHECK(etlstd::is_array::value == std::is_array::value); - CHECK(etlstd::is_array::value == std::is_array::value); - } - - //************************************************************************* - TEST(test_remove_pointer) - { - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::remove_pointer::type>::value)); - } - - //************************************************************************* - TEST(test_add_pointer) - { - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - CHECK((etlstd::is_same::type, std::add_pointer::type>::value)); - - } - - //************************************************************************* - TEST(test_remove_reference) - { - CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); - CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); - CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); - CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); - CHECK((etlstd::is_same::type, std::remove_reference::type>::value)); - } - - //************************************************************************* - TEST(test_remove_const) - { - CHECK((etlstd::is_same::type, std::remove_const::type>::value)); - CHECK((etlstd::is_same::type, std::remove_const::type>::value)); - CHECK((etlstd::is_same::type, std::remove_const::type>::value)); - } - - //************************************************************************* - TEST(test_add_const) - { - CHECK((etlstd::is_same::type, std::add_const::type>::value)); - CHECK((etlstd::is_same::type, std::add_const::type>::value)); - CHECK((etlstd::is_same::type, std::add_const::type>::value)); - } - - //************************************************************************* - TEST(test_is_const) - { - CHECK(etlstd::is_const::value == std::is_const::value); - CHECK(etlstd::is_const::value == std::is_const::value); - CHECK(etlstd::is_const::value == std::is_const::value); - } - - //************************************************************************* - TEST(test_is_volatile) - { - CHECK(etlstd::is_volatile::value == std::is_volatile::value); - CHECK(etlstd::is_volatile::value == std::is_volatile::value); - CHECK(etlstd::is_volatile::value == std::is_volatile::value); - } - - //************************************************************************* - TEST(test_remove_volatile) - { - CHECK((etlstd::is_same::type, std::remove_volatile::type>::value)); - CHECK((etlstd::is_same::type, std::remove_volatile::type>::value)); - CHECK((etlstd::is_same::type, std::remove_volatile::type>::value)); - } - - //************************************************************************* - TEST(test_add_volatile) - { - CHECK((etlstd::is_same::type, std::add_volatile::type>::value)); - CHECK((etlstd::is_same::type, std::add_volatile::type>::value)); - CHECK((etlstd::is_same::type, std::add_volatile::type>::value)); - } - - //************************************************************************* - TEST(test_remove_cv) - { - CHECK((etlstd::is_same::type, std::remove_cv::type>::value)); - CHECK((etlstd::is_same::type, std::remove_cv::type>::value)); - CHECK((etlstd::is_same::type, std::remove_cv::type>::value)); - CHECK((etlstd::is_same::type, std::remove_cv::type>::value)); - } - - //************************************************************************* - TEST(test_add_cv) - { - - typedef etlstd::add_cv::type t1; - typedef std::add_cv::type t2; - - bool pass = etlstd::is_same::value; - //etlstd::is_same::type, std::add_cv::type>::value; - - CHECK(pass); - CHECK((etlstd::is_same::type, std::add_cv::type>::value)); - CHECK((etlstd::is_same::type, std::add_cv::type>::value)); - CHECK((etlstd::is_same::type, std::add_cv::type>::value)); - } - - //************************************************************************* - TEST(test_is_arithmetic) - { - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - CHECK(etlstd::is_arithmetic::value == std::is_arithmetic::value); - } - - //************************************************************************* - TEST(test_is_fundamental) - { - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - CHECK(etlstd::is_fundamental::value == std::is_fundamental::value); - } - - //************************************************************************* - TEST(test_is_compound) - { - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - CHECK(etlstd::is_compound::value == std::is_compound::value); - } - - //************************************************************************* - TEST(test_is_void) - { - CHECK(etlstd::is_void::value == std::is_void::value); - CHECK(etlstd::is_void::value == std::is_void::value); - } - - //************************************************************************* - TEST(test_make_signed) - { - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK(etlstd::is_signed::type>::value && (sizeof(wchar_t) == sizeof(etlstd::make_signed::type))); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - CHECK((etlstd::is_same::type, std::make_signed::type>::value)); - } - - //************************************************************************* - TEST(test_make_unsigned) - { - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK(etlstd::is_unsigned::type>::value && (sizeof(wchar_t) == sizeof(etlstd::make_unsigned::type))); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - CHECK((etlstd::is_same::type, std::make_unsigned::type>::value)); - } - - //************************************************************************* - TEST(test_extent) - { - CHECK(std::extent::value == etlstd::extent::value); - CHECK(std::extent::value == etlstd::extent::value); - CHECK(std::extent::value == etlstd::extent::value); - } - - //************************************************************************* - TEST(test_remove_extent) - { - CHECK((etlstd::is_same::type, std::remove_extent::type>::value)); - CHECK((etlstd::is_same::type, std::remove_extent::type>::value)); - CHECK((etlstd::is_same::type, std::remove_extent::type>::value)); - } - - //************************************************************************* - TEST(test_remove_all_extents) - { - CHECK((etlstd::is_same::type, std::remove_all_extents::type>::value)); - CHECK((etlstd::is_same::type, std::remove_all_extents::type>::value)); - CHECK((etlstd::is_same::type, std::remove_all_extents::type>::value)); - } - - //************************************************************************* - TEST(test_rank) - { - CHECK(etlstd::rank::value == std::rank::value); - CHECK(etlstd::rank::value == std::rank::value); - CHECK(etlstd::rank::value == std::rank::value); - } - - //************************************************************************* - TEST(test_alignment_of) - { - struct Test - { - int a; - char b; - float c; - }; - - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - CHECK(std::alignment_of::value == etlstd::alignment_of::value); - } - - //************************************************************************* - TEST(test_is_one_of) - { - typedef Type<0> T0; - typedef Type<1> T1; - typedef Type<2> T2; - typedef Type<3> T3; - typedef Type<4> T4; - - CHECK(bool(etl::is_one_of::value)); - CHECK(!(etl::is_one_of::value)); - - CHECK(bool(etl::is_one_of::value)); - CHECK(!(etl::is_one_of::value)); - - CHECK(bool(etl::is_one_of::value)); - CHECK(!(etl::is_one_of::value)); - - CHECK(bool(etl::is_one_of::value)); - CHECK(!(etl::is_one_of::value)); - - CHECK(bool(etl::is_one_of::value)); - CHECK(!(etl::is_one_of::value)); - - CHECK(bool(etl::is_one_of::value)); - CHECK(bool(etl::is_one_of::value)); - CHECK(bool(etl::is_one_of::value)); - CHECK(bool(etl::is_one_of::value)); - CHECK(bool(etl::is_one_of::value)); - CHECK(!(etl::is_one_of::value)); - } - - //************************************************************************* - TEST(test_is_base_of) - { - struct A { }; - struct B : public A { }; - struct C { }; - - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - CHECK((std::is_base_of::value) == (etlstd::is_base_of::value)); - } - - //************************************************************************* - TEST(test_types) - { - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::reference>::value)); - CHECK((etlstd::is_same::const_reference>::value)); - CHECK((etlstd::is_same::pointer>::value)); - CHECK((etlstd::is_same::const_pointer>::value)); - CHECK((etlstd::is_same::const_pointer_const>::value)); - } - }; - - //************************************************************************* - TEST(conditional_integral_constant) - { - int v1 = etl::conditional_integral_constant::value; - int v2 = etl::conditional_integral_constant::value; - - CHECK_EQUAL(1, v1); - CHECK_EQUAL(2, v2); - } - - //************************************************************************* - TEST(size_of) - { - CHECK_EQUAL(1, etl::size_of::value); - CHECK_EQUAL(1, etl::size_of::value); - CHECK_EQUAL(2, etl::size_of::value); - CHECK_EQUAL(4, etl::size_of::value); - CHECK_EQUAL(20, etl::size_of::value); - - CHECK_EQUAL(1, etl::size_of_v); - CHECK_EQUAL(1, etl::size_of_v); - CHECK_EQUAL(2, etl::size_of_v); - CHECK_EQUAL(4, etl::size_of_v); - CHECK_EQUAL(20, etl::size_of_v); - } - - //************************************************************************* - TEST(is_convertible) - { - CHECK((etlstd::is_convertible::value)); - CHECK((etlstd::is_convertible::value)); - CHECK((etlstd::is_convertible::value)); - CHECK((etlstd::is_convertible::value)); - CHECK((etlstd::is_convertible::value)); - CHECK((etlstd::is_convertible::value)); - CHECK((etlstd::is_convertible::value)); - CHECK(!(etlstd::is_convertible::value)); - CHECK(!(etlstd::is_convertible::value)); - CHECK(!(etlstd::is_convertible::value)); - CHECK(!(etlstd::is_convertible::value)); - } - - //************************************************************************* - TEST(add_lvalue_reference) - { - CHECK(!std::is_lvalue_reference_v::type>); - CHECK(std::is_lvalue_reference_v::type>); - CHECK(std::is_lvalue_reference_v::type>); - CHECK(std::is_lvalue_reference_v::type>); - CHECK(std::is_lvalue_reference_v::type>); - } - - //************************************************************************* - TEST(add_rvalue_reference) - { - CHECK(!std::is_rvalue_reference_v::type>); - CHECK(std::is_rvalue_reference_v::type>); - CHECK(std::is_rvalue_reference_v::type>); - CHECK(!std::is_rvalue_reference_v::type>); - CHECK(std::is_rvalue_reference_v::type>); - } - - //************************************************************************* - TEST(is_lvalue_reference) - { - CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); - CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); - CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); - CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); - CHECK_EQUAL(std::is_lvalue_reference_v, etlstd::is_lvalue_reference_v); - } -} diff --git a/test/test_etlstd_utility.cpp b/test/test_etlstd_utility.cpp deleted file mode 100644 index 878d8a2b..00000000 --- a/test/test_etlstd_utility.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/****************************************************************************** -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. -******************************************************************************/ - -#include "UnitTest++.h" - -#undef min -#undef max - -#include "etl/utility.h" - -namespace -{ - SUITE(test_no_stl_utility) - { - //************************************************************************* - TEST(pair_default_construct) - { - etlstd::pair p1; - - CHECK_EQUAL(int(), p1.first); - CHECK_EQUAL(double(), p1.second); - } - - //************************************************************************* - TEST(test_pair_construct) - { - etlstd::pair p1(1, 2.3); - - CHECK_EQUAL(1, p1.first); - CHECK_EQUAL(2.3, p1.second); - } - - //************************************************************************* - TEST(test_pair_copy_construct) - { - etlstd::pair p1(1, 2.3); - etlstd::pair p2(p1); - - CHECK_EQUAL(p1.first, p2.first); - CHECK_EQUAL(p1.second, p2.second); - } - - //************************************************************************* - TEST(test_pair_copy_construct_alternate) - { - etlstd::pair p1(1, 2.3f); - etlstd::pair p2(p1); - - CHECK_EQUAL(p1.first, p2.first); - CHECK_EQUAL(p1.second, p2.second); - } - - //************************************************************************* - TEST(test_make_pair) - { - etlstd::pair p1(1, 2.3); - etlstd::pair p2; - p2 = etlstd::make_pair(1, 2.3); - - CHECK_EQUAL(p1.first, p2.first); - CHECK_EQUAL(p1.second, p2.second); - } - - //************************************************************************* - TEST(test_pair_swap_member) - { - etlstd::pair p1(1, 2.3); - etlstd::pair p2(2, 3.4); - - p1.swap(p2); - - CHECK_EQUAL(2, p1.first); - CHECK_EQUAL(3.4, p1.second); - - CHECK_EQUAL(1, p2.first); - CHECK_EQUAL(2.3, p2.second); - } - - //************************************************************************* - TEST(test_pair_swap_global) - { - etlstd::pair p1(1, 2.3); - etlstd::pair p2(2, 3.4); - - swap(p1, p2); - - CHECK_EQUAL(2, p1.first); - CHECK_EQUAL(3.4, p1.second); - - CHECK_EQUAL(1, p2.first); - CHECK_EQUAL(2.3, p2.second); - } - - //************************************************************************* - TEST(test_pair_conditional) - { - etlstd::pair p1(1, 2.3); - etlstd::pair p2(1, 2.3); - etlstd::pair p3(2, 3.4); - - CHECK(p1 == p2); - CHECK(!(p1 == p3)); - CHECK(p1 != p3); - CHECK(!(p1 != p2)); - CHECK(p1 <= p2); - CHECK(p1 <= p3); - CHECK(!(p1 < p2)); - CHECK(p1 < p3); - CHECK(!(p3 < p1)); - CHECK(p1 >= p2); - CHECK(!(p1 >= p3)); - CHECK(!(p1 > p2)); - CHECK(!(p1 > p3)); - CHECK(p3 > p1); - } - }; -} diff --git a/test/test_exception.cpp b/test/test_exception.cpp index 333842c3..dc2d3b95 100644 --- a/test/test_exception.cpp +++ b/test/test_exception.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include "etl/exception.h" diff --git a/test/test_fixed_iterator.cpp b/test/test_fixed_iterator.cpp index 4905739e..4efc1690 100644 --- a/test/test_fixed_iterator.cpp +++ b/test/test_fixed_iterator.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_flat_map.cpp b/test/test_flat_map.cpp index 88615048..f6f50804 100644 --- a/test/test_flat_map.cpp +++ b/test/test_flat_map.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include @@ -594,8 +594,8 @@ namespace ETL_OR_STD::pair result; - result = data.insert(ETL_MAKE_PAIR(0, N0)); - compare_data.insert(ETL_MAKE_PAIR(0, N0)); + result = data.insert(ETL_OR_STD::make_pair(0, N0)); + compare_data.insert(ETL_OR_STD::make_pair(0, N0)); bool isEqual = Check_Equal(data.begin(), data.end(), @@ -605,8 +605,8 @@ namespace CHECK(result.second); CHECK(*result.first == DataNDC::value_type(0, N0)); - result = data.insert(ETL_MAKE_PAIR(2, N2)); - compare_data.insert(ETL_MAKE_PAIR(2, N2)); + result = data.insert(ETL_OR_STD::make_pair(2, N2)); + compare_data.insert(ETL_OR_STD::make_pair(2, N2)); isEqual = Check_Equal(data.begin(), data.end(), @@ -616,8 +616,8 @@ namespace CHECK(result.second); CHECK(*result.first == DataNDC::value_type(2, N2)); - result = data.insert(ETL_MAKE_PAIR(1, N1)); - compare_data.insert(ETL_MAKE_PAIR(1, N1)); + result = data.insert(ETL_OR_STD::make_pair(1, N1)); + compare_data.insert(ETL_OR_STD::make_pair(1, N1)); isEqual = Check_Equal(data.begin(), data.end(), @@ -640,7 +640,7 @@ namespace ETL_OR_STD::pair result2; result1 = data.insert(DataNDC::value_type(0, N0)); - result2 = compare_data.insert(ETL_MAKE_PAIR(0, N0)); + result2 = compare_data.insert(ETL_OR_STD::make_pair(0, N0)); bool isEqual = Check_Equal(data.begin(), data.end(), @@ -650,8 +650,8 @@ namespace CHECK(result1.second); CHECK(*result1.first == DataNDC::value_type(0, N0)); - result1 = data.insert(ETL_MAKE_PAIR(0, N2)); - result2 = compare_data.insert(ETL_MAKE_PAIR(0, N2)); + result1 = data.insert(ETL_OR_STD::make_pair(0, N2)); + result2 = compare_data.insert(ETL_OR_STD::make_pair(0, N2)); isEqual = Check_Equal(data.begin(), data.end(), @@ -671,34 +671,34 @@ namespace ETL_OR_STD::pair dr; ETL_OR_STD::pair cr; - dr = data.insert(ETL_MAKE_PAIR(0, N0)); - cr = compare_data.insert(ETL_MAKE_PAIR(0, N0)); + dr = data.insert(ETL_OR_STD::make_pair(0, N0)); + cr = compare_data.insert(ETL_OR_STD::make_pair(0, N0)); CHECK(dr.first->first == cr.first->first); CHECK(dr.second == cr.second); - dr = data.insert(ETL_MAKE_PAIR(1, N1)); - cr = compare_data.insert(ETL_MAKE_PAIR(1, N1)); + dr = data.insert(ETL_OR_STD::make_pair(1, N1)); + cr = compare_data.insert(ETL_OR_STD::make_pair(1, N1)); CHECK(dr.first->first == cr.first->first); CHECK(dr.second == cr.second); - dr = data.insert(ETL_MAKE_PAIR(2, N2)); - cr = compare_data.insert(ETL_MAKE_PAIR(2, N2)); + dr = data.insert(ETL_OR_STD::make_pair(2, N2)); + cr = compare_data.insert(ETL_OR_STD::make_pair(2, N2)); CHECK(dr.first->first == cr.first->first); CHECK(dr.second == cr.second); // Do it again. - dr = data.insert(ETL_MAKE_PAIR(0, N0)); - cr = compare_data.insert(ETL_MAKE_PAIR(0, N0)); + dr = data.insert(ETL_OR_STD::make_pair(0, N0)); + cr = compare_data.insert(ETL_OR_STD::make_pair(0, N0)); CHECK(dr.first->first == cr.first->first); CHECK(dr.second == cr.second); - dr = data.insert(ETL_MAKE_PAIR(1, N1)); - cr = compare_data.insert(ETL_MAKE_PAIR(1, N1)); + dr = data.insert(ETL_OR_STD::make_pair(1, N1)); + cr = compare_data.insert(ETL_OR_STD::make_pair(1, N1)); CHECK(dr.first->first == cr.first->first); CHECK(dr.second == cr.second); - dr = data.insert(ETL_MAKE_PAIR(2, N2)); - cr = compare_data.insert(ETL_MAKE_PAIR(2, N2)); + dr = data.insert(ETL_OR_STD::make_pair(2, N2)); + cr = compare_data.insert(ETL_OR_STD::make_pair(2, N2)); CHECK(dr.first->first == cr.first->first); CHECK(dr.second == cr.second); @@ -716,7 +716,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - CHECK_THROW(data.insert(ETL_MAKE_PAIR(10, N10)), etl::flat_map_full); + CHECK_THROW(data.insert(ETL_OR_STD::make_pair(10, N10)), etl::flat_map_full); } //************************************************************************* @@ -762,8 +762,8 @@ namespace CHECK(result.second); CHECK(*result.first == Element1(0, D1("0"))); - result = data.emplace(ETL_MAKE_PAIR(2, D1("2"))); - compare.emplace(ETL_MAKE_PAIR(2, D1("2"))); + result = data.emplace(ETL_OR_STD::make_pair(2, D1("2"))); + compare.emplace(ETL_OR_STD::make_pair(2, D1("2"))); isEqual = Check_Equal(data.begin(), data.end(), @@ -807,8 +807,8 @@ namespace CHECK(result.second); CHECK(*result.first == Element2(0, D2("0", "1"))); - result = data.emplace(ETL_MAKE_PAIR(2, D2("2", "3"))); - compare.emplace(ETL_MAKE_PAIR(2, D2("2", "3"))); + result = data.emplace(ETL_OR_STD::make_pair(2, D2("2", "3"))); + compare.emplace(ETL_OR_STD::make_pair(2, D2("2", "3"))); isEqual = Check_Equal(data.begin(), data.end(), @@ -852,8 +852,8 @@ namespace CHECK(result.second); CHECK(*result.first == Element3(0, D3("0", "1", "2"))); - result = data.emplace(ETL_MAKE_PAIR(2, D3("2", "3", "4"))); - compare.emplace(ETL_MAKE_PAIR(2, D3("2", "3", "4"))); + result = data.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4"))); + compare.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4"))); isEqual = Check_Equal(data.begin(), data.end(), @@ -897,8 +897,8 @@ namespace CHECK(result.second); CHECK(*result.first == Element4(0, D4("0", "1", "2", "3"))); - result = data.emplace(ETL_MAKE_PAIR(2, D4("2", "3", "4", "5"))); - compare.emplace(ETL_MAKE_PAIR(2, D4("2", "3", "4", "5"))); + result = data.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5"))); + compare.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5"))); isEqual = Check_Equal(data.begin(), data.end(), diff --git a/test/test_flat_multimap.cpp b/test/test_flat_multimap.cpp index e341c21b..8b4697bc 100644 --- a/test/test_flat_multimap.cpp +++ b/test/test_flat_multimap.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include @@ -449,7 +449,7 @@ namespace DataNDC data; data.insert(DataNDC::value_type(0, N0)); - compare_data.insert(ETL_MAKE_PAIR(0, N0)); + compare_data.insert(ETL_OR_STD::make_pair(0, N0)); bool isEqual = Check_Equal(data.begin(), data.end(), @@ -457,8 +457,8 @@ namespace CHECK(isEqual); - data.insert(ETL_MAKE_PAIR(2, N2)); - compare_data.insert(ETL_MAKE_PAIR(2, N2)); + data.insert(ETL_OR_STD::make_pair(2, N2)); + compare_data.insert(ETL_OR_STD::make_pair(2, N2)); isEqual = Check_Equal(data.begin(), data.end(), @@ -466,8 +466,8 @@ namespace CHECK(isEqual); - data.insert(ETL_MAKE_PAIR(1, N1)); - compare_data.insert(ETL_MAKE_PAIR(1, N1)); + data.insert(ETL_OR_STD::make_pair(1, N1)); + compare_data.insert(ETL_OR_STD::make_pair(1, N1)); isEqual = Check_Equal(data.begin(), data.end(), @@ -484,24 +484,24 @@ namespace Compare_DataNDC compare_data; DataNDC data; - data.insert(ETL_MAKE_PAIR(0, N0)); - compare_data.insert(ETL_MAKE_PAIR(0, N0)); + data.insert(ETL_OR_STD::make_pair(0, N0)); + compare_data.insert(ETL_OR_STD::make_pair(0, N0)); - data.insert(ETL_MAKE_PAIR(1, N1)); - compare_data.insert(ETL_MAKE_PAIR(1, N1)); + data.insert(ETL_OR_STD::make_pair(1, N1)); + compare_data.insert(ETL_OR_STD::make_pair(1, N1)); - data.insert(ETL_MAKE_PAIR(2, N2)); - compare_data.insert(ETL_MAKE_PAIR(2, N2)); + data.insert(ETL_OR_STD::make_pair(2, N2)); + compare_data.insert(ETL_OR_STD::make_pair(2, N2)); // Do it again. - data.insert(ETL_MAKE_PAIR(0, N0)); - compare_data.insert(ETL_MAKE_PAIR(0, N0)); + data.insert(ETL_OR_STD::make_pair(0, N0)); + compare_data.insert(ETL_OR_STD::make_pair(0, N0)); - data.insert(ETL_MAKE_PAIR(1, N1)); - compare_data.insert(ETL_MAKE_PAIR(1, N1)); + data.insert(ETL_OR_STD::make_pair(1, N1)); + compare_data.insert(ETL_OR_STD::make_pair(1, N1)); - data.insert(ETL_MAKE_PAIR(2, N2)); - compare_data.insert(ETL_MAKE_PAIR(2, N2)); + data.insert(ETL_OR_STD::make_pair(2, N2)); + compare_data.insert(ETL_OR_STD::make_pair(2, N2)); CHECK_EQUAL(compare_data.size(), data.size()); @@ -519,7 +519,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - CHECK_THROW(data.insert(ETL_MAKE_PAIR(10, N10)), etl::flat_multimap_full); + CHECK_THROW(data.insert(ETL_OR_STD::make_pair(10, N10)), etl::flat_multimap_full); CHECK(std::is_sorted(data.begin(), data.end())); } @@ -564,8 +564,8 @@ namespace data.emplace(1, D1("1")); compare.emplace(1, D1("1")); - data.emplace(ETL_MAKE_PAIR(2, D1("2"))); - compare.emplace(ETL_MAKE_PAIR(2, D1("2"))); + data.emplace(ETL_OR_STD::make_pair(2, D1("2"))); + compare.emplace(ETL_OR_STD::make_pair(2, D1("2"))); // Do it again. data.emplace(0, "0"); @@ -574,8 +574,8 @@ namespace data.emplace(1, D1("1")); compare.emplace(1, D1("1")); - data.emplace(ETL_MAKE_PAIR(2, D1("2"))); - compare.emplace(ETL_MAKE_PAIR(2, D1("2"))); + data.emplace(ETL_OR_STD::make_pair(2, D1("2"))); + compare.emplace(ETL_OR_STD::make_pair(2, D1("2"))); CHECK_EQUAL(compare.size(), data.size()); @@ -598,8 +598,8 @@ namespace data.emplace(1, D2("1", "2")); compare.emplace(1, D2("1", "2")); - data.emplace(ETL_MAKE_PAIR(2, D2("2", "3"))); - compare.emplace(ETL_MAKE_PAIR(2, D2("2", "3"))); + data.emplace(ETL_OR_STD::make_pair(2, D2("2", "3"))); + compare.emplace(ETL_OR_STD::make_pair(2, D2("2", "3"))); // Do it again. data.emplace(0, "0", "1"); @@ -608,8 +608,8 @@ namespace data.emplace(1, D2("1", "2")); compare.emplace(1, D2("1", "2")); - data.emplace(ETL_MAKE_PAIR(2, D2("2", "3"))); - compare.emplace(ETL_MAKE_PAIR(2, D2("2", "3"))); + data.emplace(ETL_OR_STD::make_pair(2, D2("2", "3"))); + compare.emplace(ETL_OR_STD::make_pair(2, D2("2", "3"))); CHECK_EQUAL(compare.size(), data.size()); @@ -632,8 +632,8 @@ namespace data.emplace(1, D3("1", "2", "3")); compare.emplace(1, D3("1", "2", "3")); - data.emplace(ETL_MAKE_PAIR(2, D3("2", "3", "4"))); - compare.emplace(ETL_MAKE_PAIR(2, D3("2", "3", "4"))); + data.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4"))); + compare.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4"))); // Do it again. data.emplace(0, "0", "1", "2"); @@ -642,8 +642,8 @@ namespace data.emplace(1, D3("1", "2", "3")); compare.emplace(1, D3("1", "2", "3")); - data.emplace(ETL_MAKE_PAIR(2, D3("2", "3", "4"))); - compare.emplace(ETL_MAKE_PAIR(2, D3("2", "3", "4"))); + data.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4"))); + compare.emplace(ETL_OR_STD::make_pair(2, D3("2", "3", "4"))); CHECK_EQUAL(compare.size(), data.size()); @@ -666,8 +666,8 @@ namespace data.emplace(1, D4("1", "2", "3", "4")); compare.emplace(1, D4("1", "2", "3", "4")); - data.emplace(ETL_MAKE_PAIR(2, D4("2", "3", "4", "5"))); - compare.emplace(ETL_MAKE_PAIR(2, D4("2", "3", "4", "5"))); + data.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5"))); + compare.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5"))); // Do it again. data.emplace(0, "0", "1", "2", "3"); @@ -676,8 +676,8 @@ namespace data.emplace(1, D4("1", "2", "3", "4")); compare.emplace(1, D4("1", "2", "3", "4")); - data.emplace(ETL_MAKE_PAIR(2, D4("2", "3", "4", "5"))); - compare.emplace(ETL_MAKE_PAIR(2, D4("2", "3", "4", "5"))); + data.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5"))); + compare.emplace(ETL_OR_STD::make_pair(2, D4("2", "3", "4", "5"))); CHECK_EQUAL(compare.size(), data.size()); diff --git a/test/test_flat_multiset.cpp b/test/test_flat_multiset.cpp index f3f38acb..d323ccbf 100644 --- a/test/test_flat_multiset.cpp +++ b/test/test_flat_multiset.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_flat_set.cpp b/test/test_flat_set.cpp index 4e6d9548..11d94dd7 100644 --- a/test/test_flat_set.cpp +++ b/test/test_flat_set.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_fnv_1.cpp b/test/test_fnv_1.cpp index a852dce9..70dbfc88 100644 --- a/test/test_fnv_1.cpp +++ b/test/test_fnv_1.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_forward_list.cpp b/test/test_forward_list.cpp index c3574775..d3d3dd7b 100644 --- a/test/test_forward_list.cpp +++ b/test/test_forward_list.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "data.h" diff --git a/test/test_forward_list_shared_pool.cpp b/test/test_forward_list_shared_pool.cpp index 81801b14..cc11bdb4 100644 --- a/test/test_forward_list_shared_pool.cpp +++ b/test/test_forward_list_shared_pool.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "data.h" diff --git a/test/test_fsm.cpp b/test/test_fsm.cpp index 69d85f3e..dd334fa3 100644 --- a/test/test_fsm.cpp +++ b/test/test_fsm.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/fsm.h" #include "etl/enum_type.h" diff --git a/test/test_function.cpp b/test/test_function.cpp index 3f34e51b..97585cf8 100644 --- a/test/test_function.cpp +++ b/test/test_function.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/function.h" diff --git a/test/test_functional.cpp b/test/test_functional.cpp index 8e2cd1a5..f4e44d11 100644 --- a/test/test_functional.cpp +++ b/test/test_functional.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/functional.h" @@ -36,8 +36,68 @@ SOFTWARE. namespace { + template + bool compare(int a, int b) + { + return TCompare()(a, b); + } + + struct test : etl::binary_function + { + bool operator()(int a, int b) const + { + return a < b; + } + }; + SUITE(test_functional) { + //************************************************************************* + TEST(test_less) + { + CHECK((compare>(1, 2))); + CHECK(!(compare>(2, 1))); + CHECK(!(compare>(1, 1))); + } + + //************************************************************************* + TEST(test_greater) + { + CHECK(!(compare>(1, 2))); + CHECK((compare>(2, 1))); + CHECK(!(compare>(1, 1))); + } + + //************************************************************************* + TEST(test_equal_to) + { + CHECK((compare>(1, 1))); + CHECK(!(compare>(1, 2))); + CHECK(!(compare>(2, 1))); + } + + //************************************************************************* + TEST(test_not_equal_to) + { + CHECK(!(compare>(1, 1))); + CHECK((compare>(1, 2))); + CHECK((compare>(2, 1))); + } + + //************************************************************************* + TEST(test_bind1st) + { + CHECK((etl::bind1st(test(), 1)(2))); + CHECK(!(etl::bind1st(test(), 2)(1))); + } + + //************************************************************************* + TEST(test_bind2nd) + { + CHECK(!(etl::bind2nd(test(), 1)(2))); + CHECK((etl::bind2nd(test(), 2)(1))); + } + //************************************************************************* TEST(test_reference_wrapper) { diff --git a/test/test_hash.cpp b/test/test_hash.cpp index 1a4e024d..84203f81 100644 --- a/test/test_hash.cpp +++ b/test/test_hash.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_indirect_vector.cpp b/test/test_indirect_vector.cpp index bff833a8..157a009c 100644 --- a/test/test_indirect_vector.cpp +++ b/test/test_indirect_vector.cpp @@ -26,7 +26,7 @@ //SOFTWARE. //******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_indirect_vector_external_buffer.cpp b/test/test_indirect_vector_external_buffer.cpp index 90278dc1..0abafeac 100644 --- a/test/test_indirect_vector_external_buffer.cpp +++ b/test/test_indirect_vector_external_buffer.cpp @@ -26,7 +26,7 @@ //SOFTWARE. //******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_instance_count.cpp b/test/test_instance_count.cpp index 6a0b817b..d28ac40e 100644 --- a/test/test_instance_count.cpp +++ b/test/test_instance_count.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/instance_count.h" diff --git a/test/test_integral_limits.cpp b/test/test_integral_limits.cpp index d461053f..75110486 100644 --- a/test/test_integral_limits.cpp +++ b/test/test_integral_limits.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_intrusive_forward_list.cpp b/test/test_intrusive_forward_list.cpp index 062d02ab..74d54c06 100644 --- a/test/test_intrusive_forward_list.cpp +++ b/test/test_intrusive_forward_list.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "data.h" diff --git a/test/test_intrusive_links.cpp b/test/test_intrusive_links.cpp index b9304ca8..f966e768 100644 --- a/test/test_intrusive_links.cpp +++ b/test/test_intrusive_links.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "data.h" diff --git a/test/test_intrusive_list.cpp b/test/test_intrusive_list.cpp index 57182c7c..48171e53 100644 --- a/test/test_intrusive_list.cpp +++ b/test/test_intrusive_list.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "data.h" diff --git a/test/test_intrusive_queue.cpp b/test/test_intrusive_queue.cpp index ebd37ad8..df51dbd5 100644 --- a/test/test_intrusive_queue.cpp +++ b/test/test_intrusive_queue.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/intrusive_queue.h" #include "etl/intrusive_links.h" diff --git a/test/test_intrusive_stack.cpp b/test/test_intrusive_stack.cpp index 5b752a87..4ef03602 100644 --- a/test/test_intrusive_stack.cpp +++ b/test/test_intrusive_stack.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/intrusive_stack.h" #include "etl/intrusive_links.h" diff --git a/test/test_io_port.cpp b/test/test_io_port.cpp index 4634e8da..332baea0 100644 --- a/test/test_io_port.cpp +++ b/test/test_io_port.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/io_port.h" diff --git a/test/test_iterator.cpp b/test/test_iterator.cpp index 0c3d6492..ef5429c5 100644 --- a/test/test_iterator.cpp +++ b/test/test_iterator.cpp @@ -26,9 +26,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/iterator.h" +#include "iterators_for_unit_tests.h" namespace { @@ -59,14 +60,217 @@ namespace typedef int* pointer; typedef const int* const_pointer; -} -namespace -{ + const size_t SIZE = 10; + int dataA[SIZE] = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 }; + SUITE(test_iterator) { // NOTE '!!' is required to keep GCC happy. + //************************************************************************* + TEST(distance_non_random) + { + ptrdiff_t d = etl::distance(non_random_iterator(&dataA[0]), non_random_iterator(&dataA[SIZE])); + + CHECK_EQUAL(SIZE, d); + } + + //************************************************************************* + TEST(distance_random) + { + ptrdiff_t d = etl::distance(random_iterator(&dataA[0]), random_iterator(&dataA[SIZE])); + + CHECK_EQUAL(SIZE, d); + } + + //************************************************************************* + TEST(advance_non_random) + { + int* itr1 = std::begin(dataA); + non_random_iterator itr2 = std::begin(dataA); + + std::advance(itr1, 4); + etl::advance(itr2, 4); + CHECK_EQUAL(*itr1, *itr2); + + std::advance(itr1, -3); + etl::advance(itr2, -3); + CHECK_EQUAL(*itr1, *itr2); + } + + //************************************************************************* + TEST(advance_random) + { + int* itr1 = std::begin(dataA); + random_iterator itr2 = std::begin(dataA); + + std::advance(itr1, 4); + etl::advance(itr2, 4); + CHECK_EQUAL(*itr1, *itr2); + + std::advance(itr1, -3); + etl::advance(itr2, -3); + CHECK_EQUAL(*itr1, *itr2); + } + + //************************************************************************* + TEST(prev) + { + int data[] = { 1, 2, 3, 4, 5, 6, 7 }; + + size_t length = 6U; + + int* itr = &data[0] + length; + + for (size_t i = 1; i <= length; ++i) + { + CHECK_EQUAL(data[length - i], *etl::prev(itr, i)); + } + } + + //************************************************************************* + TEST(next) + { + int data[] = { 1, 2, 3, 4, 5, 6, 7 }; + + size_t length = 6U; + + int* itr = &data[0]; + + for (size_t i = 1; i <= length; ++i) + { + CHECK_EQUAL(data[i], *etl::next(itr, i)); + } + } + + //************************************************************************* + TEST(reverse_iterator) + { + int data[] = { 1, 2, 3, 4, 5, 6, 7 }; + + std::reverse_iterator sri(&data[7]); + etl::reverse_iterator eri(&data[7]); + + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri++, *eri++); + + CHECK(etl::reverse_iterator(&data[5]) < eri); + CHECK(etl::reverse_iterator(&data[3]) > eri); + CHECK(etl::reverse_iterator(&data[4]) <= eri); + CHECK(etl::reverse_iterator(&data[5]) <= eri); + CHECK(etl::reverse_iterator(&data[4]) >= eri); + CHECK(etl::reverse_iterator(&data[3]) >= eri); + + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri, *eri); + + CHECK(etl::reverse_iterator(&data[1]) == eri); + CHECK(etl::reverse_iterator(&data[2]) != eri); + CHECK(etl::reverse_iterator(&data[3]) != eri); + CHECK(etl::reverse_iterator(&data[4]) != eri); + CHECK(etl::reverse_iterator(&data[5]) != eri); + CHECK(etl::reverse_iterator(&data[6]) != eri); + CHECK(etl::reverse_iterator(&data[7]) != eri); + + sri = std::reverse_iterator(&data[7]); + eri = etl::reverse_iterator(&data[7]); + CHECK_EQUAL(sri[0], eri[0]); + CHECK_EQUAL(sri[1], eri[1]); + CHECK_EQUAL(sri[2], eri[2]); + CHECK_EQUAL(sri[3], eri[3]); + CHECK_EQUAL(sri[4], eri[4]); + CHECK_EQUAL(sri[5], eri[5]); + CHECK_EQUAL(sri[6], eri[6]); + + sri += 4; + eri += 4; + CHECK_EQUAL(*sri, *eri); + + sri -= 2; + eri -= 2; + CHECK_EQUAL(*sri, *eri); + + std::reverse_iterator sri2 = sri + 3; + etl::reverse_iterator eri2 = eri + 3; + CHECK_EQUAL(*sri, *eri); + + sri2 = sri - 3; + eri2 = eri - 3; + CHECK_EQUAL(*sri, *eri); + } + + //************************************************************************* + TEST(reverse_iterator_const) + { + const int data[] = { 1, 2, 3, 4, 5, 6, 7 }; + + std::reverse_iterator sri(&data[7]); + etl::reverse_iterator eri(&data[7]); + + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri++, *eri++); + + CHECK(etl::reverse_iterator(&data[5]) < eri); + CHECK(etl::reverse_iterator(&data[3]) > eri); + CHECK(etl::reverse_iterator(&data[4]) <= eri); + CHECK(etl::reverse_iterator(&data[5]) <= eri); + CHECK(etl::reverse_iterator(&data[4]) >= eri); + CHECK(etl::reverse_iterator(&data[3]) >= eri); + + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri++, *eri++); + CHECK_EQUAL(*sri, *eri); + + CHECK(etl::reverse_iterator(&data[1]) == eri); + CHECK(etl::reverse_iterator(&data[2]) != eri); + CHECK(etl::reverse_iterator(&data[3]) != eri); + CHECK(etl::reverse_iterator(&data[4]) != eri); + CHECK(etl::reverse_iterator(&data[5]) != eri); + CHECK(etl::reverse_iterator(&data[6]) != eri); + CHECK(etl::reverse_iterator(&data[7]) != eri); + + sri = std::reverse_iterator(&data[7]); + eri = etl::reverse_iterator(&data[7]); + CHECK_EQUAL(sri[0], eri[0]); + CHECK_EQUAL(sri[1], eri[1]); + CHECK_EQUAL(sri[2], eri[2]); + CHECK_EQUAL(sri[3], eri[3]); + CHECK_EQUAL(sri[4], eri[4]); + CHECK_EQUAL(sri[5], eri[5]); + CHECK_EQUAL(sri[6], eri[6]); + + CHECK_EQUAL(*sri, *eri); + CHECK_EQUAL(*(sri + 1), *(eri + 1)); + CHECK_EQUAL(*(sri + 2), *(eri + 2)); + CHECK_EQUAL(*(sri + 3), *(eri + 3)); + CHECK_EQUAL(*(sri + 4), *(eri + 4)); + CHECK_EQUAL(*(sri + 5), *(eri + 5)); + CHECK_EQUAL(*(sri + 6), *(eri + 6)); + + sri += 4; + eri += 4; + CHECK_EQUAL(*sri, *eri); + + sri -= 2; + eri -= 2; + CHECK_EQUAL(*sri, *eri); + + std::reverse_iterator sri2 = sri + 3; + etl::reverse_iterator eri2 = eri + 3; + CHECK_EQUAL(*sri, *eri); + + sri2 = sri - 3; + eri2 = eri - 3; + CHECK_EQUAL(*sri, *eri); + } + + TEST(test_input) { CHECK(!!etl::is_input_iterator::value); diff --git a/test/test_jenkins.cpp b/test/test_jenkins.cpp index 3b2f8647..6517ee50 100644 --- a/test/test_jenkins.cpp +++ b/test/test_jenkins.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_largest.cpp b/test/test_largest.cpp index f9638bae..998faaac 100644 --- a/test/test_largest.cpp +++ b/test/test_largest.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/largest.h" @@ -43,13 +43,13 @@ namespace bool type; size = etl::largest_type::size; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK_EQUAL(sizeof(int), size); CHECK(type); size = etl::largest_type::size; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK_EQUAL(sizeof(int), size); CHECK(type); @@ -66,13 +66,13 @@ namespace struct S3 { int a; short b; char c; }; size = etl::largest_type::size; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK_EQUAL(sizeof(S3), size); CHECK(type); size = etl::largest_type::size; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK_EQUAL(sizeof(S3), size); CHECK(type); @@ -101,43 +101,43 @@ namespace //************************************************************************* TEST(test_larger_int_type) { - CHECK(bool(etlstd::is_same::type, int16_t>::value)); - CHECK(bool(etlstd::is_same::type, int32_t>::value)); - CHECK(bool(etlstd::is_same::type, int64_t>::value)); - CHECK(bool(etlstd::is_same::type, int64_t>::value)); + CHECK(bool(etl::is_same::type, int16_t>::value)); + CHECK(bool(etl::is_same::type, int32_t>::value)); + CHECK(bool(etl::is_same::type, int64_t>::value)); + CHECK(bool(etl::is_same::type, int64_t>::value)); - CHECK(bool(etlstd::is_same::type, int16_t>::value)); - CHECK(bool(etlstd::is_same::type, int32_t>::value)); - CHECK(bool(etlstd::is_same::type, int64_t>::value)); - CHECK(bool(etlstd::is_same::type, int64_t>::value)); + CHECK(bool(etl::is_same::type, int16_t>::value)); + CHECK(bool(etl::is_same::type, int32_t>::value)); + CHECK(bool(etl::is_same::type, int64_t>::value)); + CHECK(bool(etl::is_same::type, int64_t>::value)); } //************************************************************************* TEST(test_larger_uint_type) { - CHECK(bool(etlstd::is_same::type, uint16_t>::value)); - CHECK(bool(etlstd::is_same::type, uint32_t>::value)); - CHECK(bool(etlstd::is_same::type, uint64_t>::value)); - CHECK(bool(etlstd::is_same::type, uint64_t>::value)); + CHECK(bool(etl::is_same::type, uint16_t>::value)); + CHECK(bool(etl::is_same::type, uint32_t>::value)); + CHECK(bool(etl::is_same::type, uint64_t>::value)); + CHECK(bool(etl::is_same::type, uint64_t>::value)); - CHECK(bool(etlstd::is_same::type, uint16_t>::value)); - CHECK(bool(etlstd::is_same::type, uint32_t>::value)); - CHECK(bool(etlstd::is_same::type, uint64_t>::value)); - CHECK(bool(etlstd::is_same::type, uint64_t>::value)); + CHECK(bool(etl::is_same::type, uint16_t>::value)); + CHECK(bool(etl::is_same::type, uint32_t>::value)); + CHECK(bool(etl::is_same::type, uint64_t>::value)); + CHECK(bool(etl::is_same::type, uint64_t>::value)); } //************************************************************************* TEST(test_larger_type) { - CHECK(bool(etlstd::is_same::type, int16_t>::value)); - CHECK(bool(etlstd::is_same::type, int32_t>::value)); - CHECK(bool(etlstd::is_same::type, int64_t>::value)); - CHECK(bool(etlstd::is_same::type, int64_t>::value)); + CHECK(bool(etl::is_same::type, int16_t>::value)); + CHECK(bool(etl::is_same::type, int32_t>::value)); + CHECK(bool(etl::is_same::type, int64_t>::value)); + CHECK(bool(etl::is_same::type, int64_t>::value)); - CHECK(bool(etlstd::is_same::type, uint16_t>::value)); - CHECK(bool(etlstd::is_same::type, uint32_t>::value)); - CHECK(bool(etlstd::is_same::type, uint64_t>::value)); - CHECK(bool(etlstd::is_same::type, uint64_t>::value)); + CHECK(bool(etl::is_same::type, uint16_t>::value)); + CHECK(bool(etl::is_same::type, uint32_t>::value)); + CHECK(bool(etl::is_same::type, uint64_t>::value)); + CHECK(bool(etl::is_same::type, uint64_t>::value)); } }; } diff --git a/test/test_etlstd_limits.cpp b/test/test_limits.cpp similarity index 85% rename from test/test_etlstd_limits.cpp rename to test/test_limits.cpp index 4924024f..84e002b4 100644 --- a/test/test_etlstd_limits.cpp +++ b/test/test_limits.cpp @@ -26,11 +26,38 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/limits.h" #include +namespace etl +{ + const bool numeric_limits::is_specialized; + const int numeric_limits::digits; + const int numeric_limits::digits10; + const int numeric_limits::max_digits10; + const bool numeric_limits::is_signed; + const bool numeric_limits::is_integer; + const bool numeric_limits::is_exact; + const int numeric_limits::radix; + const int numeric_limits::min_exponent; + const int numeric_limits::min_exponent10; + const int numeric_limits::max_exponent; + const int numeric_limits::max_exponent10; + const bool numeric_limits::has_infinity; + const bool numeric_limits::has_quiet_NaN; + const bool numeric_limits::has_signaling_NaN; + const float_denorm_style numeric_limits::has_denorm; + const bool numeric_limits::has_denorm_loss; + const bool numeric_limits::is_iec559; + const bool numeric_limits::is_bounded; + const bool numeric_limits::is_modulo; + const bool numeric_limits::traps; + const bool numeric_limits::tinyness_before; + const float_round_style numeric_limits::round_style; +} + namespace { SUITE(test_no_stl_limits) @@ -38,8 +65,8 @@ namespace //************************************************************************* TEST(test_bool) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); @@ -72,214 +99,208 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_char) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; - - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(false, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); - } - - //************************************************************************* - TEST(test_unsigned_char) - { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; - - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(true, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); - } - - //************************************************************************* - TEST(test_signed_char) - { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; - - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(false, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); - } - - //************************************************************************* - TEST(test_char16_t) - { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; - - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(true, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); - } - - //************************************************************************* - TEST(test_char32_t) - { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; - - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(true, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); - } - - //************************************************************************* - TEST(test_wchar_t) - { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; + + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + } + + //************************************************************************* + TEST(test_unsigned_char) + { + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; + + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + } + + //************************************************************************* + TEST(test_signed_char) + { + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; + + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + } + + //************************************************************************* + TEST(test_char16_t) + { + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; + + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + } + + //************************************************************************* + TEST(test_char32_t) + { + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; + + CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); + CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); + CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); + CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); + CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); + CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); + CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); + CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); + CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); + CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); + CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); + CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); + CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); + CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); + CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); + CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); + CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); + CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); + CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); + CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); + CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); + CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); + CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); + CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); + CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); + CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); + CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); + CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + } + + //************************************************************************* + TEST(test_wchar_t) + { + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); @@ -312,14 +333,13 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_short) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); @@ -335,7 +355,7 @@ namespace CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -352,14 +372,13 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_unsigned_short) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); @@ -375,7 +394,7 @@ namespace CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -392,14 +411,13 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_int) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); @@ -415,7 +433,7 @@ namespace CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -432,14 +450,13 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_unsigned_int) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); @@ -455,7 +472,7 @@ namespace CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -472,14 +489,13 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_long) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); @@ -495,7 +511,7 @@ namespace CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -512,13 +528,12 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_unsigned_long) { - typedef etlstd::numeric_limits ETL_NL; + typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); @@ -535,7 +550,7 @@ namespace CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -552,14 +567,13 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_long_long) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); @@ -575,7 +589,7 @@ namespace CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -592,14 +606,13 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_unsigned_long_long) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); @@ -615,7 +628,7 @@ namespace CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(true, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -632,28 +645,21 @@ namespace CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); } //************************************************************************* TEST(test_float) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(true, ETL_NL::has_denorm_loss); - CHECK_EQUAL(false, ETL_NL::has_infinity); - CHECK_EQUAL(false, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(false, ETL_NL::has_signaling_NaN); CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -666,35 +672,21 @@ namespace CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(true, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); - - // CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - // CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - // CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - // CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); } //************************************************************************* TEST(test_double) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(true, ETL_NL::has_denorm_loss); - CHECK_EQUAL(false, ETL_NL::has_infinity); - CHECK_EQUAL(false, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(false, ETL_NL::has_signaling_NaN); CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -707,35 +699,21 @@ namespace CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(true, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); - - // CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - // CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - // CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - // CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); } //************************************************************************* TEST(test_long_double) { - typedef etlstd::numeric_limits ETL_NL; - typedef std::numeric_limits STD_NL; + typedef etl::numeric_limits ETL_NL; + typedef std::numeric_limits STD_NL; CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(true, ETL_NL::has_denorm_loss); - CHECK_EQUAL(false, ETL_NL::has_infinity); - CHECK_EQUAL(false, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(false, ETL_NL::has_signaling_NaN); CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(false, ETL_NL::is_modulo); + CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); @@ -748,14 +726,6 @@ namespace CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(true, ETL_NL::tinyness_before); - CHECK_EQUAL(false, ETL_NL::traps); - - // CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - // CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - // CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - // CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); } }; } diff --git a/test/test_list.cpp b/test/test_list.cpp index 8f54b61b..ae292f13 100644 --- a/test/test_list.cpp +++ b/test/test_list.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/list.h" diff --git a/test/test_list_shared_pool.cpp b/test/test_list_shared_pool.cpp index ee7ef329..6b7443bc 100644 --- a/test/test_list_shared_pool.cpp +++ b/test/test_list_shared_pool.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/list.h" diff --git a/test/test_make_string.cpp b/test/test_make_string.cpp index 08ba1c24..c7759325 100644 --- a/test/test_make_string.cpp +++ b/test/test_make_string.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include diff --git a/test/test_map.cpp b/test/test_map.cpp index 77ce0f57..aa6dc61a 100755 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include @@ -462,7 +462,7 @@ namespace ETL_OR_STD::pair data_result = data.insert(Data::value_type(std::string("0"), 0)); ETL_OR_STD::pair compare_result = - compare_data.insert(ETL_MAKE_PAIR(std::string("0"), 0)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); // Check that both return successful return results CHECK_EQUAL(data_result.first->first, compare_result.first->first); @@ -470,7 +470,7 @@ namespace // Try adding a duplicate (should return iterator pointing to duplicate) data_result = data.insert(Data::value_type(std::string("0"), 0)); - compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("0"), 0)); + compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); // Check that both return successful return results CHECK_EQUAL(data_result.first->first, compare_result.first->first); @@ -482,8 +482,8 @@ namespace compare_data.begin()); CHECK(isEqual); - data.insert(ETL_MAKE_PAIR(std::string("2"), 2)); - compare_data.insert(ETL_MAKE_PAIR(std::string("2"), 2)); + data.insert(ETL_OR_STD::make_pair(std::string("2"), 2)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2)); isEqual = Check_Equal(data.begin(), data.end(), @@ -491,8 +491,8 @@ namespace CHECK(isEqual); - data.insert(ETL_MAKE_PAIR(std::string("1"), 1)); - compare_data.insert(ETL_MAKE_PAIR(std::string("1"), 1)); + data.insert(ETL_OR_STD::make_pair(std::string("1"), 1)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("1"), 1)); isEqual = Check_Equal(data.begin(), data.end(), @@ -508,13 +508,13 @@ namespace Data data; data.insert(Data::value_type(std::string("0"), 0)); - compare_data.insert(ETL_MAKE_PAIR(std::string("0"), 0)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); data.insert(Data::value_type(std::string("1"), 1)); - compare_data.insert(ETL_MAKE_PAIR(std::string("1"), 1)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("1"), 1)); data.insert(Data::value_type(std::string("-1"), -1)); - compare_data.insert(ETL_MAKE_PAIR(std::string("-1"), -1)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("-1"), -1)); // Check that elements in map are the same bool isEqual = Check_Equal(data.begin(), @@ -530,7 +530,7 @@ namespace Data data; data.insert(Data::value_type(std::string("0"), 0)); - compare_data.insert(ETL_MAKE_PAIR(std::string("0"), 0)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); bool isEqual = Check_Equal(data.begin(), data.end(), @@ -538,8 +538,8 @@ namespace CHECK(isEqual); - data.insert(ETL_MAKE_PAIR(std::string("0"), 1)); - compare_data.insert(ETL_MAKE_PAIR(std::string("0"), 1)); + data.insert(ETL_OR_STD::make_pair(std::string("0"), 1)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 1)); isEqual = Check_Equal(data.begin(), data.end(), @@ -557,7 +557,7 @@ namespace ETL_OR_STD::pair data_result = data.insert(Data::value_type(std::string("2"), 2)); ETL_OR_STD::pair compare_result = - compare_data.insert(ETL_MAKE_PAIR(std::string("2"), 2)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2)); // Check that both return successful return results CHECK_EQUAL(data_result.first->first, compare_result.first->first); @@ -569,8 +569,8 @@ namespace compare_data.begin()); CHECK(isEqual); - data.insert(data_result.first, ETL_MAKE_PAIR(std::string("1"), 1)); - compare_data.insert(compare_result.first, ETL_MAKE_PAIR(std::string("1"), 1)); + data.insert(data_result.first, ETL_OR_STD::make_pair(std::string("1"), 1)); + compare_data.insert(compare_result.first, ETL_OR_STD::make_pair(std::string("1"), 1)); isEqual = Check_Equal(data.begin(), data.end(), @@ -588,7 +588,7 @@ namespace ETL_OR_STD::pair data_result = data.insert(Data::value_type(std::string("2"), 2)); ETL_OR_STD::pair compare_result = - compare_data.insert(ETL_MAKE_PAIR(std::string("2"), 2)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2)); // Check that both return successful return results CHECK_EQUAL(data_result.first->first, compare_result.first->first); @@ -601,9 +601,9 @@ namespace CHECK(isEqual); data.insert(Data::const_iterator(data_result.first), - ETL_MAKE_PAIR(std::string("1"), 1)); + ETL_OR_STD::make_pair(std::string("1"), 1)); compare_data.insert(Compare_Data::const_iterator(compare_result.first), - ETL_MAKE_PAIR(std::string("1"), 1)); + ETL_OR_STD::make_pair(std::string("1"), 1)); isEqual = Check_Equal(data.begin(), data.end(), @@ -617,7 +617,7 @@ namespace { Data data(initial_data.begin(), initial_data.end()); - CHECK_THROW(data.insert(ETL_MAKE_PAIR(std::string("10"), 10)), etl::map_full); + CHECK_THROW(data.insert(ETL_OR_STD::make_pair(std::string("10"), 10)), etl::map_full); } //************************************************************************* diff --git a/test/test_maths.cpp b/test/test_maths.cpp index 636fe335..0a43785e 100644 --- a/test/test_maths.cpp +++ b/test/test_maths.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/log.h" #include "etl/power.h" diff --git a/test/test_memory.cpp b/test/test_memory.cpp index 68a62caa..796f2b63 100644 --- a/test/test_memory.cpp +++ b/test/test_memory.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/memory.h" #include "etl/debug_count.h" diff --git a/test/test_message_bus.cpp b/test/test_message_bus.cpp index 618b561e..95c32374 100644 --- a/test/test_message_bus.cpp +++ b/test/test_message_bus.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/message_router.h" diff --git a/test/test_message_router.cpp b/test/test_message_router.cpp index 81d232da..f1fe6113 100644 --- a/test/test_message_router.cpp +++ b/test/test_message_router.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/message_router.h" diff --git a/test/test_message_timer.cpp b/test/test_message_timer.cpp index cc4b734a..415ac2ed 100644 --- a/test/test_message_timer.cpp +++ b/test/test_message_timer.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/message_router.h" diff --git a/test/test_multi_array.cpp b/test/test_multi_array.cpp index cfe82bd0..a303dd3a 100644 --- a/test/test_multi_array.cpp +++ b/test/test_multi_array.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/array.h" #include "etl/multi_array.h" diff --git a/test/test_multimap.cpp b/test/test_multimap.cpp index 1c152cfe..f2633ed6 100755 --- a/test/test_multimap.cpp +++ b/test/test_multimap.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include @@ -375,28 +375,28 @@ namespace Data::iterator data_result = data.insert(Data::value_type(std::string("2"), 1)); Compare_Data::iterator compare_result = - compare_data.insert(ETL_MAKE_PAIR(std::string("2"), 1)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 1)); // Check that both return successful return results CHECK_EQUAL(compare_result->first, data_result->first); CHECK_EQUAL(compare_result->second, data_result->second); data_result = data.insert(Data::value_type(std::string("1"), 1)); - compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("1"), 1)); + compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("1"), 1)); // Check that both return successful return results CHECK_EQUAL(compare_result->first, data_result->first); CHECK_EQUAL(compare_result->second, data_result->second); data_result = data.insert(Data::value_type(std::string("2"), 2)); - compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("2"), 2)); + compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 2)); // Check that both return successful return results CHECK_EQUAL(compare_result->first, data_result->first); CHECK_EQUAL(compare_result->second, data_result->second); data_result = data.insert(Data::value_type(std::string("3"), 3)); - compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("3"), 3)); + compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("3"), 3)); // Check that both return successful return results CHECK_EQUAL(compare_result->first, data_result->first); @@ -404,7 +404,7 @@ namespace // Adding this next 2 will trigger a 3 node rotate RL on insert data_result = data.insert(Data::value_type(std::string("2"), 3)); - compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("2"), 3)); + compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 3)); // Check that both return successful return results CHECK_EQUAL(compare_result->first, data_result->first); @@ -412,14 +412,14 @@ namespace // Adding this next 4 will trigger a 2 node rotate left on insert data_result = data.insert(Data::value_type(std::string("4"), 4)); - compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("4"), 4)); + compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("4"), 4)); // Check that both return successful return results CHECK_EQUAL(compare_result->first, data_result->first); CHECK_EQUAL(compare_result->second, data_result->second); data_result = data.insert(Data::value_type(std::string("0"), 0)); - compare_result = compare_data.insert(ETL_MAKE_PAIR(std::string("0"), 0)); + compare_result = compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); // Check that both return successful return results CHECK_EQUAL(compare_result->first, data_result->first); @@ -441,7 +441,7 @@ namespace Data::iterator data_result = data.insert(Data::value_type(std::string("0"), 0)); Compare_Data::iterator compare_result = - compare_data.insert(ETL_MAKE_PAIR(std::string("0"), 0)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("0"), 0)); // Check that both return successful return results CHECK_EQUAL(compare_result->first, data_result->first); @@ -453,8 +453,8 @@ namespace compare_data.begin()); CHECK(isEqual); - data.insert(data_result, ETL_MAKE_PAIR(std::string("1"), 1)); - compare_data.insert(compare_result, ETL_MAKE_PAIR(std::string("1"), 1)); + data.insert(data_result, ETL_OR_STD::make_pair(std::string("1"), 1)); + compare_data.insert(compare_result, ETL_OR_STD::make_pair(std::string("1"), 1)); isEqual = Check_Equal(data.begin(), data.end(), @@ -472,7 +472,7 @@ namespace Data::iterator data_result = data.insert(Data::value_type(std::string("2"), 0)); Compare_Data::iterator compare_result = - compare_data.insert(ETL_MAKE_PAIR(std::string("2"), 0)); + compare_data.insert(ETL_OR_STD::make_pair(std::string("2"), 0)); // Check that both return successful return results CHECK_EQUAL(compare_result->first, data_result->first); @@ -485,9 +485,9 @@ namespace CHECK(isEqual); data.insert(Data::const_iterator(data_result), - ETL_MAKE_PAIR(std::string("1"), 1)); + ETL_OR_STD::make_pair(std::string("1"), 1)); compare_data.insert(Compare_Data::const_iterator(compare_result), - ETL_MAKE_PAIR(std::string("1"), 1)); + ETL_OR_STD::make_pair(std::string("1"), 1)); isEqual = Check_Equal(data.begin(), data.end(), @@ -501,7 +501,7 @@ namespace { Data data(initial_data.begin(), initial_data.end()); - CHECK_THROW(data.insert(ETL_MAKE_PAIR(std::string("10"), 10)), etl::multimap_full); + CHECK_THROW(data.insert(ETL_OR_STD::make_pair(std::string("10"), 10)), etl::multimap_full); } //************************************************************************* diff --git a/test/test_multiset.cpp b/test/test_multiset.cpp index 03bd1140..146f76a2 100755 --- a/test/test_multiset.cpp +++ b/test/test_multiset.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_murmur3.cpp b/test/test_murmur3.cpp index a4a61a5c..755a27b1 100644 --- a/test/test_murmur3.cpp +++ b/test/test_murmur3.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "murmurhash3.h" // The 'C' reference implementation. diff --git a/test/test_numeric.cpp b/test/test_numeric.cpp index a594de23..654cd4ff 100644 --- a/test/test_numeric.cpp +++ b/test/test_numeric.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/numeric.h" diff --git a/test/test_observer.cpp b/test/test_observer.cpp index 3f8d62f6..1f86cbf5 100644 --- a/test/test_observer.cpp +++ b/test/test_observer.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/observer.h" diff --git a/test/test_optional.cpp b/test/test_optional.cpp index c48039b7..1851d3af 100644 --- a/test/test_optional.cpp +++ b/test/test_optional.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_packet.cpp b/test/test_packet.cpp index 5ccecf13..44def9cf 100644 --- a/test/test_packet.cpp +++ b/test/test_packet.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/packet.h" diff --git a/test/test_parameter_type.cpp b/test/test_parameter_type.cpp index d71b853a..6b9aeab1 100644 --- a/test/test_parameter_type.cpp +++ b/test/test_parameter_type.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include @@ -77,13 +77,13 @@ namespace { bool b; - b = !etlstd::is_reference::type>::value; + b = !etl::is_reference::type>::value; CHECK(b); - b = etlstd::is_reference::type>::value; + b = etl::is_reference::type>::value; CHECK(b); - b = !etlstd::is_reference::type>::value; + b = !etl::is_reference::type>::value; CHECK(b); } }; diff --git a/test/test_pearson.cpp b/test/test_pearson.cpp index 1e08bb1b..d6c559e1 100644 --- a/test/test_pearson.cpp +++ b/test/test_pearson.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_pool.cpp b/test/test_pool.cpp index fbd98816..3c615cb4 100644 --- a/test/test_pool.cpp +++ b/test/test_pool.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "data.h" diff --git a/test/test_priority_queue.cpp b/test/test_priority_queue.cpp index 690c47cf..36ab6168 100644 --- a/test/test_priority_queue.cpp +++ b/test/test_priority_queue.cpp @@ -26,11 +26,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include "etl/priority_queue.h" +#include namespace { @@ -455,8 +456,8 @@ namespace etl::priority_queue priority_queue2; - etl::ipriority_queue, std::less>& ipriority_queue1 = priority_queue1; - etl::ipriority_queue, std::less>& ipriority_queue2 = priority_queue2; + etl::ipriority_queue>& ipriority_queue1 = priority_queue1; + etl::ipriority_queue>& ipriority_queue2 = priority_queue2; ipriority_queue2 = ipriority_queue1; @@ -517,5 +518,32 @@ namespace CHECK_EQUAL(compare_priority_queue.size(), ipriority_queue.size()); CHECK_EQUAL(compare_priority_queue.top(), ipriority_queue.top()); } + + //************************************************************************* + TEST(test_using_custom_compare) + { + etl::priority_queue, std::less > priority_queue1; + + priority_queue1.push(1); + priority_queue1.push(4); + priority_queue1.push(3); + priority_queue1.push(2); + + etl::priority_queue, std::less > priority_queue2; + + etl::ipriority_queue, std::less>& ipriority_queue1 = priority_queue1; + etl::ipriority_queue, std::less>& ipriority_queue2 = priority_queue2; + + ipriority_queue2 = ipriority_queue1; + + CHECK(priority_queue1.size() == priority_queue2.size()); + + while (!priority_queue1.empty()) + { + CHECK_EQUAL(priority_queue1.top(), priority_queue2.top()); + priority_queue1.pop(); + priority_queue2.pop(); + } + } }; } diff --git a/test/test_queue.cpp b/test/test_queue.cpp index bc3eafe1..da1a6eb1 100644 --- a/test/test_queue.cpp +++ b/test/test_queue.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include diff --git a/test/test_queue_memory_model_small.cpp b/test/test_queue_memory_model_small.cpp index d4ac3dbe..8e6dedd4 100644 --- a/test/test_queue_memory_model_small.cpp +++ b/test/test_queue_memory_model_small.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include diff --git a/test/test_queue_mpmc_mutex.cpp b/test/test_queue_mpmc_mutex.cpp index bbe9598d..a1a74c3c 100644 --- a/test/test_queue_mpmc_mutex.cpp +++ b/test/test_queue_mpmc_mutex.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_queue_mpmc_mutex_small.cpp b/test/test_queue_mpmc_mutex_small.cpp index 4aab31be..db8c0733 100644 --- a/test/test_queue_mpmc_mutex_small.cpp +++ b/test/test_queue_mpmc_mutex_small.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_queue_spsc_atomic.cpp b/test/test_queue_spsc_atomic.cpp index 3c5805f5..753b4a34 100644 --- a/test/test_queue_spsc_atomic.cpp +++ b/test/test_queue_spsc_atomic.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_queue_spsc_atomic_small.cpp b/test/test_queue_spsc_atomic_small.cpp index 4a8fe798..e368527b 100644 --- a/test/test_queue_spsc_atomic_small.cpp +++ b/test/test_queue_spsc_atomic_small.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_queue_spsc_isr.cpp b/test/test_queue_spsc_isr.cpp index 69a8a9c4..223e42ac 100644 --- a/test/test_queue_spsc_isr.cpp +++ b/test/test_queue_spsc_isr.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/queue_spsc_isr.h" diff --git a/test/test_queue_spsc_isr_small.cpp b/test/test_queue_spsc_isr_small.cpp index 8e874fda..a4bf7df9 100644 --- a/test/test_queue_spsc_isr_small.cpp +++ b/test/test_queue_spsc_isr_small.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/queue_spsc_isr.h" diff --git a/test/test_queue_spsc_locked.cpp b/test/test_queue_spsc_locked.cpp index ea09280f..d942bdf4 100644 --- a/test/test_queue_spsc_locked.cpp +++ b/test/test_queue_spsc_locked.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/queue_spsc_locked.h" #include "etl/function.h" diff --git a/test/test_queue_spsc_locked_small.cpp b/test/test_queue_spsc_locked_small.cpp index 1f32d8c0..c6352a6b 100644 --- a/test/test_queue_spsc_locked_small.cpp +++ b/test/test_queue_spsc_locked_small.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/queue_spsc_locked.h" diff --git a/test/test_random.cpp b/test/test_random.cpp index 3c06473f..cc4beda7 100644 --- a/test/test_random.cpp +++ b/test/test_random.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include diff --git a/test/test_reference_flat_map.cpp b/test/test_reference_flat_map.cpp index 4eb80a6f..8ec03ec8 100644 --- a/test/test_reference_flat_map.cpp +++ b/test/test_reference_flat_map.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_reference_flat_multimap.cpp b/test/test_reference_flat_multimap.cpp index a260d189..27d2c398 100644 --- a/test/test_reference_flat_multimap.cpp +++ b/test/test_reference_flat_multimap.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_reference_flat_multiset.cpp b/test/test_reference_flat_multiset.cpp index bd920947..ce0ed254 100644 --- a/test/test_reference_flat_multiset.cpp +++ b/test/test_reference_flat_multiset.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_reference_flat_set.cpp b/test/test_reference_flat_set.cpp index c88321b3..62c33123 100644 --- a/test/test_reference_flat_set.cpp +++ b/test/test_reference_flat_set.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_scaled_rounding.cpp b/test/test_scaled_rounding.cpp index 25fb5036..54a0a148 100644 --- a/test/test_scaled_rounding.cpp +++ b/test/test_scaled_rounding.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/scaled_rounding.h" diff --git a/test/test_set.cpp b/test/test_set.cpp index 146336c8..52e472e6 100755 --- a/test/test_set.cpp +++ b/test/test_set.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_smallest.cpp b/test/test_smallest.cpp index b7a2837d..5ab89f9b 100644 --- a/test/test_smallest.cpp +++ b/test/test_smallest.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/smallest.h" @@ -43,13 +43,13 @@ namespace bool type; size = etl::smallest_type::size; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK_EQUAL(sizeof(char), size); CHECK(type); size = etl::smallest_type::size; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK_EQUAL(sizeof(char), size); CHECK(type); @@ -66,13 +66,13 @@ namespace struct S3 { int a; short b; char c; }; size = etl::smallest_type::size; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK_EQUAL(sizeof(S1), size); CHECK(type); size = etl::smallest_type::size; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK_EQUAL(sizeof(S1), size); CHECK(type); @@ -83,40 +83,40 @@ namespace { bool type; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); } @@ -125,40 +125,40 @@ namespace { bool type; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); } @@ -167,28 +167,28 @@ namespace { bool type; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); } @@ -197,49 +197,49 @@ namespace { bool type; - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); - type = etlstd::is_same::type>::value; + type = etl::is_same::type>::value; CHECK(type); } }; diff --git a/test/test_stack.cpp b/test/test_stack.cpp index 36adc066..2bdcf786 100644 --- a/test/test_stack.cpp +++ b/test/test_stack.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include diff --git a/test/test_state_chart.cpp b/test/test_state_chart.cpp index 504cf4e2..68e63e44 100644 --- a/test/test_state_chart.cpp +++ b/test/test_state_chart.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/state_chart.h" #include "etl/enum_type.h" diff --git a/test/test_string_char.cpp b/test/test_string_char.cpp index 46554b66..463e85b8 100644 --- a/test/test_string_char.cpp +++ b/test/test_string_char.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index 2ff190fd..fbde9bd0 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index 242126d9..171f9580 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_string_view.cpp b/test/test_string_view.cpp index 166bf5aa..c4bbe936 100644 --- a/test/test_string_view.cpp +++ b/test/test_string_view.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/string_view.h" #include "etl/cstring.h" diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index 7d69f943..36606bd7 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_task_scheduler.cpp b/test/test_task_scheduler.cpp index 08e83222..71980a45 100644 --- a/test/test_task_scheduler.cpp +++ b/test/test_task_scheduler.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_to_string.cpp b/test/test_to_string.cpp index 28202da5..9e4b94b6 100644 --- a/test/test_to_string.cpp +++ b/test/test_to_string.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_to_u16string.cpp b/test/test_to_u16string.cpp index 70cd385b..e69e5d1b 100644 --- a/test/test_to_u16string.cpp +++ b/test/test_to_u16string.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/to_u16string.h" #include "etl/u16string.h" diff --git a/test/test_to_u32string.cpp b/test/test_to_u32string.cpp index a6399c86..e9632b82 100644 --- a/test/test_to_u32string.cpp +++ b/test/test_to_u32string.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include diff --git a/test/test_to_wstring.cpp b/test/test_to_wstring.cpp index e10ea03a..aea23abf 100644 --- a/test/test_to_wstring.cpp +++ b/test/test_to_wstring.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_type_def.cpp b/test/test_type_def.cpp index 1f4b86ca..6beb4dde 100644 --- a/test/test_type_def.cpp +++ b/test/test_type_def.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include diff --git a/test/test_type_lookup.cpp b/test/test_type_lookup.cpp index fdad5378..b17353af 100644 --- a/test/test_type_lookup.cpp +++ b/test/test_type_lookup.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/type_lookup.h" @@ -117,41 +117,41 @@ namespace //************************************************************************* TEST(test_type_from_id_16) { - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); } //************************************************************************* TEST(test_type_from_id_8) { - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); } //************************************************************************* TEST(test_type_from_id_1) { - CHECK((etlstd::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); } //************************************************************************* @@ -251,41 +251,41 @@ namespace //************************************************************************* TEST(test_type_from_type_16) { - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); } //************************************************************************* TEST(test_type_from_type_8) { - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); - CHECK((etlstd::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); } //************************************************************************* TEST(test_type_from_type_1) { - CHECK((etlstd::is_same::type>::value)); + CHECK((etl::is_same::type>::value)); } }; } diff --git a/test/test_type_select.cpp b/test/test_type_select.cpp index 113dce3b..e0031645 100644 --- a/test/test_type_select.cpp +++ b/test/test_type_select.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/type_select.h" @@ -51,66 +51,66 @@ namespace //************************************************************************* TEST(test_type_select1) { - CHECK((etlstd::is_same, typename Types1::select<0>::type>::value)); - CHECK(!(etlstd::is_same, typename Types1::select<0>::type>::value)); + CHECK((etl::is_same, typename Types1::select<0>::type>::value)); + CHECK(!(etl::is_same, typename Types1::select<0>::type>::value)); } //************************************************************************* TEST(test_type_select8) { - CHECK((etlstd::is_same, typename Types8::select<0>::type>::value)); - CHECK(!(etlstd::is_same, typename Types8::select<0>::type>::value)); - CHECK((etlstd::is_same, typename Types8::select<1>::type>::value)); - CHECK(!(etlstd::is_same, typename Types8::select<1>::type>::value)); - CHECK((etlstd::is_same, typename Types8::select<2>::type>::value)); - CHECK(!(etlstd::is_same, typename Types8::select<2>::type>::value)); - CHECK((etlstd::is_same, typename Types8::select<3>::type>::value)); - CHECK(!(etlstd::is_same, typename Types8::select<3>::type>::value)); - CHECK((etlstd::is_same, typename Types8::select<4>::type>::value)); - CHECK(!(etlstd::is_same, typename Types8::select<4>::type>::value)); - CHECK((etlstd::is_same, typename Types8::select<5>::type>::value)); - CHECK(!(etlstd::is_same, typename Types8::select<5>::type>::value)); - CHECK((etlstd::is_same, typename Types8::select<6>::type>::value)); - CHECK(!(etlstd::is_same, typename Types8::select<6>::type>::value)); - CHECK((etlstd::is_same, typename Types8::select<7>::type>::value)); - CHECK(!(etlstd::is_same, typename Types8::select<7>::type>::value)); + CHECK((etl::is_same, typename Types8::select<0>::type>::value)); + CHECK(!(etl::is_same, typename Types8::select<0>::type>::value)); + CHECK((etl::is_same, typename Types8::select<1>::type>::value)); + CHECK(!(etl::is_same, typename Types8::select<1>::type>::value)); + CHECK((etl::is_same, typename Types8::select<2>::type>::value)); + CHECK(!(etl::is_same, typename Types8::select<2>::type>::value)); + CHECK((etl::is_same, typename Types8::select<3>::type>::value)); + CHECK(!(etl::is_same, typename Types8::select<3>::type>::value)); + CHECK((etl::is_same, typename Types8::select<4>::type>::value)); + CHECK(!(etl::is_same, typename Types8::select<4>::type>::value)); + CHECK((etl::is_same, typename Types8::select<5>::type>::value)); + CHECK(!(etl::is_same, typename Types8::select<5>::type>::value)); + CHECK((etl::is_same, typename Types8::select<6>::type>::value)); + CHECK(!(etl::is_same, typename Types8::select<6>::type>::value)); + CHECK((etl::is_same, typename Types8::select<7>::type>::value)); + CHECK(!(etl::is_same, typename Types8::select<7>::type>::value)); } //************************************************************************* TEST(test_type_select16) { - CHECK((etlstd::is_same, typename Types16::select<0>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<0>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<1>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<1>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<2>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<2>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<3>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<3>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<4>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<4>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<5>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<5>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<6>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<6>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<7>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<7>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<8>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<8>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<9>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<9>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<10>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<10>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<11>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<11>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<12>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<12>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<13>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<13>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<14>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<14>::type>::value)); - CHECK((etlstd::is_same, typename Types16::select<15>::type>::value)); - CHECK(!(etlstd::is_same, typename Types16::select<15>::type>::value)); + CHECK((etl::is_same, typename Types16::select<0>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<0>::type>::value)); + CHECK((etl::is_same, typename Types16::select<1>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<1>::type>::value)); + CHECK((etl::is_same, typename Types16::select<2>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<2>::type>::value)); + CHECK((etl::is_same, typename Types16::select<3>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<3>::type>::value)); + CHECK((etl::is_same, typename Types16::select<4>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<4>::type>::value)); + CHECK((etl::is_same, typename Types16::select<5>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<5>::type>::value)); + CHECK((etl::is_same, typename Types16::select<6>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<6>::type>::value)); + CHECK((etl::is_same, typename Types16::select<7>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<7>::type>::value)); + CHECK((etl::is_same, typename Types16::select<8>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<8>::type>::value)); + CHECK((etl::is_same, typename Types16::select<9>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<9>::type>::value)); + CHECK((etl::is_same, typename Types16::select<10>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<10>::type>::value)); + CHECK((etl::is_same, typename Types16::select<11>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<11>::type>::value)); + CHECK((etl::is_same, typename Types16::select<12>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<12>::type>::value)); + CHECK((etl::is_same, typename Types16::select<13>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<13>::type>::value)); + CHECK((etl::is_same, typename Types16::select<14>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<14>::type>::value)); + CHECK((etl::is_same, typename Types16::select<15>::type>::value)); + CHECK(!(etl::is_same, typename Types16::select<15>::type>::value)); } }; } diff --git a/test/test_type_traits.cpp b/test/test_type_traits.cpp new file mode 100644 index 00000000..3c718dae --- /dev/null +++ b/test/test_type_traits.cpp @@ -0,0 +1,783 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +http://www.etlcpp.com + +Copyright(c) 2014 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. +******************************************************************************/ + +#include "UnitTest++/UnitTest++.h" + +#include "etl/type_traits.h" +#include + +namespace +{ + struct TestData { }; +} + +namespace etl +{ + template <> + struct size_of : integral_constant {}; +} + +namespace +{ + // A class to test non-fundamental types. + struct Test + { + int a; + }; + + // A class to test etl::is_one_of + template + struct Type + { + }; + + SUITE(test_type_traits) + { + //************************************************************************* + TEST(test_is_integral) + { + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + CHECK(etl::is_integral::value == std::is_integral::value); + } + + //************************************************************************* + TEST(test_is_signed) + { + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + CHECK(etl::is_signed::value == std::is_signed::value); + } + + //************************************************************************* + TEST(test_is_unsigned) + { + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + CHECK(etl::is_unsigned::value == std::is_unsigned::value); + } + + //************************************************************************* + TEST(test_is_floating_point) + { + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_floating_point::value); + CHECK(etl::is_floating_point::value == std::is_signed::value); + } + + //************************************************************************* + TEST(test_is_pointer) + { + CHECK(etl::is_pointer::value == std::is_pointer::value); + CHECK(etl::is_pointer::value == std::is_pointer::value); + CHECK(etl::is_pointer::value == std::is_pointer::value); + CHECK(etl::is_pointer::value == std::is_pointer::value); + CHECK(etl::is_pointer::value == std::is_pointer::value); + } + + //************************************************************************* + TEST(test_is_reference) + { + CHECK(etl::is_reference::value == std::is_reference::value); + CHECK(etl::is_reference::value == std::is_reference::value); + CHECK(etl::is_reference::value == std::is_reference::value); + CHECK(etl::is_reference::value == std::is_reference::value); + CHECK(etl::is_reference::value == std::is_reference::value); + } + + //************************************************************************* + TEST(test_is_same) + { + CHECK((etl::is_same::value == etl::is_same::value)); + CHECK((etl::is_same::value == etl::is_same::value)); + } + + //************************************************************************* + TEST(test_is_array) + { + CHECK(etl::is_array::value == std::is_array::value); + CHECK(etl::is_array::value == std::is_array::value); + } + + //************************************************************************* + TEST(test_remove_pointer) + { + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + CHECK((etl::is_same::type, std::remove_pointer::type>::value)); + } + + //************************************************************************* + TEST(test_add_pointer) + { + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + CHECK((etl::is_same::type, std::add_pointer::type>::value)); + + } + + //************************************************************************* + TEST(test_remove_reference) + { + CHECK((etl::is_same::type, std::remove_reference::type>::value)); + CHECK((etl::is_same::type, std::remove_reference::type>::value)); + CHECK((etl::is_same::type, std::remove_reference::type>::value)); + CHECK((etl::is_same::type, std::remove_reference::type>::value)); + CHECK((etl::is_same::type, std::remove_reference::type>::value)); + } + + //************************************************************************* + TEST(test_remove_const) + { + CHECK((etl::is_same::type, std::remove_const::type>::value)); + CHECK((etl::is_same::type, std::remove_const::type>::value)); + CHECK((etl::is_same::type, std::remove_const::type>::value)); + } + + //************************************************************************* + TEST(test_add_const) + { + CHECK((etl::is_same::type, std::add_const::type>::value)); + CHECK((etl::is_same::type, std::add_const::type>::value)); + CHECK((etl::is_same::type, std::add_const::type>::value)); + } + + //************************************************************************* + TEST(test_is_const) + { + CHECK(etl::is_const::value == std::is_const::value); + CHECK(etl::is_const::value == std::is_const::value); + CHECK(etl::is_const::value == std::is_const::value); + } + + //************************************************************************* + TEST(test_is_volatile) + { + CHECK(etl::is_volatile::value == std::is_volatile::value); + CHECK(etl::is_volatile::value == std::is_volatile::value); + CHECK(etl::is_volatile::value == std::is_volatile::value); + } + + //************************************************************************* + TEST(test_remove_volatile) + { + CHECK((etl::is_same::type, std::remove_volatile::type>::value)); + CHECK((etl::is_same::type, std::remove_volatile::type>::value)); + CHECK((etl::is_same::type, std::remove_volatile::type>::value)); + } + + //************************************************************************* + TEST(test_add_volatile) + { + CHECK((etl::is_same::type, std::add_volatile::type>::value)); + CHECK((etl::is_same::type, std::add_volatile::type>::value)); + CHECK((etl::is_same::type, std::add_volatile::type>::value)); + } + + //************************************************************************* + TEST(test_remove_cv) + { + CHECK((etl::is_same::type, std::remove_cv::type>::value)); + CHECK((etl::is_same::type, std::remove_cv::type>::value)); + CHECK((etl::is_same::type, std::remove_cv::type>::value)); + CHECK((etl::is_same::type, std::remove_cv::type>::value)); + } + + //************************************************************************* + TEST(test_add_cv) + { + + typedef etl::add_cv::type t1; + typedef std::add_cv::type t2; + + bool pass = etl::is_same::value; + //etl::is_same::type, std::add_cv::type>::value; + + CHECK(pass); + CHECK((etl::is_same::type, std::add_cv::type>::value)); + CHECK((etl::is_same::type, std::add_cv::type>::value)); + CHECK((etl::is_same::type, std::add_cv::type>::value)); + } + + //************************************************************************* + TEST(test_is_arithmetic) + { + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + CHECK(etl::is_arithmetic::value == std::is_arithmetic::value); + } + + //************************************************************************* + TEST(test_is_fundamental) + { + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + CHECK(etl::is_fundamental::value == std::is_fundamental::value); + } + + //************************************************************************* + TEST(test_is_compound) + { + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + CHECK(etl::is_compound::value == std::is_compound::value); + } + + //************************************************************************* + TEST(test_is_void) + { + CHECK(etl::is_void::value == std::is_void::value); + CHECK(etl::is_void::value == std::is_void::value); + } + + //************************************************************************* + TEST(test_make_signed) + { + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK(etl::is_signed::type>::value && (sizeof(wchar_t) == sizeof(etl::make_signed::type))); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + CHECK((etl::is_same::type, std::make_signed::type>::value)); + } + + //************************************************************************* + TEST(test_make_unsigned) + { + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK(etl::is_unsigned::type>::value && (sizeof(wchar_t) == sizeof(etl::make_unsigned::type))); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + CHECK((etl::is_same::type, std::make_unsigned::type>::value)); + } + + //************************************************************************* + TEST(test_extent) + { + CHECK(std::extent::value == etl::extent::value); + CHECK(std::extent::value == etl::extent::value); + CHECK(std::extent::value == etl::extent::value); + } + + //************************************************************************* + TEST(test_remove_extent) + { + CHECK((etl::is_same::type, std::remove_extent::type>::value)); + CHECK((etl::is_same::type, std::remove_extent::type>::value)); + CHECK((etl::is_same::type, std::remove_extent::type>::value)); + } + + //************************************************************************* + TEST(test_remove_all_extents) + { + CHECK((etl::is_same::type, std::remove_all_extents::type>::value)); + CHECK((etl::is_same::type, std::remove_all_extents::type>::value)); + CHECK((etl::is_same::type, std::remove_all_extents::type>::value)); + } + + //************************************************************************* + TEST(test_rank) + { + CHECK(etl::rank::value == std::rank::value); + CHECK(etl::rank::value == std::rank::value); + CHECK(etl::rank::value == std::rank::value); + } + + //************************************************************************* + TEST(test_alignment_of) + { + struct Test + { + int a; + char b; + float c; + }; + + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + CHECK(std::alignment_of::value == etl::alignment_of::value); + } + + //************************************************************************* + TEST(test_is_one_of) + { + typedef Type<0> T0; + typedef Type<1> T1; + typedef Type<2> T2; + typedef Type<3> T3; + typedef Type<4> T4; + + CHECK(bool(etl::is_one_of::value)); + CHECK(!(etl::is_one_of::value)); + + CHECK(bool(etl::is_one_of::value)); + CHECK(!(etl::is_one_of::value)); + + CHECK(bool(etl::is_one_of::value)); + CHECK(!(etl::is_one_of::value)); + + CHECK(bool(etl::is_one_of::value)); + CHECK(!(etl::is_one_of::value)); + + CHECK(bool(etl::is_one_of::value)); + CHECK(!(etl::is_one_of::value)); + + CHECK(bool(etl::is_one_of::value)); + CHECK(bool(etl::is_one_of::value)); + CHECK(bool(etl::is_one_of::value)); + CHECK(bool(etl::is_one_of::value)); + CHECK(bool(etl::is_one_of::value)); + CHECK(!(etl::is_one_of::value)); + } + + //************************************************************************* + TEST(test_is_base_of) + { + struct A { }; + struct B : public A { }; + struct C { }; + + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + CHECK((std::is_base_of::value) == (etl::is_base_of::value)); + } + + //************************************************************************* + TEST(test_types) + { + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + + CHECK((etl::is_same::type>::value)); + CHECK((etl::is_same::reference>::value)); + CHECK((etl::is_same::const_reference>::value)); + CHECK((etl::is_same::pointer>::value)); + CHECK((etl::is_same::const_pointer>::value)); + CHECK((etl::is_same::const_pointer_const>::value)); + } + }; + + //************************************************************************* + TEST(conditional_integral_constant) + { + int v1 = etl::conditional_integral_constant::value; + int v2 = etl::conditional_integral_constant::value; + + CHECK_EQUAL(1, v1); + CHECK_EQUAL(2, v2); + } + + //************************************************************************* + TEST(size_of) + { + CHECK_EQUAL(1, etl::size_of::value); + CHECK_EQUAL(1, etl::size_of::value); + CHECK_EQUAL(2, etl::size_of::value); + CHECK_EQUAL(4, etl::size_of::value); + CHECK_EQUAL(20, etl::size_of::value); + + CHECK_EQUAL(1, etl::size_of_v); + CHECK_EQUAL(1, etl::size_of_v); + CHECK_EQUAL(2, etl::size_of_v); + CHECK_EQUAL(4, etl::size_of_v); + CHECK_EQUAL(20, etl::size_of_v); + } + + //************************************************************************* + TEST(is_convertible) + { + CHECK((etl::is_convertible::value)); + CHECK((etl::is_convertible::value)); + CHECK((etl::is_convertible::value)); + CHECK((etl::is_convertible::value)); + CHECK((etl::is_convertible::value)); + CHECK((etl::is_convertible::value)); + CHECK((etl::is_convertible::value)); + CHECK(!(etl::is_convertible::value)); + CHECK(!(etl::is_convertible::value)); + CHECK(!(etl::is_convertible::value)); + CHECK(!(etl::is_convertible::value)); + } + + //************************************************************************* + TEST(add_lvalue_reference) + { + CHECK(!std::is_lvalue_reference_v::type>); + CHECK(std::is_lvalue_reference_v::type>); + CHECK(std::is_lvalue_reference_v::type>); + CHECK(std::is_lvalue_reference_v::type>); + CHECK(std::is_lvalue_reference_v::type>); + } + + //************************************************************************* + TEST(add_rvalue_reference) + { + CHECK(!std::is_rvalue_reference_v::type>); + CHECK(std::is_rvalue_reference_v::type>); + CHECK(std::is_rvalue_reference_v::type>); + CHECK(!std::is_rvalue_reference_v::type>); + CHECK(std::is_rvalue_reference_v::type>); + } + + //************************************************************************* + TEST(is_lvalue_reference) + { + CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); + CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); + CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); + CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); + CHECK_EQUAL(std::is_lvalue_reference_v, etl::is_lvalue_reference_v); + } +} diff --git a/test/test_unordered_map.cpp b/test/test_unordered_map.cpp index 0df2c4fd..5feb9aaa 100644 --- a/test/test_unordered_map.cpp +++ b/test/test_unordered_map.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include @@ -444,7 +444,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - CHECK_THROW(data.insert(ETL_MAKE_PAIR(K10, N10)), etl::unordered_map_full); + CHECK_THROW(data.insert(ETL_OR_STD::make_pair(K10, N10)), etl::unordered_map_full); } //************************************************************************* diff --git a/test/test_unordered_multimap.cpp b/test/test_unordered_multimap.cpp index 9173dfba..66031f50 100644 --- a/test/test_unordered_multimap.cpp +++ b/test/test_unordered_multimap.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include @@ -350,7 +350,7 @@ namespace { DataNDC data(initial_data.begin(), initial_data.end()); - CHECK_THROW(data.insert(ETL_MAKE_PAIR(K10, N10)), etl::unordered_multimap_full); + CHECK_THROW(data.insert(ETL_OR_STD::make_pair(K10, N10)), etl::unordered_multimap_full); } //************************************************************************* @@ -620,10 +620,10 @@ namespace { etl::unordered_multimap map; - map.insert(ETL_MAKE_PAIR(1, 'b')); - map.insert(ETL_MAKE_PAIR(2, 'c')); - map.insert(ETL_MAKE_PAIR(3, 'd')); - map.insert(ETL_MAKE_PAIR(4, 'e')); + map.insert(ETL_OR_STD::make_pair(1, 'b')); + map.insert(ETL_OR_STD::make_pair(2, 'c')); + map.insert(ETL_OR_STD::make_pair(3, 'd')); + map.insert(ETL_OR_STD::make_pair(4, 'e')); auto it = map.find(1); map.erase(it); diff --git a/test/test_unordered_multiset.cpp b/test/test_unordered_multiset.cpp index 83534f0c..d320801a 100644 --- a/test/test_unordered_multiset.cpp +++ b/test/test_unordered_multiset.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_unordered_set.cpp b/test/test_unordered_set.cpp index 4ef47cd7..031006d5 100644 --- a/test/test_unordered_set.cpp +++ b/test/test_unordered_set.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_user_type.cpp b/test/test_user_type.cpp index c7eb5a6d..4eabd342 100644 --- a/test/test_user_type.cpp +++ b/test/test_user_type.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include "etl/user_type.h" diff --git a/test/test_utility.cpp b/test/test_utility.cpp index f85f4969..7b367842 100644 --- a/test/test_utility.cpp +++ b/test/test_utility.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/utility.h" @@ -50,6 +50,108 @@ namespace { SUITE(test_utility) { + //************************************************************************* + TEST(pair_default_construct) + { + etl::pair p1; + + CHECK_EQUAL(int(), p1.first); + CHECK_EQUAL(double(), p1.second); + } + + //************************************************************************* + TEST(test_pair_construct) + { + etl::pair p1(1, 2.3); + + CHECK_EQUAL(1, p1.first); + CHECK_EQUAL(2.3, p1.second); + } + + //************************************************************************* + TEST(test_pair_copy_construct) + { + etl::pair p1(1, 2.3); + etl::pair p2(p1); + + CHECK_EQUAL(p1.first, p2.first); + CHECK_EQUAL(p1.second, p2.second); + } + + //************************************************************************* + TEST(test_pair_copy_construct_alternate) + { + etl::pair p1(1, 2.3f); + etl::pair p2(p1); + + CHECK_EQUAL(p1.first, p2.first); + CHECK_EQUAL(p1.second, p2.second); + } + + //************************************************************************* + TEST(test_make_pair) + { + etl::pair p1(1, 2.3); + etl::pair p2; + p2 = etl::make_pair(1, 2.3); + + CHECK_EQUAL(p1.first, p2.first); + CHECK_EQUAL(p1.second, p2.second); + } + + //************************************************************************* + TEST(test_pair_swap_member) + { + etl::pair p1(1, 2.3); + etl::pair p2(2, 3.4); + + p1.swap(p2); + + CHECK_EQUAL(2, p1.first); + CHECK_EQUAL(3.4, p1.second); + + CHECK_EQUAL(1, p2.first); + CHECK_EQUAL(2.3, p2.second); + } + + //************************************************************************* + TEST(test_pair_swap_global) + { + etl::pair p1(1, 2.3); + etl::pair p2(2, 3.4); + + swap(p1, p2); + + CHECK_EQUAL(2, p1.first); + CHECK_EQUAL(3.4, p1.second); + + CHECK_EQUAL(1, p2.first); + CHECK_EQUAL(2.3, p2.second); + } + + //************************************************************************* + TEST(test_pair_conditional) + { + etl::pair p1(1, 2.3); + etl::pair p2(1, 2.3); + etl::pair p3(2, 3.4); + + CHECK(p1 == p2); + CHECK(!(p1 == p3)); + CHECK(p1 != p3); + CHECK(!(p1 != p2)); + CHECK(p1 <= p2); + CHECK(p1 <= p3); + CHECK(!(p1 < p2)); + CHECK(p1 < p3); + CHECK(!(p3 < p1)); + CHECK(p1 >= p2); + CHECK(!(p1 >= p3)); + CHECK(!(p1 > p2)); + CHECK(!(p1 > p3)); + CHECK(p3 > p1); + } + //************************************************************************* TEST(test_exchange) { @@ -78,10 +180,10 @@ namespace TEST(test_as_const) { std::string text = "Hello World!"; - + nonConstCalled = false; constCalled = false; - + TestText(text); CHECK(nonConstCalled); diff --git a/test/test_variant.cpp b/test/test_variant.cpp index 5ef05e8d..2d68655c 100644 --- a/test/test_variant.cpp +++ b/test/test_variant.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/variant.h" @@ -216,10 +216,10 @@ namespace static test_variant_c c(3); static test_variant_d d(4.5); - CHECK((uintptr_t(&a.get()) % uintptr_t(etlstd::alignment_of::value)) == 0); - CHECK((uintptr_t(&b.get()) % uintptr_t(etlstd::alignment_of::value)) == 0); - CHECK((uintptr_t(&c.get()) % uintptr_t(etlstd::alignment_of::value)) == 0); - CHECK((uintptr_t(&d.get()) % uintptr_t(etlstd::alignment_of::value)) == 0); + CHECK((uintptr_t(&a.get()) % uintptr_t(etl::alignment_of::value)) == 0); + CHECK((uintptr_t(&b.get()) % uintptr_t(etl::alignment_of::value)) == 0); + CHECK((uintptr_t(&c.get()) % uintptr_t(etl::alignment_of::value)) == 0); + CHECK((uintptr_t(&d.get()) % uintptr_t(etl::alignment_of::value)) == 0); } //************************************************************************* diff --git a/test/test_variant_pool.cpp b/test/test_variant_pool.cpp index 65a5bc4b..9bee8c63 100644 --- a/test/test_variant_pool.cpp +++ b/test/test_variant_pool.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "ExtraCheckMacros.h" #include "etl/variant_pool.h" diff --git a/test/test_vector.cpp b/test/test_vector.cpp index fea56ac3..8f1fb019 100644 --- a/test/test_vector.cpp +++ b/test/test_vector.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_vector_external_buffer.cpp b/test/test_vector_external_buffer.cpp index 36535df2..cae90745 100644 --- a/test/test_vector_external_buffer.cpp +++ b/test/test_vector_external_buffer.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_vector_non_trivial.cpp b/test/test_vector_non_trivial.cpp index 3d6a8bac..bab37793 100644 --- a/test/test_vector_non_trivial.cpp +++ b/test/test_vector_non_trivial.cpp @@ -26,7 +26,7 @@ //SOFTWARE. //******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_vector_pointer.cpp b/test/test_vector_pointer.cpp index d823e2c1..21069b71 100644 --- a/test/test_vector_pointer.cpp +++ b/test/test_vector_pointer.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_vector_pointer_external_buffer.cpp b/test/test_vector_pointer_external_buffer.cpp index 630db121..024dd555 100644 --- a/test/test_vector_pointer_external_buffer.cpp +++ b/test/test_vector_pointer_external_buffer.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_visitor.cpp b/test/test_visitor.cpp index 38261b74..2c118ee0 100644 --- a/test/test_visitor.cpp +++ b/test/test_visitor.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include "etl/visitor.h" diff --git a/test/test_xor_checksum.cpp b/test/test_xor_checksum.cpp index ef499bcf..225588f6 100644 --- a/test/test_xor_checksum.cpp +++ b/test/test_xor_checksum.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/test_xor_rotate_checksum.cpp b/test/test_xor_rotate_checksum.cpp index 8a40f827..bbfc9936 100644 --- a/test/test_xor_rotate_checksum.cpp +++ b/test/test_xor_rotate_checksum.cpp @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************************/ -#include "UnitTest++.h" +#include "UnitTest++/UnitTest++.h" #include #include diff --git a/test/vs2017/.vs/etl/v15/.gitignore b/test/vs2017/.vs/etl/v15/.gitignore deleted file mode 100644 index 83235bb7..00000000 --- a/test/vs2017/.vs/etl/v15/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.VC.opendb diff --git a/test/vs2017/Debug LLVM/.gitignore b/test/vs2017/Debug LLVM/.gitignore deleted file mode 100644 index 998d6c2d..00000000 --- a/test/vs2017/Debug LLVM/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/random_clcg.csv -/random_hash.csv -/random_lcg.csv -/random_lsfr.csv -/random_mwc.csv -/random_pcg.csv -/random_xorshift.csv diff --git a/test/vs2017/Debug No Unit Tests/.gitignore b/test/vs2017/Debug No Unit Tests/.gitignore deleted file mode 100644 index 829cc2ea..00000000 --- a/test/vs2017/Debug No Unit Tests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.idb diff --git a/test/vs2017/Debug No Unit Tests/etl.tlog/.gitignore b/test/vs2017/Debug No Unit Tests/etl.tlog/.gitignore deleted file mode 100644 index f62d94a3..00000000 --- a/test/vs2017/Debug No Unit Tests/etl.tlog/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.1.tlog diff --git a/test/vs2017/cpp.hint b/test/vs2017/cpp.hint index 507337f7..f90cc3ba 100644 --- a/test/vs2017/cpp.hint +++ b/test/vs2017/cpp.hint @@ -2,7 +2,17 @@ // such as names of functions and macros. // For more information see https://go.microsoft.com/fwlink/?linkid=865984 #define ETL_CONSTEXPR -#define ETL_CONSTEXPR_IF +#define ETL_CONSTEXPR17 +#define ETL_IF_CONSTEXPR #define ETL_DELETE #define ETL_NOEXCEPT #define ETL_NOEXCEPT_EXPR +#define ETL_NODISCARD +#define ETL_ERROR_TEXT +#define ETL_ASSERT +#define ETL_ERROR +#define ETL_VERBOSE_ERRORS +#define ETL_FILE +#define ETL_CPP11_SUPPORTED +#define ETL_CPP14_SUPPORTED +#define ETL_CPP17_SUPPORTED \ No newline at end of file diff --git a/test/vs2017/etl.sln b/test/vs2017/etl.sln index d3579259..b6464410 100644 --- a/test/vs2017/etl.sln +++ b/test/vs2017/etl.sln @@ -13,6 +13,8 @@ Global Debug LLVM No STL|x64 = Debug LLVM No STL|x64 Debug LLVM|Win32 = Debug LLVM|Win32 Debug LLVM|x64 = Debug LLVM|x64 + Debug No STL - Force No Advanced|Win32 = Debug No STL - Force No Advanced|Win32 + Debug No STL - Force No Advanced|x64 = Debug No STL - Force No Advanced|x64 Debug No STL|Win32 = Debug No STL|Win32 Debug No STL|x64 = Debug No STL|x64 Debug No Unit Tests|Win32 = Debug No Unit Tests|Win32 @@ -35,6 +37,10 @@ Global {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|Win32.Build.0 = Debug LLVM|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|x64.ActiveCfg = Debug LLVM|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug LLVM|x64.Build.0 = Debug LLVM|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No STL - Force No Advanced|Win32.ActiveCfg = DebugNoSTLForceNoAdvanced|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No STL - Force No Advanced|Win32.Build.0 = DebugNoSTLForceNoAdvanced|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No STL - Force No Advanced|x64.ActiveCfg = DebugNoSTLForceNoAdvanced|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No STL - Force No Advanced|x64.Build.0 = DebugNoSTLForceNoAdvanced|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No STL|Win32.ActiveCfg = DebugNoSTL|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No STL|Win32.Build.0 = DebugNoSTL|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug No STL|x64.ActiveCfg = DebugNoSTL|x64 diff --git a/test/vs2017/etl.vcxproj b/test/vs2017/etl.vcxproj index 1ae168b8..39cf47c1 100644 --- a/test/vs2017/etl.vcxproj +++ b/test/vs2017/etl.vcxproj @@ -41,6 +41,14 @@ DebugLLVMNoSTL x64 + + DebugNoSTLForceNoAdvanced + Win32 + + + DebugNoSTLForceNoAdvanced + x64 + DebugNoSTL Win32 @@ -86,6 +94,12 @@ v141 Unicode + + Application + true + v141 + Unicode + Application true @@ -116,6 +130,12 @@ v141 Unicode + + Application + true + v141 + Unicode + Application true @@ -181,6 +201,9 @@ + + + @@ -196,6 +219,9 @@ + + + @@ -234,6 +260,11 @@ true \$(IntDir) + + true + true + \$(IntDir) + false true @@ -257,6 +288,10 @@ true true + + true + true + true true @@ -301,7 +336,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../../unittest-cpp/UnitTest++/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../include/etl/c;../../test false @@ -322,7 +357,28 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;%(PreprocessorDefinitions) - ../../../unittest-cpp/UnitTest++/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../include/etl/c;../../test + + + false + stdcpp17 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;ETL_FORCE_NO_ADVANCED_CPP;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../include/etl/c;../../test false @@ -343,7 +399,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;__clang__;%(PreprocessorDefinitions) - ../../../unittest-cpp/UnitTest++/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../include/etl/c;../../test false @@ -367,7 +423,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_NO_STL;__clang__;%(PreprocessorDefinitions) - ../../../unittest-cpp/UnitTest++/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../include/etl/c;../../test false @@ -415,7 +471,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../../unittest-cpp/UnitTest++/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../include/etl/c;../../test false @@ -474,6 +530,27 @@ $(OutDir)\etl.exe + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../include/etl/c;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + @@ -544,7 +621,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../../unittest-cpp\UnitTest++;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../include/etl/c;../../test false @@ -586,7 +663,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../../unittest-cpp/UnitTest++/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../include/etl/c;../../test stdcpp17 @@ -629,7 +706,7 @@ true true WIN32;NDEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../unittest-cpp/UnitTest++/;../../src + ../../unittest-cpp/;../../src false @@ -737,8 +814,6 @@ - - @@ -913,7 +988,7 @@ - + @@ -946,16 +1021,11 @@ - - - - - - + @@ -986,12 +1056,14 @@ false false false + false false false false false false false + false false false false @@ -1017,12 +1089,14 @@ false false false + false false false false false false false + false false false false @@ -1043,12 +1117,14 @@ false false false + false false false false false false false + false false false false @@ -1059,12 +1135,14 @@ false false false + false false false false false false false + false false false false @@ -1075,12 +1153,14 @@ false false false + false false false false false false false + false false false false @@ -1091,12 +1171,14 @@ false false false + false false false false false false false + false false false false @@ -1107,12 +1189,14 @@ false false false + false false false false false false false + false false false false @@ -1128,12 +1212,14 @@ false false false + false false false false false false false + false false false false @@ -1148,12 +1234,14 @@ false false false + false false false false false false false + false false false false @@ -1168,18 +1256,19 @@ - false false false + false false false false false false false + false false false false @@ -1233,6 +1322,7 @@ + diff --git a/test/vs2017/etl.vcxproj.filters b/test/vs2017/etl.vcxproj.filters index 5cd061a2..9b6c35e4 100644 --- a/test/vs2017/etl.vcxproj.filters +++ b/test/vs2017/etl.vcxproj.filters @@ -630,9 +630,6 @@ ETL\Maths - - Source Files - ETL\Utilities\Atomic @@ -756,12 +753,6 @@ ETL\Containers - - ETL\Private - - - ETL\Private - ETL\Private @@ -825,6 +816,9 @@ ETL\Utilities + + Source Files + @@ -1271,25 +1265,10 @@ Source Files - + Source Files - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - + Source Files @@ -1330,13 +1309,15 @@ Resource Files\Generators - Resource Files Resource Files + + Resource Files + From f54563ef071b72adf7dccefb1d0233ae982e1052 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 10 Jan 2020 13:27:05 +0000 Subject: [PATCH 5/6] Added use of C++11's 'alignof' keyword in 'alignment_of', if available --- include/etl/type_traits.h | 14 ++++++++------ include/etl/type_traits_generator.h | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 617b2f75..f1fdbc58 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -718,7 +718,9 @@ namespace etl //*************************************************************************** /// Alignment templates. /// These require compiler specific intrinsics. -#ifdef ETL_COMPILER_MICROSOFT +#if ETL_CPP11_SUPPORTED + template struct alignment_of : integral_constant { }; +#elif ETL_COMPILER_MICROSOFT template struct alignment_of : integral_constant {}; #elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI) template struct alignment_of : integral_constant {}; @@ -1304,7 +1306,7 @@ namespace etl struct is_one_of { static const bool value = etl::is_same::value || - etl::is_one_of::value; + etl::is_one_of::value; }; template @@ -1317,13 +1319,13 @@ namespace etl /// Template to determine if a type is one of a specified list. ///\ingroup types template struct is_one_of { - static const bool value = + static const bool value = etlstd::is_same::value || etlstd::is_same::value || etlstd::is_same::value || diff --git a/include/etl/type_traits_generator.h b/include/etl/type_traits_generator.h index 78a42254..e1ebc66b 100644 --- a/include/etl/type_traits_generator.h +++ b/include/etl/type_traits_generator.h @@ -730,7 +730,9 @@ namespace etl //*************************************************************************** /// Alignment templates. /// These require compiler specific intrinsics. -#ifdef ETL_COMPILER_MICROSOFT +#if ETL_CPP11_SUPPORTED + template struct alignment_of : integral_constant { }; +#elif ETL_COMPILER_MICROSOFT template struct alignment_of : integral_constant {}; #elif defined(ETL_COMPILER_IAR) || defined(ETL_COMPILER_TI) template struct alignment_of : integral_constant {}; From 6ad77153be4033f18241b82154c591b745f895bf Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 10 Jan 2020 14:01:33 +0000 Subject: [PATCH 6/6] Final changes --- include/etl/algorithm.h | 28 +- include/etl/limits.h | 1336 +++++++------------------------------ include/etl/version.h | 4 +- library.json | 2 +- library.properties | 2 +- support/Release notes.txt | 8 + test/test_limits.cpp | 1073 +++++++++++++++-------------- test/vs2017/etl.vcxproj | 8 +- 8 files changed, 785 insertions(+), 1676 deletions(-) diff --git a/include/etl/algorithm.h b/include/etl/algorithm.h index 7d6797ab..a9960120 100644 --- a/include/etl/algorithm.h +++ b/include/etl/algorithm.h @@ -2316,7 +2316,7 @@ namespace etl return function; } - //*************************************************************************** + //*************************************************************************** /// Like std::for_each but for 'n' iterations. ///\ingroup algorithm //*************************************************************************** @@ -2551,12 +2551,12 @@ namespace etl typename TUnaryFunctionTrue, typename TUnaryFunctionFalse, typename TUnaryPredicate> ETL_OR_STD::pair partition_transform(TSource begin, - TSource end, - TDestinationTrue destination_true, - TDestinationFalse destination_false, - TUnaryFunctionTrue function_true, - TUnaryFunctionFalse function_false, - TUnaryPredicate predicate) + TSource end, + TDestinationTrue destination_true, + TDestinationFalse destination_false, + TUnaryFunctionTrue function_true, + TUnaryFunctionFalse function_false, + TUnaryPredicate predicate) { while (begin != end) { @@ -2586,13 +2586,13 @@ namespace etl typename TBinaryFunctionFalse, typename TBinaryPredicate> ETL_OR_STD::pair partition_transform(TSource1 begin1, - TSource1 end1, - TSource2 begin2, - TDestinationTrue destination_true, - TDestinationFalse destination_false, - TBinaryFunctionTrue function_true, - TBinaryFunctionFalse function_false, - TBinaryPredicate predicate) + TSource1 end1, + TSource2 begin2, + TDestinationTrue destination_true, + TDestinationFalse destination_false, + TBinaryFunctionTrue function_true, + TBinaryFunctionFalse function_false, + TBinaryPredicate predicate) { while (begin1 != end1) { diff --git a/include/etl/limits.h b/include/etl/limits.h index a934e292..7e033dd2 100644 --- a/include/etl/limits.h +++ b/include/etl/limits.h @@ -31,17 +31,18 @@ SOFTWARE. #ifndef ETL_LIMITS_INCLUDED #define ETL_LIMITS_INCLUDED -#include "platform.h" -#include "type_traits.h" -#include "char_traits.h" -#include "integral_limits.h" +#include "etl/platform.h" +#include "etl/type_traits.h" +#include "etl/char_traits.h" +#include "etl/integral_limits.h" #include #include #include +#include #if defined(ETL_NO_STL) -#define ETL_LOG2(x) (((x) * 301) / 1000) +#define ETL_LOG10_OF_2(x) (((x) * 301) / 1000) namespace etl { @@ -61,6 +62,55 @@ namespace etl denorm_present = 1 }; + class etl_integral_limits + { + public: + + static const bool is_specialized = true; + static const bool is_integer = true; + static const bool is_exact = true; + static const int max_digits10 = 0; + static const int radix = 2; + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const bool has_denorm_loss = false; + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool traps = false; + static const bool tinyness_before = false; + static const float_denorm_style has_denorm = denorm_absent; + static const float_round_style round_style = round_toward_zero; + }; + + class etl_floating_point_limits + { + public: + + static const bool is_specialized = true; + static const bool is_signed = true; + static const bool is_integer = false; + static const bool is_exact = false; + static const int radix = 2; + static const bool has_infinity = true; + static const bool has_quiet_NaN = true; + static const bool has_signaling_NaN = true; + static const bool has_denorm_loss = false; + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = false; + static const bool traps = false; + static const bool tinyness_before = false; + static const float_denorm_style has_denorm = denorm_indeterminate; + static const float_round_style round_style = round_indeterminate; + + static const float round_error() { return float(0.5); } + }; + //*************************************************************************** // Default template @@ -78,1174 +128,371 @@ namespace etl //*************************************************************************** // bool template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const int digits = 1; - static const int digits10 = 0; - static const int max_digits10 = 0; - + static const int digits = 1; + static const int digits10 = 0; static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const bool epsilon() { return false; } - static const bool round_error() { return false; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const bool infinity() { return false; } - static const bool quiet_NaN() { return false; } - static const bool signaling_NaN() { return false; } - static const bool denorm_min() { return false; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; static const bool is_modulo = false; - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - static const bool min() { return false; } static const bool max() { return true; } static const bool lowest() { return false; } + static const bool epsilon() { return false; } + static const bool round_error() { return false; } + static const bool denorm_min() { return false; } + static const bool infinity() { return false; } + static const bool quiet_NaN() { return false; } + static const bool signaling_NaN() { return false; } }; //*************************************************************************** // char template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - - static const int digits = (CHAR_BIT * sizeof(char)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - + static const int digits = (CHAR_BIT * sizeof(char)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG10_OF_2(digits); static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const char infinity() { return 0; } - static const char quiet_NaN() { return 0; } - static const char signaling_NaN() { return 0; } - static const char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static const bool is_modulo = false; static const char min() { return char(CHAR_MIN); } static const char max() { return char(CHAR_MAX); } static const char lowest() { return char(CHAR_MIN); } + static const char epsilon() { return 0; } + static const char round_error() { return 0; } + static const char denorm_min() { return 0; } + static const char infinity() { return 0; } + static const char quiet_NaN() { return 0; } + static const char signaling_NaN() { return 0; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // unsigned char template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; + static const int digits = (CHAR_BIT * sizeof(unsigned char)) - (etl::is_signed::value ? 1 : 0); + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = false; + static const bool is_modulo = true; - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - - static const int digits = (CHAR_BIT * sizeof(unsigned char)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - - static const unsigned char min() { return 0; } + static const unsigned char min() { return 0U; } static const unsigned char max() { return UCHAR_MAX; } - static const unsigned char lowest() { return 0; } + static const unsigned char lowest() { return 0U; } + static const unsigned char epsilon() { return 0U; } + static const unsigned char round_error() { return 0U; } + static const unsigned char denorm_min() { return 0U; } + static const unsigned char infinity() { return 0U; } + static const unsigned char quiet_NaN() { return 0U; } + static const unsigned char signaling_NaN() { return 0U; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // signed char template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(char)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const char infinity() { return 0; } - static const char quiet_NaN() { return 0; } - static const char signaling_NaN() { return 0; } - static const char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = true; + static const bool is_modulo = false; static const signed char min() { return SCHAR_MIN; } static const signed char max() { return SCHAR_MAX; } static const signed char lowest() { return SCHAR_MIN; } + static const signed char epsilon() { return 0; } + static const signed char round_error() { return 0; } + static const signed char denorm_min() { return 0; } + static const signed char infinity() { return 0; } + static const signed char quiet_NaN() { return 0; } + static const signed char signaling_NaN() { return 0; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - #if (ETL_NO_LARGE_CHAR_SUPPORT == false) //*************************************************************************** // char16_t template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(char16_t)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = false; static const bool is_modulo = true; - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - - static const char16_t min() { return 0; } + static const char16_t min() { return 0U; } static const char16_t max() { return UINT_LEAST16_MAX; } - static const char16_t lowest() { return 0; } + static const char16_t lowest() { return 0U; } + static const char16_t epsilon() { return 0U; } + static const char16_t round_error() { return 0U; } + static const char16_t denorm_min() { return 0U; } + static const char16_t infinity() { return 0U; } + static const char16_t quiet_NaN() { return 0U; } + static const char16_t signaling_NaN() { return 0U; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // char32_t template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(char32_t)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = false; static const bool is_modulo = true; - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - - static const char32_t min() { return 0; } + static const char32_t min() { return 0U; } static const char32_t max() { return UINT_LEAST32_MAX; } - static const char32_t lowest() { return 0; } + static const char32_t lowest() { return 0U; } + static const char32_t epsilon() { return 0U; } + static const char32_t round_error() { return 0U; } + static const char32_t denorm_min() { return 0U; } + static const char32_t infinity() { return 0U; } + static const char32_t quiet_NaN() { return 0U; } + static const char32_t signaling_NaN() { return 0U; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - #endif //*************************************************************************** // wchar_t template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(wchar_t)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - + static const int digits10 = ETL_LOG10_OF_2(digits); static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; static const bool is_modulo = etl::is_unsigned::value; - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - static const wchar_t min() { return WCHAR_MIN; } static const wchar_t max() { return WCHAR_MAX; } static const wchar_t lowest() { return WCHAR_MIN; } + static const wchar_t epsilon() { return wchar_t(0); } + static const wchar_t round_error() { return wchar_t(0); } + static const wchar_t denorm_min() { return wchar_t(0); } + static const wchar_t infinity() { return wchar_t(0); } + static const wchar_t quiet_NaN() { return wchar_t(0); } + static const wchar_t signaling_NaN() { return wchar_t(0); } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // short template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(short)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = true; + static const bool is_modulo = false; static const short min() { return SHRT_MIN; } static const short max() { return SHRT_MAX; } static const short lowest() { return SHRT_MIN; } + static const short epsilon() { return 0; } + static const short round_error() { return 0; } + static const short denorm_min() { return 0; } + static const short infinity() { return 0; } + static const short quiet_NaN() { return 0; } + static const short signaling_NaN() { return 0; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // unsigned short template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(unsigned short)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = false; + static const bool is_modulo = true; - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - - static const unsigned short min() { return 0; } + static const unsigned short min() { return 0U; } static const unsigned short max() { return USHRT_MAX; } - static const unsigned short lowest() { return 0; } - }; + static const unsigned short lowest() { return 0U; } + static const unsigned short epsilon() { return 0U; } + static const unsigned short round_error() { return 0U; } + static const unsigned short denorm_min() { return 0U; } + static const unsigned short infinity() { return 0U; } + static const unsigned short quiet_NaN() { return 0U; } + static const unsigned short signaling_NaN() { return 0U; } - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif + }; //*************************************************************************** // int template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(int)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = true; + static const bool is_modulo = false; static const int min() { return INT_MIN; } static const int max() { return INT_MAX; } static const int lowest() { return INT_MIN; } + static const int epsilon() { return 0; } + static const int round_error() { return 0; } + static const int denorm_min() { return 0; } + static const int infinity() { return 0; } + static const int quiet_NaN() { return 0; } + static const int signaling_NaN() { return 0; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // unsigned int template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(unsigned int)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = false; + static const bool is_modulo = true; - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - - static const unsigned int min() { return 0; } + static const unsigned int min() { return 0U; } static const unsigned int max() { return UINT_MAX; } - static const unsigned int lowest() { return 0; } + static const unsigned int lowest() { return 0U; } + static const unsigned int epsilon() { return 0U; } + static const unsigned int round_error() { return 0U; } + static const unsigned int denorm_min() { return 0U; } + static const unsigned int infinity() { return 0U; } + static const unsigned int quiet_NaN() { return 0U; } + static const unsigned int signaling_NaN() { return 0U; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // long template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(long)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = true; + static const bool is_modulo = false; static const long min() { return LONG_MIN; } static const long max() { return LONG_MAX; } static const long lowest() { return LONG_MIN; } + static const long epsilon() { return 0; } + static const long round_error() { return 0; } + static const long denorm_min() { return 0; } + static const long infinity() { return 0; } + static const long quiet_NaN() { return 0; } + static const long signaling_NaN() { return 0; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // unsigned long template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(unsigned long)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = false; + static const bool is_modulo = true; - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - - static const unsigned long min() { return 0; } + static const unsigned long min() { return 0U; } static const unsigned long max() { return ULONG_MAX; } - static const unsigned long lowest() { return 0; } + static const unsigned long lowest() { return 0U; } + static const unsigned long epsilon() { return 0U; } + static const unsigned long round_error() { return 0U; } + static const unsigned long denorm_min() { return 0U; } + static const unsigned long infinity() { return 0U; } + static const unsigned long quiet_NaN() { return 0U; } + static const unsigned long signaling_NaN() { return 0U; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // long long template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(long long)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; - - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = true; + static const bool is_modulo = false; static const long long min() { return LLONG_MIN; } static const long long max() { return LLONG_MAX; } static const long long lowest() { return LLONG_MIN; } + static const long long epsilon() { return 0; } + static const long long round_error() { return 0; } + static const long long denorm_min() { return 0; } + static const long long infinity() { return 0; } + static const long long quiet_NaN() { return 0; } + static const long long signaling_NaN() { return 0; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // unsigned long long template<> - class numeric_limits + class numeric_limits : public etl_integral_limits { public: - static const bool is_specialized = true; - - static const bool is_integer = true; - static const bool is_exact = true; - - static const int radix = 2; - static const char epsilon() { return 0; } - static const char round_error() { return 0; } - static const int digits = (CHAR_BIT * sizeof(unsigned long long)) - (etl::is_signed::value ? 1 : 0); - static const int digits10 = ETL_LOG2(digits); - static const int max_digits10 = 0; + static const int digits10 = ETL_LOG10_OF_2(digits); + static const bool is_signed = false; + static const bool is_modulo = true; - static const bool is_signed = etl::is_signed::value; - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static const unsigned char infinity() { return 0; } - static const unsigned char quiet_NaN() { return 0; } - static const unsigned char signaling_NaN() { return 0; } - static const unsigned char denorm_min() { return 0; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = etl::is_unsigned::value; - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - - static const unsigned long long min() { return 0; } + static const unsigned long long min() { return 0U; } static const unsigned long long max() { return ULLONG_MAX; } - static const unsigned long long lowest() { return 0; } + static const unsigned long long lowest() { return 0U; } + static const unsigned long long epsilon() { return 0U; } + static const unsigned long long round_error() { return 0U; } + static const unsigned long long denorm_min() { return 0U; } + static const unsigned long long infinity() { return 0U; } + static const unsigned long long quiet_NaN() { return 0U; } + static const unsigned long long signaling_NaN() { return 0U; } }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - #endif - //*************************************************************************** // float template<> - class numeric_limits + class numeric_limits : public etl_floating_point_limits { public: - static const bool is_specialized = true; - - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - - static const int radix = 2; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_indeterminate; - static const bool has_denorm_loss = false; - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = false; - - static const float round_error() { return float(0.5); } - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_indeterminate; - static const float min() { return FLT_MIN; } static const float max() { return FLT_MAX; } static const float lowest() { return -FLT_MAX; } static const float epsilon() { return FLT_EPSILON; } static const float denorm_min() { return FLT_MIN; } + static const float infinity() { return HUGE_VALF; } + static const float quiet_NaN() { return nanf(""); } + static const float signaling_NaN() { return nanf(""); } static const int digits = FLT_MANT_DIG; static const int digits10 = FLT_DIG; - static const int max_digits10 = ETL_LOG2(FLT_MANT_DIG) + 2; + static const int max_digits10 = ETL_LOG10_OF_2(FLT_MANT_DIG) + 2; static const int min_exponent = FLT_MIN_EXP; static const int min_exponent10 = FLT_MIN_10_EXP; @@ -1253,72 +500,25 @@ namespace etl static const int max_exponent10 = FLT_MAX_10_EXP; }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - #endif - //*************************************************************************** // double template<> - class numeric_limits + class numeric_limits : public etl_floating_point_limits { public: - static const bool is_specialized = true; - - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - - static const int radix = 2; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_indeterminate; - static const bool has_denorm_loss = false; - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = false; - - static const float round_error() { return double(0.5); } - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_indeterminate; - static const double min() { return DBL_MIN; } static const double max() { return DBL_MAX; } static const double lowest() { return -DBL_MAX; } static const double epsilon() { return DBL_EPSILON; } static const double denorm_min() { return DBL_MIN; } + static const double infinity() { return HUGE_VAL; } + static const double quiet_NaN() { return nan(""); } + static const double signaling_NaN() { return nan(""); } static const int digits = DBL_MANT_DIG; static const int digits10 = DBL_DIG; - static const int max_digits10 = ETL_LOG2(DBL_MANT_DIG) + 2; + static const int max_digits10 = ETL_LOG10_OF_2(DBL_MANT_DIG) + 2; static const int min_exponent = DBL_MIN_EXP; static const int min_exponent10 = DBL_MIN_10_EXP; @@ -1326,104 +526,32 @@ namespace etl static const int max_exponent10 = DBL_MAX_10_EXP; }; - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - #endif - //*************************************************************************** // long double template<> - class numeric_limits + class numeric_limits : public etl_floating_point_limits { public: - static const bool is_specialized = true; - - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - - static const int radix = 2; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_indeterminate; - static const bool has_denorm_loss = false; - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = false; - - static const float round_error() { return (long double)(0.5); } - - static const bool traps = false; - static const bool tinyness_before = false; - static const float_round_style round_style = round_indeterminate; - static const long double min() { return LDBL_MIN; } static const long double max() { return LDBL_MAX; } static const long double lowest() { return -LDBL_MAX; } static const long double epsilon() { return LDBL_EPSILON; } static const long double denorm_min() { return LDBL_MIN; } + static const long double infinity() { return HUGE_VALL; } + static const long double quiet_NaN() { return nanl(""); } + static const long double signaling_NaN() { return nanl(""); } + static const int digits = LDBL_MANT_DIG; static const int digits10 = LDBL_DIG; - static const int max_digits10 = ETL_LOG2(LDBL_MANT_DIG) + 2; + static const int max_digits10 = ETL_LOG10_OF_2(LDBL_MANT_DIG) + 2; static const int min_exponent = LDBL_MIN_EXP; static const int min_exponent10 = LDBL_MIN_10_EXP; static const int max_exponent = LDBL_MAX_EXP; static const int max_exponent10 = LDBL_MAX_10_EXP; }; - - #if !defined(ETL_COMPILER_MICROSOFT) - const bool numeric_limits::is_specialized; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - #endif } #else diff --git a/include/etl/version.h b/include/etl/version.h index 69cbc002..44270f57 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -37,8 +37,8 @@ SOFTWARE. /// Definitions of the ETL version ///\ingroup utilities -#define ETL_VERSION_MAJOR 15 -#define ETL_VERSION_MINOR 5 +#define ETL_VERSION_MAJOR 16 +#define ETL_VERSION_MINOR 0 #define ETL_VERSION_PATCH 0 #define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH) diff --git a/library.json b/library.json index 9bcfadfb..689d3608 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Embedded Template Library", - "version": "15.5.0", + "version": "16.0.0", "authors": { "name": "John Wellbelove", "email": "" diff --git a/library.properties b/library.properties index 84d0db75..13083571 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library -version=15.5.0 +version=16.0.0 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/support/Release notes.txt b/support/Release notes.txt index 742a4cdd..81833538 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,11 @@ +=============================================================================== +16.0.0 +Refactored the ETL's relationship with the STL +Many reverse engineered STL algorithms and traits are now available through the +ETL namespace. +When ETL_NO_STL is defined, the ETL implements its own versions of the STL code. +When ETL_NO_STL is *not* defined, the ETL act as a wrapper around the STL implementations. + =============================================================================== 15.5.0 Added the ability to self determine the compiler type, version and language support diff --git a/test/test_limits.cpp b/test/test_limits.cpp index 84e002b4..bc75b3b2 100644 --- a/test/test_limits.cpp +++ b/test/test_limits.cpp @@ -31,36 +31,9 @@ SOFTWARE. #include "etl/limits.h" #include -namespace etl -{ - const bool numeric_limits::is_specialized; - const int numeric_limits::digits; - const int numeric_limits::digits10; - const int numeric_limits::max_digits10; - const bool numeric_limits::is_signed; - const bool numeric_limits::is_integer; - const bool numeric_limits::is_exact; - const int numeric_limits::radix; - const int numeric_limits::min_exponent; - const int numeric_limits::min_exponent10; - const int numeric_limits::max_exponent; - const int numeric_limits::max_exponent10; - const bool numeric_limits::has_infinity; - const bool numeric_limits::has_quiet_NaN; - const bool numeric_limits::has_signaling_NaN; - const float_denorm_style numeric_limits::has_denorm; - const bool numeric_limits::has_denorm_loss; - const bool numeric_limits::is_iec559; - const bool numeric_limits::is_bounded; - const bool numeric_limits::is_modulo; - const bool numeric_limits::traps; - const bool numeric_limits::tinyness_before; - const float_round_style numeric_limits::round_style; -} - namespace { - SUITE(test_no_stl_limits) + SUITE(test_limits) { //************************************************************************* TEST(test_bool) @@ -68,37 +41,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -107,37 +80,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -146,37 +119,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -185,37 +158,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -224,37 +197,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -263,37 +236,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -302,37 +275,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -341,37 +314,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -380,37 +353,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -419,37 +392,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -458,37 +431,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -497,37 +470,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -536,37 +509,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -575,37 +548,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -614,37 +587,37 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::denorm_min(), ETL_NL::denorm_min()); - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(int(STD_NL::has_denorm), int(ETL_NL::has_denorm)); - CHECK_EQUAL(STD_NL::has_denorm_loss, ETL_NL::has_denorm_loss); - CHECK_EQUAL(STD_NL::has_infinity, ETL_NL::has_infinity); - CHECK_EQUAL(STD_NL::has_quiet_NaN, ETL_NL::has_quiet_NaN); - CHECK_EQUAL(STD_NL::has_signaling_NaN, ETL_NL::has_signaling_NaN); - CHECK_EQUAL(STD_NL::infinity(), ETL_NL::infinity()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_iec559, ETL_NL::is_iec559); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::quiet_NaN(), ETL_NL::quiet_NaN()); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); - CHECK_EQUAL(int(STD_NL::round_style), int(ETL_NL::round_style)); - CHECK_EQUAL(STD_NL::signaling_NaN(), ETL_NL::signaling_NaN()); - CHECK_EQUAL(STD_NL::tinyness_before, ETL_NL::tinyness_before); + CHECK(STD_NL::denorm_min() == ETL_NL::denorm_min()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(int(STD_NL::has_denorm) == int(ETL_NL::has_denorm)); + CHECK(STD_NL::has_denorm_loss == ETL_NL::has_denorm_loss); + CHECK(STD_NL::has_infinity == ETL_NL::has_infinity); + CHECK(STD_NL::has_quiet_NaN == ETL_NL::has_quiet_NaN); + CHECK(STD_NL::has_signaling_NaN == ETL_NL::has_signaling_NaN); + CHECK(STD_NL::infinity() == ETL_NL::infinity()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_iec559 == ETL_NL::is_iec559); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::quiet_NaN() == ETL_NL::quiet_NaN()); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); + CHECK(int(STD_NL::round_style) == int(ETL_NL::round_style)); + CHECK(STD_NL::signaling_NaN() == ETL_NL::signaling_NaN()); + CHECK(STD_NL::tinyness_before == ETL_NL::tinyness_before); } //************************************************************************* @@ -653,25 +626,25 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); } //************************************************************************* @@ -680,25 +653,25 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); } //************************************************************************* @@ -707,25 +680,25 @@ namespace typedef etl::numeric_limits ETL_NL; typedef std::numeric_limits STD_NL; - CHECK_EQUAL(STD_NL::digits, ETL_NL::digits); - CHECK_EQUAL(STD_NL::digits10, ETL_NL::digits10); - CHECK_EQUAL(STD_NL::epsilon(), ETL_NL::epsilon()); - CHECK_EQUAL(STD_NL::is_bounded, ETL_NL::is_bounded); - CHECK_EQUAL(STD_NL::is_exact, ETL_NL::is_exact); - CHECK_EQUAL(STD_NL::is_integer, ETL_NL::is_integer); - CHECK_EQUAL(STD_NL::is_modulo, ETL_NL::is_modulo); - CHECK_EQUAL(STD_NL::is_signed, ETL_NL::is_signed); - CHECK_EQUAL(STD_NL::is_specialized, ETL_NL::is_specialized); - CHECK_EQUAL(STD_NL::lowest(), ETL_NL::lowest()); - CHECK_EQUAL(STD_NL::max(), ETL_NL::max()); - CHECK_EQUAL(STD_NL::max_digits10, ETL_NL::max_digits10); - CHECK_EQUAL(STD_NL::max_exponent, ETL_NL::max_exponent); - CHECK_EQUAL(STD_NL::max_exponent10, ETL_NL::max_exponent10); - CHECK_EQUAL(STD_NL::min(), ETL_NL::min()); - CHECK_EQUAL(STD_NL::min_exponent, ETL_NL::min_exponent); - CHECK_EQUAL(STD_NL::min_exponent10, ETL_NL::min_exponent10); - CHECK_EQUAL(STD_NL::radix, ETL_NL::radix); - CHECK_EQUAL(STD_NL::round_error(), ETL_NL::round_error()); + CHECK(STD_NL::digits == ETL_NL::digits); + CHECK(STD_NL::digits10 == ETL_NL::digits10); + CHECK(STD_NL::epsilon() == ETL_NL::epsilon()); + CHECK(STD_NL::is_bounded == ETL_NL::is_bounded); + CHECK(STD_NL::is_exact == ETL_NL::is_exact); + CHECK(STD_NL::is_integer == ETL_NL::is_integer); + CHECK(STD_NL::is_modulo == ETL_NL::is_modulo); + CHECK(STD_NL::is_signed == ETL_NL::is_signed); + CHECK(STD_NL::is_specialized == ETL_NL::is_specialized); + CHECK(STD_NL::lowest() == ETL_NL::lowest()); + CHECK(STD_NL::max() == ETL_NL::max()); + CHECK(STD_NL::max_digits10 == ETL_NL::max_digits10); + CHECK(STD_NL::max_exponent == ETL_NL::max_exponent); + CHECK(STD_NL::max_exponent10 == ETL_NL::max_exponent10); + CHECK(STD_NL::min() == ETL_NL::min()); + CHECK(STD_NL::min_exponent == ETL_NL::min_exponent); + CHECK(STD_NL::min_exponent10 == ETL_NL::min_exponent10); + CHECK(STD_NL::radix == ETL_NL::radix); + CHECK(STD_NL::round_error() == ETL_NL::round_error()); } }; } diff --git a/test/vs2017/etl.vcxproj b/test/vs2017/etl.vcxproj index 39cf47c1..3ac49ba6 100644 --- a/test/vs2017/etl.vcxproj +++ b/test/vs2017/etl.vcxproj @@ -336,7 +336,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../../unittest-cpp/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../test false @@ -378,7 +378,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING;ETL_NO_STL;ETL_FORCE_NO_ADVANCED_CPP;%(PreprocessorDefinitions) - ../../../unittest-cpp/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../test false @@ -399,7 +399,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;__clang__;%(PreprocessorDefinitions) - ../../../unittest-cpp/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../test false @@ -471,7 +471,7 @@ Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ../../../unittest-cpp/;../../include;../../include/etl/c;../../test + ../../../unittest-cpp/;../../include;../../test false