Questions tagged [push-back]

is the action of adding an element at the end of a container.

push-back is the action of adding an element at the end of a container.

420 questions
2
votes
1 answer

"no matching function" call error when using push_back on custom type

I get this error when trying to push back an object of custom type. code follows: class Item_base { public: Item_base(string isbn=" ", int num=0):book(isbn),number(num){} Item_base(Item_base…
2
votes
1 answer

c++ vector push back error

Im getting an error every time I try to debug this with Visual C++ 2008 #include #include #include #include using namespace std; void load(const char* filename) { vector vec; ifstream…
techbech
  • 3,754
  • 5
  • 20
  • 28
2
votes
1 answer

push_back with derived class

I want to create an array of objects and I want to use a certain constructor. std::vector arrDigOut; arrDigOut.push_back(Modul(IDC_CHECK1, this, "GVL.DigOut1", pAddr)); This works as long as DigOut is not a derived class. When I derive it…
womdom
  • 55
  • 1
  • 6
2
votes
1 answer

Segfault when pushing to member vector

Here's a relatively small but segfaulting project. I've searched quite a few posts doing similar things and while many seemed to be having the same problem, none solved my problem. The basic issue is this: I have an object (myGraph) with a member…
zedadex
  • 35
  • 1
  • 7
2
votes
3 answers

Improve performance of my C list push_back function

I have my C list, and i implemented the push_back function: bool_t push_back_clist(clist_ptr pList, void* item) { if(pList) { node_ptr pNode = new_node(item, pList->sizeof_item); if(!pNode) return FALSE; …
gliderkite
  • 8,828
  • 6
  • 44
  • 80
1
vote
7 answers

handling a 2 dimensional vector c++

I need to set up and access a two dimensional vector of structure in C++. My structure is defined as: struct nodo{ int last_prod; int last_slot; float Z_L; float Z_U; float g; bool fathomed; }; I defined the vector…
marcob8986
  • 153
  • 4
  • 12
1
vote
1 answer

c++ vector push_back with pointers

I'm trying to get my head around solving the following problem. I have the following function which accepts a const reference to an object. What I want to do, is give storage, a pointer to the object component is referencing. However, when I call…
Short
  • 7,767
  • 2
  • 25
  • 33
1
vote
2 answers

inserting on the vector c++

The code below has alot of outputting strings at the end i try to push the back onto avector and the append it to a string so then i can return it, but it only gets the last string which is outputted i need to get all of them. What am i doign wrong…
CodersSC
  • 710
  • 2
  • 13
  • 29
1
vote
3 answers

push_back in a vector in a object

I have a profesor class with this atribute vector hDisponibles; If I have a vector of this class set profesores; I try this set::iterator itP; itP = profesores.begin(); while ( itP != profesores.end() ){ …
JuanPablo
  • 23,792
  • 39
  • 118
  • 164
1
vote
2 answers

Using push_back() for STL List in C++ causes Access Violation, Crash

I'm creating a game using my own homemade gaming engine, but I'm running into trouble using lists. I have a structure in my program called BoardState. Each of these structures has a list of BoardState pointers called children. This is because I…
EightBitSpade
  • 11
  • 1
  • 2
1
vote
1 answer

C++ vector push_back with class object

I've been using this site for a while and so far never needed to ask a new question (found all answers I've needed until now). I need to push_back multiple objects into a vector but VS throws an error (This may be due to a corruption of the heap,…
1
vote
1 answer

React.Js Taking User's input and Pushing Into An Array

Simply, I am trying to take the user's input and push them into an array. The script itself starts with clicking a button, typing a text input, and clicking to repeat the process. How would I be able to get each input from the user? Would it be…
1
vote
1 answer

push_back() is not adding element to the vector? (C++ Tree Traversal)

I'm working through a tree traversal problem and using 'push_back' vector function to update a vector with the in-order traversal. Alongside using this I am using cout to print out the solution to debug. The print output is correct but my returning…
1
vote
2 answers

Erasing the first entry of a vector, after the maximum is reached

I have a vector in which i save coordinates. I perform a series of calculations on each coordinate, thats why i have a limit for the vector size. Right now i clear the vector, when the limit is reached. I'm searching for a method, that let's me keep…
1
vote
1 answer

why is there a "no instance of overloaded function matches the argument list" error when attempting vector push_back?

I am doing an assignment for a C++ class and I am getting an error when using push back with vector. I honestly cannot find any info on why this isnt working and giving me a "no instance of overloaded function" error class StudentData { class…
Dinnea
  • 13
  • 6