mirror of
https://github.com/ETLCPP/etl.git
synced 2026-07-30 16:26:17 +08:00
Allow etl::vector to store pointers to functions and member functions (#1492)
* Refactored vector.h Deleted ivectorpointer.h * Minor changes * Fixed code incompatible with C++03 * Clang-format changes * Removed redundant double-qualified name * Fixed is_is_object_pointer_v to is_object_pointer_v * Added new test files to meson.build * Added overflow checks to vector_ext copy and move constructors and assignments Added assert throw tests. * Added diagnostic pushes to eliminate GCC warning false positives * Changed the GCC C++23 Github action to use GCC14 * Applied clang-format * Added guard to pop_heap * Added guard to adjust_heap * Attempt to fix GCC diagnostic * Attempt to fix GCC diagnostic Re-enable ranges algorithm tests * Attempt to fix GCC diagnostic Re-enable ranges algorithm tests * clang-format * Attempt to fix GCC diagnostic Re-enable ranges algorithm tests * Attempt to fix GCC diagnostic Re-enable ranges algorithm tests * Attempt to fix GCC diagnostic Re-enable ranges algorithm tests * Missing newline at end of file * Attempt to fix GCC diagnostic Re-enable ranges algorithm tests * Attempt to fix GCC diagnostic Re-enable ranges algorithm tests * Attempt to fix GCC diagnostic Re-enable ranges algorithm tests * Attempt to fix GCC diagnostic Re-enable ranges algorithm tests * Attempt to fix GCC diagnostic * clang-format * Changed gcc --version to gcc-14 --version --------- Co-authored-by: John Wellbelove <john.wellbelove@etlcpp.com> Co-authored-by: Roland Reichwein <Roland.Reichwein@bmw.de>
This commit is contained in:
parent
40dddd7f96
commit
5287fe4b3b
24
.github/workflows/gcc-c++23.yml
vendored
24
.github/workflows/gcc-c++23.yml
vendored
@ -21,10 +21,10 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
export CC=gcc-14
|
||||
export CXX=g++-14
|
||||
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 -DETL_OPTIMISATION=-O3 ./
|
||||
gcc --version
|
||||
gcc-14 --version
|
||||
make -j "$(getconf _NPROCESSORS_ONLN)"
|
||||
|
||||
- name: Run tests
|
||||
@ -43,10 +43,10 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
export CC=gcc-14
|
||||
export CXX=g++-14
|
||||
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_CXX_STANDARD=23 -DETL_OPTIMISATION=-O3 ./
|
||||
gcc --version
|
||||
gcc-14 --version
|
||||
make -j "$(getconf _NPROCESSORS_ONLN)"
|
||||
|
||||
- name: Run tests
|
||||
@ -65,10 +65,10 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
export CC=gcc-14
|
||||
export CXX=g++-14
|
||||
cmake -DBUILD_TESTS=ON -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 -DETL_OPTIMISATION=-O3 ./
|
||||
gcc --version
|
||||
gcc-14 --version
|
||||
make -j "$(getconf _NPROCESSORS_ONLN)"
|
||||
|
||||
- name: Run tests
|
||||
@ -87,10 +87,10 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
export ASAN_OPTIONS=alloc_dealloc_mismatch=0,detect_leaks=0
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
export CC=gcc-14
|
||||
export CXX=g++-14
|
||||
cmake -DBUILD_TESTS=ON -DNO_STL=ON -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=ON -DETL_CXX_STANDARD=23 -DETL_OPTIMISATION=-O3 ./
|
||||
gcc --version
|
||||
gcc-14 --version
|
||||
make -j "$(getconf _NPROCESSORS_ONLN)"
|
||||
|
||||
- name: Run tests
|
||||
|
||||
@ -3,7 +3,7 @@ title: "type_traits"
|
||||
---
|
||||
|
||||
Reverse engineered types traits classes from C++11 plus several ETL extensions.
|
||||
This file is generated from type_traits_generator.h. See Generators
|
||||
This file is generated from `type_traits_generator.h`. See Generators
|
||||
Not all traits have been defined as some rely on compiler intrinsics that are not available on all compiler platforms.
|
||||
|
||||
`integral_constant`
|
||||
@ -459,3 +459,20 @@ template <typename T, template <typename...> class Template>
|
||||
inline constexpr bool is_specialization_v = etl::is_specialization<T, Template>::value;
|
||||
```
|
||||
C++17
|
||||
|
||||
## is_object_pointer
|
||||
From: `20.49.0`
|
||||
|
||||
```cpp
|
||||
template <typename T>
|
||||
struct is_object_pointer
|
||||
```
|
||||
Checks if `T` is a pointer to an object.
|
||||
Pointers to functions and member functions return `false`.
|
||||
The result is found in the member `value`.
|
||||
|
||||
```cpp
|
||||
template <typename T>
|
||||
inline constexpr bool is_object_pointer_v = etl::is_object_pointer<T>::value;
|
||||
```
|
||||
C++17
|
||||
|
||||
@ -914,6 +914,7 @@ namespace etl
|
||||
TDistance top_index = value_index;
|
||||
TDistance child2nd = (2 * value_index) + 2;
|
||||
|
||||
#include "etl/private/diagnostic_array_bounds_push.h"
|
||||
while (child2nd < length)
|
||||
{
|
||||
if (compare(*(first + child2nd), *(first + (child2nd - 1))))
|
||||
@ -931,6 +932,7 @@ namespace etl
|
||||
*(first + value_index) = ETL_MOVE(*(first + (child2nd - 1)));
|
||||
value_index = child2nd - 1;
|
||||
}
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
|
||||
push_heap(first, value_index, top_index, ETL_MOVE(value), compare);
|
||||
}
|
||||
@ -965,6 +967,12 @@ namespace etl
|
||||
typedef typename etl::iterator_traits<TIterator>::value_type value_t;
|
||||
typedef typename etl::iterator_traits<TIterator>::difference_type distance_t;
|
||||
|
||||
const distance_t n = last - first;
|
||||
if (n <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
value_t value = ETL_MOVE(*(last - 1));
|
||||
*(last - 1) = ETL_MOVE(*first);
|
||||
|
||||
@ -5844,6 +5852,8 @@ namespace etl
|
||||
{
|
||||
ETL_STATIC_ASSERT(etl::is_random_access_iterator<I>::value, "partial_sort requires random access iterators");
|
||||
|
||||
#include "etl/private/diagnostic_array_bounds_push.h"
|
||||
|
||||
I last_it = ranges::next(first, last);
|
||||
|
||||
if (first == middle || first == last_it)
|
||||
@ -5880,6 +5890,8 @@ namespace etl
|
||||
}
|
||||
|
||||
return last_it;
|
||||
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
}
|
||||
|
||||
template <class R, class Comp = ranges::less, class Proj = etl::identity, typename = etl::enable_if_t<etl::is_range_v<R>>>
|
||||
@ -5933,6 +5945,8 @@ namespace etl
|
||||
{
|
||||
ETL_STATIC_ASSERT(etl::is_random_access_iterator<I2>::value, "partial_sort_copy requires the output to be random access iterators");
|
||||
|
||||
#include "etl/private/diagnostic_array_bounds_push.h"
|
||||
|
||||
I1 in_last = ranges::next(first, last);
|
||||
I2 out_last = ranges::next(result_first, result_last);
|
||||
|
||||
@ -5970,7 +5984,6 @@ namespace etl
|
||||
}
|
||||
}
|
||||
|
||||
#include "etl/private/diagnostic_array_bounds_push.h"
|
||||
// Sort the heap to produce a sorted output range
|
||||
for (auto heap_end = heap_size - 1; heap_end > 0; --heap_end)
|
||||
{
|
||||
@ -7025,6 +7038,8 @@ namespace etl
|
||||
{
|
||||
ETL_STATIC_ASSERT(etl::is_random_access_iterator<I>::value, "pop_heap requires random access iterators");
|
||||
|
||||
#include "etl/private/diagnostic_array_bounds_push.h"
|
||||
|
||||
I last_it = ranges::next(first, last);
|
||||
|
||||
auto length = etl::distance(first, last_it);
|
||||
@ -7041,6 +7056,8 @@ namespace etl
|
||||
sift_down(first, decltype(length)(0), etl::distance(first, last_it), comp, proj);
|
||||
|
||||
return ranges::next(first, last);
|
||||
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
}
|
||||
|
||||
template <class R, class Comp = ranges::less, class Proj = etl::identity, typename = etl::enable_if_t<etl::is_range_v<R>>>
|
||||
|
||||
@ -227,11 +227,13 @@ namespace etl
|
||||
return ETL_NULLPTR == base::etl_parent;
|
||||
}
|
||||
|
||||
#include "private/diagnostic_null_dereference_push.h"
|
||||
ETL_NODISCARD
|
||||
link_type* get_parent()
|
||||
{
|
||||
return static_cast<link_type*>(base::etl_parent);
|
||||
}
|
||||
#include "private/diagnostic_pop.h"
|
||||
|
||||
ETL_NODISCARD
|
||||
const link_type* get_parent() const
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1491,14 +1491,14 @@ namespace etl
|
||||
span(const etl::array<T, Size>&) -> span<const T, Size>;
|
||||
|
||||
// Forward declaration of etl::ivector
|
||||
template <typename T>
|
||||
template <typename T, typename Enable>
|
||||
class ivector;
|
||||
|
||||
template <typename T>
|
||||
span(etl::ivector<T>&) -> span<T>;
|
||||
template <typename T, typename Enable>
|
||||
span(etl::ivector<T, Enable>&) -> span<T>;
|
||||
|
||||
template <typename T>
|
||||
span(const etl::ivector<T>&) -> span<const T>;
|
||||
template <typename T, typename Enable>
|
||||
span(const etl::ivector<T, Enable>&) -> span<const T>;
|
||||
|
||||
#if ETL_USING_STL && ETL_USING_CPP11
|
||||
template <typename T, size_t Size>
|
||||
|
||||
@ -3909,6 +3909,32 @@ namespace etl
|
||||
#endif
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
/// Is T a member pointer
|
||||
//***************************************************************************
|
||||
namespace private_type_traits
|
||||
{
|
||||
template <typename T>
|
||||
struct is_member_pointer_helper : etl::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename TObject>
|
||||
struct is_member_pointer_helper<T TObject::*> : etl::true_type
|
||||
{
|
||||
};
|
||||
} // namespace private_type_traits
|
||||
|
||||
template <typename T>
|
||||
struct is_member_pointer : private_type_traits::is_member_pointer_helper< typename etl::remove_cv<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T>
|
||||
inline constexpr bool is_member_pointer_v = etl::is_member_pointer<T>::value;
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
//*********************************
|
||||
/// Check if T is a function type
|
||||
@ -4008,6 +4034,15 @@ namespace etl
|
||||
inline constexpr bool is_function_v = etl::is_function<T>::value;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template <typename T>
|
||||
struct is_function : etl::bool_constant<!etl::is_member_pointer<T>::value && !etl::is_const<const T>::value && !etl::is_reference<T>::value>
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// is_object
|
||||
//***************************************************************************
|
||||
@ -4016,10 +4051,22 @@ namespace etl
|
||||
{
|
||||
};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T>
|
||||
inline constexpr bool is_object_v = etl::is_object<T>::value;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// is_object_pointer
|
||||
//***************************************************************************
|
||||
template <typename T>
|
||||
struct is_object_pointer : etl::bool_constant<etl::is_pointer<T>::value && etl::is_object<typename etl::remove_pointer<T>::type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T>
|
||||
inline constexpr bool is_object_pointer_v = etl::is_object_pointer<T>::value;
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
@ -4075,32 +4122,6 @@ namespace etl
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//***************************************************************************
|
||||
/// Is T a member pointer
|
||||
//***************************************************************************
|
||||
namespace private_type_traits
|
||||
{
|
||||
template <typename T>
|
||||
struct is_member_pointer_helper : etl::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T, typename TObject>
|
||||
struct is_member_pointer_helper<T TObject::*> : etl::true_type
|
||||
{
|
||||
};
|
||||
} // namespace private_type_traits
|
||||
|
||||
template <typename T>
|
||||
struct is_member_pointer : private_type_traits::is_member_pointer_helper< typename etl::remove_cv<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
#if ETL_USING_CPP17
|
||||
template <typename T>
|
||||
inline constexpr bool is_member_pointer_v = etl::is_member_pointer<T>::value;
|
||||
#endif
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
//***************************************************************************
|
||||
/// Is T a member function pointer
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -374,6 +374,10 @@ add_executable(etl_tests
|
||||
test_vector_non_trivial.cpp
|
||||
test_vector_pointer.cpp
|
||||
test_vector_pointer_external_buffer.cpp
|
||||
test_vector_function_pointer.cpp
|
||||
test_vector_function_pointer_external_buffer.cpp
|
||||
test_vector_member_function_pointer.cpp
|
||||
test_vector_member_function_pointer_external_buffer.cpp
|
||||
test_visitor.cpp
|
||||
test_xor_checksum.cpp
|
||||
test_xor_rotate_checksum.cpp
|
||||
|
||||
@ -362,6 +362,10 @@ etl_test_sources = files(
|
||||
'test_vector_non_trivial.cpp',
|
||||
'test_vector_pointer.cpp',
|
||||
'test_vector_pointer_external_buffer.cpp',
|
||||
'test_vector_function_pointer.cpp',
|
||||
'test_vector_function_pointer_external_buffer.cpp',
|
||||
'test_vector_member_function_pointer.cpp',
|
||||
'test_vector_member_function_pointer_external_buffer.cpp',
|
||||
'test_visitor.cpp',
|
||||
'test_xor_checksum.cpp',
|
||||
'test_xor_rotate_checksum.cpp'
|
||||
|
||||
@ -593,6 +593,7 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(test_conversion_operator_for_forward_iterator)
|
||||
{
|
||||
#include "etl/private/diagnostic_null_dereference_push.h"
|
||||
DataF data = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
|
||||
etl::circular_iterator<DataF::const_iterator> ci(std::begin(data), std::end(data));
|
||||
@ -607,6 +608,7 @@ namespace
|
||||
++itr;
|
||||
++ci;
|
||||
CHECK(itr == ci.current());
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -2306,7 +2306,9 @@ namespace
|
||||
|
||||
data.fill(N999);
|
||||
|
||||
#include "etl/private/diagnostic_uninitialized_push.h"
|
||||
CHECK(std::equal(blank_data.begin(), blank_data.end(), data.begin()));
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -2319,6 +2321,7 @@ namespace
|
||||
// Access via const_iterator operator[]
|
||||
DataNDC::const_iterator cit = cdata.begin();
|
||||
|
||||
#include "etl/private/diagnostic_uninitialized_push.h"
|
||||
// Verify operator[] returns values matching sequential access
|
||||
for (size_t i = 0; i < cdata.size(); ++i)
|
||||
{
|
||||
@ -2330,6 +2333,7 @@ namespace
|
||||
// the type would be non-const reference which is incorrect for const_iterator)
|
||||
const NDC& ref = cit[0];
|
||||
CHECK(ref == cdata[0]);
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -1720,6 +1720,7 @@ namespace
|
||||
{
|
||||
using Pair = std::pair<const std::string, int>;
|
||||
|
||||
#include "etl/private/diagnostic_null_dereference_push.h"
|
||||
etl::map data{Pair{"0", 0}, Pair{"1", 1}, Pair{"2", 2}, Pair{"3", 3}, Pair{"4", 4}, Pair{"5", 5}};
|
||||
|
||||
auto v = *data.begin();
|
||||
@ -1732,6 +1733,7 @@ namespace
|
||||
CHECK_EQUAL(3, data.at("3"));
|
||||
CHECK_EQUAL(4, data.at("4"));
|
||||
CHECK_EQUAL(5, data.at("5"));
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
|
||||
CHECK_TRUE(std::is_sorted(data.begin(), data.end(), data.value_comp()));
|
||||
}
|
||||
@ -1743,6 +1745,7 @@ namespace
|
||||
{
|
||||
using Pair = ETL_OR_STD::pair<const std::string, int>;
|
||||
|
||||
#include "etl/private/diagnostic_null_dereference_push.h"
|
||||
auto data = etl::make_map<const std::string, int, std::less<std::string>>(Pair{"0", 0}, Pair{"1", 1}, Pair{"2", 2}, Pair{"3", 3}, Pair{"4", 4},
|
||||
Pair{"5", 5});
|
||||
|
||||
@ -1756,6 +1759,7 @@ namespace
|
||||
CHECK_EQUAL(3, data.at("3"));
|
||||
CHECK_EQUAL(4, data.at("4"));
|
||||
CHECK_EQUAL(5, data.at("5"));
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
|
||||
CHECK_TRUE(std::is_sorted(data.begin(), data.end(), data.value_comp()));
|
||||
}
|
||||
|
||||
@ -1167,6 +1167,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
#include "etl/private/diagnostic_uninitialized_push.h"
|
||||
TEST(test_const_variant_accept_visitor)
|
||||
{
|
||||
struct Visitor : public etl::visitor<const char&, const int&, const std::string&>
|
||||
@ -1217,8 +1218,10 @@ namespace
|
||||
const_variant_etl3.accept(visitor);
|
||||
CHECK_EQUAL("3", visitor.result_s);
|
||||
}
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
|
||||
//*************************************************************************
|
||||
#include "etl/private/diagnostic_uninitialized_push.h"
|
||||
TEST(test_const_variant_accept_visitor_deprecated)
|
||||
{
|
||||
struct Visitor : public etl::visitor<char, int, const std::string&>
|
||||
@ -1271,6 +1274,7 @@ namespace
|
||||
const_variant_etl3.accept(visitor);
|
||||
CHECK_EQUAL("3", visitor.result_s);
|
||||
}
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_variant_accept_functor_with_functor_class)
|
||||
@ -1378,6 +1382,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
#include "etl/private/diagnostic_uninitialized_push.h"
|
||||
TEST(test_const_variant_accept_functor_with_functor_class)
|
||||
{
|
||||
struct Visitor
|
||||
@ -1428,8 +1433,10 @@ namespace
|
||||
const_variant_etl3.accept(visitor);
|
||||
CHECK_EQUAL("3", visitor.result_s);
|
||||
}
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
|
||||
//*************************************************************************
|
||||
#include "etl/private/diagnostic_uninitialized_push.h"
|
||||
TEST(test_const_variant_accept_functor_with_functor_class_deprecated)
|
||||
{
|
||||
struct Visitor
|
||||
@ -1480,6 +1487,7 @@ namespace
|
||||
const_variant_etl3.accept(visitor);
|
||||
CHECK_EQUAL("3", visitor.result_s);
|
||||
}
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
|
||||
//*************************************************************************
|
||||
#if ETL_USING_CPP17
|
||||
@ -1550,6 +1558,7 @@ namespace
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
#include "etl/private/diagnostic_uninitialized_push.h"
|
||||
TEST(test_const_variant_accept_functor_with_overload)
|
||||
{
|
||||
char result_c;
|
||||
@ -1576,8 +1585,10 @@ namespace
|
||||
const_variant_etl3.accept(visitor);
|
||||
CHECK_EQUAL("3", result_s);
|
||||
}
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
|
||||
//*************************************************************************
|
||||
#include "etl/private/diagnostic_uninitialized_push.h"
|
||||
TEST(test_const_variant_accept_functor_with_overload_deprecated)
|
||||
{
|
||||
char result_c;
|
||||
@ -1604,6 +1615,7 @@ namespace
|
||||
const_variant_etl3.accept(visitor);
|
||||
CHECK_EQUAL("3", result_s);
|
||||
}
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
#endif
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -1078,12 +1078,14 @@ namespace
|
||||
Data data(initial_data.begin(), initial_data.end());
|
||||
|
||||
Compare_Data::iterator const_cdi = compare_data.begin() + 2U;
|
||||
int compare_value = *(const_cdi + 1U);
|
||||
#include "etl/private/diagnostic_null_dereference_push.h"
|
||||
int compare_value = compare_data[3];
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
Compare_Data::iterator cdi = compare_data.erase(const_cdi);
|
||||
CHECK_EQUAL(compare_value, *cdi);
|
||||
|
||||
Data::iterator const_di = data.begin() + 2U;
|
||||
int data_value = *(const_di + 1U);
|
||||
int data_value = data[3];
|
||||
Data::iterator di = data.erase(const_di);
|
||||
CHECK_EQUAL(data_value, *di);
|
||||
|
||||
@ -1109,12 +1111,14 @@ namespace
|
||||
Data data(initial_data.begin(), initial_data.end());
|
||||
|
||||
Compare_Data::const_iterator const_cdi = compare_data.cbegin() + 2U;
|
||||
int compare_value = *(const_cdi + 1U);
|
||||
#include "etl/private/diagnostic_null_dereference_push.h"
|
||||
int compare_value = compare_data[3];
|
||||
#include "etl/private/diagnostic_pop.h"
|
||||
Compare_Data::iterator cdi = compare_data.erase(const_cdi);
|
||||
CHECK_EQUAL(compare_value, *cdi);
|
||||
|
||||
Data::const_iterator const_di = data.cbegin() + 2U;
|
||||
int data_value = *(const_di + 1U);
|
||||
int data_value = data[3];
|
||||
Data::iterator di = data.erase(const_di);
|
||||
CHECK_EQUAL(data_value, *di);
|
||||
|
||||
@ -1139,15 +1143,9 @@ namespace
|
||||
Compare_Data compare_data(initial_data.begin(), initial_data.end());
|
||||
Data data(initial_data.begin(), initial_data.end());
|
||||
|
||||
Compare_Data::const_iterator const_cdi = compare_data.cbegin() + 2U;
|
||||
int compare_value = *(const_cdi + 2U);
|
||||
Compare_Data::iterator cdi = compare_data.erase(const_cdi, const_cdi + 2U);
|
||||
CHECK_EQUAL(compare_value, *cdi);
|
||||
compare_data.erase(compare_data.begin() + 2, compare_data.begin() + 4);
|
||||
|
||||
Data::const_iterator const_di = data.cbegin() + 2U;
|
||||
int data_value = *(const_di + 2U);
|
||||
Data::iterator di = data.erase(const_di, const_di + 2U);
|
||||
CHECK_EQUAL(data_value, *di);
|
||||
data.erase(data.begin() + 2, data.begin() + 4);
|
||||
|
||||
CHECK_EQUAL(compare_data.size(), data.size());
|
||||
|
||||
|
||||
@ -46,6 +46,8 @@ namespace
|
||||
int buffer4[SIZE];
|
||||
int buffer5[SIZE];
|
||||
|
||||
int bufferLarger[SIZE + 1];
|
||||
|
||||
SUITE(test_vector_external_buffer)
|
||||
{
|
||||
typedef etl::vector_ext<int> Data;
|
||||
@ -183,6 +185,14 @@ namespace
|
||||
CHECK(data2 != data);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_copy_construct_from_larger_vector_ext)
|
||||
{
|
||||
Data data(initial_data.begin(), initial_data.end(), bufferLarger, SIZE + 1);
|
||||
data.resize(SIZE + 1, 0);
|
||||
CHECK_THROW(Data data2(data, buffer1, SIZE), etl::vector_full);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_move_constructor)
|
||||
{
|
||||
@ -193,6 +203,14 @@ namespace
|
||||
CHECK(data2 != data);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_move_construct_from_larger_vector_ext)
|
||||
{
|
||||
Data data(initial_data.begin(), initial_data.end(), bufferLarger, SIZE + 1);
|
||||
data.resize(SIZE + 1, 0);
|
||||
CHECK_THROW(Data data2(etl::move(data), buffer1, SIZE), etl::vector_full);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, test_assignment)
|
||||
{
|
||||
|
||||
1321
test/test_vector_function_pointer.cpp
Normal file
1321
test/test_vector_function_pointer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1301
test/test_vector_function_pointer_external_buffer.cpp
Normal file
1301
test/test_vector_function_pointer_external_buffer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1330
test/test_vector_member_function_pointer.cpp
Normal file
1330
test/test_vector_member_function_pointer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1329
test/test_vector_member_function_pointer_external_buffer.cpp
Normal file
1329
test/test_vector_member_function_pointer_external_buffer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -3700,7 +3700,6 @@
|
||||
<ClInclude Include="..\..\include\etl\mutex\mutex_std.h" />
|
||||
<ClInclude Include="..\..\include\etl\packet.h" />
|
||||
<ClInclude Include="..\..\include\etl\permutations.h" />
|
||||
<ClInclude Include="..\..\include\etl\private\ivectorpointer.h" />
|
||||
<ClInclude Include="..\..\include\etl\private\minmax_pop.h" />
|
||||
<ClInclude Include="..\..\include\etl\private\minmax_push.h" />
|
||||
<ClInclude Include="..\..\include\etl\profiles\arduino_arm.h" />
|
||||
@ -11462,6 +11461,10 @@
|
||||
<ClCompile Include="..\test_variant_pool.cpp" />
|
||||
<ClCompile Include="..\test_vector.cpp" />
|
||||
<ClCompile Include="..\test_vector_external_buffer.cpp" />
|
||||
<ClCompile Include="..\test_vector_function_pointer.cpp" />
|
||||
<ClCompile Include="..\test_vector_function_pointer_external_buffer.cpp" />
|
||||
<ClCompile Include="..\test_vector_member_function_pointer.cpp" />
|
||||
<ClCompile Include="..\test_vector_member_function_pointer_external_buffer.cpp" />
|
||||
<ClCompile Include="..\test_vector_non_trivial.cpp" />
|
||||
<ClCompile Include="..\test_vector_pointer.cpp" />
|
||||
<ClCompile Include="..\test_vector_pointer_external_buffer.cpp" />
|
||||
@ -11497,19 +11500,32 @@
|
||||
<None Include="..\..\.clang-format" />
|
||||
<None Include="..\..\.coderabbit.yaml" />
|
||||
<None Include="..\..\.gitattributes" />
|
||||
<None Include="..\..\.github\workflows\bazel-gcc-c++23-no-stl.yml" />
|
||||
<None Include="..\..\.github\workflows\clang-c++11.yml" />
|
||||
<None Include="..\..\.github\workflows\clang-c++14.yml" />
|
||||
<None Include="..\..\.github\workflows\clang-c++17.yml" />
|
||||
<None Include="..\..\.github\workflows\clang-c++20.yml" />
|
||||
<None Include="..\..\.github\workflows\clang-c++23.yml" />
|
||||
<None Include="..\..\.github\workflows\clang-c++26.yml" />
|
||||
<None Include="..\..\.github\workflows\clang-format.yaml" />
|
||||
<None Include="..\..\.github\workflows\clang-format_update.yaml" />
|
||||
<None Include="..\..\.github\workflows\clang-syntax-checks.yml" />
|
||||
<None Include="..\..\.github\workflows\clang-tidy.yaml" />
|
||||
<None Include="..\..\.github\workflows\coverage.yml" />
|
||||
<None Include="..\..\.github\workflows\deploy-etl-documentation.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++11.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++14.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++17.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++20.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-armhf.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-i386.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-powerpc.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-riscv64.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-s390x.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++23.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-c++26.yml" />
|
||||
<None Include="..\..\.github\workflows\generator.yml" />
|
||||
<None Include="..\..\.github\workflows\meson-gcc-c++23-no-stl.yml" />
|
||||
<None Include="..\..\.github\workflows\msvc.yml" />
|
||||
<None Include="..\..\.github\workflows\gcc-syntax-checks.yml" />
|
||||
<None Include="..\..\.github\workflows\platformio-update.yml" />
|
||||
|
||||
@ -597,9 +597,6 @@
|
||||
<ClInclude Include="..\..\include\etl\bit_stream.h">
|
||||
<Filter>ETL\Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\etl\private\ivectorpointer.h">
|
||||
<Filter>ETL\Private</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\etl\private\minmax_pop.h">
|
||||
<Filter>ETL\Private</Filter>
|
||||
</ClInclude>
|
||||
@ -1569,6 +1566,9 @@
|
||||
<ClInclude Include="..\..\include\etl\generators\message_router_cpp03_generator.h">
|
||||
<Filter>ETL\Messaging\Generators</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\etl\format.h">
|
||||
<Filter>UnitTest++\Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\test_string_char.cpp">
|
||||
@ -3815,6 +3815,18 @@
|
||||
<ClCompile Include="..\test_closure_with_inplace_function.cpp">
|
||||
<Filter>Tests\Callbacks & Delegates</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_vector_function_pointer.cpp">
|
||||
<Filter>Tests\Containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_vector_member_function_pointer.cpp">
|
||||
<Filter>Tests\Containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_vector_function_pointer_external_buffer.cpp">
|
||||
<Filter>Tests\Containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\test_vector_member_function_pointer_external_buffer.cpp">
|
||||
<Filter>Tests\Containers</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\library.properties">
|
||||
@ -3999,6 +4011,45 @@
|
||||
<None Include="..\run-coverage.sh">
|
||||
<Filter>Tests\Scripts</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\bazel-gcc-c++23-no-stl.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\clang-c++26.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\clang-tidy.yaml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\coverage.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\deploy-etl-documentation.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-armhf.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-i386.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-powerpc.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-riscv64.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++23-s390x.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++26.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\generator.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\meson-gcc-c++23-no-stl.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\support\Release notes.txt">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user