+ 3

Merge Function in C++

What's wrong in this way? Why is this not working? After executing this program res.queue is still empty Queue operator+(Queue obj){ Queue res; int ar[8]; merge(this->queue,(this->queue+this->size),obj.queue,(obj.queue+obj.size),res.queue); return res; }

23rd Feb 2021, 10:55 AM
Ankit Yadav
Ankit Yadav - avatar
2 Answers
+ 2
Arsenic could you give an example as queue is not a vector. if it would be a vector I would have called it as merge(queue.begin(),queue.end().... right The code is here and I just added the above query's lines to this. https://www.sololearn.com/coach/917?ref=app
24th Feb 2021, 1:39 AM
Ankit Yadav
Ankit Yadav - avatar
+ 1
Can I have a look at your entire code ? Because merge() required iterators to work with and looks like you are not calling it as it should be called.
23rd Feb 2021, 11:38 AM
Arsenic
Arsenic - avatar