mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Merge branch 'development' into feature/optimise-cyclic_value
This commit is contained in:
commit
e321e11d22
@ -137,7 +137,7 @@ namespace etl
|
||||
/// Returns a reference to the value at index 'i'.
|
||||
///\param i The index of the element to access.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR14 reference operator[](size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
ETL_NODISCARD ETL_CONSTEXPR14 reference operator[](size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
{
|
||||
ETL_ASSERT_CHECK_INDEX_OPERATOR(i < SIZE, ETL_ERROR(array_out_of_range));
|
||||
|
||||
@ -149,7 +149,7 @@ namespace etl
|
||||
/// Returns a const reference to the value at index 'i'.
|
||||
///\param i The index of the element to access.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR const_reference operator[](size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
ETL_NODISCARD ETL_CONSTEXPR const_reference operator[](size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
{
|
||||
// Throwing from c++11 constexpr requires special syntax
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_INDEX_OPERATOR
|
||||
|
||||
@ -518,7 +518,7 @@ namespace etl
|
||||
/// If asserts or exceptions are enabled, throws an etl::array_view_bounds
|
||||
/// if the index is out of bounds.
|
||||
//*************************************************************************
|
||||
reference operator[](const size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
reference operator[](const size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
{
|
||||
ETL_ASSERT_CHECK_INDEX_OPERATOR(i < size(), ETL_ERROR(array_view_bounds));
|
||||
|
||||
@ -531,7 +531,7 @@ namespace etl
|
||||
/// If asserts or exceptions are enabled, throws an etl::array_view_bounds
|
||||
/// if the index is out of bounds.
|
||||
//*************************************************************************
|
||||
const_reference operator[](const size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
const_reference operator[](const size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
{
|
||||
ETL_ASSERT_CHECK_INDEX_OPERATOR(i < size(), ETL_ERROR(array_view_bounds));
|
||||
|
||||
|
||||
@ -271,7 +271,7 @@ namespace etl
|
||||
/// If asserts or exceptions are enabled, throws an
|
||||
/// etl::array_wrapper_bounds if the index is out of bounds.
|
||||
//*************************************************************************
|
||||
reference operator[](size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
reference operator[](size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
{
|
||||
ETL_ASSERT_CHECK_INDEX_OPERATOR(i < SIZE, ETL_ERROR(etl::array_wrapper_bounds));
|
||||
return ARRAY_[i];
|
||||
@ -282,7 +282,7 @@ namespace etl
|
||||
/// If asserts or exceptions are enabled, throws an
|
||||
/// etl::array_wrapper_bounds if the index is out of bounds.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR const_reference operator[](size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
ETL_CONSTEXPR const_reference operator[](size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
{
|
||||
// Throwing from c++11 constexpr requires special syntax
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_INDEX_OPERATOR
|
||||
|
||||
@ -644,8 +644,7 @@ namespace etl
|
||||
/// Obtains a span that is a view over the first count elements of this
|
||||
/// span.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, etl::dynamic_extent> first(size_t count) const
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, etl::dynamic_extent> first(size_t count) const ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return count <= size() ? etl::span<element_type, etl::dynamic_extent>(pbegin, pbegin + count) : throw(ETL_ERROR(span_out_of_range));
|
||||
@ -672,8 +671,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Obtains a span that is a view over the last count elements of this span.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, etl::dynamic_extent> last(size_t count) const
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, etl::dynamic_extent> last(size_t count) const ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return count <= size() ? etl::span<element_type, etl::dynamic_extent>((pbegin + Extent) - count, (pbegin + Extent))
|
||||
@ -735,7 +733,7 @@ namespace etl
|
||||
/// elements of this span.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, etl::dynamic_extent> subspan(size_t offset, size_t count = etl::dynamic_extent) const
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return (offset <= size()) && (count != etl::dynamic_extent ? count <= (size() - offset) : true)
|
||||
@ -1003,7 +1001,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns a reference to the first element.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR reference front() const ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NODISCARD ETL_CONSTEXPR reference front() const ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return size() > 0 ? *pbegin : throw(ETL_ERROR(span_out_of_range));
|
||||
@ -1017,7 +1015,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Returns a reference to the last element.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR reference back() const ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NODISCARD ETL_CONSTEXPR reference back() const ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return size() > 0 ? *(pend - 1) : throw(ETL_ERROR(span_out_of_range));
|
||||
@ -1197,7 +1195,7 @@ namespace etl
|
||||
/// span.
|
||||
//*************************************************************************
|
||||
template <size_t COUNT>
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, COUNT> first() const ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, COUNT> first() const ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return COUNT <= size() ? etl::span<element_type, COUNT>(pbegin, pbegin + COUNT) : throw(ETL_ERROR(span_out_of_range));
|
||||
@ -1212,8 +1210,7 @@ namespace etl
|
||||
/// Obtains a span that is a view over the first count elements of this
|
||||
/// span.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, etl::dynamic_extent> first(size_t count) const
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, etl::dynamic_extent> first(size_t count) const ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return count <= size() ? etl::span<element_type, etl::dynamic_extent>(pbegin, pbegin + count) : throw(ETL_ERROR(span_out_of_range));
|
||||
@ -1228,7 +1225,7 @@ namespace etl
|
||||
/// Obtains a span that is a view over the last COUNT elements of this span.
|
||||
//*************************************************************************
|
||||
template <size_t COUNT>
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, COUNT> last() const ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, COUNT> last() const ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return COUNT <= size() ? etl::span<element_type, COUNT>(pend - COUNT, pend) : throw(ETL_ERROR(span_out_of_range));
|
||||
@ -1242,8 +1239,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Obtains a span that is a view over the last count elements of this span.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, etl::dynamic_extent> last(size_t count) const
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, etl::dynamic_extent> last(size_t count) const ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return count <= size() ? etl::span<element_type, etl::dynamic_extent>(pend - count, pend) : throw(ETL_ERROR(span_out_of_range));
|
||||
@ -1261,7 +1257,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <size_t OFFSET, size_t COUNT = etl::dynamic_extent>
|
||||
ETL_NODISCARD ETL_CONSTEXPR etl::span< element_type, COUNT != etl::dynamic_extent ? COUNT : etl::dynamic_extent> subspan() const
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_EXTRA
|
||||
return (OFFSET <= size()) && (COUNT != etl::dynamic_extent ? COUNT <= (size() - OFFSET) : true)
|
||||
@ -1305,7 +1301,7 @@ namespace etl
|
||||
/// elements of this span.
|
||||
//*************************************************************************
|
||||
ETL_NODISCARD ETL_CONSTEXPR14 etl::span<element_type, etl::dynamic_extent> subspan(size_t offset, size_t count = etl::dynamic_extent) const
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_EXTRA)
|
||||
ETL_NOEXCEPT_IF(ETL_NOT_CHECKING_EXTRA)
|
||||
{
|
||||
ETL_ASSERT_CHECK_EXTRA(offset <= size(), ETL_ERROR(span_out_of_range));
|
||||
ETL_ASSERT_CHECK_EXTRA(count != etl::dynamic_extent ? count <= (size() - offset) : true, ETL_ERROR(span_out_of_range));
|
||||
|
||||
@ -355,7 +355,7 @@ namespace etl
|
||||
/// If asserts or exceptions are enabled, throws an etl::string_view_bounds
|
||||
/// if the index is out of bounds.
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR const_reference operator[](size_type i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
ETL_CONSTEXPR const_reference operator[](size_type i) const ETL_NOEXCEPT_EXPR(ETL_NOT_CHECKING_INDEX_OPERATOR)
|
||||
{
|
||||
#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_INDEX_OPERATOR
|
||||
return i < size() ? mbegin[i] : throw(ETL_ERROR(string_view_bounds));
|
||||
|
||||
@ -393,7 +393,7 @@ namespace etl
|
||||
typename etl::enable_if<!etl::is_integral<TIterator>::value
|
||||
&& etl::is_convertible<typename etl::iterator_traits<TIterator>::value_type, T>::value,
|
||||
typename etl::enable_if<!etl::is_integral<TIterator>::value, void>::type>::type
|
||||
assign(TIterator first, TIterator last) ETL_NOEXCEPT_IF((etl::is_nothrow_copy_constructible<T>::value && ETL_NOT_USING_EXCEPTIONS))
|
||||
assign(TIterator first, TIterator last)
|
||||
{
|
||||
#if ETL_USING_CPP11
|
||||
ETL_STATIC_ASSERT((etl::is_same<typename etl::remove_cv<T>::type,
|
||||
@ -2082,7 +2082,6 @@ namespace etl
|
||||
/// Copy constructor.
|
||||
//*************************************************************************
|
||||
vector_ext(const vector_ext& other, void* buffer, size_t max_size)
|
||||
ETL_NOEXCEPT_IF((etl::is_nothrow_copy_constructible<T>::value && ETL_NOT_USING_EXCEPTIONS))
|
||||
: etl::ivector<T>(reinterpret_cast<T*>(buffer), max_size)
|
||||
{
|
||||
if (&other != this)
|
||||
@ -2094,7 +2093,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Assignment operator.
|
||||
//*************************************************************************
|
||||
vector_ext& operator=(const vector_ext& rhs) ETL_NOEXCEPT_IF((etl::is_nothrow_copy_constructible<T>::value && ETL_NOT_USING_EXCEPTIONS))
|
||||
vector_ext& operator=(const vector_ext& rhs)
|
||||
{
|
||||
if (&rhs != this)
|
||||
{
|
||||
@ -2109,7 +2108,6 @@ namespace etl
|
||||
/// Move constructor.
|
||||
//*************************************************************************
|
||||
vector_ext(vector_ext&& other, void* buffer, size_t max_size)
|
||||
ETL_NOEXCEPT_IF((etl::is_nothrow_move_constructible<T>::value && ETL_NOT_USING_EXCEPTIONS))
|
||||
: etl::ivector<T>(reinterpret_cast<T*>(buffer), max_size)
|
||||
{
|
||||
if (&other != this)
|
||||
@ -2123,7 +2121,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Move assignment operator.
|
||||
//*************************************************************************
|
||||
vector_ext& operator=(vector_ext&& rhs) ETL_NOEXCEPT_IF((etl::is_nothrow_move_constructible<T>::value && ETL_NOT_USING_EXCEPTIONS))
|
||||
vector_ext& operator=(vector_ext&& rhs)
|
||||
{
|
||||
if (&rhs != this)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user