following code doesn't work with input:
2
7
add Elly 0888424242
add Elly 0883666666
queryname Elly
querynum 0883266642
querynum 0888424242
delnum 0883666666
queryname Elly
3
add Kriss 42
add Elly 42
querynum 42
Why my erase doesn't work?
#include<stdio.h>
#include<iostream>
#include<map>
#include <string>
using namespace std;
void ...
I am manipulating vectors of objects defined as follow:
class Hyp{
public:
int x;
int y;
double wFactor;
double hFactor;
char shapeNum;
double* visibleShape;
int xmin, xmax, ymin, ymax;
Hyp(int xx, int yy, double ww, double hh, char s): x(xx), y(yy), wFactor(ww), hFactor(hh), shapeNum(s) {visibleShape=0;shapeNum=-1;};
//Copy constru...
Hi Everyone,
I am trying to implement an OpenGL eraser tool. I am struggling with this. I was thinking of painting somehow over the previous changes to "clear" out the changes. I can't use the background color because it is not a pattern, not one solid color. Can you point me to the right direction on how to implement an eraser tool...
Hi,
I am trying to do a Z-Index reordering of videoObjects stored in a vector. The plan is to identify the videoObject which is going to be put on the first position of the vector, erase it and then insert it at the first position. Unfortunately the erase() function always causes bad memory access.
Here is my code:
testApp.h:
vector...
Hi I have tried to draw an rubberband rectangle on a form using the mouse in C#.
Problems
1) After the mouse release the rectangle disappears. [I want it to stay on the form]
2) I also need to find the coordinates of the four points of the drawn rectangle
3) I also need to erase the rectangle to draw a new one when necessary
Form :...
I'm planning to allow user drawing shapes and lines on image using mouse. If the background is solid, it's quite easy to build the eraser tool (simply fill with background color). But how to make it with image as background?
...
I have a std::set and I need to erase similar adjacet elements:
DnaSet::const_iterator next = dna_list.begin();
DnaSet::const_iterator actual = next;
++next;
while(next != dna_list.end()) // cycle over pairs, dna_list is the set
{
if (similar(*actual, *next))
{
Dna dna_temp(*actual); // copy constructor
dna_lis...
I've recently inherited a project primarily done in C++, so this is my first real exposure to it. I'm wondering if I may have a problem erasing a vector's elements from within a loop bounded by the vector's begin() and end().
Here's (essentially) what I've been trying to do:
for (vector<double>::iterator i = distance.begin(); i < dista...
Hello C++/STL gurus:
Does the "delete" statement below "doubly free" an object?
(...object_list is a global vector<object*>...)
vector< object * >::iterator it, eit, iter;
object *p_object;
vector< object * > dead_objects;
it = object_list_.begin();
eit = object_list_.end();
//---collect pointers of all dead objects to d...
Hey guys, how would you erase a whole array, as in it has no items. I want to do this so I could store new values (a new set of 100 floats) into it and find the minimum.
Right now my program is reading the minimum from sets before I think because it is appending itself with the previous set still in there (i use .append by the way).
...
hi,
I want to ask how can I erase a line witch I've drawn by using the pyGTK
I used:cairo library
cr = widget.window.cairo_create()
cr.move_to(x, y)
cr.line_to(x1, y1)
cr.stroke()
I want to delete this line after drawing it on screen
...
My situation:
I have a single window with a content view (NSView), which has several subviews (plain NSControl subclasses; not important, just for testing) scattered around it. For part of the end effect I am trying to achieve, I want to place a semi-transparent black CALayer overlaying the whole window's content view, and be able to m...
Hi!
I am currently trying to implement deleting characters from a text field in C++. If the user hits Backspace, the following code is executed. There is currently no cursor, it should just remove the last character...
if (mText.length() > 0){
mText.erase( mText.length() - 1, 1);
// mText.resize(mText.length() - 1);
}
This wo...
Hello,
how can i free up memory in a pointer vector?
Here's the code:
class A
{
private:
int x,y,z;
public:
A(param1, param2, param3)
{
x=param1;
y=param2;
z=param3;
}
~A()
{
//prompts an alertbox, warning me about the successful call...
Hello, I'm trying to define an iterator to iterate my map to erase it (destructor)
I'm getting an error : incompatible iterator.
My destructor looks like this :
Consortium<S,T>::~Consortium()
{
map<const S, Node<T>*>::iterator deleteIterator;
for (m_consortiumMap.begin() ; deleteIterator != m_consortiumMap.end() ; del...
Sorry I can't provide code bc I don't have it.
My coworker (who has been with the company for a long time but doesn't appear to know what he's doing) claims that he has to do some weird stuff to remove elements from a vector. He moves all the elements down a position (starting at the element that he wants to remove) then he'll remove t...
Can someone help me out here?
Compiling this code:
void test()
{
std::set<int> test;
test.insert(42);
test.erase(std::remove(test.begin(), test.end(), 30), test.end()); // <- Line 33
}
Is generating the following error when compiling:
$ make
g++ -c -Wall -pedantic-errors -Wextra -Wunused -Werror a_star.cpp
/usr/lib/gcc/i686-p...
Hi there,
I have the following toy code, intended to remove duplicates from a vector:
void overlap_removal(vector<int> &vec1, vector<int> &vec2) {
for (vector<int>::iterator it1 = vec1.begin(); it1 != vec1.end(); ++it1) {
for (vector<int>::iterator it2 = vec2.begin(); it2 != vec2.end(); ++it2) {
if ((*it1)*(*it2) < 10) {
...
Hi, gang. First, a high-level description of the problem & approach.
I have a list containing images and pixel locations in each image - a list of lists. I want to pick n items at random from that list of images and for each image I want to iterate over k random pixel locations. I want to do this in parallel. For each processed pixel, I...
Ok, I'm using C++ STL containers (currently vector<customType*>).
Now I need to remove elements from the container,
but using erase deconstructs the object, which is bad, since I'm taking it off one, and putting it onto a variable doing some processing then onto another one.
At the moment my code is quite nasty, and I'm just putting NUL...