remove useless function

even worse some useless cleaning was done before deallocation
This commit is contained in:
Sébastien Loriot 2022-04-06 12:08:14 +02:00
parent e059d68e94
commit c27c162950
1 changed files with 1 additions and 20 deletions

View File

@ -87,7 +87,6 @@ public:
chained_map& operator=(const chained_map<T, Allocator>& D);
void reserve(std::size_t n);
void clear_entries();
void clear();
~chained_map()
{
@ -252,12 +251,7 @@ chained_map<T, Allocator>::chained_map(const chained_map<T, Allocator>& D)
template <typename T, typename Allocator>
chained_map<T, Allocator>& chained_map<T, Allocator>::operator=(const chained_map<T, Allocator>& D)
{
clear_entries();
for (chained_map_item item = table ; item != table_end ; ++item)
destroy(item);
alloc.deallocate(table, table_end - table);
clear();
init_table(D.table_size);
@ -277,25 +271,12 @@ void chained_map<T, Allocator>::reserve(std::size_t n)
reserved_size = n;
}
template <typename T, typename Allocator>
void chained_map<T, Allocator>::clear_entries()
{
if(!table)
return;
for(chained_map_item p = table; p < free; p++)
if (p->k != nullptrKEY || p >= table + table_size)
p->i = T();
}
template <typename T, typename Allocator>
void chained_map<T, Allocator>::clear()
{
if(!table)
return;
clear_entries();
for (chained_map_item item = table ; item != table_end ; ++item)
destroy(item);
alloc.deallocate(table, table_end - table);