Add transparent_tests

This commit is contained in:
Christian Mazakas
2022-10-10 10:52:01 -07:00
parent 1ff2dc4042
commit 58b78f8ff0
4 changed files with 194 additions and 16 deletions

View File

@@ -286,6 +286,15 @@ namespace boost {
size_type erase(key_type const& key) { return table_.erase(key); }
template <class K>
typename std::enable_if<
detail::transparent_non_iterable<K, unordered_flat_map>::value,
size_type>::type
erase(K const& key)
{
return table_.erase(key);
}
/// Lookup
///
@@ -326,6 +335,15 @@ namespace boost {
return pos != table_.end() ? 1 : 0;
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value, size_type>::type
count(K const& key) const
{
auto pos = table_.find(key);
return pos != table_.end() ? 1 : 0;
}
iterator find(key_type const& key) { return table_.find(key); }
const_iterator find(key_type const& key) const
@@ -390,6 +408,38 @@ namespace boost {
return {pos, next};
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value,
std::pair<iterator, iterator> >::type
equal_range(K const& key)
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value,
std::pair<const_iterator, const_iterator> >::type
equal_range(K const& key) const
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
/// Hash Policy
///

View File

@@ -214,6 +214,15 @@ namespace boost {
size_type erase(key_type const& key) { return table_.erase(key); }
template <class K>
typename std::enable_if<
detail::transparent_non_iterable<K, unordered_flat_set>::value,
size_type>::type
erase(K const& key)
{
return table_.erase(key);
}
/// Lookup
///
@@ -223,6 +232,15 @@ namespace boost {
return pos != table_.end() ? 1 : 0;
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value, size_type>::type
count(K const& key) const
{
auto pos = table_.find(key);
return pos != table_.end() ? 1 : 0;
}
iterator find(key_type const& key) { return table_.find(key); }
const_iterator find(key_type const& key) const
@@ -287,6 +305,38 @@ namespace boost {
return {pos, next};
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value,
std::pair<iterator, iterator> >::type
equal_range(K const& key)
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
template <class K>
typename std::enable_if<
detail::are_transparent<K, hasher, key_equal>::value,
std::pair<const_iterator, const_iterator> >::type
equal_range(K const& key) const
{
auto pos = table_.find(key);
if (pos == table_.end()) {
return {pos, pos};
}
auto next = pos;
++next;
return {pos, next};
}
/// Hash Policy
///