Merge branch 'development'

# Conflicts:
#	include/etl/parameter_pack.h
This commit is contained in:
John Wellbelove 2020-05-23 20:37:31 +01:00
commit dce2c95632
4 changed files with 15 additions and 13 deletions

View File

@ -66,8 +66,8 @@ namespace etl
};
//***********************************
template <typename T, typename T1>
struct index_of_type_helper<T, T1>
template <typename Type, typename T1>
struct index_of_type_helper<Type, T1>
{
static constexpr size_t value = 1;
};
@ -94,15 +94,15 @@ namespace etl
private:
//***********************************
template <size_t I, size_t N, typename T1, typename... TRest>
template <size_t II, size_t N, typename T1, typename... TRest>
struct type_from_index_helper
{
using type = typename std::conditional<I == N, T1, typename type_from_index_helper<I, N + 1, TRest...>::type>::type;
using type = typename std::conditional<II == N, T1, typename type_from_index_helper<II, N + 1, TRest...>::type>::type;
};
//***********************************
template <size_t I, size_t N, typename T1>
struct type_from_index_helper<I, N, T1>
template <size_t II, size_t N, typename T1>
struct type_from_index_helper<II, N, T1>
{
using type = T1;
};

View File

@ -137,6 +137,7 @@ set(TEST_SOURCE_FILES
test_queue_spsc_isr_small.cpp
test_queue_spsc_locked.cpp
test_queue_spsc_locked_small.cpp
test_parameter_pack
test_scaled_rounding.cpp
test_state_chart.cpp
test_string_view.cpp

View File

@ -349,6 +349,7 @@
<Unit filename="../../include/etl/observer.h" />
<Unit filename="../../include/etl/optional.h" />
<Unit filename="../../include/etl/packet.h" />
<Unit filename="../../include/etl/parameter_pack.h" />
<Unit filename="../../include/etl/parameter_type.h" />
<Unit filename="../../include/etl/pearson.h" />
<Unit filename="../../include/etl/permutations.h" />
@ -542,6 +543,7 @@
<Unit filename="../test_observer.cpp" />
<Unit filename="../test_optional.cpp" />
<Unit filename="../test_packet.cpp" />
<Unit filename="../test_parameter_pack.cpp" />
<Unit filename="../test_parameter_type.cpp" />
<Unit filename="../test_parity_checksum.cpp" />
<Unit filename="../test_pearson.cpp" />

View File

@ -809,13 +809,12 @@ namespace
}
//*************************************************************************
TEST(index_of)
TEST(is_rvalue_reference)
{
CHECK_EQUAL(0U, (etl::index_of<char, char, short, int>::value));
CHECK_EQUAL(1U, (etl::index_of<short, char, short, int>::value));
CHECK_EQUAL(2U, (etl::index_of<int, char, short, int>::value));
// Static assert
//CHECK_EQUAL(0U, (etl::index_of<long, char, short, int>::value));
CHECK_EQUAL(std::is_rvalue_reference_v<void>, etl::is_rvalue_reference_v<void>);
CHECK_EQUAL(std::is_rvalue_reference_v<int>, etl::is_rvalue_reference_v<int>);
CHECK_EQUAL(std::is_rvalue_reference_v<int*>, etl::is_rvalue_reference_v<int*>);
CHECK_EQUAL(std::is_rvalue_reference_v<int&>, etl::is_rvalue_reference_v<int&>);
CHECK_EQUAL(std::is_rvalue_reference_v<int&&>, etl::is_rvalue_reference_v<int&&>);
}
}