Skip to content

Commit c411239

Browse files
committed
Sync to 20.35.11
1 parent 96588da commit c411239

20 files changed

+529
-134
lines changed

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Embedded Template Library - Arduino",
3-
"version": "20.35.6",
3+
"version": "20.35.11",
44
"authors": {
55
"name": "John Wellbelove",
66
"email": "[email protected]"

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Embedded Template Library - Arduino
2-
version=20.35.6
2+
version=20.35.11
33
author= John Wellbelove <[email protected]>
44
maintainer=John Wellbelove <[email protected]>
55
license=MIT

src/etl/binary.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,7 +2198,7 @@ namespace etl
21982198

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

22032203
//***********************************
22042204
template <typename T, size_t NBits>
@@ -2214,7 +2214,7 @@ namespace etl
22142214
ETL_CONSTEXPR T make_msb_mask(size_t nbits)
22152215
{
22162216
return static_cast<T>(etl::reverse_bits(make_lsb_mask<T>(nbits)));
2217-
};
2217+
}
22182218

22192219
//***************************************************************************
22202220
/// 8 bit binary byte constants.

src/etl/byte_stream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ namespace etl
749749
template <typename T>
750750
bool skip(size_t n)
751751
{
752-
if (n < available<T>())
752+
if (n <= available<T>())
753753
{
754754
pcurrent += (n * sizeof(T));
755755
return true;

src/etl/delegate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ SOFTWARE.
3333

3434
#include "platform.h"
3535

36-
#if ETL_USING_CPP11 && !defined(ETL_CRC_FORCE_CPP03_IMPLEMENTATION)
36+
#if ETL_USING_CPP11 && !defined(ETL_DELEGATE_FORCE_CPP03_IMPLEMENTATION)
3737
#include "private/delegate_cpp11.h"
3838
#else
3939
#include "private/delegate_cpp03.h"

src/etl/deque.h

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ namespace etl
17421742
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
17431743
//*************************************************************************
17441744
template <typename ... Args>
1745-
void emplace_back(Args && ... args)
1745+
reference emplace_back(Args && ... args)
17461746
{
17471747
#if defined(ETL_CHECK_PUSH_POP)
17481748
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1752,6 +1752,7 @@ namespace etl
17521752
++_end;
17531753
++current_size;
17541754
ETL_INCREMENT_DEBUG_COUNT
1755+
return back();
17551756
}
17561757

17571758
#else
@@ -1761,7 +1762,7 @@ namespace etl
17611762
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
17621763
//*************************************************************************
17631764
template <typename T1>
1764-
void emplace_back(const T1& value1)
1765+
reference emplace_back(const T1& value1)
17651766
{
17661767
#if defined(ETL_CHECK_PUSH_POP)
17671768
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1771,14 +1772,15 @@ namespace etl
17711772
++_end;
17721773
++current_size;
17731774
ETL_INCREMENT_DEBUG_COUNT
1775+
return back();
17741776
}
17751777

17761778
//*************************************************************************
17771779
/// Emplaces an item to the back of the deque.
17781780
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
17791781
//*************************************************************************
17801782
template <typename T1, typename T2>
1781-
void emplace_back(const T1& value1, const T2& value2)
1783+
reference emplace_back(const T1& value1, const T2& value2)
17821784
{
17831785
#if defined(ETL_CHECK_PUSH_POP)
17841786
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1788,14 +1790,15 @@ namespace etl
17881790
++_end;
17891791
++current_size;
17901792
ETL_INCREMENT_DEBUG_COUNT
1793+
return back();
17911794
}
17921795

17931796
//*************************************************************************
17941797
/// Emplaces an item to the back of the deque.
17951798
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
17961799
//*************************************************************************
17971800
template <typename T1, typename T2, typename T3>
1798-
void emplace_back(const T1& value1, const T2& value2, const T3& value3)
1801+
reference emplace_back(const T1& value1, const T2& value2, const T3& value3)
17991802
{
18001803
#if defined(ETL_CHECK_PUSH_POP)
18011804
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1805,14 +1808,15 @@ namespace etl
18051808
++_end;
18061809
++current_size;
18071810
ETL_INCREMENT_DEBUG_COUNT
1811+
return back();
18081812
}
18091813

18101814
//*************************************************************************
18111815
/// Emplaces an item to the back of the deque.
18121816
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
18131817
//*************************************************************************
18141818
template <typename T1, typename T2, typename T3, typename T4>
1815-
void emplace_back(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
1819+
reference emplace_back(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
18161820
{
18171821
#if defined(ETL_CHECK_PUSH_POP)
18181822
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1822,6 +1826,7 @@ namespace etl
18221826
++_end;
18231827
++current_size;
18241828
ETL_INCREMENT_DEBUG_COUNT
1829+
return back();
18251830
}
18261831
#endif
18271832

@@ -1870,7 +1875,7 @@ namespace etl
18701875
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
18711876
//*************************************************************************
18721877
template <typename ... Args>
1873-
void emplace_front(Args && ... args)
1878+
reference emplace_front(Args && ... args)
18741879
{
18751880
#if defined(ETL_CHECK_PUSH_POP)
18761881
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1880,6 +1885,7 @@ namespace etl
18801885
::new (&(*_begin)) T(etl::forward<Args>(args)...);
18811886
++current_size;
18821887
ETL_INCREMENT_DEBUG_COUNT
1888+
return front();
18831889
}
18841890

18851891
#else
@@ -1889,7 +1895,7 @@ namespace etl
18891895
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
18901896
//*************************************************************************
18911897
template <typename T1>
1892-
void emplace_front(const T1& value1)
1898+
reference emplace_front(const T1& value1)
18931899
{
18941900
#if defined(ETL_CHECK_PUSH_POP)
18951901
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1899,14 +1905,15 @@ namespace etl
18991905
::new (&(*_begin)) T(value1);
19001906
++current_size;
19011907
ETL_INCREMENT_DEBUG_COUNT
1908+
return front();
19021909
}
19031910

19041911
//*************************************************************************
19051912
/// Emplaces an item to the front of the deque.
19061913
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
19071914
//*************************************************************************
19081915
template <typename T1, typename T2>
1909-
void emplace_front(const T1& value1, const T2& value2)
1916+
reference emplace_front(const T1& value1, const T2& value2)
19101917
{
19111918
#if defined(ETL_CHECK_PUSH_POP)
19121919
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1916,14 +1923,15 @@ namespace etl
19161923
::new (&(*_begin)) T(value1, value2);
19171924
++current_size;
19181925
ETL_INCREMENT_DEBUG_COUNT
1926+
return front();
19191927
}
19201928

19211929
//*************************************************************************
19221930
/// Emplaces an item to the front of the deque.
19231931
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
19241932
//*************************************************************************
19251933
template <typename T1, typename T2, typename T3>
1926-
void emplace_front(const T1& value1, const T2& value2, const T3& value3)
1934+
reference emplace_front(const T1& value1, const T2& value2, const T3& value3)
19271935
{
19281936
#if defined(ETL_CHECK_PUSH_POP)
19291937
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1933,14 +1941,15 @@ namespace etl
19331941
::new (&(*_begin)) T(value1, value2, value3);
19341942
++current_size;
19351943
ETL_INCREMENT_DEBUG_COUNT
1944+
return front();
19361945
}
19371946

19381947
//*************************************************************************
19391948
/// Emplaces an item to the front of the deque.
19401949
/// If asserts or exceptions are enabled, throws an etl::deque_full if the deque is already full.
19411950
//*************************************************************************
19421951
template <typename T1, typename T2, typename T3, typename T4>
1943-
void emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
1952+
reference emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
19441953
{
19451954
#if defined(ETL_CHECK_PUSH_POP)
19461955
ETL_ASSERT(!full(), ETL_ERROR(deque_full));
@@ -1950,6 +1959,7 @@ namespace etl
19501959
::new (&(*_begin)) T(value1, value2, value3, value4);
19511960
++current_size;
19521961
ETL_INCREMENT_DEBUG_COUNT
1962+
return front();
19531963
}
19541964
#endif
19551965

src/etl/forward_list.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ namespace etl
722722
/// Emplaces a value to the front of the list..
723723
//*************************************************************************
724724
template <typename ... Args>
725-
void emplace_front(Args && ... args)
725+
reference emplace_front(Args && ... args)
726726
{
727727
#if defined(ETL_CHECK_PUSH_POP)
728728
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
@@ -731,13 +731,14 @@ namespace etl
731731
::new (&(p_data_node->value)) T(etl::forward<Args>(args)...);
732732
ETL_INCREMENT_DEBUG_COUNT
733733
insert_node_after(start_node, *p_data_node);
734+
return front();
734735
}
735736
#else
736737
//*************************************************************************
737738
/// Emplaces a value to the front of the list..
738739
//*************************************************************************
739740
template <typename T1>
740-
void emplace_front(const T1& value1)
741+
reference emplace_front(const T1& value1)
741742
{
742743
#if defined(ETL_CHECK_PUSH_POP)
743744
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
@@ -746,13 +747,14 @@ namespace etl
746747
::new (&(p_data_node->value)) T(value1);
747748
ETL_INCREMENT_DEBUG_COUNT
748749
insert_node_after(start_node, *p_data_node);
750+
return front();
749751
}
750752

751753
//*************************************************************************
752754
/// Emplaces a value to the front of the list..
753755
//*************************************************************************
754756
template <typename T1, typename T2>
755-
void emplace_front(const T1& value1, const T2& value2)
757+
reference emplace_front(const T1& value1, const T2& value2)
756758
{
757759
#if defined(ETL_CHECK_PUSH_POP)
758760
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
@@ -761,13 +763,14 @@ namespace etl
761763
::new (&(p_data_node->value)) T(value1, value2);
762764
ETL_INCREMENT_DEBUG_COUNT
763765
insert_node_after(start_node, *p_data_node);
766+
return front();
764767
}
765768

766769
//*************************************************************************
767770
/// Emplaces a value to the front of the list..
768771
//*************************************************************************
769772
template <typename T1, typename T2, typename T3>
770-
void emplace_front(const T1& value1, const T2& value2, const T3& value3)
773+
reference emplace_front(const T1& value1, const T2& value2, const T3& value3)
771774
{
772775
#if defined(ETL_CHECK_PUSH_POP)
773776
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
@@ -776,13 +779,14 @@ namespace etl
776779
::new (&(p_data_node->value)) T(value1, value2, value3);
777780
ETL_INCREMENT_DEBUG_COUNT
778781
insert_node_after(start_node, *p_data_node);
782+
return front();
779783
}
780784

781785
//*************************************************************************
782786
/// Emplaces a value to the front of the list..
783787
//*************************************************************************
784788
template <typename T1, typename T2, typename T3, typename T4>
785-
void emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
789+
reference emplace_front(const T1& value1, const T2& value2, const T3& value3, const T4& value4)
786790
{
787791
#if defined(ETL_CHECK_PUSH_POP)
788792
ETL_ASSERT(!full(), ETL_ERROR(forward_list_full));
@@ -791,6 +795,7 @@ namespace etl
791795
::new (&(p_data_node->value)) T(value1, value2, value3, value4);
792796
ETL_INCREMENT_DEBUG_COUNT
793797
insert_node_after(start_node, *p_data_node);
798+
return front();
794799
}
795800
#endif // ETL_USING_CPP11 && ETL_NOT_USING_STLPORT
796801

@@ -1756,7 +1761,7 @@ namespace etl
17561761
//*************************************************************************
17571762
#if ETL_USING_CPP11 && ETL_HAS_INITIALIZER_LIST
17581763
template <typename... T>
1759-
constexpr auto make_forward_list(T... t) -> etl::forward_list<typename etl::common_type_t<T...>, sizeof...(T)>
1764+
constexpr auto make_forward_list(T&&... t) -> etl::forward_list<typename etl::common_type_t<T...>, sizeof...(T)>
17601765
{
17611766
return { { etl::forward<T>(t)... } };
17621767
}

src/etl/generators/type_traits_generator.h

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ namespace etl
714714
//***************************************************************************
715715
/// is_enum
716716
///\ingroup type_traits
717-
/// Implemented by checking if type is convertable to an integer thru static_cast
717+
/// Implemented by checking if type is convertible to an integer through static_cast
718718

719719
namespace private_type_traits
720720
{
@@ -1988,13 +1988,40 @@ namespace etl
19881988
};
19891989

19901990
#if ETL_USING_CPP11
1991-
//*********************************************
1992-
// is_constructible
1993-
template <typename T, typename... TArgs>
1994-
struct is_constructible : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
1991+
//***************************************************************************
1992+
/// is_constructible
1993+
namespace private_type_traits
19951994
{
1995+
template <class, class T, class... Args>
1996+
struct is_constructible_ : etl::false_type {};
1997+
1998+
template <class T, class... Args>
1999+
struct is_constructible_<void_t<decltype(T(etl::declval<Args>()...))>, T, Args...> : etl::true_type {};
19962000
};
1997-
#endif
2001+
2002+
2003+
//*********************************************
2004+
// is_constructible
2005+
template <class T, class... Args>
2006+
using is_constructible = private_type_traits::is_constructible_<void_t<>, T, Args...>;
2007+
2008+
//*********************************************
2009+
// is_copy_constructible
2010+
template <class T> struct is_copy_constructible : public is_constructible<T, typename etl::add_lvalue_reference<typename etl::add_const<T>::type>::type>{};
2011+
template <> struct is_copy_constructible<void> : public false_type{};
2012+
template <> struct is_copy_constructible<void const> : public false_type{};
2013+
template <> struct is_copy_constructible<void volatile> : public false_type{};
2014+
template <> struct is_copy_constructible<void const volatile> : public false_type{};
2015+
2016+
//*********************************************
2017+
// is_move_constructible
2018+
template <typename T> struct is_move_constructible: public is_constructible<T, typename etl::add_rvalue_reference<T>::type>{};
2019+
template <> struct is_move_constructible<void> : public false_type{};
2020+
template <> struct is_move_constructible<void const> : public false_type{};
2021+
template <> struct is_move_constructible<void volatile> : public false_type{};
2022+
template <> struct is_move_constructible<void const volatile> : public false_type{};
2023+
2024+
#else
19982025

19992026
//*********************************************
20002027
// is_copy_constructible
@@ -2009,6 +2036,7 @@ namespace etl
20092036
struct is_move_constructible : public etl::bool_constant<etl::is_arithmetic<T>::value || etl::is_pointer<T>::value>
20102037
{
20112038
};
2039+
#endif
20122040

20132041
//*********************************************
20142042
// is_trivially_constructible

0 commit comments

Comments
 (0)