etl::const_map completed

This commit is contained in:
John Wellbelove 2025-06-15 20:11:08 +01:00
parent a2efcd2fe7
commit 609dc3dc2d
2 changed files with 5 additions and 3 deletions

View File

@ -64,7 +64,6 @@ namespace etl
/// Defines the parameter types
using const_key_reference = const key_type&;
using rvalue_key_reference = key_type&&;
using const_mapped_reference = const mapped_type&;
//*********************************************************************
@ -116,7 +115,8 @@ namespace etl
: element_list{etl::forward<TElements>(elements)...}
, element_list_end{element_list + sizeof...(elements)}
{
static_assert((etl::is_default_constructible<value_type>::value), "value_type must be default constructible");
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
static_assert((etl::is_default_constructible<mapped_type>::value), "mapped_type must be default constructible");
static_assert((etl::are_all_same<value_type, etl::decay_t<TElements>...>::value), "All elements must be value_type");
static_assert(sizeof...(elements) <= Size, "Number of elements exceeds capacity");
}

View File

@ -501,10 +501,12 @@ namespace
CMap compare_data(initial_data.begin(), initial_data.end());
EMap data(initial_data.begin(), initial_data.end());
auto v = data.at("3");
CHECK(data.at(Key("0")) == compare_data.at("0"));
CHECK(data.at(Key("1")) == compare_data.at("1"));
CHECK(data.at(Key("2")) == compare_data.at("2"));
CHECK(data.at(Key("3")) == compare_data.at("3"));
CHECK(data.at("3") == compare_data.at("3"));
CHECK(data.at(Key("4")) == compare_data.at("4"));
CHECK(data.at(Key("5")) == compare_data.at("5"));
CHECK(data.at(Key("6")) == compare_data.at("6"));