Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
John Wellbelove committed Apr 18, 2024
2 parents dd6d2a5 + e2998e4 commit 3b7b70a
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 11 deletions.
50 changes: 46 additions & 4 deletions include/etl/algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3185,10 +3185,7 @@ namespace etl
/// see https://en.cppreference.com/w/cpp/algorithm/nth_element
//*********************************************************
#if ETL_USING_CPP11
template <typename TIterator, typename TCompare = etl::less<typename etl::iterator_traits<TIterator>::value_type> >
#else
template <typename TIterator, typename TCompare>
#endif
template <typename TIterator, typename TCompare = etl::less<typename etl::iterator_traits<TIterator>::value_type>>
#if (ETL_USING_CPP20 && ETL_USING_STL) || (ETL_USING_CPP14 && ETL_NOT_USING_STL && !defined(ETL_IN_UNIT_TEST))
constexpr
#endif
Expand Down Expand Up @@ -3221,6 +3218,51 @@ namespace etl
}
}
}

#else

//*********************************************************
template <typename TIterator, typename TCompare>
typename etl::enable_if<etl::is_random_access_iterator_concept<TIterator>::value, void>::type
nth_element(TIterator first, TIterator nth, TIterator last, TCompare compare)
{
if (first == last)
{
return;
}

// 'last' must point to the actual last value.
--last;

while (first <= last)
{
TIterator p = private_algorithm::nth_partition(first, last, compare);

if (p == nth)
{
return;
}
else if (p > nth)
{
last = p - 1;
}
else
{
first = p + 1;
}
}
}

//*********************************************************
template <typename TIterator>
typename etl::enable_if<etl::is_random_access_iterator_concept<TIterator>::value, void>::type
nth_element(TIterator first, TIterator nth, TIterator last)
{
typedef etl::less<typename etl::iterator_traits<TIterator>::value_type> compare_t;

nth_element(first, last, compare_t());
}
#endif
}

#include "private/minmax_pop.h"
Expand Down
38 changes: 31 additions & 7 deletions support/Release notes.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
===============================================================================
20.38.11

Fixes
Fixes:
#803 etl::unordered_map buffer overflow
#805 legacy etl::bitset set/reset does not work if the element type is greater than 8 bit
#815 etl::remove_if calls predicate twice for first iterator, where predicate returns true.
#819 etl::optional cannot return an optional object of self from member function
#820 etl::send_message does not allow for non-virtual calls
#825 Fixed extent etl::span shouldn't allow default constructor
Expand All @@ -16,9 +17,12 @@ Fixes
#869 etl::fsm::receive function can call p_state process_event also when p_state is nullptr
#873 Validate allocated DataNode is not null to prevent gcc Wnull-dereference
#874 Allow direct removal of a node from an etl::intrusive_list
#877 Optimize find_first_not_of and find_last_not_of on string_view
#879 Render include paths relative (limits.h & random.h)
#855 Strange expression in volatile atomic operator--

Pull Requests:
#782 Set-is-full-error-when-adding-existing-item
#782 Set is full error when adding existing item
#804 etl::variant (variadic) default constructed state
#812 Implement SAE-J1850 CRC8
#843 In subspan function, add static checks on extents
Expand All @@ -30,13 +34,33 @@ Pull Requests:
#863 Add eq and ne operators for compare utility

Features:
#812 Added: Implement-SAE-J1850-CRC8
#774 Added: Truncating access for etl::bitset - Added extract() functions.
#818 Added: Apply-code-spell-check-across-entire-code-base
#806 etl::variant_pool should support C++17 variadic parameters
#774 Truncating access for etl::bitset - Added extract() functions.
#806 etl::variant_pool should support C++17 variadic parameters (supports C++11 variadic parameters)
#812 Implement-SAE-J1850-CRC8
#818 Apply-code-spell-check-across-entire-code-base
#841 Change push to push_back on containers, so they can be used with std::back_inserterAdded push_insert_iterator
#847 Add has_active_timer to callback_timer
#883 Add etl::partition and etl::nth_element algorithms
#864 cyclic_value first/last methods. Make first() and last() static for template based limits specialisation

Changes without a Github issue:
Added etl::mem_fn
Added etl::generate algorithm
Added binary functors for ~ & | ^
Added etl::is_default_constructible_v
Added etl::is_default_constructible
Added syntax checks to github ci

Refactored etl::optional implementation
Fixed etl::optional operator =() for invalid values with non-pod types
Refactored message_packet constructors
Added specific copy and move constructors to message_packet for C++17 and above.
Changed optional 'simple' types implementation for C++14 constexpr compatibility
Fixed implicitly disabled copy constructor for message_packet
Modified accepts() message router functions to interrogate subscribed and successor routers to achieve consistency.
Fixed 'nodiscard' keyword errors
Removed unused ETL_STATIC_CONSTANT
Make binary functor operator() const
Improved display of CHECK_EQUAL_HEX in unittest++

===============================================================================
20.38.10
Expand Down

0 comments on commit 3b7b70a

Please sign in to comment.