Skip to content

Superfluous clearing of containers #2991

@heplesser

Description

@heplesser

As noticed by @diesmann and @mlober, the (*it)->clear() calls in the code below are most likely superfluous, since the vector pointed to by it is deleted immediately afterwards:

for ( auto it = emitted_spikes_register_.begin(); it < emitted_spikes_register_.end(); ++it )
{
( *it )->clear();
delete ( *it );
}
emitted_spikes_register_.clear();
for ( auto it = off_grid_emitted_spikes_register_.begin(); it < off_grid_emitted_spikes_register_.end(); ++it )
{
( *it )->clear();
delete ( *it );
}
off_grid_emitted_spikes_register_.clear();

The loops would also become simpler and more robust using C++11-style container iteration.

Metadata

Metadata

Assignees

Labels

I: No breaking changePreviously written code will work as before, no one should note anything changing (aside the fix)S: NormalHandle this with default priorityT: MaintenanceWork to keep up the quality of the code and documentation.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions