Skip to content

Commit 3e7da9f

Browse files
Update ETL
1 parent 39890c9 commit 3e7da9f

File tree

91 files changed

+12196
-1638
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+12196
-1638
lines changed

libs/3rdparty/etl/include/etl/algorithm.h

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ SOFTWARE.
4343
#include "iterator.h"
4444
#include "functional.h"
4545
#include "utility.h"
46+
#include "largest.h"
4647
#include "gcd.h"
4748
#include "error_handler.h"
4849
#include "exception.h"
@@ -952,12 +953,12 @@ namespace etl
952953

953954
while ((value_index > top_index) && compare(first[parent], value))
954955
{
955-
first[value_index] = etl::move(first[parent]);
956+
first[value_index] = ETL_MOVE(first[parent]);
956957
value_index = parent;
957958
parent = (value_index - 1) / 2;
958959
}
959960

960-
first[value_index] = etl::move(value);
961+
first[value_index] = ETL_MOVE(value);
961962
}
962963

963964
// Adjust Heap Helper
@@ -974,18 +975,18 @@ namespace etl
974975
--child2nd;
975976
}
976977

977-
first[value_index] = etl::move(first[child2nd]);
978+
first[value_index] = ETL_MOVE(first[child2nd]);
978979
value_index = child2nd;
979980
child2nd = 2 * (child2nd + 1);
980981
}
981982

982983
if (child2nd == length)
983984
{
984-
first[value_index] = etl::move(first[child2nd - 1]);
985+
first[value_index] = ETL_MOVE(first[child2nd - 1]);
985986
value_index = child2nd - 1;
986987
}
987988

988-
push_heap(first, value_index, top_index, etl::move(value), compare);
989+
push_heap(first, value_index, top_index, ETL_MOVE(value), compare);
989990
}
990991

991992
// Is Heap Helper
@@ -1018,10 +1019,10 @@ namespace etl
10181019
typedef typename etl::iterator_traits<TIterator>::value_type value_t;
10191020
typedef typename etl::iterator_traits<TIterator>::difference_type distance_t;
10201021

1021-
value_t value = etl::move(last[-1]);
1022-
last[-1] = etl::move(first[0]);
1022+
value_t value = ETL_MOVE(last[-1]);
1023+
last[-1] = ETL_MOVE(first[0]);
10231024

1024-
private_heap::adjust_heap(first, distance_t(0), distance_t(last - first - 1), etl::move(value), compare);
1025+
private_heap::adjust_heap(first, distance_t(0), distance_t(last - first - 1), ETL_MOVE(value), compare);
10251026
}
10261027

10271028
// Pop Heap
@@ -1040,7 +1041,7 @@ namespace etl
10401041
typedef typename etl::iterator_traits<TIterator>::difference_type difference_t;
10411042
typedef typename etl::iterator_traits<TIterator>::value_type value_t;
10421043

1043-
private_heap::push_heap(first, difference_t(last - first - 1), difference_t(0), value_t(etl::move(*(last - 1))), compare);
1044+
private_heap::push_heap(first, difference_t(last - first - 1), difference_t(0), value_t(ETL_MOVE(*(last - 1))), compare);
10441045
}
10451046

10461047
// Push Heap
@@ -1068,7 +1069,7 @@ namespace etl
10681069

10691070
while (true)
10701071
{
1071-
private_heap::adjust_heap(first, parent, length, etl::move(*(first + parent)), compare);
1072+
private_heap::adjust_heap(first, parent, length, ETL_MOVE(*(first + parent)), compare);
10721073

10731074
if (parent == 0)
10741075
{
@@ -1205,7 +1206,7 @@ namespace etl
12051206

12061207
for (int i = 0; i < gcd_nm; i++)
12071208
{
1208-
value_type temp = etl::move(*(first + i));
1209+
value_type temp = ETL_MOVE(*(first + i));
12091210
int j = i;
12101211

12111212
while (true)
@@ -1222,11 +1223,11 @@ namespace etl
12221223
break;
12231224
}
12241225

1225-
*(first + j) = etl::move(*(first + k));
1226+
*(first + j) = ETL_MOVE(*(first + k));
12261227
j = k;
12271228
}
12281229

1229-
*(first + j) = etl::move(temp);
1230+
*(first + j) = ETL_MOVE(temp);
12301231
}
12311232

12321233
return result;
@@ -1347,13 +1348,13 @@ namespace etl
13471348
typedef typename etl::iterator_traits<TIterator>::value_type value_type;
13481349

13491350
// Save the first item.
1350-
value_type temp(etl::move(*first));
1351+
value_type temp(ETL_MOVE(*first));
13511352

13521353
// Move the rest.
13531354
TIterator result = etl::move(etl::next(first), last, first);
13541355

13551356
// Restore the first item in its rotated position.
1356-
*result = etl::move(temp);
1357+
*result = ETL_MOVE(temp);
13571358

13581359
// The new position of the first item.
13591360
return result;
@@ -1369,13 +1370,13 @@ namespace etl
13691370

13701371
// Save the last item.
13711372
TIterator previous = etl::prev(last);
1372-
value_type temp(etl::move(*previous));
1373+
value_type temp(ETL_MOVE(*previous));
13731374

13741375
// Move the rest.
13751376
TIterator result = etl::move_backward(first, previous, last);
13761377

13771378
// Restore the last item in its rotated position.
1378-
*first = etl::move(temp);
1379+
*first = ETL_MOVE(temp);
13791380

13801381
// The new position of the first item.
13811382
return result;
@@ -2150,7 +2151,7 @@ namespace etl
21502151
{
21512152
while (first != last)
21522153
{
2153-
sum = etl::move(sum) + *first;
2154+
sum = ETL_MOVE(sum) + *first;
21542155
++first;
21552156
}
21562157

@@ -2167,7 +2168,7 @@ namespace etl
21672168
{
21682169
while (first != last)
21692170
{
2170-
sum = operation(etl::move(sum), *first);
2171+
sum = operation(ETL_MOVE(sum), *first);
21712172
++first;
21722173
}
21732174

@@ -2224,7 +2225,7 @@ namespace etl
22242225
{
22252226
if (!(*itr == value))
22262227
{
2227-
*first++ = etl::move(*itr);
2228+
*first++ = ETL_MOVE(*itr);
22282229
}
22292230
}
22302231
}
@@ -2250,7 +2251,7 @@ namespace etl
22502251
{
22512252
if (!predicate(*itr))
22522253
{
2253-
*first++ = etl::move(*itr);
2254+
*first++ = ETL_MOVE(*itr);
22542255
}
22552256
}
22562257
}
@@ -2280,14 +2281,19 @@ namespace etl
22802281
ETL_CONSTEXPR14
22812282
typename etl::enable_if<etl::is_random_iterator<TInputIterator>::value &&
22822283
etl::is_random_iterator<TOutputIterator>::value, TOutputIterator>::type
2283-
copy_s(TInputIterator i_begin,
2284-
TInputIterator i_end,
2285-
TOutputIterator o_begin,
2286-
TOutputIterator o_end)
2284+
copy_s(TInputIterator i_begin,
2285+
TInputIterator i_end,
2286+
TOutputIterator o_begin,
2287+
TOutputIterator o_end)
22872288
{
2288-
using s_size_type = typename iterator_traits<TInputIterator>::difference_type;
2289-
using d_size_type = typename iterator_traits<TOutputIterator>::difference_type;
2290-
using min_size_type = typename etl::common_type<s_size_type, d_size_type>::type;
2289+
typedef typename iterator_traits<TInputIterator>::difference_type s_size_type;
2290+
typedef typename iterator_traits<TOutputIterator>::difference_type d_size_type;
2291+
2292+
#if ETL_USING_CPP11
2293+
typedef typename etl::common_type<s_size_type, d_size_type>::type min_size_type;
2294+
#else
2295+
typedef typename etl::largest_type<s_size_type, d_size_type>::type min_size_type;
2296+
#endif
22912297

22922298
s_size_type s_size = etl::distance(i_begin, i_end);
22932299
ETL_ASSERT(s_size >= 0, ETL_ERROR(algorithm_error));

libs/3rdparty/etl/include/etl/alignment.h

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,10 @@ namespace etl
347347
#if ETL_USING_CPP11
348348
template <size_t Length, typename T>
349349
using aligned_storage_as_t = typename aligned_storage_as<Length, T>::type;
350+
#endif
350351

351352
//***************************************************************************
352-
/// Wrapper class that provides a memory area and lets the user emplace and
353+
/// Wrapper class that provides a memory area and lets the user create an
353354
/// instance of T in this memory at runtime. This class also erases the
354355
/// destructor call of T, i.e. if typed_storage goes out of scope, the
355356
/// destructor if the wrapped type will not be called. This can be done
@@ -361,11 +362,11 @@ namespace etl
361362
{
362363
public:
363364

364-
using value_type = T;
365-
using reference = T&;
366-
using const_reference = T const&;
367-
using pointer = T*;
368-
using const_pointer = T const*;
365+
typedef T value_type;
366+
typedef T& reference;
367+
typedef const T& const_reference;
368+
typedef T* pointer;
369+
typedef const T* const_pointer;
369370

370371
// Constructor
371372
typed_storage()
@@ -375,7 +376,7 @@ namespace etl
375376

376377
//***************************************************************************
377378
/// Default destructor which will NOT call the destructor of the object which
378-
/// was created by calling emplace().
379+
/// was created by calling create().
379380
//***************************************************************************
380381
~typed_storage() = default;
381382

@@ -390,17 +391,18 @@ namespace etl
390391
}
391392

392393
//***************************************************************************
393-
/// \returns true if object has been constructed using emplace().
394-
/// \returns false otherwise.
394+
/// \returns <b>true</b> if object has been constructed using create().
395+
/// \returns <b>false</b> otherwise.
395396
//***************************************************************************
396397
bool has_value() const
397398
{
398399
return valid;
399400
}
400401

402+
#if ETL_USING_CPP11
401403
//***************************************************************************
402404
/// Constructs the instance of T forwarding the given \p args to its constructor and
403-
/// asserts if has_value() is true before calling emplace().
405+
/// asserts if has_value() is false.
404406
///
405407
/// \returns the instance of T which has been constructed in the internal byte array.
406408
//***************************************************************************
@@ -411,6 +413,63 @@ namespace etl
411413
valid = true;
412414
return *::new (data.template get_address<char>()) value_type(etl::forward<Args>(args)...);
413415
}
416+
#else
417+
//***************************************************************************
418+
/// Constructs the instance of T with type T1
419+
/// asserts if has_value() is false.
420+
///
421+
/// \returns the instance of T which has been constructed in the internal byte array.
422+
//***************************************************************************
423+
template<typename T1>
424+
reference create(const T1& t1)
425+
{
426+
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
427+
valid = true;
428+
return *::new (data.template get_address<char>()) value_type(t1);
429+
}
430+
431+
//***************************************************************************
432+
/// Constructs the instance of T with types T1, T2
433+
/// asserts if has_value() is false.
434+
///
435+
/// \returns the instance of T which has been constructed in the internal byte array.
436+
//***************************************************************************
437+
template<typename T1, typename T2>
438+
reference create(const T1& t1, const T2& t2)
439+
{
440+
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
441+
valid = true;
442+
return *::new (data.template get_address<char>()) value_type(t1, t2);
443+
}
444+
445+
//***************************************************************************
446+
/// Constructs the instance of T with types T1, T2, T3
447+
/// asserts if has_value() is false.
448+
///
449+
/// \returns the instance of T which has been constructed in the internal byte array.
450+
//***************************************************************************
451+
template<typename T1, typename T2, typename T3>
452+
reference create(const T1& t1, const T2& t2, const T3& t3)
453+
{
454+
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
455+
valid = true;
456+
return *::new (data.template get_address<char>()) value_type(t1, t2, t3);
457+
}
458+
459+
//***************************************************************************
460+
/// Constructs the instance of T with types T1, T2, T3, T4
461+
/// asserts if has_value() is false.
462+
///
463+
/// \returns the instance of T which has been constructed in the internal byte array.
464+
//***************************************************************************
465+
template<typename T1, typename T2, typename T3, typename T4>
466+
reference create(const T1& t1, const T2& t2, const T3& t3, const T4& t4)
467+
{
468+
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
469+
valid = true;
470+
return *::new (data.template get_address<char>()) value_type(t1, t2, t3, t4);
471+
}
472+
#endif
414473

415474
//***************************************************************************
416475
/// \returns a pointer of type T and asserts if has_value() is false.
@@ -450,7 +509,6 @@ namespace etl
450509
typename aligned_storage_as<sizeof(value_type), value_type>::type data;
451510
bool valid;
452511
};
453-
#endif
454512
}
455513

456514
#endif

0 commit comments

Comments
 (0)