Skip to content

Commit

Permalink
Fix issue #931 (#932)
Browse files Browse the repository at this point in the history
* Fix doc comment for pool::allocate() (#914)

* Fix issue #931

Superfluous curly braces removed

---------

Co-authored-by: Michael K <130953568+kmichaelk@users.noreply.github.com>
  • Loading branch information
Chiraffollo and kmichaelk authored Jul 23, 2024
1 parent c959c93 commit 5d97f07
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
1 change: 0 additions & 1 deletion include/etl/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ namespace etl

//*************************************************************************
/// Allocate an object from the pool.
/// Uses the default constructor.
/// If asserts or exceptions are enabled and there are no more free items an
/// etl::pool_no_allocation if thrown, otherwise a null pointer is returned.
/// Static asserts if the specified type is too large for the pool.
Expand Down
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 5d97f07

Please sign in to comment.