Skip to content

Commit

Permalink
Fix issue ETLCPP#931
Browse files Browse the repository at this point in the history
Superfluous curly braces removed
  • Loading branch information
Chiraffollo committed Jul 23, 2024
1 parent 744d54c commit 31eca7a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/etl/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ namespace etl
template <typename... T>
constexpr auto make_vector(T&&... t) -> etl::vector<typename etl::common_type_t<T...>, sizeof...(T)>
{
return { { etl::forward<T>(t)... } };
return { etl::forward<T>(t)... };
}
#endif

Expand Down Expand Up @@ -1674,7 +1674,7 @@ namespace etl
template <typename... T>
constexpr auto make_vector(T*... t) -> etl::vector<typename etl::common_type_t<T*...>, sizeof...(T)>
{
return { { etl::forward<T*>(t)... } };
return { etl::forward<T*>(t)... };
}
#endif

Expand Down
23 changes: 23 additions & 0 deletions test/test_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,29 @@ namespace
}
#endif

//*************************************************************************
#if ETL_HAS_INITIALIZER_LIST
TEST(test_make_vector_issue_931_two_pairs)
{
auto data3 = etl::make_vector(etl::make_pair(1, 2),
etl::make_pair(3, 4),
etl::make_pair(5, 6));
CHECK_EQUAL(1, data3[0].first);
CHECK_EQUAL(2, data3[0].second);
CHECK_EQUAL(3, data3[1].first);
CHECK_EQUAL(4, data3[1].second);
CHECK_EQUAL(5, data3[2].first);
CHECK_EQUAL(6, data3[2].second);

auto data2 = etl::make_vector(etl::make_pair(1, 2),
etl::make_pair(3, 4));
CHECK_EQUAL(1, data3[0].first);
CHECK_EQUAL(2, data3[0].second);
CHECK_EQUAL(3, data3[1].first);
CHECK_EQUAL(4, data3[1].second);
}
#endif

//*************************************************************************
TEST(test_fill)
{
Expand Down

0 comments on commit 31eca7a

Please sign in to comment.