Fixed missing conditional macros around transparent comparator C++11 functions

This commit is contained in:
John Wellbelove 2024-11-11 13:19:59 +00:00
parent c9180a4b18
commit 27492b4562
4 changed files with 57 additions and 9 deletions

View File

@ -744,12 +744,12 @@ namespace etl
return pbucket->begin()->key_value_pair.second;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns a reference to the value at index 'key'
///\param key The key.
///\return A reference to the value at index 'key'
//*********************************************************************
#if ETL_USING_CPP11
template <typename K, typename KE = TKeyEqual, etl::enable_if_t<comparator_is_transparent<KE>::value, int> = 0>
mapped_reference operator [](const K& key)
{
@ -773,7 +773,6 @@ namespace etl
++inode;
}
}
#endif
// Doesn't exist, so add a new one.
// Get a new node.
@ -789,6 +788,7 @@ namespace etl
return pbucket->begin()->key_value_pair.second;
}
#endif
//*********************************************************************
/// Returns a reference to the value at index 'key'
@ -860,13 +860,13 @@ namespace etl
return begin()->second;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns a reference to the value at index 'key'
/// If asserts or exceptions are enabled, emits an etl::unordered_map_out_of_range if the key is not in the range.
///\param key The key.
///\return A reference to the value at index 'key'
//*********************************************************************
#if ETL_USING_CPP11
template <typename K, typename KE = TKeyEqual, etl::enable_if_t<comparator_is_transparent<KE>::value, int> = 0>
mapped_reference at(const K& key)
{
@ -1190,12 +1190,12 @@ namespace etl
return n;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Erases an element.
///\param key The key to erase.
///\return The number of elements erased. 0 or 1.
//*********************************************************************
#if ETL_USING_CPP11
template <typename K, typename KE = TKeyEqual, etl::enable_if_t<comparator_is_transparent<KE>::value, int> = 0>
size_t erase(const K& key)
{
@ -1326,12 +1326,12 @@ namespace etl
return (find(key) == end()) ? 0 : 1;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Counts an element.
///\param key The key to search for.
///\return 1 if the key exists, otherwise 0.
//*********************************************************************
#if ETL_USING_CPP11
template <typename K, typename KE = TKeyEqual, etl::enable_if_t<comparator_is_transparent<KE>::value, int> = 0>
size_t count(const K& key) const
{
@ -1407,12 +1407,12 @@ namespace etl
return end();
}
#if ETL_USING_CPP11
//*********************************************************************
/// Finds an element.
///\param key The key to search for.
///\return An iterator to the element if the key exists, otherwise end().
//*********************************************************************
#if ETL_USING_CPP11
template <typename K, typename KE = TKeyEqual, etl::enable_if_t<comparator_is_transparent<KE>::value, int> = 0>
iterator find(const K& key)
{
@ -1444,12 +1444,12 @@ namespace etl
}
#endif
#if ETL_USING_CPP11
//*********************************************************************
/// Finds an element.
///\param key The key to search for.
///\return An iterator to the element if the key exists, otherwise end().
//*********************************************************************
#if ETL_USING_CPP11
template <typename K, typename KE = TKeyEqual, etl::enable_if_t<comparator_is_transparent<KE>::value, int> = 0>
const_iterator find(const K& key) const
{
@ -1523,6 +1523,7 @@ namespace etl
return ETL_OR_STD::pair<const_iterator, const_iterator>(f, l);
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns a range containing all elements with key key in the container.
/// The range is defined by two iterators, the first pointing to the first
@ -1531,7 +1532,6 @@ namespace etl
///\param key The key to search for.
///\return An iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
#if ETL_USING_CPP11
template <typename K, typename KE = TKeyEqual, etl::enable_if_t<comparator_is_transparent<KE>::value, int> = 0>
ETL_OR_STD::pair<iterator, iterator> equal_range(const K& key)
{
@ -1547,6 +1547,7 @@ namespace etl
}
#endif
#if ETL_USING_CPP11
//*********************************************************************
/// Returns a range containing all elements with key key in the container.
/// The range is defined by two iterators, the first pointing to the first
@ -1555,7 +1556,6 @@ namespace etl
///\param key The key to search for.
///\return A const iterator pair to the range of elements if the key exists, otherwise end().
//*********************************************************************
#if ETL_USING_CPP11
template <typename K, typename KE = TKeyEqual, etl::enable_if_t<comparator_is_transparent<KE>::value, int> = 0>
ETL_OR_STD::pair<const_iterator, const_iterator> equal_range(const K& key) const
{

View File

@ -599,6 +599,7 @@ namespace etl
return key_hash_function(key) % number_of_buckets;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns the bucket index for the key.
///\return The bucket index for the key.
@ -608,6 +609,7 @@ namespace etl
{
return key_hash_function(key) % number_of_buckets;
}
#endif
//*********************************************************************
/// Returns the size of the bucket key.
@ -620,6 +622,7 @@ namespace etl
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns the size of the bucket key.
///\return The bucket size of the bucket key.
@ -631,6 +634,7 @@ namespace etl
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
#endif
//*********************************************************************
/// Returns the maximum number of the buckets the container can hold.
@ -892,6 +896,7 @@ namespace etl
return n;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Erases an element.
///\param key The key to erase.
@ -926,6 +931,7 @@ namespace etl
return n;
}
#endif
//*********************************************************************
/// Erases an element.
@ -1044,6 +1050,7 @@ namespace etl
return n;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Counts an element.
///\param key The key to search for.
@ -1070,6 +1077,7 @@ namespace etl
return n;
}
#endif
//*********************************************************************
/// Finds an element.
@ -1139,6 +1147,7 @@ namespace etl
return end();
}
#if ETL_USING_CPP11
//*********************************************************************
/// Finds an element.
///\param key The key to search for.
@ -1173,7 +1182,9 @@ namespace etl
return end();
}
#endif
#if ETL_USING_CPP11
//*********************************************************************
/// Finds an element.
///\param key The key to search for.
@ -1208,6 +1219,7 @@ namespace etl
return end();
}
#endif
//*********************************************************************
/// Returns a range containing all elements with key key in the container.
@ -1261,6 +1273,7 @@ namespace etl
return ETL_OR_STD::pair<const_iterator, const_iterator>(f, l);
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns a range containing all elements with key key in the container.
/// The range is defined by two iterators, the first pointing to the first
@ -1287,7 +1300,9 @@ namespace etl
return ETL_OR_STD::pair<iterator, iterator>(f, l);
}
#endif
#if ETL_USING_CPP11
//*********************************************************************
/// Returns a range containing all elements with key key in the container.
/// The range is defined by two iterators, the first pointing to the first
@ -1314,6 +1329,7 @@ namespace etl
return ETL_OR_STD::pair<const_iterator, const_iterator>(f, l);
}
#endif
//*************************************************************************
/// Gets the size of the unordered_multimap.

View File

@ -590,6 +590,7 @@ namespace etl
return key_hash_function(key) % number_of_buckets;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns the bucket index for the key.
///\return The bucket index for the key.
@ -599,6 +600,7 @@ namespace etl
{
return key_hash_function(key) % number_of_buckets;
}
#endif
//*********************************************************************
/// Returns the size of the bucket key.
@ -611,6 +613,7 @@ namespace etl
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns the size of the bucket key.
///\return The bucket size of the bucket key.
@ -622,6 +625,7 @@ namespace etl
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
#endif
//*********************************************************************
/// Returns the maximum number of the buckets the container can hold.
@ -736,6 +740,7 @@ namespace etl
return result;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Inserts a value to the unordered_multiset.
/// If asserts or exceptions are enabled, emits unordered_multiset_full if the unordered_multiset is already full.
@ -806,6 +811,7 @@ namespace etl
return result;
}
#endif
#if ETL_USING_CPP11
//*********************************************************************
@ -941,6 +947,7 @@ namespace etl
return n;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Erases an element.
///\param key The key to erase.
@ -975,6 +982,7 @@ namespace etl
return n;
}
#endif
//*********************************************************************
/// Erases an element.
@ -1093,6 +1101,7 @@ namespace etl
return n;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Counts an element.
///\param key The key to search for.
@ -1119,6 +1128,7 @@ namespace etl
return n;
}
#endif
//*********************************************************************
/// Finds an element.
@ -1188,6 +1198,7 @@ namespace etl
return end();
}
#if ETL_USING_CPP11
//*********************************************************************
/// Finds an element.
///\param key The key to search for.
@ -1222,7 +1233,9 @@ namespace etl
return end();
}
#endif
#if ETL_USING_CPP11
//*********************************************************************
/// Finds an element.
///\param key The key to search for.
@ -1257,6 +1270,7 @@ namespace etl
return end();
}
#endif
//*********************************************************************
/// Returns a range containing all elements with key key in the container.

View File

@ -591,6 +591,7 @@ namespace etl
return key_hash_function(key) % number_of_buckets;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns the bucket index for the key.
///\return The bucket index for the key.
@ -600,6 +601,7 @@ namespace etl
{
return key_hash_function(key) % number_of_buckets;
}
#endif
//*********************************************************************
/// Returns the size of the bucket key.
@ -612,6 +614,7 @@ namespace etl
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns the size of the bucket key.
///\return The bucket size of the bucket key.
@ -623,6 +626,7 @@ namespace etl
return etl::distance(pbuckets[index].begin(), pbuckets[index].end());
}
#endif
//*********************************************************************
/// Returns the maximum number of the buckets the container can hold.
@ -754,6 +758,7 @@ namespace etl
return result;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Inserts a value to the unordered_set.
/// If asserts or exceptions are enabled, emits unordered_set_full if the unordered_set is already full.
@ -841,6 +846,7 @@ namespace etl
return result;
}
#endif
#if ETL_USING_CPP11
//*********************************************************************
@ -1004,6 +1010,7 @@ namespace etl
return n;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Erases an element.
///\param key The key to erase.
@ -1036,6 +1043,7 @@ namespace etl
return n;
}
#endif
//*********************************************************************
/// Erases an element.
@ -1138,6 +1146,7 @@ namespace etl
return (find(key) == end()) ? 0 : 1;
}
#if ETL_USING_CPP11
//*********************************************************************
/// Counts an element.
///\param key The key to search for.
@ -1148,6 +1157,7 @@ namespace etl
{
return (find(key) == end()) ? 0 : 1;
}
#endif
//*********************************************************************
/// Finds an element.
@ -1217,6 +1227,7 @@ namespace etl
return end();
}
#if ETL_USING_CPP11
//*********************************************************************
/// Finds an element.
///\param key The key to search for.
@ -1251,7 +1262,9 @@ namespace etl
return end();
}
#endif
#if ETL_USING_CPP11
//*********************************************************************
/// Finds an element.
///\param key The key to search for.
@ -1286,6 +1299,7 @@ namespace etl
return end();
}
#endif
//*********************************************************************
/// Returns a range containing all elements with key 'key' in the container.
@ -1329,6 +1343,7 @@ namespace etl
return ETL_OR_STD::pair<const_iterator, const_iterator>(f, l);
}
#if ETL_USING_CPP11
//*********************************************************************
/// Returns a range containing all elements with key 'key' in the container.
/// The range is defined by two iterators, the first pointing to the first
@ -1350,7 +1365,9 @@ namespace etl
return ETL_OR_STD::pair<iterator, iterator>(f, l);
}
#endif
#if ETL_USING_CPP11
//*********************************************************************
/// Returns a range containing all elements with key 'key' in the container.
/// The range is defined by two iterators, the first pointing to the first
@ -1372,6 +1389,7 @@ namespace etl
return ETL_OR_STD::pair<const_iterator, const_iterator>(f, l);
}
#endif
//*************************************************************************
/// Gets the size of the unordered_set.