Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#1063 closed defect (fixed)

[PATCH] The return value of function 'remove_if' is required to be utilized.

Reported by: Echelon9 Owned by:
Priority: Should Have Milestone: Alpha 9
Component: Core engine Keywords:
Cc: Jan Wassenberg Patch:

Description

Calls of some functions are senseless if their results are not used.

Example: The std::remove function does not remove elements from the container. It only shifts the elements and brings the iterator back to the beginning of the trash. Suppose we have the vector<int> container that contains elements 1,2,3,1,2,3,1,2,3. If we execute the code "remove( v.begin(), v.end(), 2 )", the container will contain elements 1,3,1,3,?,?,?, where ? is some trash. The function will bring the iterator back to the first senseless element, so if we want to remove these trash elements, we must write the code this way: "v.erase(remove(v.begin(), v.end(), 2), v.end())".

Proposed code is attached.

Attachments (1)

cache_adt_remove-fix.patch (440 bytes ) - added by Echelon9 12 years ago.
Proposed fix for adt_cache std::remove_if approach

Download all attachments as: .zip

Change History (5)

by Echelon9, 12 years ago

Attachment: cache_adt_remove-fix.patch added

Proposed fix for adt_cache std::remove_if approach

comment:1 by Kieran P, 12 years ago

Milestone: Alpha 8Alpha 9

comment:2 by historic_bruno, 12 years ago

Cc: Jan Wassenberg added

comment:3 by Jan Wassenberg, 12 years ago

Resolution: fixed
Status: newclosed

(In [10818]) minor fixes waio: ensure error is disk_full on failure cache_adt: scaffolding code wrongly used std::remove_if instead of list::remove. thanks to Echelon9 for catching this! fixes #1063

comment:4 by sanderd17, 8 years ago

Keywords: review removed
Note: See TracTickets for help on using tickets.