mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 22:59:47 +08:00
Added missing explicit initialisation from in_place structures.
This commit is contained in:
parent
bc095c9993
commit
6af5a0bbd2
@ -411,18 +411,18 @@ namespace etl
|
||||
};
|
||||
|
||||
#if ETL_CPP17_SUPPORTED
|
||||
inline constexpr in_place_t in_place;
|
||||
inline constexpr in_place_t in_place{};
|
||||
#endif
|
||||
|
||||
//*************************
|
||||
template <typename T> struct in_place_type_t
|
||||
{
|
||||
explicit ETL_CONSTEXPR in_place_type_t(){};
|
||||
explicit ETL_CONSTEXPR in_place_type_t() {};
|
||||
};
|
||||
|
||||
#if ETL_CPP17_SUPPORTED
|
||||
template <typename T>
|
||||
inline constexpr in_place_type_t<T> in_place_type;
|
||||
inline constexpr in_place_type_t<T> in_place_type{};
|
||||
#endif
|
||||
|
||||
//*************************
|
||||
@ -433,7 +433,7 @@ namespace etl
|
||||
|
||||
#if ETL_CPP17_SUPPORTED
|
||||
template <size_t I>
|
||||
inline constexpr in_place_index_t<I> in_place_index;
|
||||
inline constexpr in_place_index_t<I> in_place_index{};
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -478,19 +478,19 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(test_construct_multiple_parameters_by_type)
|
||||
{
|
||||
test_variant_emplace variant_etl1(etl::in_place_type_t<D1>(), "1");
|
||||
test_variant_emplace variant_etl1(etl::in_place_type<D1>, "1");
|
||||
CHECK(etl::holds_alternative<D1>(variant_etl1));
|
||||
CHECK_EQUAL(D1("1"), etl::get<D1>(variant_etl1));
|
||||
|
||||
test_variant_emplace variant_etl2(etl::in_place_type_t<D2>{}, "1", "2");
|
||||
test_variant_emplace variant_etl2(etl::in_place_type<D2>, "1", "2");
|
||||
CHECK(etl::holds_alternative<D2>(variant_etl2));
|
||||
CHECK_EQUAL(D2("1", "2"), etl::get<D2>(variant_etl2));
|
||||
|
||||
test_variant_emplace variant_etl3(etl::in_place_type_t<D3>{}, "1", "2", "3");
|
||||
test_variant_emplace variant_etl3(etl::in_place_type<D3>, "1", "2", "3");
|
||||
CHECK(etl::holds_alternative<D3>(variant_etl3));
|
||||
CHECK_EQUAL(D3("1", "2", "3"), etl::get<D3>(variant_etl3));
|
||||
|
||||
test_variant_emplace variant_etl4(etl::in_place_type_t<D4>{}, "1", "2", "3", "4");
|
||||
test_variant_emplace variant_etl4(etl::in_place_type<D4>, "1", "2", "3", "4");
|
||||
CHECK(etl::holds_alternative<D4>(variant_etl4));
|
||||
CHECK_EQUAL(D4("1", "2", "3", "4"), etl::get<D4>(variant_etl4));
|
||||
}
|
||||
@ -498,19 +498,19 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(test_construct_multiple_parameters_by_index)
|
||||
{
|
||||
test_variant_emplace variant_etl1(etl::in_place_index_t<1U>{}, "1");
|
||||
test_variant_emplace variant_etl1(etl::in_place_index<1U>, "1");
|
||||
CHECK(etl::holds_alternative<D1>(variant_etl1));
|
||||
CHECK_EQUAL(D1("1"), etl::get<D1>(variant_etl1));
|
||||
|
||||
test_variant_emplace variant_etl2(etl::in_place_index_t<2>{}, "1", "2");
|
||||
test_variant_emplace variant_etl2(etl::in_place_index<2>, "1", "2");
|
||||
CHECK(etl::holds_alternative<D2>(variant_etl2));
|
||||
CHECK_EQUAL(D2("1", "2"), etl::get<D2>(variant_etl2));
|
||||
|
||||
test_variant_emplace variant_etl3(etl::in_place_index_t<3>{}, "1", "2", "3");
|
||||
test_variant_emplace variant_etl3(etl::in_place_index<3>, "1", "2", "3");
|
||||
CHECK(etl::holds_alternative<D3>(variant_etl3));
|
||||
CHECK_EQUAL(D3("1", "2", "3"), etl::get<D3>(variant_etl3));
|
||||
|
||||
test_variant_emplace variant_etl4(etl::in_place_index_t<4U>{}, "1", "2", "3", "4");
|
||||
test_variant_emplace variant_etl4(etl::in_place_index<4U>, "1", "2", "3", "4");
|
||||
CHECK(etl::holds_alternative<D4>(variant_etl4));
|
||||
CHECK_EQUAL(D4("1", "2", "3", "4"), etl::get<D4>(variant_etl4));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user