Skip to content

Commit

Permalink
Sync to 20.35.11
Browse files Browse the repository at this point in the history
  • Loading branch information
jwellbelove committed Jan 20, 2023
1 parent 96588da commit c411239
Show file tree
Hide file tree
Showing 20 changed files with 529 additions and 134 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Embedded Template Library - Arduino",
"version": "20.35.6",
"version": "20.35.11",
"authors": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Embedded Template Library - Arduino
version=20.35.6
version=20.35.11
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT
Expand Down
4 changes: 2 additions & 2 deletions src/etl/binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ namespace etl

return (nbits == etl::integral_limits<type>::bits) ? static_cast<T>(etl::integral_limits<type>::max)
: static_cast<T>((static_cast<type>(1U) << nbits) - 1U);
};
}

//***********************************
template <typename T, size_t NBits>
Expand All @@ -2214,7 +2214,7 @@ namespace etl
ETL_CONSTEXPR T make_msb_mask(size_t nbits)
{
return static_cast<T>(etl::reverse_bits(make_lsb_mask<T>(nbits)));
};
}

//***************************************************************************
/// 8 bit binary byte constants.
Expand Down
2 changes: 1 addition & 1 deletion src/etl/byte_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ namespace etl
template <typename T>
bool skip(size_t n)
{
if (n < available<T>())
if (n <= available<T>())
{
pcurrent += (n * sizeof(T));
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/etl/delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SOFTWARE.

#include "platform.h"

#if ETL_USING_CPP11 && !defined(ETL_CRC_FORCE_CPP03_IMPLEMENTATION)
#if ETL_USING_CPP11 && !defined(ETL_DELEGATE_FORCE_CPP03_IMPLEMENTATION)
#include "private/delegate_cpp11.h"
#else
#include "private/delegate_cpp03.h"
Expand Down
30 changes: 20 additions & 10 deletions src/etl/deque.h
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ namespace etl
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename ... Args>
void emplace_back(Args && ... args)
reference emplace_back(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1752,6 +1752,7 @@ namespace etl
++_end;
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return back();
}

#else
Expand All @@ -1761,7 +1762,7 @@ namespace etl
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename T1>
void emplace_back(const T1& value1)
reference emplace_back(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1771,14 +1772,15 @@ namespace etl
++_end;
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return back();
}

//*************************************************************************
/// Emplaces an item to the back of the deque.
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename T1, typename T2>
void emplace_back(const T1& value1, const T2& value2)
reference emplace_back(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1788,14 +1790,15 @@ namespace etl
++_end;
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return back();
}

//*************************************************************************
/// Emplaces an item to the back of the deque.
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename T1, typename T2, typename T3>
void emplace_back(const T1& value1, const T2& value2, const T3& value3)
reference emplace_back(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1805,14 +1808,15 @@ namespace etl
++_end;
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return back();
}

//*************************************************************************
/// Emplaces an item to the back of the deque.
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
void emplace_back(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
reference emplace_back(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1822,6 +1826,7 @@ namespace etl
++_end;
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return back();
}
#endif

Expand Down Expand Up @@ -1870,7 +1875,7 @@ namespace etl
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename ... Args>
void emplace_front(Args && ... args)
reference emplace_front(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1880,6 +1885,7 @@ namespace etl
::new (&(*_begin)) T(etl::forward<Args>(args)...);
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return front();
}

#else
Expand All @@ -1889,7 +1895,7 @@ namespace etl
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename T1>
void emplace_front(const T1& value1)
reference emplace_front(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1899,14 +1905,15 @@ namespace etl
::new (&(*_begin)) T(value1);
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return front();
}

//*************************************************************************
/// Emplaces an item to the front of the deque.
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename T1, typename T2>
void emplace_front(const T1& value1, const T2& value2)
reference emplace_front(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1916,14 +1923,15 @@ namespace etl
::new (&(*_begin)) T(value1, value2);
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return front();
}

//*************************************************************************
/// Emplaces an item to the front of the deque.
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename T1, typename T2, typename T3>
void emplace_front(const T1& value1, const T2& value2, const T3& value3)
reference emplace_front(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1933,14 +1941,15 @@ namespace etl
::new (&(*_begin)) T(value1, value2, value3);
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return front();
}

//*************************************************************************
/// Emplaces an item to the front of the deque.
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
//*************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
void emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
reference emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
Expand All @@ -1950,6 +1959,7 @@ namespace etl
::new (&(*_begin)) T(value1, value2, value3, value4);
++current_size;
ETL_INCREMENT_DEBUG_COUNT
return front();
}
#endif

Expand Down
17 changes: 11 additions & 6 deletions src/etl/forward_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ namespace etl
/// Emplaces a value to the front of the list..
//*************************************************************************
template <typename ... Args>
void emplace_front(Args && ... args)
reference emplace_front(Args && ... args)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
Expand All @@ -731,13 +731,14 @@ namespace etl
::new (&(p_data_node->value)) T(etl::forward<Args>(args)...);
ETL_INCREMENT_DEBUG_COUNT
insert_node_after(start_node, *p_data_node);
return front();
}
#else
//*************************************************************************
/// Emplaces a value to the front of the list..
//*************************************************************************
template <typename T1>
void emplace_front(const T1& value1)
reference emplace_front(const T1& value1)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
Expand All @@ -746,13 +747,14 @@ namespace etl
::new (&(p_data_node->value)) T(value1);
ETL_INCREMENT_DEBUG_COUNT
insert_node_after(start_node, *p_data_node);
return front();
}

//*************************************************************************
/// Emplaces a value to the front of the list..
//*************************************************************************
template <typename T1, typename T2>
void emplace_front(const T1& value1, const T2& value2)
reference emplace_front(const T1& value1, const T2& value2)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
Expand All @@ -761,13 +763,14 @@ namespace etl
::new (&(p_data_node->value)) T(value1, value2);
ETL_INCREMENT_DEBUG_COUNT
insert_node_after(start_node, *p_data_node);
return front();
}

//*************************************************************************
/// Emplaces a value to the front of the list..
//*************************************************************************
template <typename T1, typename T2, typename T3>
void emplace_front(const T1& value1, const T2& value2, const T3& value3)
reference emplace_front(const T1& value1, const T2& value2, const T3& value3)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
Expand All @@ -776,13 +779,14 @@ namespace etl
::new (&(p_data_node->value)) T(value1, value2, value3);
ETL_INCREMENT_DEBUG_COUNT
insert_node_after(start_node, *p_data_node);
return front();
}

//*************************************************************************
/// Emplaces a value to the front of the list..
//*************************************************************************
template <typename T1, typename T2, typename T3, typename T4>
void emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
reference emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
{
#if defined(ETL_CHECK_PUSH_POP)
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
Expand All @@ -791,6 +795,7 @@ namespace etl
::new (&(p_data_node->value)) T(value1, value2, value3, value4);
ETL_INCREMENT_DEBUG_COUNT
insert_node_after(start_node, *p_data_node);
return front();
}
#endif // ETL_USING_CPP11 && ETL_NOT_USING_STLPORT

Expand Down Expand Up @@ -1756,7 +1761,7 @@ namespace etl
//*************************************************************************
#if ETL_USING_CPP11 && ETL_HAS_INITIALIZER_LIST
template <typename... T>
constexpr auto make_forward_list(T... t) -> etl::forward_list<typename etl::common_type_t<T...>, sizeof...(T)>
constexpr auto make_forward_list(T&&... t) -> etl::forward_list<typename etl::common_type_t<T...>, sizeof...(T)>
{
return { { etl::forward<T>(t)... } };
}
Expand Down
40 changes: 34 additions & 6 deletions src/etl/generators/type_traits_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ namespace etl
//***************************************************************************
/// is_enum
///\ingroup type_traits
/// Implemented by checking if type is convertable to an integer thru static_cast
/// Implemented by checking if type is convertible to an integer through static_cast

namespace private_type_traits
{
Expand Down Expand Up @@ -1988,13 +1988,40 @@ namespace etl
};

#if ETL_USING_CPP11
//*********************************************
// is_constructible
template <typename T, typename... TArgs>
struct is_constructible : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
//***************************************************************************
/// is_constructible
namespace private_type_traits
{
template <class, class T, class... Args>
struct is_constructible_ : etl::false_type {};

template <class T, class... Args>
struct is_constructible_<void_t<decltype(T(etl::declval<Args>()...))>, T, Args...> : etl::true_type {};
};
#endif


//*********************************************
// is_constructible
template <class T, class... Args>
using is_constructible = private_type_traits::is_constructible_<void_t<>, T, Args...>;

//*********************************************
// is_copy_constructible
template <class T> struct is_copy_constructible : public is_constructible<T, typename etl::add_lvalue_reference<typename etl::add_const<T>::type>::type>{};
template <> struct is_copy_constructible<void> : public false_type{};
template <> struct is_copy_constructible<void const> : public false_type{};
template <> struct is_copy_constructible<void volatile> : public false_type{};
template <> struct is_copy_constructible<void const volatile> : public false_type{};

//*********************************************
// is_move_constructible
template <typename T> struct is_move_constructible: public is_constructible<T, typename etl::add_rvalue_reference<T>::type>{};
template <> struct is_move_constructible<void> : public false_type{};
template <> struct is_move_constructible<void const> : public false_type{};
template <> struct is_move_constructible<void volatile> : public false_type{};
template <> struct is_move_constructible<void const volatile> : public false_type{};

#else

//*********************************************
// is_copy_constructible
Expand All @@ -2009,6 +2036,7 @@ namespace etl
struct is_move_constructible : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
{
};
#endif

//*********************************************
// is_trivially_constructible
Expand Down
Loading

0 comments on commit c411239

Please sign in to comment.