mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-26 20:38:45 +08:00
Removed erronious 'const' and '&' from 'key_value_parameter_t' parameters, as for non-fundamental types they will already be 'const &'.
This commit is contained in:
parent
fe0467e8b7
commit
113a561596
40
src/map.h
40
src/map.h
@ -516,11 +516,11 @@ namespace etl
|
||||
{
|
||||
return key_compare()(node1.value.first, node2.value.first);
|
||||
}
|
||||
bool node_comp(const Data_Node& node, const key_value_parameter_t& key) const
|
||||
bool node_comp(const Data_Node& node, key_value_parameter_t key) const
|
||||
{
|
||||
return key_compare()(node.value.first, key);
|
||||
}
|
||||
bool node_comp(const key_value_parameter_t& key, const Data_Node& node) const
|
||||
bool node_comp(key_value_parameter_t key, const Data_Node& node) const
|
||||
{
|
||||
return key_compare()(key, node.value.first);
|
||||
}
|
||||
@ -903,7 +903,7 @@ namespace etl
|
||||
///\param i The index.
|
||||
///\return A reference to the value at index 'key'
|
||||
//*********************************************************************
|
||||
mapped_type& operator [](const key_value_parameter_t& key)
|
||||
mapped_type& operator [](key_value_parameter_t key)
|
||||
{
|
||||
iterator i_element = find(key);
|
||||
|
||||
@ -922,7 +922,7 @@ namespace etl
|
||||
///\param i The index.
|
||||
///\return A reference to the value at index 'key'
|
||||
//*********************************************************************
|
||||
mapped_type& at(const key_value_parameter_t& key)
|
||||
mapped_type& at(key_value_parameter_t key)
|
||||
{
|
||||
iterator i_element = find(key);
|
||||
|
||||
@ -937,7 +937,7 @@ namespace etl
|
||||
///\param i The index.
|
||||
///\return A const reference to the value at index 'key'
|
||||
//*********************************************************************
|
||||
const mapped_type& at(const key_value_parameter_t& key) const
|
||||
const mapped_type& at(key_value_parameter_t key) const
|
||||
{
|
||||
const_iterator i_element = find(key);
|
||||
|
||||
@ -973,7 +973,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return 1 if element was found, 0 otherwise.
|
||||
//*********************************************************************
|
||||
size_type count(const key_value_parameter_t& key) const
|
||||
size_type count(key_value_parameter_t key) const
|
||||
{
|
||||
return find_node(root_node, key) ? 1 : 0;
|
||||
}
|
||||
@ -982,7 +982,7 @@ namespace etl
|
||||
/// Returns two iterators with bounding (lower bound, upper bound) the key
|
||||
/// provided
|
||||
//*************************************************************************
|
||||
std::pair<iterator, iterator> equal_range(const key_value_parameter_t& key)
|
||||
std::pair<iterator, iterator> equal_range(key_value_parameter_t key)
|
||||
{
|
||||
return std::make_pair<iterator, iterator>(
|
||||
iterator(*this, find_lower_node(root_node, key)),
|
||||
@ -993,7 +993,7 @@ namespace etl
|
||||
/// Returns two const iterators with bounding (lower bound, upper bound)
|
||||
/// the key provided.
|
||||
//*************************************************************************
|
||||
std::pair<const_iterator, const_iterator> equal_range(const key_value_parameter_t& key) const
|
||||
std::pair<const_iterator, const_iterator> equal_range(key_value_parameter_t key) const
|
||||
{
|
||||
return std::make_pair<const_iterator, const_iterator>(
|
||||
const_iterator(*this, find_lower_node(root_node, key)),
|
||||
@ -1027,7 +1027,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
// Erase the key specified.
|
||||
//*************************************************************************
|
||||
size_type erase(const key_value_parameter_t& key)
|
||||
size_type erase(key_value_parameter_t key)
|
||||
{
|
||||
// Return 1 if key value was found and removed
|
||||
return remove_node(root_node, key) ? 1 : 0;
|
||||
@ -1066,7 +1066,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pointing to the element or end() if not found.
|
||||
//*********************************************************************
|
||||
iterator find(const key_value_parameter_t& key)
|
||||
iterator find(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_node(root_node, key));
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pointing to the element or end() if not found.
|
||||
//*********************************************************************
|
||||
const_iterator find(const key_value_parameter_t& key) const
|
||||
const_iterator find(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_node(root_node, key));
|
||||
}
|
||||
@ -1173,7 +1173,7 @@ namespace etl
|
||||
/// if all keys are considered to go before the key provided.
|
||||
///\return An iterator pointing to the element not before key or end()
|
||||
//*********************************************************************
|
||||
iterator lower_bound(const key_value_parameter_t& key)
|
||||
iterator lower_bound(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_lower_node(root_node, key));
|
||||
}
|
||||
@ -1184,7 +1184,7 @@ namespace etl
|
||||
/// or end() if all keys are considered to go before the key provided.
|
||||
///\return An const_iterator pointing to the element not before key or end()
|
||||
//*********************************************************************
|
||||
const_iterator lower_bound(const key_value_parameter_t& key) const
|
||||
const_iterator lower_bound(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_lower_node(root_node, key));
|
||||
}
|
||||
@ -1195,7 +1195,7 @@ namespace etl
|
||||
/// if all keys are considered to go after the key provided.
|
||||
///\return An iterator pointing to the element after key or end()
|
||||
//*********************************************************************
|
||||
iterator upper_bound(const key_value_parameter_t& key)
|
||||
iterator upper_bound(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_upper_node(root_node, key));
|
||||
}
|
||||
@ -1206,7 +1206,7 @@ namespace etl
|
||||
/// or end() if all keys are considered to go after the key provided.
|
||||
///\return An const_iterator pointing to the element after key or end()
|
||||
//*********************************************************************
|
||||
const_iterator upper_bound(const key_value_parameter_t& key) const
|
||||
const_iterator upper_bound(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_upper_node(root_node, key));
|
||||
}
|
||||
@ -1270,7 +1270,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the value matching the node provided
|
||||
//*************************************************************************
|
||||
Node* find_node(Node* position, const key_value_parameter_t& key)
|
||||
Node* find_node(Node* position, key_value_parameter_t key)
|
||||
{
|
||||
Node* found = position;
|
||||
while (found)
|
||||
@ -1303,7 +1303,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the value matching the node provided
|
||||
//*************************************************************************
|
||||
const Node* find_node(const Node* position, const key_value_parameter_t& key) const
|
||||
const Node* find_node(const Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
const Node* found = position;
|
||||
while (found)
|
||||
@ -1477,7 +1477,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the node whose key is not considered to go before the key provided
|
||||
//*************************************************************************
|
||||
Node* find_lower_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_lower_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
// Something at this position? keep going
|
||||
Node* lower_node = position;
|
||||
@ -1516,7 +1516,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the node whose key is considered to go after the key provided
|
||||
//*************************************************************************
|
||||
Node* find_upper_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_upper_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
// Keep track of parent of last upper node
|
||||
Node* upper_node = nullptr;
|
||||
@ -1805,7 +1805,7 @@ namespace etl
|
||||
/// Remove the node specified from somewhere starting at the position
|
||||
/// provided
|
||||
//*************************************************************************
|
||||
Node* remove_node(Node*& position, const key_value_parameter_t& key)
|
||||
Node* remove_node(Node*& position, key_value_parameter_t key)
|
||||
{
|
||||
// Step 1: Find the target node that matches the key provided, the
|
||||
// replacement node (might be the same as target node), and the critical
|
||||
|
||||
@ -667,12 +667,12 @@ namespace etl
|
||||
return key_compare()(node1.value.first, node2.value.first);
|
||||
}
|
||||
|
||||
bool node_comp(const Data_Node& node, const key_value_parameter_t& key) const
|
||||
bool node_comp(const Data_Node& node, key_value_parameter_t key) const
|
||||
{
|
||||
return key_compare()(node.value.first, key);
|
||||
}
|
||||
|
||||
bool node_comp(const key_value_parameter_t& key, const Data_Node& node) const
|
||||
bool node_comp(key_value_parameter_t key, const Data_Node& node) const
|
||||
{
|
||||
return key_compare()(key, node.value.first);
|
||||
}
|
||||
@ -1074,7 +1074,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return 1 if element was found, 0 otherwise.
|
||||
//*********************************************************************
|
||||
size_type count(const key_value_parameter_t& key) const
|
||||
size_type count(key_value_parameter_t key) const
|
||||
{
|
||||
return count_nodes(key);
|
||||
}
|
||||
@ -1083,7 +1083,7 @@ namespace etl
|
||||
/// Returns two iterators with bounding (lower bound, upper bound) the key
|
||||
/// provided
|
||||
//*************************************************************************
|
||||
std::pair<iterator, iterator> equal_range(const key_value_parameter_t& key)
|
||||
std::pair<iterator, iterator> equal_range(key_value_parameter_t key)
|
||||
{
|
||||
return std::make_pair<iterator, iterator>(
|
||||
iterator(*this, find_lower_node(root_node, key)),
|
||||
@ -1094,7 +1094,7 @@ namespace etl
|
||||
/// Returns two const iterators with bounding (lower bound, upper bound)
|
||||
/// the key provided.
|
||||
//*************************************************************************
|
||||
std::pair<const_iterator, const_iterator> equal_range(const key_value_parameter_t& key) const
|
||||
std::pair<const_iterator, const_iterator> equal_range(key_value_parameter_t key) const
|
||||
{
|
||||
return std::make_pair<const_iterator, const_iterator>(
|
||||
const_iterator(*this, find_lower_node(root_node, key)),
|
||||
@ -1131,7 +1131,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
// Erase the key specified.
|
||||
//*************************************************************************
|
||||
size_type erase(const key_value_parameter_t& key)
|
||||
size_type erase(key_value_parameter_t key)
|
||||
{
|
||||
// Number of nodes removed
|
||||
size_type count = 0;
|
||||
@ -1182,7 +1182,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pointing to the element or end() if not found.
|
||||
//*********************************************************************
|
||||
iterator find(const key_value_parameter_t& key)
|
||||
iterator find(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_node(root_node, key));
|
||||
}
|
||||
@ -1192,7 +1192,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pointing to the element or end() if not found.
|
||||
//*********************************************************************
|
||||
const_iterator find(const key_value_parameter_t& key) const
|
||||
const_iterator find(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_node(root_node, key));
|
||||
}
|
||||
@ -1265,7 +1265,7 @@ namespace etl
|
||||
/// if all keys are considered to go before the key provided.
|
||||
///\return An iterator pointing to the element not before key or end()
|
||||
//*********************************************************************
|
||||
iterator lower_bound(const key_value_parameter_t& key)
|
||||
iterator lower_bound(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_lower_node(root_node, key));
|
||||
}
|
||||
@ -1276,7 +1276,7 @@ namespace etl
|
||||
/// or end() if all keys are considered to go before the key provided.
|
||||
///\return An const_iterator pointing to the element not before key or end()
|
||||
//*********************************************************************
|
||||
const_iterator lower_bound(const key_value_parameter_t& key) const
|
||||
const_iterator lower_bound(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_lower_node(root_node, key));
|
||||
}
|
||||
@ -1287,7 +1287,7 @@ namespace etl
|
||||
/// if all keys are considered to go after the key provided.
|
||||
///\return An iterator pointing to the element after key or end()
|
||||
//*********************************************************************
|
||||
iterator upper_bound(const key_value_parameter_t& key)
|
||||
iterator upper_bound(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_upper_node(root_node, key));
|
||||
}
|
||||
@ -1298,7 +1298,7 @@ namespace etl
|
||||
/// or end() if all keys are considered to go after the key provided.
|
||||
///\return An const_iterator pointing to the element after key or end()
|
||||
//*********************************************************************
|
||||
const_iterator upper_bound(const key_value_parameter_t& key) const
|
||||
const_iterator upper_bound(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_upper_node(root_node, key));
|
||||
}
|
||||
@ -1362,7 +1362,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Count the nodes that match the key provided
|
||||
//*************************************************************************
|
||||
size_type count_nodes(const key_value_parameter_t& key) const
|
||||
size_type count_nodes(key_value_parameter_t key) const
|
||||
{
|
||||
// Number of nodes that match the key provided result
|
||||
size_type result = 0;
|
||||
@ -1394,7 +1394,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the value matching the node provided
|
||||
//*************************************************************************
|
||||
Node* find_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
Node* found = nullptr;
|
||||
while (position)
|
||||
@ -1427,7 +1427,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the value matching the node provided
|
||||
//*************************************************************************
|
||||
const Node* find_node(const Node* position, const key_value_parameter_t& key) const
|
||||
const Node* find_node(const Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
const Node* found = nullptr;
|
||||
while (position)
|
||||
@ -1460,7 +1460,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the node whose key is not considered to go before the key provided
|
||||
//*************************************************************************
|
||||
Node* find_lower_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_lower_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
// Something at this position? keep going
|
||||
Node* lower_node = nullptr;
|
||||
@ -1501,7 +1501,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the node whose key is considered to go after the key provided
|
||||
//*************************************************************************
|
||||
Node* find_upper_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_upper_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
// Keep track of parent of last upper node
|
||||
Node* upper_node = nullptr;
|
||||
|
||||
@ -594,7 +594,7 @@ namespace etl
|
||||
}
|
||||
|
||||
size_type current_size; ///< The number of the used nodes.
|
||||
const size_type MAX_SIZE; ///< The maximum size of the set.
|
||||
const size_type MAX_SIZE; ///< The maximum size of the set.
|
||||
Node* root_node; ///< The node that acts as the multiset root.
|
||||
etl::debug_count construct_count;
|
||||
};
|
||||
@ -663,11 +663,11 @@ namespace etl
|
||||
{
|
||||
return key_compare()(node1.value, node2.value);
|
||||
}
|
||||
bool node_comp(const Data_Node& node, const key_value_parameter_t& key) const
|
||||
bool node_comp(const Data_Node& node, key_value_parameter_t key) const
|
||||
{
|
||||
return key_compare()(node.value, key);
|
||||
}
|
||||
bool node_comp(const key_value_parameter_t& key, const Data_Node& node) const
|
||||
bool node_comp(key_value_parameter_t key, const Data_Node& node) const
|
||||
{
|
||||
return key_compare()(key, node.value);
|
||||
}
|
||||
@ -1054,7 +1054,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return 1 if element was found, 0 otherwise.
|
||||
//*********************************************************************
|
||||
size_type count(const key_value_parameter_t& key) const
|
||||
size_type count(key_value_parameter_t key) const
|
||||
{
|
||||
return count_nodes(key);
|
||||
}
|
||||
@ -1111,7 +1111,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
// Erase the key specified.
|
||||
//*************************************************************************
|
||||
size_type erase(const key_value_parameter_t& key_value)
|
||||
size_type erase(key_value_parameter_t key_value)
|
||||
{
|
||||
// Number of nodes removed
|
||||
size_type count = 0;
|
||||
@ -1162,7 +1162,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pointing to the element or end() if not found.
|
||||
//*********************************************************************
|
||||
iterator find(const key_value_parameter_t& key_value)
|
||||
iterator find(key_value_parameter_t key_value)
|
||||
{
|
||||
return iterator(*this, find_node(root_node, key_value));
|
||||
}
|
||||
@ -1172,7 +1172,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pointing to the element or end() if not found.
|
||||
//*********************************************************************
|
||||
const_iterator find(const key_value_parameter_t& key_value) const
|
||||
const_iterator find(key_value_parameter_t key_value) const
|
||||
{
|
||||
return const_iterator(*this, find_node(root_node, key_value));
|
||||
}
|
||||
@ -1245,7 +1245,7 @@ namespace etl
|
||||
/// if all keys are considered to go before the key provided.
|
||||
///\return An iterator pointing to the element not before key or end()
|
||||
//*********************************************************************
|
||||
iterator lower_bound(const key_value_parameter_t& key)
|
||||
iterator lower_bound(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_lower_node(root_node, key));
|
||||
}
|
||||
@ -1256,7 +1256,7 @@ namespace etl
|
||||
/// or end() if all keys are considered to go before the key provided.
|
||||
///\return An const_iterator pointing to the element not before key or end()
|
||||
//*********************************************************************
|
||||
const_iterator lower_bound(const key_value_parameter_t& key) const
|
||||
const_iterator lower_bound(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_lower_node(root_node, key));
|
||||
}
|
||||
@ -1267,7 +1267,7 @@ namespace etl
|
||||
/// if all keys are considered to go after the key provided.
|
||||
///\return An iterator pointing to the element after key or end()
|
||||
//*********************************************************************
|
||||
iterator upper_bound(const key_value_parameter_t& key)
|
||||
iterator upper_bound(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_upper_node(root_node, key));
|
||||
}
|
||||
@ -1278,7 +1278,7 @@ namespace etl
|
||||
/// or end() if all keys are considered to go after the key provided.
|
||||
///\return An const_iterator pointing to the element after key or end()
|
||||
//*********************************************************************
|
||||
const_iterator upper_bound(const key_value_parameter_t& key) const
|
||||
const_iterator upper_bound(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_upper_node(root_node, key));
|
||||
}
|
||||
@ -1342,7 +1342,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Count the nodes that match the key provided
|
||||
//*************************************************************************
|
||||
size_type count_nodes(const key_value_parameter_t& key) const
|
||||
size_type count_nodes(key_value_parameter_t key) const
|
||||
{
|
||||
// Number of nodes that match the key provided result
|
||||
size_type result = 0;
|
||||
@ -1374,7 +1374,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the value matching the node provided
|
||||
//*************************************************************************
|
||||
Node* find_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
Node* found = nullptr;
|
||||
while (position)
|
||||
@ -1407,7 +1407,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the value matching the node provided
|
||||
//*************************************************************************
|
||||
const Node* find_node(const Node* position, const key_value_parameter_t& key) const
|
||||
const Node* find_node(const Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
const Node* found = nullptr;
|
||||
while (position)
|
||||
@ -1440,7 +1440,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the node whose key is not considered to go before the key provided
|
||||
//*************************************************************************
|
||||
Node* find_lower_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_lower_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
// Something at this position? keep going
|
||||
Node* lower_node = nullptr;
|
||||
@ -1481,7 +1481,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the node whose key is considered to go after the key provided
|
||||
//*************************************************************************
|
||||
Node* find_upper_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_upper_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
// Keep track of parent of last upper node
|
||||
Node* upper_node = nullptr;
|
||||
|
||||
32
src/set.h
32
src/set.h
@ -433,7 +433,7 @@ namespace etl
|
||||
// Clear weight factor for new current position
|
||||
position->weight = uint_least8_t(kNeither);
|
||||
}
|
||||
|
||||
|
||||
size_type current_size; ///< The number of the used nodes.
|
||||
const size_type MAX_SIZE; ///< The maximum size of the set.
|
||||
Node* root_node; ///< The node that acts as the set root.
|
||||
@ -504,11 +504,11 @@ namespace etl
|
||||
{
|
||||
return key_compare()(node1.value, node2.value);
|
||||
}
|
||||
bool node_comp(const Data_Node& node, const key_value_parameter_t& key) const
|
||||
bool node_comp(const Data_Node& node, key_value_parameter_t key) const
|
||||
{
|
||||
return key_compare()(node.value, key);
|
||||
}
|
||||
bool node_comp(const key_value_parameter_t& key, const Data_Node& node) const
|
||||
bool node_comp(key_value_parameter_t key, const Data_Node& node) const
|
||||
{
|
||||
return key_compare()(key, node.value);
|
||||
}
|
||||
@ -908,7 +908,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return 1 if element was found, 0 otherwise.
|
||||
//*********************************************************************
|
||||
size_type count(const key_value_parameter_t& key) const
|
||||
size_type count(key_value_parameter_t key) const
|
||||
{
|
||||
return find_node(root_node, key) ? 1 : 0;
|
||||
}
|
||||
@ -962,7 +962,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
// Erase the key specified.
|
||||
//*************************************************************************
|
||||
size_type erase(const key_value_parameter_t& key_value)
|
||||
size_type erase(key_value_parameter_t key_value)
|
||||
{
|
||||
// Return 1 if key value was found and removed
|
||||
return remove_node(root_node, key_value) ? 1 : 0;
|
||||
@ -1001,7 +1001,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pointing to the element or end() if not found.
|
||||
//*********************************************************************
|
||||
iterator find(const key_value_parameter_t& key_value)
|
||||
iterator find(key_value_parameter_t key_value)
|
||||
{
|
||||
return iterator(*this, find_node(root_node, key_value));
|
||||
}
|
||||
@ -1011,7 +1011,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pointing to the element or end() if not found.
|
||||
//*********************************************************************
|
||||
const_iterator find(const key_value_parameter_t& key_value) const
|
||||
const_iterator find(key_value_parameter_t key_value) const
|
||||
{
|
||||
return const_iterator(*this, find_node(root_node, key_value));
|
||||
}
|
||||
@ -1108,7 +1108,7 @@ namespace etl
|
||||
/// if all keys are considered to go before the key provided.
|
||||
///\return An iterator pointing to the element not before key or end()
|
||||
//*********************************************************************
|
||||
iterator lower_bound(const key_value_parameter_t& key)
|
||||
iterator lower_bound(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_lower_node(root_node, key));
|
||||
}
|
||||
@ -1119,7 +1119,7 @@ namespace etl
|
||||
/// or end() if all keys are considered to go before the key provided.
|
||||
///\return An const_iterator pointing to the element not before key or end()
|
||||
//*********************************************************************
|
||||
const_iterator lower_bound(const key_value_parameter_t& key) const
|
||||
const_iterator lower_bound(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_lower_node(root_node, key));
|
||||
}
|
||||
@ -1130,7 +1130,7 @@ namespace etl
|
||||
/// if all keys are considered to go after the key provided.
|
||||
///\return An iterator pointing to the element after key or end()
|
||||
//*********************************************************************
|
||||
iterator upper_bound(const key_value_parameter_t& key)
|
||||
iterator upper_bound(key_value_parameter_t key)
|
||||
{
|
||||
return iterator(*this, find_upper_node(root_node, key));
|
||||
}
|
||||
@ -1141,7 +1141,7 @@ namespace etl
|
||||
/// or end() if all keys are considered to go after the key provided.
|
||||
///\return An const_iterator pointing to the element after key or end()
|
||||
//*********************************************************************
|
||||
const_iterator upper_bound(const key_value_parameter_t& key) const
|
||||
const_iterator upper_bound(key_value_parameter_t key) const
|
||||
{
|
||||
return const_iterator(*this, find_upper_node(root_node, key));
|
||||
}
|
||||
@ -1191,7 +1191,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the value matching the node provided
|
||||
//*************************************************************************
|
||||
Node* find_node(Node* position, const key_value_parameter_t& key)
|
||||
Node* find_node(Node* position, key_value_parameter_t key)
|
||||
{
|
||||
Node* found = position;
|
||||
while (found)
|
||||
@ -1224,7 +1224,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the value matching the node provided
|
||||
//*************************************************************************
|
||||
const Node* find_node(const Node* position, const key_value_parameter_t& key) const
|
||||
const Node* find_node(const Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
const Node* found = position;
|
||||
while (found)
|
||||
@ -1398,7 +1398,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the node whose key is not considered to go before the key provided
|
||||
//*************************************************************************
|
||||
Node* find_lower_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_lower_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
// Something at this position? keep going
|
||||
Node* lower_node = position;
|
||||
@ -1437,7 +1437,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Find the node whose key is considered to go after the key provided
|
||||
//*************************************************************************
|
||||
Node* find_upper_node(Node* position, const key_value_parameter_t& key) const
|
||||
Node* find_upper_node(Node* position, key_value_parameter_t key) const
|
||||
{
|
||||
// Keep track of parent of last upper node
|
||||
Node* upper_node = nullptr;
|
||||
@ -1726,7 +1726,7 @@ namespace etl
|
||||
/// Remove the node specified from somewhere starting at the position
|
||||
/// provided
|
||||
//*************************************************************************
|
||||
Node* remove_node(Node*& position, const key_value_parameter_t& key)
|
||||
Node* remove_node(Node*& position, key_value_parameter_t key)
|
||||
{
|
||||
// Step 1: Find the target node that matches the key provided, the
|
||||
// replacement node (might be the same as target node), and the critical
|
||||
|
||||
@ -1075,7 +1075,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pair to the range of elements if the key exists, otherwise end().
|
||||
//*********************************************************************
|
||||
std::pair<iterator, iterator> equal_range(const key_value_parameter_t& key)
|
||||
std::pair<iterator, iterator> equal_range(key_value_parameter_t key)
|
||||
{
|
||||
iterator first = find(key);
|
||||
iterator last = first;
|
||||
@ -1096,7 +1096,7 @@ 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().
|
||||
//*********************************************************************
|
||||
std::pair<const_iterator, const_iterator> equal_range(const key_value_parameter_t& key) const
|
||||
std::pair<const_iterator, const_iterator> equal_range(key_value_parameter_t key) const
|
||||
{
|
||||
const_iterator first = find(key);
|
||||
const_iterator last = first;
|
||||
|
||||
@ -145,7 +145,7 @@ namespace etl
|
||||
typedef typename etl::parameter_type<TKey>::type key_value_parameter_t;
|
||||
|
||||
typedef etl::forward_link<0> link_t; // Default link.
|
||||
|
||||
|
||||
struct node_t : public link_t // The nodes that store the elements.
|
||||
{
|
||||
node_t(const value_type& key_value_pair)
|
||||
@ -977,7 +977,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pair to the range of elements if the key exists, otherwise end().
|
||||
//*********************************************************************
|
||||
std::pair<iterator, iterator> equal_range(const key_value_parameter_t& key)
|
||||
std::pair<iterator, iterator> equal_range(key_value_parameter_t key)
|
||||
{
|
||||
iterator first = find(key);
|
||||
iterator last = first;
|
||||
@ -1003,7 +1003,7 @@ 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().
|
||||
//*********************************************************************
|
||||
std::pair<const_iterator, const_iterator> equal_range(const key_value_parameter_t& key) const
|
||||
std::pair<const_iterator, const_iterator> equal_range(key_value_parameter_t key) const
|
||||
{
|
||||
const_iterator first = find(key);
|
||||
const_iterator last = first;
|
||||
|
||||
@ -970,7 +970,7 @@ namespace etl
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pair to the range of elements if the key exists, otherwise end().
|
||||
//*********************************************************************
|
||||
std::pair<iterator, iterator> equal_range(const key_value_parameter_t& key)
|
||||
std::pair<iterator, iterator> equal_range(key_value_parameter_t key)
|
||||
{
|
||||
iterator first = find(key);
|
||||
iterator last = first;
|
||||
@ -996,7 +996,7 @@ 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().
|
||||
//*********************************************************************
|
||||
std::pair<const_iterator, const_iterator> equal_range(const key_value_parameter_t& key) const
|
||||
std::pair<const_iterator, const_iterator> equal_range(key_value_parameter_t key) const
|
||||
{
|
||||
const_iterator first = find(key);
|
||||
const_iterator last = first;
|
||||
|
||||
@ -951,13 +951,13 @@ namespace etl
|
||||
|
||||
//*********************************************************************
|
||||
/// 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
|
||||
/// element of the wanted range and the second pointing past the last
|
||||
/// The range is defined by two iterators, the first pointing to the first
|
||||
/// element of the wanted range and the second pointing past the last
|
||||
/// element of the range.
|
||||
///\param key The key to search for.
|
||||
///\return An iterator pair to the range of elements if the key exists, otherwise end().
|
||||
//*********************************************************************
|
||||
std::pair<iterator, iterator> equal_range(const key_value_parameter_t& key)
|
||||
std::pair<iterator, iterator> equal_range(key_value_parameter_t key)
|
||||
{
|
||||
iterator first = find(key);
|
||||
iterator last = first;
|
||||
@ -972,13 +972,13 @@ namespace etl
|
||||
|
||||
//*********************************************************************
|
||||
/// 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
|
||||
/// element of the wanted range and the second pointing past the last
|
||||
/// The range is defined by two iterators, the first pointing to the first
|
||||
/// element of the wanted range and the second pointing past the last
|
||||
/// element of the range.
|
||||
///\param key The key to search for.
|
||||
///\return A const iterator pair to the range of elements if the key exists, otherwise end().
|
||||
//*********************************************************************
|
||||
std::pair<const_iterator, const_iterator> equal_range(const key_value_parameter_t& key) const
|
||||
std::pair<const_iterator, const_iterator> equal_range(key_value_parameter_t key) const
|
||||
{
|
||||
const_iterator first = find(key);
|
||||
const_iterator last = first;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user