This tag refers to the process of removing or deleting data, text, files, or memory.
Questions tagged [erase]
739 questions
3
votes
3 answers
Erase-remove idiom: what happens when remove return past-the-end-iterator?
I got this question when I was reading erase-remove idiom (item 32) from Scott Meyers "Effective STL” book.
vector v;
...
v.erase(remove(v.begin(), v.end(), 99), v.end());
remove basically returns the "new logical end” and elements of the…

aJ.
- 34,624
- 22
- 86
- 128
3
votes
4 answers
Is it safe to invoke std::map::erase with std::map::begin?
We (all) know, erasing an element, pointer by an iterator invalidates the iterator, for example:
std::map< .. > map_;
std::map< .. >::iterator iter;
// ..
map_.erase( iter ); // this will invalidate `iter`.
But, what about:
map_.erase( map_.begin()…

Kiril Kirov
- 37,467
- 22
- 115
- 187
3
votes
0 answers
Eraser without erase background image
Hi I want to make an eraser for finger paint witch erase only what I painted not backgroud image imported. My erase is white. How can I do that?

Markus Hayner
- 63
- 1
- 9
3
votes
1 answer
std::multimap and equal_range
I'm having some headaches with the std::multimap container and I wish to know what would be the proper way to achieve my goal. Basically, here is my SSCCE:
#include
#include

Mihai Todor
- 8,014
- 9
- 49
- 86
3
votes
1 answer
Java Graphics2D to erase to a alpha background
I'm making an application that has a drawing board where you draw with your mouse, it draws ontop of an Label in a BUfferedImage. What I'm trying to implement right now is an eraser, the problem is I cannot find anywhere help to make an eraser to…

nullwriter
- 785
- 9
- 34
3
votes
2 answers
How to delete a line from a file after it has been used
I'm trying to create a script which makes requests to random urls from a txt file e.g.:
import urllib2
with open('urls.txt') as urls:
for url in urls:
try:
r = urllib2.urlopen(url)
except urllib2.URLError as e:
…

user1985563
- 207
- 1
- 2
- 6
3
votes
3 answers
Erasing an element from a list container
I am having difficulty understanding why the code is behaving this way. First of all I have read the relevant answered material and still found the explanations abit advanced. So I'm wondering if some-one could explain this in a simple fashion.
Ok,…

A Big Ball Of Lettuce
- 313
- 3
- 14
3
votes
2 answers
Remove special characters from a string using iterators
I have a pretty simple one for you today, but it certainly has had me stumped for hours. I imagine there is something wrong with the subtitles of my string iterator. I've looked online and even passed the code to my CSE professor - but what with it…

MS-DDOS
- 578
- 5
- 15
3
votes
2 answers
Javascript erase image with cursor
Is it possible with javascript?
I'm trying to implement a scratchcard type thing, and I was wondering if the user could 'scratch it' with his cursor and then javascript would remove/erase the image to show the text below.
But i've not been able to…

James Andrew
- 7,197
- 14
- 46
- 62
3
votes
3 answers
How to erase content on a Bitmap
I have C# winForm application which holds a pictureBox control. This control has a Paint event. Every time paint event is fired , a Bitmap is dynamically created and I perform some drawing on it. And when user clicks "save" button , edited image…
tugrul
2
votes
3 answers
erase element from vector
I have the following vector passed to a function
void WuManber::Initialize( const vector &patterns,
bool bCaseSensitive, bool bIncludeSpecialCharacters, bool bIncludeExtendedAscii )
I want to erase any element…

user1231229
- 61
- 1
- 8
2
votes
4 answers
How to delete elements in a vector. (erase won't work )
When I delete elements in a vector with “erase”, then there is no memory cleared. For example I make a vector of the size 2000. After the creation the program use 1,5 MB memory. When I do the erase call nothing will be cleared. All the elements are…

Laurence
- 1,815
- 4
- 22
- 35
2
votes
5 answers
Erase a foreign iterator
I experimented the following code
list a ={1,2};
list b ={3,4};
a.erase(b.begin());
for (auto x:b) cout << x << endl;
Strangely, the program ran fine without any error. What it prints out is 4. I wonder why erase is a member function when…

zer0ne
- 403
- 1
- 5
- 13
2
votes
2 answers
Secure erasing java implementation
I need to implement Gutmann's algorithm for secure erasing some data in a database table.
First of all, is it effective in a database?
I'm not sure about the 35 steps. For 1-4 and 32-35, it's clear, generate some random data. But the steps 5-31 I'm…

braincell
- 562
- 1
- 13
- 26
2
votes
3 answers
What is proper way to delete objects that resides in a list that you find while looping that list?
I have a list of Star structs. These structs are in a std::list
I am double looping this list and compairing there locations to detect a collision. When A collision is found I will delete Star with the lowest mass. But how can I delete the Star…

EddieV223
- 5,085
- 11
- 36
- 38